Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0008373Openbravo ERP08. Project and service managementpublic2009-04-01 11:272009-05-05 00:00
serc 
areefbasha 
highmajorrandom
closedfixed 
10Xp
2.50beta 
2.50MP1 
Core
No
0008373: 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.
250MP1
depends on backport 0008410 closed areefbasha Expense invoices are not being created properly. 
Issue History
2009-04-01 11:27sercNew Issue
2009-04-01 11:27sercAssigned To => rafaroda
2009-04-01 11:27sercRegression testing => No
2009-04-03 08:44rafarodaAssigned Torafaroda => serc
2009-04-03 08:44rafarodaPrioritynormal => high
2009-04-03 08:44rafarodaSteps to Reproduce Updated
2009-04-03 08:44rafarodaStatusnew => scheduled
2009-04-03 08:44rafarodafix_in_branch => pi
2009-04-23 16:05psarobeTag Attached: 250MP1
2009-04-27 11:07rafarodaAssigned Toserc => sathiyan
2009-04-27 12:36sathiyanAssigned Tosathiyan => areefbasha
2009-04-28 13:59areefbashafix_in_branchpi =>
2009-04-28 13:59areefbashaProposed Solution updated
2009-04-28 14:41rafarodaSteps to Reproduce Updated
2009-04-28 16:18rafarodaSteps to Reproduce Updated
2009-04-28 18:24hgbotCheckin
2009-04-28 18:24hgbotNote Added: 0015877
2009-04-28 18:24hgbotStatusscheduled => resolved
2009-04-28 18:24hgbotResolutionopen => fixed
2009-04-28 18:24hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/11714fc5cfc0453dee2fe460302b138d4181c9b0 [^]
2009-05-04 19:53psarobeStatusresolved => closed
2009-05-05 00:00anonymoussf_bug_id0 => 2786888

Notes
(0015877)
hgbot   
2009-04-28 18:24   
Repository: erp/devel/pi
Changeset: 11714fc5cfc0453dee2fe460302b138d4181c9b0
Author: Areef Basha <areef.basha <at> openbravo.com>
Date: Tue Apr 28 21:52:08 2009 -0400
URL: http://code.openbravo.com/erp/devel/pi/rev/11714fc5cfc0453dee2fe460302b138d4181c9b0 [^]

Fixes bug 8373: : 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
---