From c348d596a68f75eb1a97bec98e7ea0380cccb8a6 Mon Sep 17 00:00:00 2001 From: "Xavier BOL (xbo)" Date: Tue, 12 Oct 2021 16:27:00 +0000 Subject: [PATCH] [FIX] sale_timesheet: ensure product is a service one for timesheets Before this commit, since the adding of new field in `product.template` model called `detailed_type` to define the detailed type of a product. We need to update some domains to select a correct timesheet product. That is, the timesheet product must be a service product and not an event or event booth product. This commit updates the domains in those fields: - `timesheet_product_id` field defined in project (`project.project`). - `sale_line_id` field defined in the `project.create.sale.order` model. to be sure we select a service product (or SOL with service product linked) for timesheets. task-2642872 closes #79034 X-original-commit: b60bc724c197f101d71109d7b8fcdfe7cdc5b57a Part-of: odoo/odoo#79291 --- addons/sale_timesheet/models/project.py | 2 +- addons/sale_timesheet/wizard/project_create_sale_order.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/sale_timesheet/models/project.py b/addons/sale_timesheet/models/project.py index ce1286b546c..0d070e6d9fc 100644 --- a/addons/sale_timesheet/models/project.py +++ b/addons/sale_timesheet/models/project.py @@ -45,7 +45,7 @@ class Project(models.Model): timesheet_product_id = fields.Many2one( 'product.product', string='Timesheet Product', domain="""[ - ('type', '=', 'service'), + ('detailed_type', '=', 'service'), ('invoice_policy', '=', 'delivery'), ('service_type', '=', 'timesheet'), '|', ('company_id', '=', False), ('company_id', '=', company_id)]""", diff --git a/addons/sale_timesheet/wizard/project_create_sale_order.py b/addons/sale_timesheet/wizard/project_create_sale_order.py index f85807e0729..82f36387ea5 100644 --- a/addons/sale_timesheet/wizard/project_create_sale_order.py +++ b/addons/sale_timesheet/wizard/project_create_sale_order.py @@ -257,7 +257,7 @@ class ProjectCreateSalesOrderLine(models.TransientModel): _order = 'id,create_date' wizard_id = fields.Many2one('project.create.sale.order', required=True) - product_id = fields.Many2one('product.product', domain=[('type', '=', 'service'), ('invoice_policy', '=', 'delivery'), ('service_type', '=', 'timesheet')], string="Service", + product_id = fields.Many2one('product.product', domain=[('detailed_type', '=', 'service'), ('invoice_policy', '=', 'delivery'), ('service_type', '=', 'timesheet')], string="Service", help="Product of the sales order item. Must be a service invoiced based on timesheets on tasks.") price_unit = fields.Float("Unit Price", help="Unit price of the sales order item.") currency_id = fields.Many2one('res.currency', string="Currency")