Modify "Update Costing" process to create a cost adjustment document

Description

None

Environment

A core enhancement to modify the "Update Costing" process (Import Inventory) to create a cost adjustment document.

Activity

Show:
Hiep Lq
September 9, 2014, 7:03 AM

by investigate code, i see something strange, i want confirm.

example we have import data as below
line 1: product p_phy_1, doc type is physical inventory
line 2: product p_phy_2, doc type is physical inventory
line 3: product p_Adj_1, doc type is Cost Adjustment
line 4: product p_Adj_2, doc type is Cost Adjustment

when we run import inventory process. with parameter "Update Costing" = true
below is current step of idempiere.

with each import record:
1. make a inventory document with type = type of import record. call save it.
2. make a inventory_line for this inventory doc. call save it.
3. check if "Update Costing" = true
3-1. make instance inventory document object (it's mean just a inventory document for all import record) with
"Costing Method" get from process parameter
"doc type" get from process parameter (current just "Cost Adjustment")
3-2. make a inventory line, set new cost from i_inventory.current code (because each import record will has a inventory line for inventory doc make at 3-1)
==================================
My confirm

1. when import line 3, 4 encounter error: "FillMandatory: New Cost Price"
2. with line3, line4, not need run step 3-2? true?
1 + 2 => with line3,4 not need run stem 3-2, but change code at step 2 to set newcost value.
3. a adjust cost inventory document for all record (exclude record 3,4) is suiltable or
each import record should have a adjust cost inventory document

==================================
work-around:
split data two file
1 contain adjust cost type, import it without "Update Costing" is tick, because it's "Update Costing" document
2 contain other record, with this file, run with "Update Costing" if you wish "update cost "

Deepak Pansheriya
November 6, 2014, 8:05 AM

Carlos,

For resolving initial cost import with inventory in case of new new Tenant setup, I suggest we should let have old code works when cost adjustment document type is not selected. And when document type is selected, we should create cost adjustment instead.

If you are agree on that, I can fix and send patch.

With Regards,
--Deepak

Deepak Pansheriya
November 6, 2014, 2:01 PM

Carlos,

Created pull request https://bitbucket.org/idempiere/idempiere/pull-request/94/idempiere-2057-enabling-import-for-initial/diff

I have following 2 changes in this request
1. For initial inventory with cost import, currently there is no way to get correct cost.
So added code where if you do not select cost adjustment document type, then it use old code for importing cost and create cost record.
2. When there is mandatory ASI, Costing line save was failing due to missing ASI.

Please accept patch and let me know if you need any clarification.

With Regards
--Deepak Pansheriya

Carlos Ruiz
November 7, 2014, 2:13 AM

I attached a patch for

Bringing the note to discuss here:
NOTE: In my latest tests with this patch the two documents can be completed (Physical Inventory and Cost Adjustment) but none can be posted - I think this is what's being discussed in

Seems like a catch-22 situation:

  • Physical Inventory cannot post because no costs -> "No Costs for ..."

  • Cost Adjustment which is initially intended to create the cost cannot post because no qty "AverageCostingZeroQtyException ..."

Must Physical Inventory be posted in conjunction with the Cost Adjustment (as a pair of related documents)?

Carlos Ruiz
November 10, 2014, 8:46 PM

Hi

I'm attaching a patch file IDEMPIERE-2057_CR.patch

With this patch, combined with the patch for I was able to complete and post the inventory documents.

Note, the patch on allows to complete the import documents (a physical inventory and a cost adjustment)

With the patch attached here I was able to post - firstly the Cost Adjustment document - which doesn't really post anything but creates the initial cost detail record required for the physical inventory to post.

WDYT?

Regards,

Carlos Ruiz

Fixed

Assignee

Heng Sin Low

Reporter

Carlos Ruiz

Labels

None

Tested By

None

Priority

Major