Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0045164Openbravo ERP05. Production managementpublic2020-09-30 16:362020-10-26 16:11
Leyre 
inigo_lerga 
normalmajoralways
closedfixed 
5
 
PR21Q1 
Core
No
0045164: The cost of a salary category and machine defined for the future is taken into account in a work effort
When a salary category or machine has an assigned cost with a date higher than the current one, the database function = "MA_PRODUCTION_COST" returns the assigned cost wrong, because it should be the one with a higher date but always below of the current date.

However, the function returns the one with a higher date.
Create two products: "consumed" and "produced"
Set them as production
Set a storage bin for "produced" product in Product - Manufacturing tab
Set a cost of 1 for "consumed" product in Product - Costing tab
Increase the stock of the "consumed" one (you can use a physical inventory)

Create a Salary Category
Set a Cost to it:
   Cost: 1000
   Cost UOM: per Produced Units
   Starting date: today
Create a Machine:
Set a Cost to it:
   Cost: 1000
   Cost UOM: per Produced Units
   Starting date: a date in the future (06-10-2021)
Create a Manufacting Cost Center and version (valid from today)
Add the Machine to it
Add the Salary Category to it
Go to Salary category and change its Cost starting date to a date in the future (06-10-2021)
Create an Activity and assign the previously created cost center
Create a Process Plan, Version and Operation
Assign the previously created Activity to the Operation
Set a Cost Center Use time
Select Create Standards
Add in I/O products tab the "consumed" product as Product use (P-) and the "produced" product as Product Production (P+)
Create a Work Requirement
Assign the previously created Process Plan
Process it

Create Work Effort
Go to Work Effort and assign the Cost Center Version, Salary Category and Machine
Validate it

Launch the costing background process and check the cost of the salary category and machine has been taken into account for cost calculation and they shouldn't as they are not valid in the current date
Please, see attached file MA_PRODUCTION_COST.diff
No tags attached.
diff MA_PRODUCTION_COST.diff (3,422) 2020-09-30 16:36
https://issues.openbravo.com/file_download.php?file_id=15001&type=bug
png Before-Fix.png (94,335) 2020-10-20 10:25
https://issues.openbravo.com/file_download.php?file_id=15033&type=bug
png

png After-Fix.png (91,866) 2020-10-20 10:25
https://issues.openbravo.com/file_download.php?file_id=15034&type=bug
png
Issue History
2020-09-30 16:36LeyreNew Issue
2020-09-30 16:36LeyreAssigned To => Triage Finance
2020-09-30 16:36LeyreFile Added: MA_PRODUCTION_COST.diff
2020-09-30 16:36LeyreModules => Core
2020-09-30 16:36LeyreResolution time => 1603231200
2020-09-30 16:36LeyreTriggers an Emergency Pack => No
2020-09-30 16:59LeyreSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=21762#r21762
2020-10-01 11:04inigo_lergaAssigned ToTriage Finance => inigo_lerga
2020-10-01 11:04inigo_lergaStatusnew => scheduled
2020-10-01 14:02hgbotNote Added: 0123480
2020-10-05 12:20inigo_lergaNote Added: 0123530
2020-10-05 12:20inigo_lergaStatusscheduled => feedback
2020-10-06 17:57ngarciaStatusfeedback => scheduled
2020-10-06 17:57ngarciaSummaryCost calculation => The cost of a salary category and machine defined for the future is taken into account in a work effort
2020-10-06 17:57ngarciaDescription Updatedbug_revision_view_page.php?rev_id=21768#r21768
2020-10-06 17:57ngarciaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=21769#r21769
2020-10-09 10:59ngarciaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=21773#r21773
2020-10-12 12:52PracticsIssue Monitored: Practics
2020-10-20 10:25inigo_lergaNote Added: 0123795
2020-10-20 10:25inigo_lergaFile Added: Before-Fix.png
2020-10-20 10:25inigo_lergaFile Added: After-Fix.png
2020-10-20 10:26inigo_lergaNote Edited: 0123795bug_revision_view_page.php?bugnote_id=0123795#r21810
2020-10-26 16:11hgbotResolutionopen => fixed
2020-10-26 16:11hgbotStatusscheduled => closed
2020-10-26 16:11hgbotNote Added: 0123944
2020-10-26 16:11hgbotFixed in Version => PR21Q1
2020-10-26 16:11hgbotNote Added: 0123945
2020-10-26 16:11hgbotNote Added: 0123946

Notes
(0123480)
hgbot   
2020-10-01 14:02   
Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/186 [^]
(0123530)
inigo_lerga   
2020-10-05 12:20   
Please attach new proper detailed steps to reproduce this Issue.
(0123795)
inigo_lerga   
2020-10-20 10:25   
(edited on: 2020-10-20 10:26)
--Test Plan Mantis--
Beforehand, in Preference window, 'Show MRP and Production Fileds' property
must be set to 'Y'.
Openbravo Instance must be activated.
Also, use 'F&B España, S.A' as Organization for all records created.

As the F&B International Group Admin role in Backend:
1º- Go to Process Request window and Unschedule the Costing Background Process.
    Open the record and set the Timing field to 'Run Immediately'

2º- Go to Product window and create a new record with 'CONSUMED' as
    Search Key and Name.
    Check the Production checkbox.
3º- Go to Costing tab and create a new record with Cost Type 'Standard'
    and 1 as Cost.
    Set '01-01-2020' as Starting Date and '06-10-2023' as Ending Date.

4º- Go to Product window and create a new record with 'PRODUCED' as
    Search Key and Name.
    Check the Production checkbox.
5º- Go to Manufacturing tab and create a new record with 'RN-2-0-0' as
    Storage Bin.

6º- Go to Physical Inventory window and create a new record.
7º- Go to Lines tab and create a new Line with 'CONSUMED' as Product,
    'RN-2-0-0' as Storage Bin and 50000 as Quantity Count.
8º- Process the Physical Inventory.

9º- Go to Salary Category window and create a new record with
    'SALARY CATEGORY TEST' as Name.
10º- Go to Cost tab and create a new record with 1000 as Cost, 'per Produced Units'
    as Cost UOM and Today as Starting Date.

11º- Go to Machine window and create a new record with 'MACHINE TEST' as
    Search Key and Name.
12º- Go to Cost tab and create a new record with 1000 as Cost, 'per Produced Units'
    as Cost UOM and '06-10-2021' as Valid From Date.

13º- Go to Manufacturing Cost Center window and create a new record with
    'MANUFACTURING COST CENTER TEST' as Search Key and Name.
14º- Go to Version tab and create a new line with Today as Valid From Date field.
15º- Go to Machine subtab and create a new record with 'MACHINE TEST' in Machine field.
16º- Go to Employee subtab and create a new record with 'SALARY CATEGORY TEST'
    as Salary Category and 1 as Quantity.

17º- Go back to Salary Category window and edit the Starting Date in Cost tab of
    previously created Salary Category.
    Set the Starting Date to '06-10-2021'.

18º- Go to Activity window and create a new record with 'ACTIVITY TEST' as
    Search Key and Name.
    Set 'MANUFACTURING COST CENTER TEST' as Cost Center.

19º- Go to Process Plan window and create a new record with 'PROCESS PLAN TEST' as
    Search Key and Name.
20º- Go to Version tab and create a new line with '01-01-2020' as Starting Date
    and '06-10-2023' as Ending Date.
21º- Go to Operation subtab and create a new record with 'OPERATION TEST' as
    Search Key and Name.
    Set previously created 'ACTIVITY TEST' as Activity.
    Set 5 as Cost Center Use Time.
    Check Create Standards checkbox.
22º- Go to I/O Products subtab and create a new record with 'CONSUMED' as Product
    with 'Product use (P-)' as Production Type and 1 as Quantity.
23º- Create another I/O Products record for 'PRODUCED' product and 'Product Production (P+)'
    as Production Type, with 1 as Quantity.

24º- Go to Work Requirement window and create a new record with 'PROCESS PLAN TEST' as
    Process Plan, '01-01-2020' as Starting Date, '06-10-2023' as Ending Date and 1 as
    Quantity.
    Process Work Requirement.

25º- Go to Work Effort window and create a new record with '8:00:00' as Starting Time
    and '21:00:00' as Ending Time.
26º- Go to Production Run tab and create a new line with previous created Work Requirement
    as WR Phase and 10 as Completed Quantity.
    Set previously created 'MANUFACTURING COST CENTER TEST' as Cost Center Version.
27º- Go to Salary Category subtab and create a new line with 'SALARY CATEGORY TEST' as Salary Category,
    with 1 as Quantity and 1 as Run Time.
28º- Go to Machine subtab and create a new line with 'MACHINE TEST' as Machine.
29º- Go back to Production Run tab and press the Create Standards button.
30º- Validate the Work Effort

31º- Go back to Process Request window and Reschedule the Costing Background Process.

#If you go now to Production Cost Report window and use dates such as 1 month before now
as From Date and 1 month after today as To Date, you can see that now MACHINE TEST's and
SALARY CATEGORY TEST's Real Cost is not taken into account.
Images attached of result before and after the fix for this Issue#

(0123944)
hgbot   
2020-10-26 16:11   
Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/186 [^]
(0123945)
hgbot   
2020-10-26 16:11   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: fcf5117f6f85c4b52a92476b5840d8d605093bbd
Author: inigo_lerga <inigo.lerga@openbravo.com>
Date: 2020-10-26T10:24:57+01:00
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/fcf5117f6f85c4b52a92476b5840d8d605093bbd [^]

fixes BUG-45164:Proper date considered in query

Now the function returns the proper assigned cost with
highest date but bellow the current date. Before, the
highest date would be picked with no consideration
for current date.

---
M src-db/database/model/functions/MA_PRODUCTION_COST.xml
---
(0123946)
hgbot   
2020-10-26 16:11   
Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: 157305ea94b5703e76ae62dca8fa618323d861fb
Author: inigo_lerga <inigo.lerga@openbravo.com>
Date: 2020-10-26T12:49:03+01:00
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/157305ea94b5703e76ae62dca8fa618323d861fb [^]

related to ISSUE-45164: Correction in query proper date

---
M src-db/database/model/functions/MA_PRODUCTION_COST.xml
---