Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0027280Openbravo ERP07. Sales managementpublic2014-08-05 15:172015-01-26 16:22
ngarcia 
reinaldoguerra 
urgentmajoralways
closedfixed 
5
 
3.0PR15Q1 
pramakrishnan
Core
No
0027280: Commission payment details are duplicated if the invoice has fractionated payment terms
Commission payment details are duplicated if the invoice has fractionated payment terms
As group admin role:
   Create a Payment Term header:
      Overdue Payment Days Rule: 30
   Add a line to it:
      Percentage due: 50
      Overdue Payment Days Rule: 0
   Create a Commission with:
      Business Partner / Sales Rep.: define one
      Frequency Type: Monthly
      Basis Document: Invoice
      Basis Status. Fully paid docuemnts
      Basis Amount: Net amount
   Add a line to it:
      Based on Sales Rep. = Y
      Multiplier amount: 0.5
   Create a Sales Invoice and associate the previously created payment terms and the sales representative to it.
   Complete it and pay the whole amount
   Generate Commission
   Go to the Commission Payment - Amounts - Details tab and check the invoice appears twice
No tags attached.
related to defect 0030184 closed aferraz Wrong commission amount if the invoice has fractionated payment terms but it is paid in the same commission period 
Issue History
2014-08-05 15:17ngarciaNew Issue
2014-08-05 15:17ngarciaAssigned To => jonalegriaesarte
2014-08-05 15:17ngarciaModules => Core
2014-08-05 15:17ngarciaResolution time => 1409608800
2014-08-05 15:17ngarciaTriggers an Emergency Pack => No
2014-08-05 15:18ngarciaIssue Monitored: networkb
2014-10-02 11:42jonalegriaesarteAssigned Tojonalegriaesarte => AtulOpenbravo
2014-10-02 11:42jonalegriaesarteTarget Version => 3.0PR15Q1
2014-11-19 00:08reinaldoguerraAssigned ToAtulOpenbravo => reinaldoguerra
2014-11-19 00:08reinaldoguerraStatusnew => scheduled
2014-11-20 01:54reinaldoguerraNote Added: 0071837
2014-11-20 01:56reinaldoguerraNote Edited: 0071837bug_revision_view_page.php?bugnote_id=0071837#r7103
2014-12-06 05:05reinaldoguerraNote Edited: 0071837bug_revision_view_page.php?bugnote_id=0071837#r7219
2014-12-11 00:15reinaldoguerraNote Edited: 0071837bug_revision_view_page.php?bugnote_id=0071837#r7243
2014-12-11 09:51hgbotCheckin
2014-12-11 09:51hgbotNote Added: 0072417
2014-12-11 09:51hgbotStatusscheduled => resolved
2014-12-11 09:51hgbotResolutionopen => fixed
2014-12-11 09:51hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/e96f620e675872dff29917e9e2363d533592dc57 [^]
2014-12-11 09:53pramakrishnanReview Assigned To => pramakrishnan
2014-12-11 09:53pramakrishnanNote Added: 0072418
2014-12-11 09:53pramakrishnanStatusresolved => closed
2014-12-12 07:04hgbotCheckin
2014-12-12 07:04hgbotNote Added: 0072443
2014-12-30 23:27hudsonbotCheckin
2014-12-30 23:27hudsonbotNote Added: 0073207
2014-12-30 23:27hudsonbotCheckin
2014-12-30 23:27hudsonbotNote Added: 0073210
2015-01-26 16:22ngarciaIssue cloned0028772
2015-06-15 16:08ngarciaRelationship addedcauses 0030184
2015-06-16 19:31aferrazRelationship deletedcauses 0030184
2015-06-16 19:31aferrazRelationship addedrelated to 0030184

Notes
(0071837)
reinaldoguerra   
2014-11-20 01:54   
(edited on: 2014-12-11 00:15)
Test plan used:
1- Login into Openbravo ERP
2- Go to Payment Term window and create a new header record.
3- Set Overdue Payment Days Rule: 30
4- Add a new line to it
5- Set Percentage due: 50 and Overdue Payment Days Rule: 0
6- Go to Commission window and create a new header
7- Select a Business Partner / Sales Rep (create a new one if is required).
   Set Frequency Type: Monthly
   Basis Document: Invoice
   Basis Status. Fully paid docuemnts
   Basis Amount: Net amount
8- Go to lines tab and create a new record
9- Check Based on Sales Rep. flag and set Multiplier amount: 0.5
10- Go to Sales Invoice window and create a new one selecting the same sales representative and the previously created payment terms.
11- Add a line with a product
11- Complete it
12- Pay the whole amount by clicking add payment button, realize that two record are selected in the invoice grid as the invoice has fractionated payment terms. Complete the process.
13- Go back to Commission window, select previous commision record and click in Generate Commission button
14- Go to the Commission Payment window, select created record, go to Amounts tab and then select Details tab.
15- Realize that one record per invoice is shown.
16- Execute ant update.database and realize that duplicated data are deleted for other Commission Payments. Also quantities and amounts are correctly updated.

(0072417)
hgbot   
2014-12-11 09:51   
Repository: erp/devel/pi
Changeset: e96f620e675872dff29917e9e2363d533592dc57
Author: Reinaldo Guerra <reinaldo.guerra <at> peoplewalking.com>
Date: Wed Dec 10 17:48:00 2014 -0500
URL: http://code.openbravo.com/erp/devel/pi/rev/e96f620e675872dff29917e9e2363d533592dc57 [^]

Fixed bug 27280: Commission payment details are duplicated in some cases.

Generate commision process was changed to exclude the same records when retrieving data to be inserted in the payment detail table. This information comes duplicated due to the payment is divided in two records as the invoice has fractionated payment terms.
Thus the stored procedure was changed only in those cases when the commission basis document is an invoice, and the information related with the payments and its products are joined in the same query, avoiding duplicated tuples.
Now there are not duplicated fields when processing commissions for invoices with fractionated payment terms. Also a module script was developed to correct inconsistent data. When executing an ant update database duplicated data in commission detail table will be deleted, also amounts and quantities will be updated in commission amount and commission payment tables with the correct information.

---
M src-db/database/model/functions/C_COMMISSION_PROCESS.xml
A src-util/modulescript/build/classes/org/openbravo/modulescript/DeleteDuplicateCommissionDetail.class
A src-util/modulescript/build/classes/org/openbravo/modulescript/DeleteDuplicateCommissionDetailData.class
A src-util/modulescript/src/org/openbravo/modulescript/DeleteDuplicateCommissionDetail.java
A src-util/modulescript/src/org/openbravo/modulescript/DeleteDuplicateCommissionDetail_data.xsql
---
(0072418)
pramakrishnan   
2014-12-11 09:53   
Code Review + Testing - OK.
(0072443)
hgbot   
2014-12-12 07:04   
Repository: erp/devel/pi
Changeset: 70a223e52c0844e430449ed1dd8655c31b19dc0d
Author: Reinaldo Guerra <reinaldo.guerra <at> peoplewalking.com>
Date: Thu Dec 11 12:43:38 2014 -0500
URL: http://code.openbravo.com/erp/devel/pi/rev/70a223e52c0844e430449ed1dd8655c31b19dc0d [^]

Related to issue 27280: Changes required in module script in order to improve it

Some changes were made in Delete Duplicate Commission Detail module script in order to improve it. A short comment indicating the issue to solve, was added in the java class and the dummy sql method was replaced for the really used selecting logic.

---
M src-util/modulescript/build/classes/org/openbravo/modulescript/DeleteDuplicateCommissionDetail.class
M src-util/modulescript/build/classes/org/openbravo/modulescript/DeleteDuplicateCommissionDetailData.class
M src-util/modulescript/src/org/openbravo/modulescript/DeleteDuplicateCommissionDetail.java
M src-util/modulescript/src/org/openbravo/modulescript/DeleteDuplicateCommissionDetail_data.xsql
---
(0073207)
hudsonbot   
2014-12-30 23:27   
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/6525fe229e06 [^]
Maturity status: Test
(0073210)
hudsonbot   
2014-12-30 23:27   
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/6525fe229e06 [^]
Maturity status: Test