details:   /erp/stable/2.50/rev/375d11540b62
changeset: 9427:375d11540b62
user:      Adrián Romero <adrianromero <at> openbravo.com>
date:      Tue May 17 17:25:03 2011 +0200
summary:   Fixes issue 0017118: Should not be possible to void an invoice with 
no lines, as it is not possible to complete it
It has been added a check in the C_INVOICE_POST function that verifies that an 
invoice must not be voided if it has no lines and no taxes

diffstat:

 src-db/database/model/functions/C_INVOICE_POST.xml |  14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diffs (24 lines):

diff -r df4ea4945c39 -r 375d11540b62 
src-db/database/model/functions/C_INVOICE_POST.xml
--- a/src-db/database/model/functions/C_INVOICE_POST.xml        Tue May 17 
15:44:58 2011 +0200
+++ b/src-db/database/model/functions/C_INVOICE_POST.xml        Tue May 17 
17:25:03 2011 +0200
@@ -369,6 +369,20 @@
      * Void if Document not processed
      */
     IF (v_DocAction='VO' AND v_DocStatus NOT IN('CO', 'RE')) THEN
+
+        SELECT COUNT(*) INTO v_count
+        FROM C_INVOICE
+        WHERE C_INVOICE_ID=v_Record_ID
+        AND (EXISTS (SELECT 1
+            FROM C_INVOICELINE
+            WHERE C_INVOICE_ID=v_Record_ID)
+           OR EXISTS (SELECT 1
+            FROM C_INVOICETAX
+            WHERE C_INVOICE_ID=v_Record_ID));
+       IF (v_count=0) THEN
+            RAISE_APPLICATION_ERROR(-20000, '@InvoicesNeedLines@');
+        END IF;
+
       SELECT COUNT(*) INTO v_count
       FROM C_DEBT_PAYMENT
       WHERE C_Invoice_ID = v_Record_ID;

------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to