Production costs are wrongly calculated. It is a case when the FIFO cost method
is used for input products. It takes the cost of product instead of values of
actual stock moves used in production.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items
...
Show closed items
Linked items
0
Link issues together to show that they're related.
Learn more.
After production is "run", the cost price becomes correct, but it is not
transferred to production.outputs cost.
This results to the exception when trying to "done" the production: Production
"x" misses costs on some of its outputs.
The same method like in Production.explode_bom, just only using input.cost_price
instead of input.product.cost_price.
In addition, the cost allocation could be splitted out from
Production.explode_bom into the new method and re-used twice. First time - in
(or after) Production.explode_bom, second - in Production.run()
To implement a simple allocation, I suggest to add these fields to BOM.output:
* Allocation type: Selection(['fixed', 'multiplier'])
* Cost price: Decimal, visible when type == 'fixed'
* Multiplier: Float, visible when type == 'multiplier'
Then for allocation type == 'multiplier', production.output.cost_price =
(production.cost - all_fixed) * ratio / BOM.output.quantity
Where all_fixed = sum(for all fixed outputs)
And ratio = BOM.output.multiplier / sum(for all BOM output multipliers)
I propose to add on the bom outputs a distribution factor of the cost.
So the production will be able to distribute the cost automatically.
This will allow to apply the same design as #8795 (closed) to recompute the production cost after the production is done (with user intervention).
I forgot the case if there is no BOM on the production.
Indeed there are standardized methods [1] to allocate cost to by-product.
So the new proposal is to allocate the cost based on the list price of each products (and ignore products without list price).