Adrien Widart db95421c7d [FIX] sale_stock_margin: use data of SOL's company
In a multi-company and multi-currency environment, the computation of
the purchase price may be based on the incorrect company (and thus lead
to incorrect results)

To reproduce the issue:
(Use demo data)
1. In Settings:
    - Enable "Multi-Currencies"
2. Update "My Company (Chicago)":
    - Currency: EUR
3. Edit currencies' rate for all companies(!):
    - USD: 1.0
    - EUR: 3.0
4. Create a product category PC:
    - Costing Method: FIFO
5. Create a product P:
    - Type: Storable
    - Category: PC
6. Switch to "My Company (Chicago)"
    - Note that in this company, the costing method of PC is "Standard
Price"
7. Edit P:
    - Cost: 10
8. Create a sale order SO:
    - Pricelist: EUR
    - Lines (add Cost columns):
        - 1 x P (Note that cost is 10€)
9. Confirm SO

Error: The sale order line is incorrect, the cost is now 30€. A rate
conversion has been applied on the amount

In `_compute_purchase_price`, several fields/methods depend on the SOL's
company: `property_cost_method`, `_compute_average_price`,
`cost_currency_id`. Therefore, we should include this specific company
in the environment of the product

OPW-2659265

closes odoo/odoo#79430

X-original-commit: 868142c3885f7bf65a7974066234feb0eb6241ae
Signed-off-by: Steve Van Essche <svs@odoo.com>
Signed-off-by: Adrien Widart <awt@odoo.com>
2021-11-08 07:59:42 +00:00
2021-10-21 19:09:48 +00:00
2021-10-21 19:09:48 +00:00
…
…
…
…
2021-11-04 10:21:58 +00:00
2021-10-21 19:09:48 +00:00
2021-10-07 17:59:53 +00:00
2021-10-21 19:09:48 +00:00
2021-10-21 19:09:48 +00:00

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%