-
- Downloads
[FIX] sale, sale_project: correct analytic tag set from SO to INV
Steps to reproduce: - Create default analytic rule with (account, tags; conditions: set a product and the account `400000 Product Sales`) - create a sale order with product - create an invoice from the sale order Issue: There won't be any tag set for the account_move_line Cause: In analytic_default rules we use fields available differently according to the scope: Fields sale_order account_move product_id V V date_start V V end_start V V company_id V V partner_id V V user_id V V account_id X V So the rule created earlier won't be found from the sale order because we don't provide an account_id in https://github.com/odoo/odoo/blob/15.0/addons/sale/models/sale_order_line.py#L525-L531 And since the field `analytic_tag_ids` is stored, it won't be computed during the creation of the invoice since it is already set (to `[]`). Solution: Set the analytic_tag_ids during the conversion from a so to an invoice only if there is a rule for the so_line. Note: The change made in sale_project is to avoid getting a key that, in certain situation, does not exist anymore. opw-3069382 closes odoo/odoo#107295 Signed-off-by:Laurent Smet <las@odoo.com>
Showing
- addons/sale/models/sale_order_line.py 2 additions, 1 deletionaddons/sale/models/sale_order_line.py
- addons/sale/tests/test_sale_to_invoice.py 80 additions, 0 deletionsaddons/sale/tests/test_sale_to_invoice.py
- addons/sale_project/models/sale_order.py 5 additions, 4 deletionsaddons/sale_project/models/sale_order.py
Loading
Please register or sign in to comment