Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0005544Openbravo ERP07. Sales managementpublic2008-10-16 10:152009-04-21 11:07
azabaleta 
Dowid 
normalmajoralways
closedfixed 
5
2.40 
 
Core
No
0005544: Running commissions gives an incorrect error
When creating a commission, if you dont select a product (is not mandatory), when creating purchase invoices from commissions it gives incorrect error messages due to the bad PL implementation of the proccess.
Before validating if the sales representative has address, payment form, terms... the PL should validate if the commission has a product.
No tags attached.
depends on backport 0005586 closed Dowid Running commissions gives an incorrect error 
Issue History
2008-10-16 10:15azabaletaNew Issue
2008-10-16 10:15azabaletaAssigned To => cromero
2008-10-16 10:15azabaletasf_bug_id0 => 2170921
2008-10-20 11:31psarobeStatusnew => scheduled
2008-10-20 11:31psarobeNote Added: 0009646
2008-10-20 11:31psarobeAssigned Tocromero => Dowid
2008-10-20 11:31psarobefix_in_branch => trunk
2008-11-13 17:11azabaletaNote Added: 0010252
2008-11-19 13:57DowidNote Added: 0010406
2008-11-19 13:59DowidNote Edited: 0010406
2008-11-19 14:16svnbotCheckin
2008-11-19 14:16svnbotNote Added: 0010408
2008-11-19 14:16svnbotStatusscheduled => resolved
2008-11-19 14:16svnbotResolutionopen => fixed
2008-11-19 14:16svnbotsvn_revision => 10236
2008-11-25 11:51psarobeNote Added: 0010621
2008-12-03 18:24azabaletaNote Added: 0010947
2008-12-13 19:03psarobeStatusresolved => new
2008-12-13 19:03psarobeResolutionfixed => open
2008-12-13 19:03psarobeNote Added: 0011295
2008-12-13 19:04psarobeStatusnew => scheduled
2008-12-13 19:04psarobeNote Added: 0011296
2008-12-16 16:48DowidNote Added: 0011426
2008-12-18 17:48svnbotCheckin
2008-12-18 17:48svnbotNote Added: 0011544
2008-12-18 17:48svnbotStatusscheduled => resolved
2008-12-18 17:48svnbotResolutionopen => fixed
2008-12-18 17:48svnbotsvn_revision10236 => 11390
2009-04-21 11:07psarobeStatusresolved => closed

Notes
(0009646)
psarobe   
2008-10-20 11:31   
This should be the first validation
(0010252)
azabaleta   
2008-11-13 17:11   
When creating a comission there is a "product" field. This field is not mandatory. I create a comission without selecting a product.

After, when you want to create purchase invoices of this comissions (to pay your sales representatives) in comission payment if you click the button create invoices, you will get an error saying that the business partner does not have an address or something similar.

The real error is that the comission does not have a product selected, so the PL should be revised.
(0010406)
Dowid   
2008-11-19 13:57   
(edited on: 2008-11-19 13:59)
The PL has been modified to operate correctly when the "Invoice Product" field is empty.

The following code has been replaced:

SELECT com.C_Currency_ID, com.C_BPartner_ID, pl.C_BPartner_Location_ID,
            PaymentRulePO, PO_PaymentTerm_ID, PO_PriceList_ID,
          POReference, IsDiscountPrinted, p.SalesRep_ID, com.M_Product_ID, C_UOM_ID, p.name as bpartnername
         FROM M_Product prd, C_BPARTNER p, C_COMMISSION com LEFT JOIN C_BPARTNER_LOCATION pl ON com.C_BPartner_ID = pl.C_BPartner_ID
         WHERE com.C_Commission_ID = CUR_ComRun.C_Commission_ID
           AND com.C_BPartner_ID = p.C_BPartner_ID
            AND com.M_Product_ID = prd.M_Product_ID



New code:

SELECT com.C_Currency_ID, com.C_BPartner_ID, pl.C_BPartner_Location_ID,
            PaymentRulePO, PO_PaymentTerm_ID, PO_PriceList_ID,
          POReference, IsDiscountPrinted, p.SalesRep_ID, com.M_Product_ID, C_UOM_ID, p.name as bpartnername
         FROM C_BPARTNER p, C_COMMISSION com LEFT JOIN C_BPARTNER_LOCATION pl ON com.C_BPartner_ID = pl.C_BPartner_ID
                                LEFT JOIN M_Product prd ON com.M_Product_ID = prd.M_Product_ID
         WHERE com.C_Commission_ID = CUR_ComRun.C_Commission_ID
           AND com.C_BPartner_ID = p.C_BPartner_ID

(0010408)
svnbot   
2008-11-19 14:16   
Repository: openbravo
Revision: 10236
Author: dowid
Date: 2008-11-19 14:16:54 +0100 (Wed, 19 Nov 2008)

Fixed bug 0005544: Running commissions gives an incorrect error

---
U trunk/src-db/database/model/functions/C_COMMISSIONRUN_PROCESS.xml
---

https://dev.openbravo.com/websvn/openbravo/?rev=10236&sc=1 [^]
(0010621)
psarobe   
2008-11-25 11:51   
You can find the commission in:

Sales management->Setup->commision
Click new and fill the mandatory fields. Don't fill the product
save
click on Generate commission. click OK.
A message should show up saying that the product is not filled
(0010947)
azabaleta   
2008-12-03 18:24   
I dont understand why a bug can be marked as resolved before the person who reported it test the solution or at least give the ok.

In this case Im not happy with the solution, nor with the user experience for realizing the problem in the commision.
(0011295)
psarobe   
2008-12-13 19:03   
dowid,

If you read the propuse solution says: Before validating if the sales representative has address, payment form, terms... the PL should validate if the commission has a product.

So the first thing it's to validate the product but given that it's not even doing that. When the user clicks the button Create invoice in Sales Management || Transactions || Commission Payment || Header you first have to check if exists a product in Sales Management || Setup || Commission || Header

Regards
(0011296)
psarobe   
2008-12-13 19:04   
Please take also a look if you also did wrong in the backport
(0011426)
Dowid   
2008-12-16 16:48   
Azabaleta thank you for advice.
I've made a decision to use another solution for this bug. Below is an explanation of my solution.

Step for test.

1. Go to Sales management->Setup->commision. Click new and fill the mandatory fields. Don't fill the "invoiced product"
2. click on "Generate commission".
3. Go to Sales Management->Transactions->Commission Payment->Header. Select generated commission and click "Create Invoice"


My solution allows process "Create invoice" to complete with an empty "invoiced product".

Because:

The field "Invoice Product" is not mandatory. (In the Sales Management-> Setup -> Commission -> Header)
The field "Product" in the generated purchase invoice is not mandanatory too.

So, I think that the "Create invoice" process shouldn't stop if "Invoice Product" field is empty.

On the other hand, If you beleive that the Commission should have the "Invoiced Product" field filled in, then this field should be set in the Application dictionary as mandatory.
(0011544)
svnbot   
2008-12-18 17:48   
Repository: openbravo
Revision: 11390
Author: dowid
Date: 2008-12-18 17:48:44 +0100 (Thu, 18 Dec 2008)

Bug fixed 0005544: Running commissions gives an incorrect error
Fixed according to the solution proposed by azabaleta and Pablo Sarobe.

---
U trunk/src-db/database/model/functions/C_COMMISSIONRUN_PROCESS.xml
U trunk/src-db/database/sourcedata/AD_MESSAGE.xml
---

https://dev.openbravo.com/websvn/openbravo/?rev=11390&sc=1 [^]