Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0008410Openbravo ERP08. Project and service managementpublic2009-04-01 11:272009-05-11 08:31
serc 
areefbasha 
highmajorrandom
closedfixed 
10Xp
2.50beta 
2.40MP4 
Core
No
0008410: Expense invoices are not being created properly.
Create AP Expense Invoices doesn't properly generate invoices from expense sheets.
Randomly, it merges expenses into some other invoices. One of the potential reasons is, in the respective servlet i.e., org.openbravo.erpCommon.ad_process.ExpenseAPInvoice there is an issues with a query.


Method processExpense needs invoice header to process expense sheets, and gets it from another method selectInvoiceHeader which is using max in the query. This seems to be absurd and might be cause of the problem.
1. Create some expense sheets.
2. Process them in Create AP Expense Invoice page.
3. See output at Procurement Management-> Transactions-> Purchase Invoices.
You will see at times expenses that are to merge in one invoice are merged at different purchase invoices.

Sample data
-----------

1) Create a new expense sheet

Create a line item

one line item --> 5000 --> Food

Click Process Expenses button in the expense sheet header.


2) Create another new expense sheet

Create two line items

a line item --> 6000 --> Electricity
a line item --> 7000 --> Food

Click Process Expenses button in the expense sheet header.


3) Create AP Expense Invoices for the above items

Gor the message as "Purchase Invoice No. 10000039 has been created"


Expected Result: Now the all the three lines items should appear in one pucharse invoice 10000039

Actual Result :

Only the first item appear in the purchase invoice 10000039

the second item appear in another purchase invoice 10000038.
SERVLET: org.openbravo.erpCommon.ad_process.ExpenseAPInvoice


Method processExpense needs invoice header to process expense sheets, and gets it from another method selectInvoiceHeader which is using max in the query.

This is not causing the problem but the following:

1) C_INVOICELINE table is no needed in selectInvoiceHeader and selectInvoiceHeaderNoProject selects selects.

2) There are some checks done to employee condition: price list, location, payment rule, payment term, etc... These check has to be done before selectInvoiceHeader and selectInvoiceHeaderNoProject and not after.

3) These employee conditions should take part in the selectInvoiceHeader and selectInvoiceHeaderNoProject selects.
No tags attached.
blocks defect 0008373 closed areefbasha Expense invoices are not being created properly. 
Issue History
2009-04-03 08:44rafarodaTypedefect => backport
2009-04-03 08:44rafarodafix_in_branch => 2.40
2009-04-27 11:07rafarodaAssigned Toserc => sathiyan
2009-04-27 12:36sathiyanAssigned Tosathiyan => areefbasha
2009-04-28 14:42rafarodaProposed Solution updated
2009-04-28 14:42rafarodaSteps to Reproduce Updated
2009-04-28 16:19rafarodaSteps to Reproduce Updated
2009-04-28 18:08hgbotCheckin
2009-04-28 18:08hgbotNote Added: 0015875
2009-04-28 18:08hgbotStatusscheduled => resolved
2009-04-28 18:08hgbotResolutionopen => fixed
2009-04-28 18:08hgbotFixed in SCM revision => http://code.openbravo.com/erp/stable/2.40/rev/722df645160b0983ea9aa237e2d32ae2c3f46e40 [^]
2009-05-10 19:37psarobeFixed in Version => 2.40MP4
2009-05-11 08:31arunkumarStatusresolved => closed
2009-05-11 08:31arunkumarNote Added: 0016215

Notes
(0015875)
hgbot   
2009-04-28 18:08   
Repository: erp/stable/2.40
Changeset: 722df645160b0983ea9aa237e2d32ae2c3f46e40
Author: Areef Basha <areef.basha <at> openbravo.com>
Date: Tue Apr 28 21:36:18 2009 -0400
URL: http://code.openbravo.com/erp/stable/2.40/rev/722df645160b0983ea9aa237e2d32ae2c3f46e40 [^]

Fixes bug 8410: Expense invoices are not being created properly.

The selectInvoiceHeader and selectInvoiceHeaderNoProject selects have been changed.

---
M src/org/openbravo/erpCommon/ad_process/ExpenseAPInvoice.java
M src/org/openbravo/erpCommon/ad_process/ExpenseAPInvoice_data.xsql
---
(0016215)
arunkumar   
2009-05-11 08:31   
This issue has been fixed.