Costing. Average PO
Use case - create - document with 3 products. post it (eg. shipment) - document includes 2 products with proper m_costdetail 1 product with issues.
P1. OK - cost calc has no error
P2. OK - cost calc has no error
P3. ERROR in costing calculation << this line prevent to create costing records for P1, P2 well.
SUMMARY: When document has multiple lines-products and one of them has costing error in posting transaction, then transaction is rolled back and no costing records are created.
This error cause products costing calculation sequence has gaps and prevent to calculate properly. This cause eg. error logs in case of shipments in SEVERE LEVEL: org.adempiere.exceptions.AverageCostingNegativeQtyException
new posting status - costing error. when above scenario happening, then costing records MUST BE created for P1, P2 and not for P3. in this case this new status can be set, and accounting consequence can be created.
REMARK: additionally we recognise the following happens. WHEN posting submitted then new transaction created and start costing methods. when costing cant be calculated then POSTING rolled Back for ALL Products included in transaction. ONLY one solution is we can imagine here - after lot experimenting - SPLIT posting and Costing resp. call 2 methods when costing fall then return back to continue to next costing record product.
To implement this, probably will have to add costing status for each line. The split of posting and costing is very problematic as if there's costing error, you can't be sure that the posting will be correct.