details: https://code.openbravo.com/erp/devel/pi/rev/4949275527c9
changeset: 33548:4949275527c9
user: David Miguelez <david.miguelez <at> openbravo.com>
date: Fri Feb 23 08:45:53 2018 +0100
summary: Fixes issue 37850: Stock Valuation of 0 in Product - Unit Cost tab
if product is
received in a warehouse created after unit cost is calculated
When a new transaction increase the product stock in a warehouse and doesn't
exist
a stock valuation record to this warehouse the M_Transaction_Cost trigger can't
set the valuation cost because the stock is 0.
The flush to M_Transaction when the cost is calculated trigger the
M_Update_Stock_Valuation
with the correct stock quantity and then the M_Transaction_Cost trigger can set
the
valuation cost to the Stock Valuation created in the M_Transaction trigger.
diffstat:
src/org/openbravo/costing/CostingServer.java | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diffs (19 lines):
diff -r c4ccb5d59890 -r 4949275527c9
src/org/openbravo/costing/CostingServer.java
--- a/src/org/openbravo/costing/CostingServer.java Thu Feb 22 17:13:18
2018 +0000
+++ b/src/org/openbravo/costing/CostingServer.java Fri Feb 23 08:45:53
2018 +0100
@@ -121,9 +121,15 @@
transaction.setCurrency(currency);
transaction.setCostCalculated(true);
transaction.setCostingStatus("CC");
+ // Flush the changes in the Transaction to fire the Triggers in the
database before creating
+ // the TransactionCost. If not done here, the Trigger for the
TransactionCost will be
+ // launched before the one in the Transaction generating wrong data in
some tables
+ OBDal.getInstance().flush();
// insert on m_transaction_cost
createTransactionCost();
updateLastTransaction();
+ // Flush the changes in the TransactionCost and in the Transaction to
fire the Triggers in
+ // the database before doing Cost Adjustments
OBDal.getInstance().flush();
setNotPostedTransaction();
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits