changeset 91987f686283 in modules/stock_secondary_unit:default details: https://hg.tryton.org/modules/stock_secondary_unit?cmd=changeset&node=91987f686283 description: Avoid recursion error when stock origin is set to itself
issue10205 review336071005 diffstat: stock.py | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diffs (27 lines): diff -r 86c5fe21b6e9 -r 91987f686283 stock.py --- a/stock.py Mon Apr 12 19:43:05 2021 +0200 +++ b/stock.py Mon Apr 26 13:07:54 2021 +0200 @@ -114,7 +114,7 @@ if self.secondary_unit: # Stay valid even if origin has been deleted category = self.secondary_unit.category.id - if isinstance(self.origin, self.__class__): + if isinstance(self.origin, self.__class__) and self.origin != self: if self.origin.product_secondary_uom_category: category = self.origin.product_secondary_uom_category.id return category @@ -125,12 +125,12 @@ @property def secondary_uom_factor(self): - if isinstance(self.origin, self.__class__): + if isinstance(self.origin, self.__class__) and self.origin != self: return self.origin.secondary_uom_factor @property def secondary_uom_rate(self): - if isinstance(self.origin, self.__class__): + if isinstance(self.origin, self.__class__) and self.origin != self: return self.origin.secondary_uom_rate