Costing Recalculation Project

From iDempiere en

Thread: https://groups.google.com/g/idempiere/c/ghFgs44mPb8/m/WPJ7BzvYEwAJ

What is costing: Costing Costing Main page: Category:Cost accounting

Project: Costing Recalculation Process Implementation

Project Leader: Norbert Bede

Imact: Critical

Project Scope: collect all known issues and experiences with costing, existing contributors solutions, including design and pro/contra perspectives.

Goal: make final design, approval, coding process handle the best of costing recalculation process.

Costing Issues

issue description workaround ideal behaviour priority source
backdated documents the user enter backdated document
Norbert Bede

muriloht

no cost issue Norbert Bede

Contributor solutions

contributor short overview status Contact Xref
BrERP We actually have 2 solutions that we use in different situations.


NOTE: we keep active the Invoice Average costing, that is the best fit for Brazil and we fixed a lot of situations to keep it working with our use cases.


1 - The first one, for less complex situations is a process that can be executed from menu. It recalculates cost amounts (based on in out) and storage qtys, and marks documents for reposting and records a history table of adjustments made for reference purposes. Mainly used when quantities end up being incorrect due to operational problems or even adjustments made to products not respecting the temporal order.


2 - The second, and more complex and less used, we currently do a manual process and only use it when we have a set of errors (incorrect tax settings, ledger accounts, incorrect entries, etc.) that led to a completely incorrect result in accounting and/or costs.

After mapping the entire scenario, with the system under maintenance:


A - Stop the accounting processor

B - Reset the accounting

C - Delete the Cost* records

delete from m_costhistory where ad_client_id=5000008;
delete from m_costdetail where ad_client_id=5000008;
update m_cost set futurecostprice = 0, currentqty =0 , cumulatedqty =0, currentcostprice =0, cumulatedamt = 0 where ad_client_id=5000008;

D - Start the accounting processor and wait (or force) the next run

E - Check for possible errors and proceed with adjustments if necessary

F - Restore the dates of the the newly created entries of cost* tables to respect the date of the documents (this is a need that may not be common, but for us in some tax obligations it is important)

update m_costdetail cd1 set created = (
select
coalesce(co.created, mi.created, ci.created, ml.created, mi2.created, cp.created, mp.created, mc.created)
from
m_costdetail mc
left join c_orderline co on co.c_orderline_id = mc.c_orderline_id
left join m_inoutline mi on mi.m_inoutline_id = mc.m_inoutline_id
left join c_invoiceline ci on ci.c_invoiceline_id = mc.c_invoiceline_id
left join m_movementline ml on ml.m_movementline_id = mc.m_movementline_id
left join m_inventoryline mi2 on mi2.m_inventoryline_id = mc.m_inventoryline_id
left join cp_projectissue cp on cp.c_projectissue_id = mc.c_projectissue_id
left join m_productionline mp on mp.m_productionline_id = mc.m_productionline_id
left join m_product p on p.m_product_id = mc.m_product_id
where cd1.m_costdetail_id = mc.m_costdetail_id )
where ad_client_id=5000008 ;
-- update cost history
update m_costhistory ch set created = (select created from m_costdetail cd where cd.m_costdetail_id = ch.m_costdetail_id) where ad_client_id = 5000008;
update m_costdetail set updated = created where ad_client_id=5000008 ;
update m_costhistory set updated = created where ad_client_id=5000008 ;
production muriloht BrERP
Cloudempiere our solution designed allow run on scheduler server, without any touch-intelligent way found when to re-calculate costing records. we have users with habit backdating and re-activating documents, which make quite huge issue with processing order. in worst case, we can run eg 1 month for all material transactions.

READ MORE in clde-project Page

production Norbert Bede clde-project
INGEINT we created a process for the re-costing, we should have a meeting to review said processes and see how we unify this in a single plugin taking the best practices, ours does not touch any kind of the core. Orlando Curilies inteint-project
Andres Lopez Great idea, I've the same issue and we have a recalculate process to do that, let´s have a meeting! Andres Lopez andreas-project
Frontuari We have also developed through plugins a process that allows recreating costs based on the result of a database view, which orders the transactions, as they were created in the system, additionally tools support to correct traceable errors. I agree to participate in the meeting and contribute ideas. Jorge Colmenarez frontuari-project
Cookies help us deliver our services. By using our services, you agree to our use of cookies.