Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0009643
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] 08. Project and service managementminoralways2009-06-25 18:102009-07-21 16:54
ReporternetworkbView Statuspublic 
Assigned Tosathiyan 
PriorityurgentResolutionno change requiredFixed in Version
StatusclosedFix in branchpiFixed in SCM revision
ProjectionnoneETAnoneTarget Version2.50MP4
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product Version2.40SCM revision 
Review Assigned To
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0009643: Purchase invoice can not be deleted if it has been created in "Created AP Expense invoices"

DescriptionWhen a Purchase invoice is created using "Created AP Expense invoices", the invoice can not be deleted because its lines has reference to Expense sheet.
At the same time, Expense sheet can not be unprocessed because it has a link to Purchase Invoice.

It exists an infinitive loop.
Steps To ReproduceGenerate an Expense Sheet (Project & Service Management > Transactions > Expense sheet).
Add lines and process it.

Execute Project & Service Management > Transactions > Created AP Expense invoices.

Go to new Purchase invoice. Try to delete it. It is not possible.

Go back to Expense Sheet. Try to unprocessed it. It is not possible
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
related to feature request 0004526 acknowledgedrmorley Process/Unprocess Expense Sheet lines individually 

-  Notes
(0017648)
psarobe (manager)
2009-06-29 19:02

can you please write the MP?
(0017668)
networkb (developer)
2009-06-30 10:13

the bug was reported in 2.40 (no MP)
(0017773)
dmitry_mezentsev (developer)
2009-07-03 10:50

Rafa,

As if we have already split teams I think your team has to take it?
What do you think?
(0018142)
sathiyan (reporter)
2009-07-13 08:32

There is no loop in the process. But we have some constraint as explained below:

Case 1 : Constraint in DB(we can not update or delete invoice if any invoice line associate with):
ALTER TABLE c_invoiceline
  ADD CONSTRAINT cinvoice_cinvoiceline FOREIGN KEY (c_invoice_id)
      REFERENCES c_invoice (c_invoice_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION;

update or delete on table "c_invoice" violates foreign key constraint "cinvoice_cinvoiceline" on table "c_invoiceline"

Case 2: Constraint in DB (We can not update or delete any invoice line if it is associate with any expense line)
ALTER TABLE s_timeexpenseline
  ADD CONSTRAINT cinvoiceline_stimeexpenseline FOREIGN KEY (c_invoiceline_id)
      REFERENCES c_invoiceline (c_invoiceline_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION;

Case 3 : Condition in the process(Unprocess Expenses)
if we have any expense line associated with invoice line, we can not do unprocess.
IF (v_Processed = 'Y') THEN
    <<our target fix would be on below line>>
    IF (v_CInvoicelineId IS NULL AND v_COrderlineId IS NULL) THEN
        UPDATE S_TimeExpense SET Processed = 'N' WHERE S_TimeExpense_ID=v_Record_ID;
    ELSE
       <<other code>>


I may fix it in case 3 as enable un-process even we have invoice line id associated. However it violates business rules in many places. If you do unprocess, you can delete expense line and then invoice line and then only you can delete invoice(however you never delete invoice directly due to database constraint we have). I need to confirm on this.

Regards
Sathiyan.
(0018382)
rafaroda (developer)
2009-07-17 17:35

This is not a defect but the expected behavior of Openbravo ERP.

Please take into account that the Process/UnProcess button in the Expense Sheet Header has the following security implemented:
1) An employee logs his expense lines.
2) Another person, usually the manager of this employee, processes (validates/approves) those expenses.
3) A third person in the HR or the Financial department creates invoices to bill employees for their expenses (Create AP Expense Invoices process).
4) The same last person or a 4th one is in charge of managing the purchase invoices and post them.
5) Now imagine that the person in step 2 goes to the expense sheet and wants to modify a line that already went to an invoice. He should not be able to modify nor delete it because, otherwise, the origin of this invoice (that was originated by an expense sheet line) would be lost.

The normal procedure in this case would be for the person in step 2 to ask the corresponding person to void the invoice and a new expense sheet line will have to be created with the correct data.
(0018495)
networkb (developer)
2009-07-21 16:51
edited on: 2009-07-21 16:56

As a proposed solution can be:

*Void the invoice and create a new expense sheet.

*Modify the invoice created and complete it.

Both solutions work.

(0018496)
networkb (developer)
2009-07-21 16:54

Finally, the reason why this is not a bug, is because more than one expense sheet lines can be grouped in one invoice line, and that's why the constraint is correct.

- Issue History
Date Modified Username Field Change
2009-06-25 18:10 networkb New Issue
2009-06-25 18:10 networkb Assigned To => rafaroda
2009-06-29 19:02 psarobe Note Added: 0017648
2009-06-29 19:02 psarobe Status new => feedback
2009-06-30 10:13 networkb Note Added: 0017668
2009-06-30 10:13 networkb Status feedback => new
2009-06-30 21:19 psarobe Status new => scheduled
2009-06-30 21:19 psarobe Assigned To rafaroda => gmauleon
2009-06-30 21:19 psarobe fix_in_branch => pi
2009-07-03 10:50 dmitry_mezentsev Note Added: 0017773
2009-07-03 11:06 gmauleon Assigned To gmauleon => sathiyan
2009-07-10 11:00 pjuvara Priority immediate => urgent
2009-07-10 11:00 pjuvara fix_in_branch pi =>
2009-07-13 06:35 pjuvara Target Version => 2.50MP4
2009-07-13 06:35 pjuvara Status scheduled => acknowledged
2009-07-13 06:35 pjuvara Status acknowledged => scheduled
2009-07-13 06:35 pjuvara fix_in_branch => pi
2009-07-13 08:32 sathiyan Note Added: 0018142
2009-07-14 13:41 rafaroda Relationship added related to 0004526
2009-07-17 17:35 rafaroda Status scheduled => closed
2009-07-17 17:35 rafaroda Note Added: 0018382
2009-07-17 17:35 rafaroda Resolution open => no change required
2009-07-18 00:00 anonymous sf_bug_id 0 => 2823349
2009-07-21 16:51 networkb Note Added: 0018495
2009-07-21 16:54 networkb Note Added: 0018496
2009-07-21 16:56 rafaroda Note Edited: 0018495


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker