Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0023999Openbravo ERP04. Warehouse managementpublic2013-06-05 16:422013-08-01 17:51
VictorVillar 
pramakrishnan 
urgentmajoralways
closedfixed 
5
pi 
3.0MP26 
VictorVillar
Core
No
0023999: Wrong cost calculation for production products under some circunstancies
Wrong cost calculation for production products under some circunstancies, regarding the new costing engine.

Production 1:Movement date: 22 April, Transaction process date: today
 - product A (P+).
 - product B (p-)

Production 2: Movement date: 22 April, Transaction process date: today
 - product B (P+)
 - product C (P-)

Cost calculation of Production 2 is OK, so the transaction cost for product B is OK.
The Starting date of costing record generated for the product B, is 'TODAY', so when the ma_production_cost function, tries to calculate the cost for the transaction of the product A, will search a register in the m_costing table for product B valid from the 22th of April (the movement date) instead the transaction process date.
Production 1:Movement date: 22 April, Transaction process date: today
 - product A (P+).
 - product B (p-)

Production 2: Movement date: 22 April, Transaction process date: today
 - product B (P+)
 - product C (P-)

Cost calculation of Production 2 is OK, so the transaction cost for product B is OK.
The Starting date of costing record generated for the product B, is 'TODAY', so when the ma_production_cost function, tries to calculate the cost for the transaction of the product A, will search a register in the m_costing table for product B valid from the 22th of April (the movement date) instead the transaction process date.
There are two options to solve this issue:

The PL should be split in two parts, the first one for the instances already migrated and the second one for the instances that use the old costing engine.

* Part 1: Instances already migrated
1.- if the v_ProductionDate = MAX(movementdate) variable is only used for costing purposes, 'costing queries'. The solution should be v_ProductionDate = MAX(trxprocessdate), doing a join with the m_transaction table.

2.- if the v_ProductionDate = MAX(movementdate) variable is not used only in 'costing queries', the solution should be add a new variable = MAX(trxprocessdate), doing a join with the m_transaction table in the same query where you define the v_ProductionDate and add the new variable only in the 'costing queries'

*Part2: Instances is not migrated:

Should contain the same function as now.
No tags attached.
Issue History
2013-06-05 16:42VictorVillarNew Issue
2013-06-05 16:42VictorVillarAssigned To => dmiguelez
2013-06-05 16:42VictorVillarModules => Core
2013-06-05 16:42VictorVillarResolution time => 1372629600
2013-06-05 16:42VictorVillarTriggers an Emergency Pack => No
2013-06-05 16:42VictorVillarIssue Monitored: networkb
2013-06-06 16:45dmiguelezAssigned Todmiguelez => jonalegriaesarte
2013-06-24 09:29jonalegriaesarteAssigned Tojonalegriaesarte => ioritzCia
2013-06-25 16:37ioritzCiaStatusnew => scheduled
2013-06-25 16:37ioritzCiafix_in_branch => pi
2013-06-26 12:57ioritzCiaNote Added: 0059678
2013-06-26 12:58hgbotCheckin
2013-06-26 12:58hgbotNote Added: 0059679
2013-06-26 12:58hgbotStatusscheduled => resolved
2013-06-26 12:58hgbotResolutionopen => fixed
2013-06-26 12:58hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/167acdfcb2b04b23b0409279645ebd6f13691952 [^]
2013-06-27 12:56hudsonbotCheckin
2013-06-27 12:56hudsonbotNote Added: 0059703
2013-07-01 17:59hgbotCheckin
2013-07-01 17:59hgbotNote Added: 0059795
2013-07-01 18:05ioritzCiaStatusresolved => new
2013-07-01 18:05ioritzCiaResolutionfixed => open
2013-07-01 18:05ioritzCiaTarget Version3.0MP25 => 3.0MP26
2013-07-01 18:05ioritzCiafix_in_branchpi =>
2013-07-01 18:05ioritzCiaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=4850#r4850
2013-07-02 10:31hudsonbotCheckin
2013-07-02 10:31hudsonbotNote Added: 0059803
2013-07-29 12:04jonalegriaesarteAssigned ToioritzCia => pramakrishnan
2013-07-31 13:28hgbotCheckin
2013-07-31 13:28hgbotNote Added: 0060414
2013-07-31 13:28hgbotStatusnew => resolved
2013-07-31 13:28hgbotResolutionopen => fixed
2013-07-31 13:28hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/devel/pi/rev/167acdfcb2b04b23b0409279645ebd6f13691952 [^] => http://code.openbravo.com/erp/devel/pi/rev/e7559d190d29acfb5d151b1947dfae8f07a4169d [^]
2013-07-31 13:29VictorVillarReview Assigned To => VictorVillar
2013-07-31 13:29VictorVillarNote Added: 0060416
2013-07-31 13:29VictorVillarStatusresolved => closed
2013-08-01 17:51hudsonbotCheckin
2013-08-01 17:51hudsonbotNote Added: 0060460

Notes
(0059678)
ioritzCia   
2013-06-26 12:57   
Testing plan:

- You need three production products. If you have them right, if not:
  - Create three new products.
  - Mark production = 'Y'
  - Imagine A, B and C products.
  - Having the two productions B is going to be P+ and C is going to be P- of the first one. A is going to be P+ and B is going to be P- of the second one. So, we need to initialize the costs of C. We can do this with a Physical Inventory, a Goods Receipt or manually.
- Create a Physical Inventory for C and in the lines initialize it's cost.
- Go to Process Plan window and create one for B and C and another one for A and B as said before.
- Go to Work Requirement window.
  - Create two Work Requirement one for each Process Plan.
  - Process the Work Requirements and create the Work Efforts.
- Go to Production Run window.
  - There are already two created corresponding to the previous Work Requirements.
  - Set for each one the completed quantity.
  - Set for each one the cost center version. (The cost center for this case does not need anything special just create it and name it)
  - Set the movement date previous to the transaction date, so that the cost in of the product B is different for the movement date in comparison to the one for the transaction date.
  - Create the standards.
  - Process the Production Run the production run for product B must be processed before the one for product A.
- Check the Costing tab for products A and B.
  - The last row generated for product A must have in the Net Unit Price column, the same amount of the Cost column for the product B for the row in product B that matches the Transaction Date and not the Movement Date.
(0059679)
hgbot   
2013-06-26 12:58   
Repository: erp/devel/pi
Changeset: 167acdfcb2b04b23b0409279645ebd6f13691952
Author: Ioritz Cia <ioritz.cia <at> openbravo.com>
Date: Tue Jun 25 16:34:37 2013 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/167acdfcb2b04b23b0409279645ebd6f13691952 [^]

Fixes issue 23999: Wrong production cost calculation.

---
M src-db/database/model/functions/MA_PRODUCTION_COST.xml
---
(0059703)
hudsonbot   
2013-06-27 12:56   
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/badcced5427d [^]

Maturity status: Test
(0059795)
hgbot   
2013-07-01 17:59   
Repository: erp/devel/pi
Changeset: c0b047987095c3b7cea09de4e667c44a5a24fec9
Author: Ioritz Cia <ioritz.cia <at> openbravo.com>
Date: Mon Jul 01 17:59:17 2013 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/c0b047987095c3b7cea09de4e667c44a5a24fec9 [^]

Related to issue 23999: Backout of changeset 167acdfcb2b0.

---
M src-db/database/model/functions/MA_PRODUCTION_COST.xml
---
(0059803)
hudsonbot   
2013-07-02 10:31   
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/62f36c5324f7 [^]

Maturity status: Test
(0060414)
hgbot   
2013-07-31 13:28   
Repository: erp/devel/pi
Changeset: e7559d190d29acfb5d151b1947dfae8f07a4169d
Author: Ioritz Cia <ioritz.cia <at> openbravo.com>
Date: Wed Jul 31 13:27:18 2013 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/e7559d190d29acfb5d151b1947dfae8f07a4169d [^]

Fixes issue 23999: Backout of changeset c0b047987095.
The issue is fixed again.

---
M src-db/database/model/functions/MA_PRODUCTION_COST.xml
---
(0060416)
VictorVillar   
2013-07-31 13:29   
verified
(0060460)
hudsonbot   
2013-08-01 17:51   
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/37aeae33b0c0 [^]

Maturity status: Test