[FIX] sale_project: analytic default plan
issue: When creating a sale order, with a service that involves the creation of a project, with analytic accounting activated, the default analytic account is not the default one set in the settings of the Project app. Steps to reproduce the issue : - activate analytic accounting in the Accounting app. - in the settings of the Project app, set the default analytic plan to any value but the first one. - create a product in the Sale app, with a product type 'Service', that involves the creation of a 'Project'. - create a sale order with the product - go in the analytic accounting menu in Accounting app -> the analytic plan is not the one set by default in the settings of the Project app. closes odoo/odoo#114302 Task: 3169483 X-original-commit: e801b3fa1bbc31713375cc669c6d47b32b175f53 Signed-off-by: Quentin De Paoli <qdp@odoo.com> Signed-off-by: hupo-odoo <hupo@odoo.com>
This commit is contained in:
@@ -163,3 +163,8 @@ class SaleOrder(models.Model):
|
||||
if 'state' in values and values['state'] == 'cancel':
|
||||
self.project_id.sudo().sale_line_id = False
|
||||
return super(SaleOrder, self).write(values)
|
||||
|
||||
def _prepare_analytic_account_data(self, prefix=None):
|
||||
result = super(SaleOrder, self)._prepare_analytic_account_data(prefix=prefix)
|
||||
result['plan_id'] = self.company_id.analytic_plan_id.id or result['plan_id']
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user