From d74959940215c82e2df8dedfbbf86df2237ce914 Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Mon, 26 Apr 2021 13:07:54 +0200 Subject: [PATCH] Avoid recursion error when stock origin is set to itself issue10205 review336071005 --- stock.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stock.py b/stock.py index 2e1ba1a639..1ae73c773b 100644 --- a/stock.py +++ b/stock.py @@ -114,7 +114,7 @@ class Move(metaclass=PoolMeta): 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 @@ class Move(metaclass=PoolMeta): @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