Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0030376
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] 02. Master data managementmajoralways2015-07-15 18:462015-08-20 23:16
ReporterVictorVillarView Statuspublic 
Assigned ToAtulOpenbravo 
PriorityurgentResolutionfixedFixed in Version
StatusclosedFix in branchFixed in SCM revision116e50e703f6
ProjectionnoneETAnoneTarget Version3.0PR15Q4
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionpiSCM revision 
Review Assigned Tovmromanos
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0030376: The Create Price List process is modifying the Current Vendor field when it should not

DescriptionThe Create Price List process is modifying the Current Vendor field when it should not
Steps To ReproduceAs System Admin,
  Go to Windows, tabs and fields:
    select the Product window - Purchasing Tab
    Organization field = Yes

Log out and Log in.
 
Go to Product window
   Add two registers for different organizations.
   Add 2 Business Partners in Purchasing tab with the same Price List defined. Current Vendor = Yes for both registers. 2 different organizations
   Add the same Price List to the product.

Go to Price List window,
  select the same Price List as before
  Click on 'Create Price List' button (Note that you should have define a base price list in the price list version)
  When finishes realise that the process has changed the flag 'current vendor'. Now it has 'N'.


The problem is in the m_pricelist_create function:

/**
    * Make sure that we have only one active product
    */
    v_ResultStr:='CorrectingDuplicates';
    RAISE NOTICE '%',v_ResultStr ;
    DECLARE
      -- All duplicate products
      Cur_Duplicates RECORD;
      -- All vendors of Product - expensive first
      DECLARE Cur_Vendors CURSOR (Product_ID VARCHAR) FOR
        SELECT M_Product_ID,
          C_BPartner_ID
        FROM M_Product_PO
        WHERE IsCurrentVendor='Y'
          AND IsActive='Y'
          AND M_Product_ID=Product_ID
        ORDER BY PriceList DESC;
        --
        Product_ID VARCHAR(32); --OBTG:VARCHAR2--
        BPartner_ID VARCHAR(32); --OBTG:VARCHAR2--
      BEGIN
        FOR Cur_Duplicates IN
          (SELECT DISTINCT M_Product_ID
          FROM M_Product_PO po
          WHERE IsCurrentVendor='Y'
            AND IsActive='Y'
            AND EXISTS
            (SELECT M_Product_ID
            FROM M_Product_PO x
            WHERE x.M_Product_ID=po.M_Product_ID
            GROUP BY M_Product_ID
            HAVING COUNT(*)>1
            )
          ORDER BY 1
          )
        LOOP
          OPEN Cur_Vendors(Cur_Duplicates.M_Product_ID) ;
          FETCH Cur_Vendors INTO Product_ID,
          BPartner_ID; -- Leave First
          LOOP
            FETCH Cur_Vendors INTO Product_ID,
            BPartner_ID; -- Get Record ID
            EXIT WHEN NOT FOUND ; --OBTG:Cur_Vendors--
            --
            RAISE NOTICE '%',' Record: ' || Product_ID || ' / ' || BPartner_ID ;
            UPDATE M_Product_PO
              SET IsCurrentVendor='N'
            WHERE M_Product_ID=Product_ID
              AND C_BPartner_ID=BPartner_ID;
          END LOOP;
          CLOSE Cur_Vendors;
        END LOOP;
Proposed SolutionIt should not change anything.
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0078910)
AtulOpenbravo (developer)
2015-07-17 09:18
edited on: 2015-07-17 09:18

Test Plan
- Login as System Admin,
    Go to Windows, tabs and fields:
    Select the Product window - Purchasing Tab
    Set Organization field Displayed = Yes

- Log out and Log in.
 
- Go to Product window
   Add a Product for eg:- F&B Inc US.
   Add two registers in Purchasing Tab for 2 different Organization, 2
     different Business Partners, set same List Price, Current Vendor = Yes.
   Add the Product Price to the product for some Price List.

- Go to Price List window,
   Select the same Price List in which Product Price was created for above
     product.
   Create a new Price List Version. Set Base Price List as above. Fill up name
     Valid till Date, etc. Save record.
   Click on 'Create Price List' button

- When create price list process finishes, check Current Vendor flag for both registers in the Purchasing Plan. They are not changed by the above process. They are set as Yes.

(0078913)
hgbot (developer)
2015-07-17 10:04

Repository: erp/devel/pi
Changeset: 116e50e703f6b420f6fc087aa72663d0ede7d1cb
Author: Atul Gaware <atul.gaware <at> openbravo.com>
Date: Thu Jul 16 17:21:16 2015 +0530
URL: http://code.openbravo.com/erp/devel/pi/rev/116e50e703f6b420f6fc087aa72663d0ede7d1cb [^]

Fixes Issue 30376:The Create Price List process is modifying the Current
Vendor field when it should not

In case of multiple m_product_po register's for same product and same
business partner keeping iscurrentvendor flag active only for one register
is no more needed due to unique constraint applied on m_product_po for
m_product_id and c_bpartner_id during r2.5x merge into trunk.

---
M src-db/database/model/functions/M_PRICELIST_CREATE.xml
---
(0078914)
hgbot (developer)
2015-07-17 10:04

Repository: erp/devel/pi
Changeset: 131b77a5d55b5eb27b93fa85bd606eb3ac157021
Author: Víctor Martínez Romanos <victor.martinez <at> openbravo.com>
Date: Fri Jul 17 09:30:16 2015 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/131b77a5d55b5eb27b93fa85bd606eb3ac157021 [^]

Related to issue 30376: code review improvements
Removed piece of code where IsCurrentVendor is set to Y. This process shouldn't update this column

---
M src-db/database/model/functions/M_PRICELIST_CREATE.xml
---
(0078915)
hgbot (developer)
2015-07-17 10:04

Repository: erp/devel/pi
Changeset: 94988f01014d317b55cf3b44ce75261155419abd
Author: Víctor Martínez Romanos <victor.martinez <at> openbravo.com>
Date: Fri Jul 17 09:43:31 2015 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/94988f01014d317b55cf3b44ce75261155419abd [^]

Related to issue 30376: M_PriceList_Create removed unreached code
At the beginning of the process an error is raised when v_Costbased = 'N' AND (v_PriceList_Version_Base_ID IS NULL OR v_PriceList_Version_Base_ID='').
In this changeset we delete the code afterwards that would be only executed when the previous condition is true

---
M src-db/database/model/functions/M_PRICELIST_CREATE.xml
---
(0078916)
vmromanos (manager)
2015-07-17 10:06

Code review + testing OK
(0079497)
hudsonbot (developer)
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
(0079498)
hudsonbot (developer)
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
(0079499)
hudsonbot (developer)
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

- Issue History
Date Modified Username Field Change
2015-07-15 18:46 VictorVillar New Issue
2015-07-15 18:46 VictorVillar Assigned To => Triage Finance
2015-07-15 18:46 VictorVillar Modules => Core
2015-07-15 18:46 VictorVillar Resolution time => 1438898400
2015-07-15 18:46 VictorVillar Triggers an Emergency Pack => No
2015-07-15 18:46 VictorVillar Issue Monitored: networkb
2015-07-16 09:01 jpcalvente Issue Monitored: jpcalvente
2015-07-16 09:18 AtulOpenbravo Assigned To Triage Finance => AtulOpenbravo
2015-07-16 09:18 AtulOpenbravo Status new => scheduled
2015-07-17 09:18 AtulOpenbravo Note Added: 0078910
2015-07-17 09:18 AtulOpenbravo Note Edited: 0078910 View Revisions
2015-07-17 10:04 hgbot Checkin
2015-07-17 10:04 hgbot Note Added: 0078913
2015-07-17 10:04 hgbot Status scheduled => resolved
2015-07-17 10:04 hgbot Resolution open => fixed
2015-07-17 10:04 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/116e50e703f6b420f6fc087aa72663d0ede7d1cb [^]
2015-07-17 10:04 hgbot Checkin
2015-07-17 10:04 hgbot Note Added: 0078914
2015-07-17 10:04 hgbot Checkin
2015-07-17 10:04 hgbot Note Added: 0078915
2015-07-17 10:06 vmromanos Review Assigned To => vmromanos
2015-07-17 10:06 vmromanos Note Added: 0078916
2015-07-17 10:06 vmromanos Status resolved => closed
2015-08-20 23:16 hudsonbot Checkin
2015-08-20 23:16 hudsonbot Note Added: 0079497
2015-08-20 23:16 hudsonbot Checkin
2015-08-20 23:16 hudsonbot Note Added: 0079498
2015-08-20 23:16 hudsonbot Checkin
2015-08-20 23:16 hudsonbot Note Added: 0079499


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker