Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0004739Openbravo ERP07. Sales managementpublic2008-08-28 13:032008-09-04 16:19
jtarbal 
eduardo_Argal 
highmajoralways
closedfixed 
5
2.35MP5 
2.40 
Core
No
0004739: Cannot complete an invoice with a BOM product
The system throws the following error when trying to complete an invoice with a BOM product: ORA-00937: la función de grupo no es de grupo único.

To reproduce the error follow the next steps:
 1.- Check that there is a BOM product in the products catalog. If not, create one with some components and with a price.
 2.- Go to Sales Management > Transactions > Sales Invoice
 3.- Create a new invoice with the BOM product
 4.- Complete the invoice
The error occurs in line 781 of C_INVOICE_POST (PLSQL)
No tags attached.
depends on backport 0004776 closed eduardo_Argal Cannot complete an invoice with a BOM product 
depends on backport 0004802 closed eduardo_Argal Cannot complete an invoice with a BOM product 
Issue History
2008-08-28 13:03jtarbalNew Issue
2008-08-28 13:03jtarbalAssigned To => cromero
2008-08-28 13:03jtarbalsf_bug_id0 => 2080350
2008-08-28 17:20networkbNote Added: 0008776
2008-09-01 10:29psarobePrioritynormal => high
2008-09-01 10:29psarobeSeveritycritical => major
2008-09-01 10:29psarobeStatusnew => scheduled
2008-09-01 10:29psarobeAssigned Tocromero => eduardo_Argal
2008-09-01 10:29psarobefix_in_branch => trunk
2008-09-03 13:13svnbotCheckin
2008-09-03 13:13svnbotNote Added: 0008863
2008-09-03 13:13svnbotStatusscheduled => resolved
2008-09-03 13:13svnbotResolutionopen => fixed
2008-09-03 13:13svnbotsvn_revision => 6772
2008-09-03 17:07cromeroStatusresolved => new
2008-09-03 17:07cromeroResolutionfixed => open
2008-09-03 17:07cromeroStatusnew => scheduled
2008-09-03 17:07cromeroStatusscheduled => resolved
2008-09-03 17:07cromeroResolutionopen => fixed
2008-09-04 16:19psarobeRegression testing => No
2008-09-04 16:19psarobeStatusresolved => closed
2008-09-04 16:19psarobeFixed in Version => 2.40

Notes
(0008776)
networkb   
2008-08-28 17:20   
What is wrong, is the next select arround line 781.

(SELECT COALESCE(SUM(v.M_PriceList_Version_ID), 0) AS PriceList_Version_ID, o.M_PriceList_ID AS M_PriceLIst_ID
              FROM M_PRICELIST_VERSION v,
                C_INVOICE o
              WHERE v.M_PriceList_ID=o.M_PriceList_ID
                AND v.ValidFrom<=o.DateOrdered
                AND v.IsActive='Y'
                AND o.C_Invoice_ID=v_Record_ID
              ORDER BY v.ValidFrom DESC
              )

Is needed a group by and change the order by.

group by o.M_PriceList_ID
ORDER BY o.M_PriceList_ID DESC

Insted of o.DateOrdered you have to use o.DateInvoiced because many times the dateordered field is not filled.

Finally instead of use SUM is better to user MAX because the query could return many rows if there are many pricelist versions under the price with date<dateinvoiced
(0008863)
svnbot   
2008-09-03 13:13   
Repository: openbravo
Revision: 6772
Author: eduardoargal
Date: 2008-09-03 13:13:41 +0200 (Wed, 03 Sep 2008)

Fixes bug 0004739: Cannot complete an invoice with a BOM product

---
U trunk/src-db/database/model/functions/C_INVOICE_POST.xml
---

https://dev.openbravo.com/websvn/openbravo/?rev=6772&sc=1 [^]