diff --git a/stock_release_channel/models/stock_release_channel.py b/stock_release_channel/models/stock_release_channel.py index be8546a098..2bcbafc5b8 100644 --- a/stock_release_channel/models/stock_release_channel.py +++ b/stock_release_channel/models/stock_release_channel.py @@ -485,13 +485,14 @@ def assign_release_channel(self, picking): for channel in picking._find_release_channel_possible_candidate(): current = picking domain = channel._prepare_domain() - if not domain and not channel.code: + code = channel.sudo().code + if not domain and not code: current.release_channel_id = channel if domain: current = picking.filtered_domain(domain) if not current: continue - if channel.code: + if code: current = channel._eval_code(current) if not current: continue @@ -536,7 +537,8 @@ def _eval_context(self, pickings): return eval_context def _eval_code(self, pickings): - expr = self.code.strip() + code = self.sudo().code + expr = code.strip() eval_context = self._eval_context(pickings) try: safe_eval(expr, eval_context, mode="exec", nocopy=True)