Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0012857Openbravo ERP07. Sales managementpublic2010-03-31 17:032010-06-08 13:59
networkb 
sivaraman 
normalminoralways
closedfixed 
5
2.50MP13 
2.50MP17 
OBPS
Core
No
0012857: It is possible to generate an invoice with a Transaction Document disabled
It is possible to generate an invoice with a document type disabled.
-As Openbravo Admin go to Financial Management || Accounting || Setup || Document Type
-Select AR Invoice and disabled it (Active: no)

-Go to Sales Management || Transactions || Create Invoices from Orders
-Create an Invoice.
-Realize that the invoice created is AR Invoice

The Create Invoices from Orders process should raise an exception here and not create an invoice with a disabled document type.
No tags attached.
Issue History
2010-03-31 17:03networkbNew Issue
2010-03-31 17:03networkbAssigned To => adrianromero
2010-03-31 17:03networkbOBNetwork customer => Yes
2010-03-31 17:09adrianromeroStatusnew => scheduled
2010-04-16 15:59adrianromeroNote Added: 0026318
2010-04-16 16:05adrianromeroRelationship addedrelated to 0012879
2010-04-16 16:15psarobePriorityurgent => normal
2010-04-16 16:15psarobeSeveritymajor => minor
2010-04-16 16:22psarobeNote Added: 0026319
2010-04-16 16:22psarobeStatusscheduled => closed
2010-04-16 16:22psarobeResolutionopen => no change required
2010-04-16 17:17adrianromeroNote Added: 0026323
2010-04-17 00:00anonymoussf_bug_id0 => 2988600
2010-04-21 12:48adrianromeroSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=251#r251
2010-04-21 12:49adrianromeroRelationship deletedrelated to 0012879
2010-04-21 12:50adrianromeroNote Added: 0026537
2010-04-21 12:50adrianromeroStatusclosed => new
2010-04-21 12:50adrianromeroResolutionno change required => open
2010-04-21 12:50adrianromeroStatusnew => scheduled
2010-04-21 12:50adrianromerofix_in_branch => pi
2010-04-23 12:17sivaramanAssigned Toadrianromero => sivaraman
2010-04-23 12:21hgbotCheckin
2010-04-23 12:21hgbotNote Added: 0026610
2010-04-23 12:21hgbotStatusscheduled => resolved
2010-04-23 12:21hgbotResolutionopen => fixed
2010-04-23 12:21hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/f416696344a65ee0d719fc26b98099f7f1f1c876 [^]
2010-04-23 12:28sivaramanNote Added: 0026612
2010-04-23 18:08sureshbabuNote Added: 0026651
2010-04-23 18:08sureshbabuStatusresolved => closed
2010-05-12 12:22networkbNote Added: 0027165
2010-05-12 13:28hgbotCheckin
2010-05-12 13:28hgbotNote Added: 0027170
2010-05-12 13:28hgbotStatusclosed => resolved
2010-05-12 13:28hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/devel/pi/rev/f416696344a65ee0d719fc26b98099f7f1f1c876 [^] => http://code.openbravo.com/erp/devel/pi/rev/f38fcdbde42072b7e015c51752f3c3d20f7fa4d0 [^]
2010-05-13 07:54arunkumarNote Added: 0027183
2010-05-13 07:54arunkumarStatusresolved => closed
2010-05-14 15:27hudsonbotCheckin
2010-05-14 15:27hudsonbotNote Added: 0027279
2010-05-18 12:12gorka_gilTarget Version2.50MP15 => 2.50MP17
2010-05-18 21:44hudsonbotCheckin
2010-05-18 21:44hudsonbotNote Added: 0027517
2010-06-04 14:45hgbotCheckin
2010-06-04 14:45hgbotNote Added: 0027972
2010-06-04 14:45hgbotStatusclosed => resolved
2010-06-04 14:45hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/devel/pi/rev/f38fcdbde42072b7e015c51752f3c3d20f7fa4d0 [^] => http://code.openbravo.com/erp/devel/pi/rev/1b3b2e2ae942eb759aa2541a8e1d61d6df6b6117 [^]
2010-06-07 21:21hudsonbotCheckin
2010-06-07 21:21hudsonbotNote Added: 0028094
2010-06-07 23:43hudsonbotCheckin
2010-06-07 23:43hudsonbotNote Added: 0028136
2010-06-08 13:59sureshbabuNote Added: 0028183
2010-06-08 13:59sureshbabuStatusresolved => closed

Notes
(0026318)
adrianromero   
2010-04-16 15:59   
Probably the error is in the function C_INVOICE_CREATE. When requesting the document type:

SELECT od.C_DocTypeInvoice_ID,
                od.DocSubTypeSO
              INTO v_DocType_ID,
                v_DocSubTypeSO
              FROM C_DOCTYPE od,
                C_DOCTYPE ID
              WHERE od.C_DocType_ID=Cur_Order.C_DocType_ID
                AND od.C_DocTypeInvoice_ID=ID.C_DocType_ID;


Here is not verified that the document type is active.

Take into account that this function is very sensitive and changes must be done without affecting any other business case.
(0026319)
psarobe   
2010-04-16 16:22   
This is not an issue. The way you suppose the ERP has to work is not correct.
Please log another issue related with the casuistic of deactivating a document type
(0026323)
adrianromero   
2010-04-16 17:17   
Actually the problem here is problably that the POS order document type has not the value AR Invoice Document Type in the "Document Type for Invoice" field . If both document types are related it will work.

Other problem is that the SQL sentece described in the previous note does not filter by ACTIVE='Y'. This sentence must have this filter and raise an error if the sentence does not return any value.
(0026537)
adrianromero   
2010-04-21 12:50   
Modified the steps to reproduce to identify properly the cause of the isue
(0026610)
hgbot   
2010-04-23 12:21   
Repository: erp/devel/pi
Changeset: f416696344a65ee0d719fc26b98099f7f1f1c876
Author: Sivaraman Rajagopal <sivaraman.rajagopal <at> openbravo.com>
Date: Fri Apr 23 15:50:49 2010 +0530
URL: http://code.openbravo.com/erp/devel/pi/rev/f416696344a65ee0d719fc26b98099f7f1f1c876 [^]

Fixes issue 12857: It is possible to generate an invoice with a Transaction Document disabled

---
M src-db/database/model/functions/C_INVOICE_CREATE.xml
M src-db/database/sourcedata/AD_MESSAGE.xml
M src/org/openbravo/erpCommon/ad_forms/GenerateInvoicesmanual.java
---
(0026612)
sivaraman   
2010-04-23 12:28   
Steps to test:

-As Openbravo Admin go to Financial Management || Accounting || Setup || Document Type
-Select AR Invoice and disabled it (Active: no)

-Go to Sales Management || Transactions || Create Invoices from Orders
-Create an Invoice.
-Realize that 'No document type found' error message is thrown
(0026651)
sureshbabu   
2010-04-23 18:08   
Tested working fine
(0027165)
networkb   
2010-05-12 12:22   
It has been tested in PI + PostgreSQL and this is the error message:

Error:
null value in column "c_doctype_id" violates not-null constraint

Please, reopen it, and fix it properly for PostgreSQL
(0027170)
hgbot   
2010-05-12 13:28   
Repository: erp/devel/pi
Changeset: f38fcdbde42072b7e015c51752f3c3d20f7fa4d0
Author: Adrián Romero <adrianromero <at> openbravo.com>
Date: Wed May 12 13:27:35 2010 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/f38fcdbde42072b7e015c51752f3c3d20f7fa4d0 [^]

Fixes issue 0012857: It is possible to generate an invoice with a Transaction Document disabled
In order to behave the same way in PosgreSQL and Oracle, it has been modified the PL/SQL flow. The problem is that when an SQL sentence is used to assign a variable and the SQL does not return any row, In PosgreSQL it just sets the variable to NULL and in Oracle a NOT_DATA_FOUND exception is thrown

---
M src-db/database/model/functions/C_INVOICE_CREATE.xml
---
(0027183)
arunkumar   
2010-05-13 07:54   
Pi Postgres also display the error message as
"No document type found for invoice"

Tested working fine
(0027279)
hudsonbot   
2010-05-14 15:27   
A changeset related to this issue has been promoted to main after passing a series of tests and an OBX has been generated:

Changeset: http://code.openbravo.com/erp/devel/main/rev/f416696344a6 [^]
Merge Changeset: http://code.openbravo.com/erp/devel/main/rev/36f76c8d7193 [^]
Tests: http://builds.openbravo.com/view/devel-int/ [^]
OBX: http://builds.openbravo.com/erp/core/obx/OpenbravoERP-2.50CI.17198.obx [^]
(0027517)
hudsonbot   
2010-05-18 21:44   
A changeset related to this issue has been promoted to main after passing a series of tests and an OBX has been generated:

Changeset: http://code.openbravo.com/erp/devel/main/rev/f38fcdbde420 [^]
Merge Changeset: http://code.openbravo.com/erp/devel/main/rev/aa11838d5f80 [^]
Tests: http://builds.openbravo.com/view/devel-int/ [^]
OBX: http://builds.openbravo.com/erp/core/obx/OpenbravoERP-2.50CI.17380.obx [^]
(0027972)
hgbot   
2010-06-04 14:45   
Repository: erp/devel/pi
Changeset: 1b3b2e2ae942eb759aa2541a8e1d61d6df6b6117
Author: Sivaraman Rajagopal <sivaraman.rajagopal <at> openbravo.com>
Date: Fri Apr 23 15:50:49 2010 +0530
URL: http://code.openbravo.com/erp/devel/pi/rev/1b3b2e2ae942eb759aa2541a8e1d61d6df6b6117 [^]

Fixes issue 12857: It is possible to generate an invoice with a Transaction Document disabled

---
M src-db/database/model/functions/C_INVOICE_CREATE.xml
M src-db/database/sourcedata/AD_MESSAGE.xml
M src/org/openbravo/erpCommon/ad_forms/GenerateInvoicesmanual.java
---
(0028094)
hudsonbot   
2010-06-07 21:21   
A changeset related to this issue has been promoted to main after passing a series of tests and an OBX has been generated:

Changeset: http://code.openbravo.com/erp/devel/main/rev/1b3b2e2ae942 [^]
Merge Changeset: http://code.openbravo.com/erp/devel/main/rev/8b43a1f2fff4 [^]
Tests: http://builds.openbravo.com/view/int/ [^]
OBX: http://builds.openbravo.com/erp/core/obx/OpenbravoERP-2.50CI.17563.obx [^]
(0028136)
hudsonbot   
2010-06-07 23:43   
A changeset related to this issue has been promoted to main after passing a series of tests and an OBX has been generated:

Changeset: http://code.openbravo.com/erp/devel/main/rev/1b3b2e2ae942 [^]
Merge Changeset: http://code.openbravo.com/erp/devel/main/rev/8b43a1f2fff4 [^]
Tests: http://builds.openbravo.com/view/int/ [^]
OBX: http://builds.openbravo.com/erp/core/obx/OpenbravoERP-2.50CI.17563.obx [^]
(0028183)
sureshbabu   
2010-06-08 13:59   
Retestd by following the below steps

1) For "POS" Document type changed the value for"Document Type for Invoice" as "AR Invoice"
2) Deactivated the "AR invoice" document type
3) Tried to create a sales order with transaction document type as "POS" order

System rightly shows the below error

" Error: No document type found for invoice"