[IMP] mrp: search bom by reference
When select a BOM in the field, now we only search by the finished product name. In this commit, we will also match the reference of the BOM. Task 2326786 PR #57945 Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
from odoo.osv.expression import AND, NEGATIVE_TERM_OPERATORS
|
||||
from odoo.tools import float_round
|
||||
|
||||
from itertools import groupby
|
||||
@@ -149,6 +150,16 @@ class MrpBom(models.Model):
|
||||
raise UserError(_('You can not delete a Bill of Material with running manufacturing orders.\nPlease close or cancel it first.'))
|
||||
return super(MrpBom, self).unlink()
|
||||
|
||||
@api.model
|
||||
def _name_search(self, name='', args=None, operator='ilike', limit=100, name_get_uid=None):
|
||||
args = args or []
|
||||
domain = []
|
||||
if (name or '').strip():
|
||||
domain = ['|', (self._rec_name, operator, name), ('code', operator, name)]
|
||||
if operator in NEGATIVE_TERM_OPERATORS:
|
||||
domain = domain[1:]
|
||||
return self._search(AND([domain, args]), limit=limit, access_rights_uid=name_get_uid)
|
||||
|
||||
@api.model
|
||||
def _bom_find_domain(self, product_tmpl=None, product=None, picking_type=None, company_id=False, bom_type=False):
|
||||
if product:
|
||||
|
||||
Reference in New Issue
Block a user