[IMP] sale_timesheet: add default filter for SOL field

Purpose of this commit help the user find the relevant SO for their
employee/SOL mapping among the thousands of SOLs there can be. It
is highly likely that the selected SOLs will be part of the same SO
as the one of the default SOL.

So, in this commit set a default filter on the project's SO when
clicking on 'search more'.

task-3165202

Part-of: odoo/odoo#112620
This commit is contained in:
Kartik Chavda
2023-04-13 16:39:59 +02:00
parent 73b7fb75b5
commit b7dc281a5a
2 changed files with 3 additions and 1 deletions
@@ -19,6 +19,7 @@ class ProjectProductEmployeeMap(models.Model):
('state', 'in', ['sale', 'done']),
('order_partner_id', '=?', partner_id),
'|', ('company_id', '=', False), ('company_id', '=', company_id)]""")
sale_order_id = fields.Many2one(related="project_id.sale_order_id")
company_id = fields.Many2one('res.company', string='Company', related='project_id.company_id')
partner_id = fields.Many2one(related='project_id.partner_id')
price_unit = fields.Float("Unit Price", compute='_compute_price_unit', store=True, readonly=True)
@@ -16,8 +16,9 @@
<tree editable="bottom">
<field name="company_id" invisible="1"/>
<field name="partner_id" invisible="1"/>
<field name="sale_order_id" invisible="1"/>
<field name="employee_id" options="{'no_create': True}" widget="many2one_avatar_user"/>
<field name="sale_line_id" attrs="{'required': True}" options="{'no_create': True}"/>
<field name="sale_line_id" attrs="{'required': True}" options="{'no_create': True}" context="{'search_default_order_id': sale_order_id}"/>
<field name="price_unit" widget="monetary" force_save="1" options="{'currency_field': 'currency_id'}"/>
<field name="display_cost" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="is_cost_changed" invisible="1"/>