We update the cost price of product after reception using the landed cost on incoming shipments.
On outgoing shipment, we compute a theoretical shipment cost from which we deduced the cost sold. But we should also allow to update the shipment cost using the actual invoice of the carrier (or any other services). This will give retrospectively more accurate margin reports.
On a new module
account_shipment_cost, we add a document
account.shipment_cost which is similar to
account.landed_cost but for shipment cost. The available shipment to select are the outgoing and the drop shipments. And the invoice lines available for this document are those for product with the
shipment_cost flag checked.
On posting the amount of the invoice lines are allocated to each shipment by updating or added the
cost field and the
set_shipment_cost is called. The field is updated if there are no other
account.shipment_cost posted on the shipment otherwise it is added.