Skip to content
Snippets Groups Projects
Commit 3a6561dc authored by Yolann Sabaux's avatar Yolann Sabaux
Browse files

[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: default avatarWilliam André (wan) <wan@odoo.com>
parent 421ee12a
Branches
Tags
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment