diff options
| author | jem-odoo <jem@openerp.com> | 2018-09-14 10:30:31 +0200 |
|---|---|---|
| committer | jem-odoo <jem@openerp.com> | 2018-09-18 14:49:09 +0200 |
| commit | bf905014f738ff0b48f1aba6990006321723491a (patch) | |
| tree | 5f03a73549a42d038a6eafb43c563a8cb10ac78b | |
| parent | 0a95798a099deb71339361b2384cfe04243f756f (diff) | |
[FIX] sale_timesheet: remove domain on wizard map
We want to allow setting user that havent timesheeted yet
on the project, in the map. We keep the check that every
user with a timesheet should be in the map, but there
can have others.
Task #1883640
| -rw-r--r-- | addons/sale_timesheet/wizard/project_create_sale_order.py | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/addons/sale_timesheet/wizard/project_create_sale_order.py b/addons/sale_timesheet/wizard/project_create_sale_order.py index c67499b0ee2..1e4ea237a48 100644 --- a/addons/sale_timesheet/wizard/project_create_sale_order.py +++ b/addons/sale_timesheet/wizard/project_create_sale_order.py @@ -196,20 +196,12 @@ class ProjectCreateSalesOrderLine(models.TransientModel): _name = 'project.create.sale.order.line' _order = 'id,create_date' - def _default_domain_employee_id(self): - active_id = self._context.get('active_id') - if active_id: - project = self.env['project.project'].browse(active_id) - employee_ids = [item['employee_id'][0] for item in self.env['account.analytic.line'].search_read([('task_id', 'in', project.tasks.ids)], ['employee_id'])] - return [('id', 'in', employee_ids)] - return [] - 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", required=True, help="Product of the sales order item. Must be a service invoiced based on timesheets on tasks.") price_unit = fields.Float("Unit Price", default=1.0, help="Unit price of the sales order item.") currency_id = fields.Many2one('res.currency', string="Currency", related='product_id.currency_id') - employee_id = fields.Many2one('hr.employee', string="Employee", domain=lambda self: self._default_domain_employee_id(), required=True, help="Employee that has timesheets on the project.") + employee_id = fields.Many2one('hr.employee', string="Employee", required=True, help="Employee that has timesheets on the project.") _sql_constraints = [ ('unique_employee_per_wizard', 'UNIQUE(wizard_id, employee_id)', "An employee cannot be selected more than once in the mapping. Please remove duplicate(s) and try again."), |
