changeset 12e1f54aa7fd in modules/purchase_secondary_unit:default details: https://hg.tryton.org/modules/purchase_secondary_unit?cmd=changeset&node=12e1f54aa7fd description: Add web_shop_shopify module
issue10611 review362271002 diffstat: product.py | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diffs (32 lines): diff -r db172fa0ee4b -r 12e1f54aa7fd product.py --- a/product.py Mon Aug 30 00:27:13 2021 +0200 +++ b/product.py Tue Oct 12 10:15:55 2021 +0200 @@ -36,6 +36,11 @@ depends=['purchase_secondary_uom'], help="The coefficient for the formula:\n" "coefficient (purchase unit) = 1 (secondary unit)") + purchase_secondary_uom_category = fields.Function( + fields.Many2One( + 'product.uom.category', "Purchase Secondary UOM Category"), + 'on_change_with_purchase_secondary_uom_category', + searcher='search_purchase_secondary_uom_category') @fields.depends('purchase_secondary_uom_factor') def on_change_purchase_secondary_uom_factor(self): @@ -55,6 +60,16 @@ 1. / self.purchase_secondary_uom_rate, uom_conversion_digits[1]) + @fields.depends('purchase_secondary_uom') + def on_change_with_purchase_secondary_uom_category(self, name=None): + if self.purchase_secondary_uom: + return self.purchase_secondary_uom.category.id + + @classmethod + def search_purchase_secondary_uom_category(cls, name, clause): + return [('purchase_secondary_uom.category' + clause[0].lstrip(name),) + + tuple(clause[1:])] + @property def purchase_secondary_uom_normal_rate(self): uom = self.purchase_secondary_uom