[FIX] sale_,(project): set default analytic account and analytic tags in task

Currently, the project's analytic account and analytic tags are not set by
default in the task. Now it will be fixed.

 Steps to reproduce:
    1. Install project
    2. Activate the analytic account and analytic tags in the user setting
    3. Create a project with analytic account and analytic tags
    4. Create a task from the kanban view
    5. Check the analytic account and analytic tags in the task

 Steps to reproduce:
    1. Install sale_project
    2. Activate the analytic account and analytic tags in the user setting
    3. Create a project with analytic account and analytic tags
    4. Create a product (Create on Order = task)
    5. Create a sale order and confirm
    6. Check the analytic account and analytic tags in the task

task-2930761

closes odoo/odoo#97455

X-original-commit: 0a5bc153cf682b29b1c86ac966d8164bd41acbdb
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
This commit is contained in:
Kartik Chavda
2022-08-05 03:38:14 +02:00
parent 4dc5d76c8d
commit 7517bf46d4
@@ -197,6 +197,8 @@ class SaleOrderLine(models.Model):
description = '<br/>'.join(sale_line_name_parts[1:])
return {
'name': title if project.sale_line_id else '%s - %s' % (self.order_id.name or '', title),
'analytic_account_id': project.analytic_account_id.id,
'analytic_tag_ids': [Command.set(project.analytic_tag_ids.ids)],
'planned_hours': planned_hours,
'partner_id': self.order_id.partner_id.id,
'email_from': self.order_id.partner_id.email,