David (dafr) 67260ed60e [FIX] purchase_stock: compute amount_currency from balance for valuation lines
Previously, 'amount_currency' was calculated using data from the purchase line. However, numerous variables could interfere with the accurate computation of 'purchase_price_unit' (e.g., taxes, taxes without account, standard costing method, kit product, and potentially more).

This commit revises the approach by utilizing the pre-calculated value and converting it to the desired currency. This maintains coherence between the balance and 'amount_currency' without necessitating the recreation of a function like '_get_price_unit()' in 'purchase_stock.'

## Reproduce Errors ##

### Tax Included in price without Account:
- Create a currency, CTest, with a conversion factor of 10 (10 CTest = 1 USD).
- Define a new tax:
  ° No accounts in repartition lines
  ° Rate: 15%
  ° Included in the price
- Create a Purchase Order:
  ° 1 unit | 100 CTest | Tax applied
- Receive the product.
-> SVL value is 10 USD, because tax without account increments the stock value. Refer to 'test_valuation_multicurrency_with_tax'.
-> Check SVL journal entry: credit / debit is 10, but amount currency is 86.96 CTest instead of 100 CTest.

### Reproduce With Kit:
- Create a currency, CTest, with a conversion factor of 10 (10 CTest = 1 USD).
- Create a Kit (storable, fifo), with 5 unit of CPM (storable fifo) in it's BoM
- Create a Purchase Order:
  ° Kit: 1 unit | 100 CTest
- Receive product
-> Check SVL journal entry: credit / debit is 10, but amount currency is 500 CTest instead of 100 CTest.

OPW-3453703

closes odoo/odoo#143033

X-original-commit: 5ea188fb65507d4bd06ab3361241d121ac2a468b
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: David Fesquet (dafr) <dafr@odoo.com>
2023-11-22 11:44:48 +00:00
2023-10-27 08:36:16 +00:00
2023-11-02 21:02:44 +00:00
2023-11-20 04:58:31 +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%