Allow to search on default UoM of stock lot

Since e49aaf8553e1, default UoM of "Lots by Locations" has a searcher using
the default UoM of the stock lot.

Closes #12583
(grafted from 09a961f1f5e27c8f0787bea29c881ee67c9163a6)

--HG--
branch : 6.0
This commit is contained in:
Cédric Krier committed 2023-10-21 01:03:21 +02:00
1 parent c375b2f1c7
commit 24684e6dc5
1 file changed
+6 -1
+6 -1
View File
@@ -79,7 +79,7 @@ class Lot(ModelSQL, ModelView, LotMixin, StockMixin):
'get_quantity', searcher='search_quantity')
default_uom = fields.Function(
fields.Many2One('product.uom', "Default UOM"),
'on_change_with_default_uom')
'on_change_with_default_uom', searcher='search_default_uom')
default_uom_digits = fields.Function(fields.Integer("Default Unit Digits"),
'on_change_with_default_uom_digits')
@@ -108,6 +108,11 @@ class Lot(ModelSQL, ModelView, LotMixin, StockMixin):
if self.product:
return self.product.default_uom.id
@classmethod
def search_default_uom(cls, name, clause):
nested = clause[0][len(name):]
return [('product.' + name + nested, *clause[1:])]
@fields.depends('product')
def on_change_with_default_uom_digits(self, name=None):
if self.product: