[FIX] mrp: make _bom_find return type consistent

MAke sure the `_bom_find` meothd always return a `mrp.bom` recordset.

X-original-commit: adc6af4aeba7fb5ef43c30714d73e4b9401dc536
This commit is contained in:
Nicolas Martinelli
2020-11-09 10:01:36 +00:00
parent e9638fd3ae
commit 682650a57e
+2 -2
View File
@@ -184,10 +184,10 @@ class MrpBom(models.Model):
def _bom_find(self, product_tmpl=None, product=None, picking_type=None, company_id=False, bom_type=False):
""" Finds BoM for particular product, picking and company """
if product and product.type == 'service' or product_tmpl and product_tmpl.type == 'service':
return False
return self.env['mrp.bom']
domain = self._bom_find_domain(product_tmpl=product_tmpl, product=product, picking_type=picking_type, company_id=company_id, bom_type=bom_type)
if domain is False:
return domain
return self.env['mrp.bom']
return self.search(domain, order='sequence, product_id', limit=1)
def explode(self, product, quantity, picking_type=False):