Skip to content
Snippets Groups Projects
Commit 29d8a175 authored by Pieter Claeys (clpi)'s avatar Pieter Claeys (clpi)
Browse files

[FIX] mrp: search workorders by finished_lot_id

Before this commit, it was impossible to search workorders by their
finished_lot_id as there was no search function for this field.
This commit adds the search function.

opw-3330126
community PR: https://github.com/odoo/odoo/pull/123223



closes odoo/odoo#123506

X-original-commit: b5f482d8
Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
parent 799749d7
Branches
Tags
No related merge requests found
......@@ -124,7 +124,7 @@ class MrpWorkorder(models.Model):
finished_lot_id = fields.Many2one(
'stock.lot', string='Lot/Serial Number', compute='_compute_finished_lot_id',
inverse='_set_finished_lot_id', domain="[('product_id', '=', product_id), ('company_id', '=', company_id)]",
check_company=True)
check_company=True, search='_search_finished_lot_id')
time_ids = fields.One2many(
'mrp.workcenter.productivity', 'workorder_id', copy=False)
is_user_working = fields.Boolean(
......@@ -230,6 +230,9 @@ class MrpWorkorder(models.Model):
for workorder in self:
workorder.finished_lot_id = workorder.production_id.lot_producing_id
def _search_finished_lot_id(self, operator, value):
return [('production_id.lot_producing_id', operator, value)]
def _set_finished_lot_id(self):
for workorder in self:
workorder.production_id.lot_producing_id = workorder.finished_lot_id
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment