Fixes issue 0018051: All the lines are update to 0 when creating an invoice
authorJon Alegría <jon.alegria@openbravo.com>
Thu, 21 Jul 2011 19:40:37 +0200
changeset 13240 6c10bfc2134c
parent 13239 c3aabcc39ede
child 13241 24d223cc5c9e
Fixes issue 0018051: All the lines are update to 0 when creating an invoice
with a product isbom and not stocked
src-db/database/model/functions/C_INVOICE_POST.xml
--- a/src-db/database/model/functions/C_INVOICE_POST.xml	Thu Jul 21 18:17:33 2011 +0200
+++ b/src-db/database/model/functions/C_INVOICE_POST.xml	Thu Jul 21 19:40:37 2011 +0200
@@ -978,7 +978,7 @@
           (SELECT COALESCE(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.ValidFrom<=COALESCE(o.DateOrdered, o.DateInvoiced)
              AND v.IsActive='Y'
              AND o.C_Invoice_ID=v_Record_ID
            ORDER BY v.ValidFrom DESC