details:   https://code.openbravo.com/erp/devel/pi/rev/aa0a5c2e4f93
changeset: 28064:aa0a5c2e4f93
user:      David Miguelez <david.miguelez <at> openbravo.com>
date:      Tue Nov 24 16:53:42 2015 +0100
summary:   Fixes Issue 31115. Allow to change price of a non Invoiced Sales 
Order.

Previously it was fixed, but when it was done, it was allowing to change
the Sales Order Quantity when the Sales Invoice had a Goods Shipment related
and that is not right.

Changed the restriction to check changes related to prices in another
condition and allow to do this changes when the Sales Order is not
yet Invoiced, even if it has been delivered.

diffstat:

 src-db/database/model/triggers/C_ORDLINE_CHK_RESTRICTIONS_TRG.xml |  13 
++++++---
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (32 lines):

diff -r 71227823d930 -r aa0a5c2e4f93 
src-db/database/model/triggers/C_ORDLINE_CHK_RESTRICTIONS_TRG.xml
--- a/src-db/database/model/triggers/C_ORDLINE_CHK_RESTRICTIONS_TRG.xml Fri Nov 
27 12:19:15 2015 +0100
+++ b/src-db/database/model/triggers/C_ORDLINE_CHK_RESTRICTIONS_TRG.xml Tue Nov 
24 16:53:42 2015 +0100
@@ -61,10 +61,6 @@
       IF((COALESCE(:OLD.LINE, 0) <> COALESCE(:NEW.LINE, 0))
           OR(COALESCE(:OLD.M_PRODUCT_ID, '0') <> COALESCE(:NEW.M_PRODUCT_ID, 
'0'))
           OR(COALESCE(:OLD.QTYORDERED, 0) <> COALESCE(:NEW.QTYORDERED, 0))
-          OR(COALESCE(:OLD.PRICELIST, 0) <> COALESCE(:NEW.PRICELIST, 0))
-          OR(COALESCE(:OLD.PRICEACTUAL, 0) <> COALESCE(:NEW.PRICEACTUAL, 0))
-          OR(COALESCE(:OLD.PRICELIMIT, 0) <> COALESCE(:NEW.PRICELIMIT, 0))
-          OR(COALESCE(:OLD.LINENETAMT, 0) <> COALESCE(:NEW.LINENETAMT, 0))
           OR(COALESCE(:OLD.C_CHARGE_ID, '0') <> COALESCE(:NEW.C_CHARGE_ID, 
'0'))
           OR(COALESCE(:OLD.CHARGEAMT, 0) <> COALESCE(:NEW.CHARGEAMT, 0))
           OR(COALESCE(:OLD.C_TAX_ID, '0') <> COALESCE(:NEW.C_TAX_ID, '0'))
@@ -77,9 +73,16 @@
         ) THEN
         IF (v_Processed='Y' AND v_Docaction <> 'CL') THEN
           RAISE_APPLICATION_ERROR(-20000, '@20501@') ;
-        ELSIF (v_IsSOTrx ='Y' AND v_DocStatus = 'DR' AND (:OLD.QTYDELIVERED <> 
0 OR :OLD.QTYINVOICED <> 0) AND (COALESCE(:OLD.PRICEACTUAL, 0) = 
COALESCE(:NEW.PRICEACTUAL, 0) OR :OLD.QTYINVOICED <> 0)) THEN
+        ELSIF (v_IsSOTrx ='Y' AND v_DocStatus = 'DR' AND (:OLD.QTYDELIVERED <> 
0 OR :OLD.QTYINVOICED <> 0)) THEN
           RAISE_APPLICATION_ERROR(-20000, '@DeliveredInvoicedOrderline@');
         END IF;
+      ELSIF ((COALESCE(:OLD.PRICELIST, 0) <> COALESCE(:NEW.PRICELIST, 0))
+          OR(COALESCE(:OLD.PRICELIMIT, 0) <> COALESCE(:NEW.PRICELIMIT, 0))
+          OR(COALESCE(:OLD.LINENETAMT, 0) <> COALESCE(:NEW.LINENETAMT, 0))
+        ) THEN
+          IF (v_IsSOTrx = 'Y' AND v_DocStatus = 'DR' AND :OLD.QTYINVOICED <> 
0) THEN
+            RAISE_APPLICATION_ERROR(-20000, '@DeliveredInvoicedOrderline@');
+          END IF;
       ELSIF (v_QTYVARIABLE <> 'Y' AND v_IsSOTrx = 'Y' AND 
ABS(:new.QtyInvoiced) > ABS(:new.QtyOrdered)) THEN
         v_Message := '@OrderDocumentno@' || ' ' || v_DocumentNo || ' ' || 
'@line@' || :old.line || '. ';
         v_Message := v_Message || '@QtyInvoicedHigherOrdered@';

------------------------------------------------------------------------------
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to