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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0058052
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] 04. Warehouse managementmajoralways2025-02-21 14:482025-03-25 10:15
ReportermalsasuaView Statuspublic 
Assigned ToSandrahuguet 
PriorityhighResolutionfixedFixed in VersionPR25Q2
StatusclosedFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Merge Request Statusapproved
Review Assigned ToAtulOpenbravo
OBNetwork customerOBPS
Web browser
ModulesCore
Support ticket121225
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0058052: Wrong cost amount with backdated transactions

DescriptionWith"backdated transactions" feature enabled, the query that calculates the accumulated stock does not take this feature into account and does not sort by "transaction date" first. This results in incorrect accumulated stock on days when backdated transactions are processed.
Steps To Reproduce. backdated transactions enabled
. trx1 - trxProcessDate 20/05/2024 07:00:00 - movementdate 19/05/2024 - qty +3
. trx3 - trxProcessDate 20/05/2024 07:30:00 - movementdate 19/05/2024 - qty +4
. trx2 - trxProcessDate 20/05/2024 07:15:00 - movementdate 20/05/2024 - qty -3

the trx2 is processed after trx1 - reducing the stock
the trx3 is processed after trx2, but with date 19/05/2025 , butg in this moment, the acumulated stock should not take the trx2

More detail in
https://docs.google.com/document/d/1j17OLSgMQs3lzpXTvlwoCSrC_zD2joCa8wOmfAkxjZc/edit?usp=sharing [^]
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
related to defect 0058297 newTriage Omni WMS Modules MovementDate should be truncate 

-  Notes
(0176203)
mtaal (viewer)
2025-02-27 10:23

We discussed internally and backdated transactions are not supported with the accumulated stock. This was stated from the start of the development.

To support backdating the accumulated stock has to be removed and recomputed from the backdated date.
(0176787)
egoitz (viewer)
2025-03-13 12:22

Ticket reopened after internall discussion
(0177029)
hgbot (developer)
2025-03-20 14:11

Merge Request created: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/openbravo/-/merge_requests/1601 [^]
(0177030)
Sandrahuguet (viewer)
2025-03-20 14:44
edited on: 2025-03-25 09:45

Test Plan:
In F&B Client
-Go to Costing Rule and activate backdated transactions (Fix backdated transactions button) Use Today's date as the input value in the popup.
-Go to product tab and create a new product add a price in be soft drinker price list and in general sales price list. Set price as 10.
- Add a costing record with date as today cost = 10.
-Create a physical inventory for this product qty 100 and date today
-Create a goods shipment for 10 units date as today and product created in previous step
-Create a goods receipt date as today and product with 50 units created in previous step
-Create a goods receipt date as tomorrow and product with 75 units created in previous step
-Create a goods shipment date as tomorrow and product with 15 units created in previous step (in the database update the movementdate in m_transaction with any hour,min,sec) for example: 2025-03-25 16:43:22
-Create a goods receipt date as tomorrow and product with 25 units created in previous step
-Create a goods receipt date as day after tomorrow and product with 35 units created in previous step
-Launch the costing background


Use the product id in the below query

select t.movementtype, t.movementqty, t.trxprocessdate, t.movementdate, tcost.cost
  , sum(t.movementqty) over (order by trunc(t.movementdate), trxprocessdate asc, rl.seqno, movementqty desc, t.m_transaction_id asc) as realstock
  , sum(t.movementqty) over (order by trxprocessdate asc, rl.seqno, movementqty desc, t.m_transaction_id asc) as realstock2
  , sum(tcost.cost) OVER (order by trunc(t.movementdate), trxprocessdate asc, rl.seqno, movementqty desc, t.m_transaction_id asc) as realcumcost
  , ROUND(CASE WHEN sum(t.movementqty) OVER (order by trunc(t.movementdate), trxprocessdate asc, rl.seqno, movementqty desc, t.m_transaction_id asc) = 0 THEN 0 ELSE sum(tcost.cost) OVER (order by trunc(t.movementdate), trxprocessdate asc, rl.seqno, movementqty desc, t.m_transaction_id asc)/sum(t.movementqty) OVER (order by trunc(t.movementdate), trxprocessdate asc, rl.seqno, movementqty desc, t.m_transaction_id asc) END, 6) AS realavg
  , ' ' as blank
  , c.datefrom, c.dateto, c.ismanual, c.qty, c.price, c.cost, c.cumstock, c.cumcost, c.originalcost
  , sum(t.movementqty) OVER (order by trunc(t.movementdate), trxprocessdate asc, rl.seqno, movementqty desc, t.m_transaction_id asc) - c.cumstock as stockdiff
  , t.m_transaction_id
from m_transaction t
  left join m_costing c on t.m_transaction_id = c.m_transaction_id
  left join (select sum(tc.cost)*sign(tct.movementqty) as cost, tc.m_transaction_id
             from m_transaction_cost tc
               join m_transaction tct on tc.m_transaction_id = tct.m_transaction_id
             where tct.m_product_id = '689293E13F6B4DBDB835AB3506CC6876'
       -- and tct.m_locator_id in ('BCDE2DA62BD048869B1899590E8E0484', '8D1543D981594A56891E4BC21472A88F')
             group by tc.m_transaction_id, tct.movementqty) as tcost on tcost.m_transaction_id = t.m_transaction_id
  join ad_ref_list rl on t.movementtype = rl.value and rl.ad_reference_id = '189'
where t.m_product_id = '689293E13F6B4DBDB835AB3506CC6876'
-- and t.m_locator_id in ('BCDE2DA62BD048869B1899590E8E0484', '8D1543D981594A56891E4BC21472A88F')
group by t.m_transaction_id, tcost.cost, c.m_costing_id, rl.seqno
order by trunc(t.movementdate), trxprocessdate asc, rl.seqno, movementqty desc, t.m_transaction_id asc;

- Check that cumulative stock is correct i.e 260 and cumulative cost is 2600.

(0177204)
hgbot (developer)
2025-03-25 10:15

Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/openbravo [^]
Changeset: af439d33188bc50e360af3cac7638b917808f1e3
Author: Sandra Huguet <s.huguet@orisha.com>
Date: 25-03-2025 13:47:19
URL: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/openbravo/-/commit/af439d33188bc50e360af3cac7638b917808f1e3 [^]

Fixed ISSUE-58052 truncate movementDate in order to calculate correct the accumulated cost

---
M src/org/openbravo/costing/AverageCostAdjustment.java
M src/org/openbravo/costing/CostingUtils.java
---
(0177205)
hgbot (developer)
2025-03-25 10:15

Merge request merged: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/openbravo/-/merge_requests/1601 [^]

- Issue History
Date Modified Username Field Change
2025-02-21 14:48 malsasua New Issue
2025-02-21 14:48 malsasua Assigned To => Triage Omni WMS
2025-02-21 14:48 malsasua OBNetwork customer => OBPS
2025-02-21 14:48 malsasua Modules => Core
2025-02-21 14:48 malsasua Support ticket => 121225
2025-02-21 14:48 malsasua Triggers an Emergency Pack => No
2025-02-21 16:44 Practics Issue Monitored: Practics
2025-02-27 10:23 mtaal Review Assigned To => mtaal
2025-02-27 10:23 mtaal Note Added: 0176203
2025-02-27 10:23 mtaal Status new => closed
2025-03-13 12:22 egoitz Note Added: 0176787
2025-03-13 12:22 egoitz Status closed => new
2025-03-19 19:20 aferraz Assigned To Triage Omni WMS => Sandrahuguet
2025-03-20 14:04 Sandrahuguet Relationship added related to 0058297
2025-03-20 14:11 hgbot Merge Request Status => open
2025-03-20 14:11 hgbot Note Added: 0177029
2025-03-20 14:44 Sandrahuguet Note Added: 0177030
2025-03-21 12:30 Sandrahuguet Note Edited: 0177030 View Revisions
2025-03-21 12:31 Sandrahuguet Note Edited: 0177030 View Revisions
2025-03-24 12:41 AtulOpenbravo Status new => scheduled
2025-03-24 12:41 AtulOpenbravo Review Assigned To mtaal => AtulOpenbravo
2025-03-25 09:45 AtulOpenbravo Note Edited: 0177030 View Revisions
2025-03-25 09:45 AtulOpenbravo Note Edited: 0177030 View Revisions
2025-03-25 09:46 hgbot Merge Request Status open => approved
2025-03-25 10:15 hgbot Resolution open => fixed
2025-03-25 10:15 hgbot Status scheduled => closed
2025-03-25 10:15 hgbot Fixed in Version => PR25Q2
2025-03-25 10:15 hgbot Note Added: 0177204
2025-03-25 10:15 hgbot Note Added: 0177205


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker