[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
This commit is contained in:
Xavier BOL (xbo)
2021-11-02 16:59:56 +00:00
committed by Laurent Stukkens (LTU)
parent 448fe8fce1
commit c348d596a6
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -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)]""",
@@ -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")