-
- Downloads
[FIX] purchase: update analytic account on change of the line
Steps to reproduce: - create two products - create two analytic accounts - create two new analytic rules by assigning an account to a product - Create a new PO and select on of the product - On the same line, change the product to the other one Issue: - The analytic account won't be updated Cause: Bypass of the `account_analytic_id` whenever there is already on defined Solution: For the `Sale` fix, I added the `line.state == 'draft'`. The reason? Because the compute is triggered after confirmation of the order due to: https://github.com/odoo/odoo/blob/14.0/addons/sale/models/sale.py#L931-L935 Therefore, the compute won't also be triggered after confirmation of the SO. opw-2948950 closes odoo/odoo#98151 Signed-off-by:William André (wan) <wan@odoo.com>
Showing
- addons/purchase/models/purchase.py 2 additions, 2 deletionsaddons/purchase/models/purchase.py
- addons/purchase/tests/test_purchase_invoice.py 43 additions, 0 deletionsaddons/purchase/tests/test_purchase_invoice.py
- addons/sale/models/sale.py 1 addition, 1 deletionaddons/sale/models/sale.py
- addons/sale/tests/test_sale_order.py 50 additions, 0 deletionsaddons/sale/tests/test_sale_order.py
Loading
Please register or sign in to comment