[IMP] sale_project: not filter SOLs if SO defined in project

Before this commit, when the pricing type of the project is either
project rate or employee rate, the list of possible SOLs in sale_line_id
is filtered to have only the SOLs in the SO.

This commit removes this filter because we just want to use the SOL set
in the project as a default value.

task-2442683

closes odoo/odoo#66181
This commit is contained in:
Xavier BOL (xbo)
2021-04-16 10:35:47 +02:00
committed by Yannick Tivisse
parent 3c7626fe08
commit 863662ffe0
3 changed files with 2 additions and 3 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ class ProjectTask(models.Model):
sale_order_id = fields.Many2one('sale.order', 'Sales Order', help="Sales order to which the task is linked.")
sale_line_id = fields.Many2one(
'sale.order.line', 'Sales Order Item', domain="[('is_service', '=', True), ('order_partner_id', 'child_of', commercial_partner_id), ('is_expense', '=', False), ('state', 'in', ['sale', 'done']), ('order_id', '=?', project_sale_order_id)]",
'sale.order.line', 'Sales Order Item', domain="[('is_service', '=', True), ('order_partner_id', 'child_of', commercial_partner_id), ('is_expense', '=', False), ('state', 'in', ['sale', 'done'])]",
compute='_compute_sale_line', store=True, readonly=False, copy=False,
help="Sales order item to which the project is linked. Link the timesheet entry to the sales order item defined on the project. "
"Only applies on tasks without sale order item defined, and if the employee is not in the 'Employee/Sales Order Item Mapping' of the project.")
@@ -46,7 +46,6 @@
<field name="sale_order_id" attrs="{'invisible': True}" groups="sales_team.group_sale_salesman"/>
<field name="sale_line_id" string="Sales Order Item" attrs="{'invisible': [('partner_id', '=', False)]}" options='{"no_open": True}' readonly="1" context="{'create': False, 'edit': False, 'delete': False}"/>
<field name="commercial_partner_id" invisible="1" />
<field name="project_sale_order_id" invisible="1"/>
</xpath>
</field>
</record>
@@ -154,7 +154,7 @@
<field name="so_line"
attrs="{'column_invisible': [('parent.allow_billable', '=', False)]}"
context="{'with_remaining_hours': True, 'with_price_unit': True}" options="{'no_create': True, 'no_open': True}"
domain="[('is_service', '=', True), ('order_partner_id', 'child_of', parent.commercial_partner_id), ('is_expense', '=', False), ('state', 'in', ['sale', 'done']), ('order_id', '=?', parent.project_sale_order_id)]"
domain="[('is_service', '=', True), ('order_partner_id', 'child_of', parent.commercial_partner_id), ('is_expense', '=', False), ('state', 'in', ['sale', 'done'])]"
optional="hide"/>
</xpath>
<xpath expr="//field[@name='remaining_hours']" position="after">