Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0030292Openbravo ERPZ. Otherspublic2015-06-30 18:472015-08-20 23:16
maite 
AtulOpenbravo 
urgentmajoralways
closedfixed 
5
 
3.0PR15Q4 
vmromanos
Core
No
0030292: Wrong Document Type calculation when there are types configured in the legal entity and the store (generic child organization)
When doing a Payment In from a Sales Invoice. If there are default document types
defined in the generic organization and the legal entity the application can return the doctype of the legal entity instead of prioritize the doctype of the generic.
1. Create a new autonumeric sequence in F&B España, set a prefix for example "RN".
2. Create a new document type for Payment Ins:
* Organization: F&B Región Norte
* Document Category: AR Receipt
* Sequenced document: Yes
* Sequence: the seq created on step 1.
* Sales Trx: Yes
* Default: Yes
3. Access database and ensure that c_doctype_id of the legal is higher than c_doctype_id of the generic (if necessary, update c_doctype_id to reproduce the issue)
4. Check that the equivalent document type for F&B España is also default: Y.
5. Create a new Sales Invoice in organization F&B España Norte and complete it.
6. Click on Add Payment and check the Document Number proposed. It should always use the doc type of Region Norte (as the document type is hidden in the popup it is possible to notice the error checking the prefix of the document number)
When the payment is generated it is using the java function
FIN_Utility.getDocumentType(organization, strCategory). This function does a query considering the parent tree of the organization. It sorts the result by the default flag and the document type id. The sorting should be changed to include the org parent level so it first returns the default types of the base org.
The db function AD_GET_DOCTYPE used in stored procedures is already sorting first by the org parent level.
No tags attached.
Issue History
2015-06-30 18:47maiteNew Issue
2015-06-30 18:47maiteAssigned To => Triage Finance
2015-06-30 18:47maiteModules => Core
2015-06-30 18:47maiteResolution time => 1438639200
2015-06-30 18:47maiteTriggers an Emergency Pack => No
2015-06-30 18:47maiteIssue Monitored: networkb
2015-07-10 09:03AtulOpenbravoAssigned ToTriage Finance => AtulOpenbravo
2015-07-10 09:03AtulOpenbravoStatusnew => scheduled
2015-07-13 07:50AtulOpenbravoNote Added: 0078761
2015-07-13 13:16hgbotCheckin
2015-07-13 13:16hgbotNote Added: 0078771
2015-07-13 13:16hgbotStatusscheduled => resolved
2015-07-13 13:16hgbotResolutionopen => fixed
2015-07-13 13:16hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/3ae7799bc9344084635a04597b3da9e6cc576e55 [^]
2015-07-13 13:16hgbotCheckin
2015-07-13 13:16hgbotNote Added: 0078772
2015-07-13 13:17vmromanosReview Assigned To => vmromanos
2015-07-13 13:17vmromanosNote Added: 0078773
2015-07-13 13:17vmromanosStatusresolved => closed
2015-07-16 12:02gorka_gilFixed in SCM revisionhttp://code.openbravo.com/erp/devel/pi/rev/3ae7799bc9344084635a04597b3da9e6cc576e55 [^] => http://code.openbravo.com/erp/devel/pi/rev/219fa2d8cb3d [^]
2015-07-16 12:02gorka_gilNote Edited: 0078771bug_revision_view_page.php?bugnote_id=0078771#r9046
2015-07-16 12:02gorka_gilNote Edited: 0078772bug_revision_view_page.php?bugnote_id=0078772#r9048
2015-08-20 23:16hudsonbotCheckin
2015-08-20 23:16hudsonbotNote Added: 0079490
2015-08-20 23:16hudsonbotCheckin
2015-08-20 23:16hudsonbotNote Added: 0079491

Notes
(0078761)
AtulOpenbravo   
2015-07-13 07:50   
Test Plan
- Create a new auto numeric sequence in F&B España, set a prefix for example "RN".
- Create a new document type for Payment In:
  * Organization: F&B Región Norte
  * Document Category: AR Receipt
  * Sequenced document: Yes
  * Sequence: the seq created on step 1.
  * Sales Trx: Yes
  * Default: Yes
- Check into database and ensure that c_doctype_id of the legal (F&B España) is higher than c_doctype_id of the generic (F&B España Norte). If required update c_doctype_id to reproduce the issue.
- Check that the equivalent document type for F&B España is also default: Y.
- Create a new Sales Invoice in organization F&B España Norte and complete it.
- Click on Add Payment and check the Document Number proposed. It uses the document type defined for Region Norte having prefix 'RN'.
(0078771)
hgbot   
2015-07-13 13:16   
(edited on: 2015-07-16 12:02)
Repository: erp/devel/pi
Changeset: 219fa2d8cb3d
Author: Atul Gaware <atul.gaware <at> openbravo.com>
Date: Sat Jul 11 10:35:43 2015 +0530
URL: http://code.openbravo.com/erp/devel/pi/rev/219fa2d8cb3d [^]

Fixes Issue 30292:Wrong Document Type calculation when there are types
configured in the legal entity and the store (generic child organization)

Instead of OBCriteria, OBQuery is implemented in order to sort record by
organization parent level using ad_isorgincluded function prior to default
flag and id.

---
M modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java
---

(0078772)
hgbot   
2015-07-13 13:16   
(edited on: 2015-07-16 12:02)
Repository: erp/devel/pi
Changeset: c0e8945c69fa
Author: Víctor Martínez Romanos <victor.martinez <at> openbravo.com>
Date: Mon Jul 13 13:15:38 2015 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/c0e8945c69fa [^]

Related to issue 30292: code review improvements

1. Ordered by dt.default desc to get first the records with default = Y
2. Ordered by dt.id desc as it was in the original code.
Note that this order is different from the one used at AD_GET_DOCTYPE. However I have kept this order to to get the same records as in the past (otherwise it could be considered as a functional regression)
3. Limit query to just 1 record to improve performance

---
M modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java
---

(0078773)
vmromanos   
2015-07-13 13:17   
Code review + testing OK
(0079490)
hudsonbot   
2015-08-20 23:16   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/8c91718397a5 [^]
Maturity status: Test
(0079491)
hudsonbot   
2015-08-20 23:16   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/8c91718397a5 [^]
Maturity status: Test