Commit Graph
2 Commits
Author SHA1 Message Date
Anh Thao Pham (pta) 38fd5f4eb9 [FIX] sale_stock_margin: compute purchase_price from correct company
- Install sale_stock_margin
- In a multi-company environment, create a Product (i.e. Product X)
with a different Cost in each Company
- Switch to Company that is not the main one
- Create a SO with Product X
- Make sure Cost (purchase_price) field is diplayed in Order Lines tab
- Confirm SO
After confirmation, the purchase_price of Product X switches from Cost configured
for current Company to Cost configured for the main Company.

opw-2389741

closes odoo/odoo#62997

X-original-commit: 82106350d3a7b82c6c529ae4ff9a2513ae34518e
Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
2020-12-08 09:57:00 +00:00
Debauche Stéphane f21b696c6e [IMP] sale_stock_margin: improve the margin computation
Before
======
The margin stay unchanged after the validation of the delivery.

After
=====
The margin is updated when the delivery is validated.
To compute the margin for FIFO products, we use the value in the stock valuation layer as ``standard_price``.

e.g.:
    IN 1 product @ 10
    IN 2 product @ 20
    SO 4 products @ 40

    After delivery validation (after stock move creation), the margin is
    (40 * 4 - 10 - 20 - 20 - 20)

Task #2038418

closes odoo/odoo#41381

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-12-10 16:13:29 +00:00