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

[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: default avatarLaurent Smet <las@odoo.com>
parent c36457f8
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment