Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0010807Openbravo ERP09. Financial managementpublic2009-09-29 10:422010-02-18 00:31
networkb 
rafaroda 
urgentmajoralways
closedfixed 
5
2.50MP5 
2.50MP82.50MP9 
Core
No
0010807: The documentno on invoices is not unique
The documentno on invoices is not unique. You can use the same documentno
in the same organization.

-Create a new invoice on organization A and save it
-Create another new invoice on organization A and put in the documentno the documentno of the invoice created previously
Logic will be added into the invoice completion function (C_Invoice_Post) in order that these documents can not be completed if the document number is repeated in the organization tree of the document sequence within the same fiscal year.

Can not be done via a trigger since it will lead to mutating table issues.
No tags attached.
related to defect 00113842.50MP9 closed rafaroda Unable to complete the sales invoice document 
related to defect 0012230pi closed rafaroda not able to void invoices 
Issue History
2009-09-29 10:42networkbNew Issue
2009-09-29 10:42networkbAssigned To => rafaroda
2009-09-29 22:32psarobeStatusnew => scheduled
2009-09-29 22:32psarobefix_in_branch => pi
2009-09-30 06:46rafarodaNote Added: 0020572
2009-09-30 06:46rafarodaPrioritynormal => urgent
2009-09-30 06:46rafarodafix_in_branchpi =>
2009-10-13 12:12psarobeAssigned Torafaroda => gorkaion
2009-10-14 12:11shuehnerNote Added: 0021000
2009-10-15 13:01gorkaionNote Added: 0021049
2009-10-19 11:39rafarodaAssigned Togorkaion => rafaroda
2009-10-20 15:01rafarodaSteps to Reproduce Updated
2009-10-22 10:03networkbTarget Version2.50MP7 => 2.50MP8
2009-10-26 12:49dmitry_mezentsevNote Added: 0021369
2009-11-02 13:46rafarodaSteps to Reproduce Updated
2009-11-02 13:51hgbotCheckin
2009-11-02 13:51hgbotNote Added: 0021504
2009-11-02 13:51hgbotStatusscheduled => resolved
2009-11-02 13:51hgbotResolutionopen => fixed
2009-11-02 13:51hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/005a6d8a4029174ac9c2bf5e1bd9066660c1018a [^]
2009-11-02 13:53rafarodaNote Added: 0021505
2009-11-02 13:57rafarodaNote Added: 0021506
2009-11-09 07:51arunkumarStatusresolved => closed
2009-11-09 07:51arunkumarNote Added: 0021629
2009-11-09 07:51arunkumarFixed in Version => 2.50MP9
2009-11-10 00:00anonymoussf_bug_id0 => 2894887
2009-11-17 15:02rafarodaRelationship addedrelated to 0011384
2009-11-18 18:30rafarodaNote Edited: 0021505
2009-11-18 19:17hgbotCheckin
2009-11-18 19:17hgbotNote Added: 0021989
2009-11-18 19:17hgbotStatusclosed => resolved
2009-11-18 19:17hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/devel/pi/rev/005a6d8a4029174ac9c2bf5e1bd9066660c1018a [^] => http://code.openbravo.com/erp/devel/pi/rev/9ad3ddb414cd2351a1eb44faf899882b96d2f183 [^]
2009-11-19 05:34sureshbabuNote Added: 0021997
2009-11-19 05:34sureshbabuStatusresolved => closed
2010-02-16 12:55rafarodaRelationship addedrelated to 0012230
2010-02-16 15:15hgbotCheckin
2010-02-16 15:15hgbotNote Added: 0024414
2010-02-16 15:15hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/devel/pi/rev/9ad3ddb414cd2351a1eb44faf899882b96d2f183 [^] => http://code.openbravo.com/erp/devel/pi/rev/7de7c4a6be7eb6b511d2156f5c75b9953af86bf9 [^]
2010-02-18 00:31hudsonbotCheckin
2010-02-18 00:31hudsonbotNote Added: 0024541

Notes
(0020572)
rafaroda   
2009-09-30 06:46   
Upgraded to urgent.
(0021000)
shuehner   
2009-10-14 12:11   
Note: this will be an API change and require extra effort on upgrades (for installations where the new unique constraint is not satisfied))
(0021049)
gorkaion   
2009-10-15 13:01   
In some countries it is possible to have the same Document Number in an organization for different fiscal years. So creating an index is not an option.
(0021369)
dmitry_mezentsev   
2009-10-26 12:49   
Gorka,

There was a discussion about the best way to fix this issue. Could you please share it with Rafa if his team is going to resolve it (just as a reminder if it is not yet done cause the issue is moving to its deadline)?
(0021504)
hgbot   
2009-11-02 13:51   
Repository: erp/devel/pi
Changeset: 005a6d8a4029174ac9c2bf5e1bd9066660c1018a
Author: Rafa Roda Palacios <rafael.roda <at> openbravo.com>
Date: Thu Oct 29 04:39:58 2009 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/005a6d8a4029174ac9c2bf5e1bd9066660c1018a [^]

Fixes issue 10807 Now document numbers can not be repeated.

Logic has been added into the invoice completion function (C_Invoice_Post) in order that these documents can not be completed if the document number is repeated in the organization tree of the document sequence within the same fiscal year.

---
M src-db/database/model/functions/C_INVOICE_POST.xml
M src-db/database/sourcedata/AD_MESSAGE.xml
---
(0021505)
rafaroda   
2009-11-02 13:53   
(edited on: 2009-11-18 18:30)
Steps to test the fix.

With the following organization tree:
_ *
__ Main
___ A
____ A1
____ A2
___ B

1) Create a AR sales invoice in organization A with document number 200200 and invoice date 22-10-2009 and complete it.

2) Create a AR Credit Memo sales invoice in organization A with document number 200200 and invoice date 22-12-2009 and complete it.

3) Re-activate it and change its transaction document to AR Invoice and complete it. You will not be allowed since you are in the same organization and fiscal year (and same transaction document -document type-).

4) Change is organization to A1 and complete it. You will not be allowed since the document type is defined at * level and both A and A1 are children of it.

5) Change its invoice date to 22-10-2008 and complete it.

6) Create a AR sales invoice in organization A2 with document number 200200 and invoice date 22-10-2009 and complete it. You will not be allowed since the document type is defined at * level and both A and A2 are children of it.

7) Change its document number to 200201 and complete it.

8) Create a AR sales invoice in organization Main with document number 200200 and invoice date 22-10-2009 and complete it. You will not be allowed since the document type is defined at * level and both Main and A are children of it.

9) Change its document number to 200201 and complete it. You will not be allowed since the document type is defined at * level and both Main and A2 are children of it.

10) Change its invoice date to 22-10-2007 and complete it.

11) Create a AR sales invoice in organization B with document number 200201 and invoice date 22-12-2007 and complete it. You will not be allowed since the document type is defined at * level and both Main and B are children of it.

12) Change its document number to 200200 and complete it.

13) Re-activate it, change its invoice date to 22-10-2009 and complete it. You will not be allowed since the document type is defined at * level and both A and B are children of it.

(0021506)
rafaroda   
2009-11-02 13:57   
Why using date invoiced for looking for invoices in the same fiscal year?

After completing the invoice, accounting date can be changed (until the invoice is posted) but not the invoiced date. If one forgets to include the invoice in the accounting of one year he can always change its accounting date for including it in the following year. But the document sequence number has to follow the invoiced date year.
(0021629)
arunkumar   
2009-11-09 07:51   
I have tested the steps given by Rafa to test the fix.They are working fine.
(0021989)
hgbot   
2009-11-18 19:17   
Repository: erp/devel/pi
Changeset: 9ad3ddb414cd2351a1eb44faf899882b96d2f183
Author: Rafa Roda Palacios <rafael.roda <at> openbravo.com>
Date: Fri Nov 13 04:26:44 2009 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/9ad3ddb414cd2351a1eb44faf899882b96d2f183 [^]

Fixes issue 11384 fixes issue 10807 DocumentNo check is now filtering by client.

---
M src-db/database/model/functions/C_INVOICE_POST.xml
---
(0021997)
sureshbabu   
2009-11-19 05:34   
Tested working fine
(0024414)
hgbot   
2010-02-16 15:15   
Repository: erp/devel/pi
Changeset: 7de7c4a6be7eb6b511d2156f5c75b9953af86bf9
Author: Rafa Roda Palacios <rafael.roda <at> openbravo.com>
Date: Tue Feb 16 15:08:01 2010 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/7de7c4a6be7eb6b511d2156f5c75b9953af86bf9 [^]

Fixes issue 12230 Check for repeated invoice document nos works also now for non existing periods. Related to issue 10807

---
M src-db/database/model/functions/C_INVOICE_POST.xml
---
(0024541)
hudsonbot   
2010-02-18 00:31   
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/7de7c4a6be7e [^]
Merge Changeset: http://code.openbravo.com/erp/devel/main/rev/7c1b489fb0a0 [^]
Tests: http://builds.openbravo.com/view/devel-int/ [^]
OBX: http://builds.openbravo.com/erp/core/obx/OpenbravoERP-2.50CI.16459.obx [^]