From 89595be62c7d17fa81a973c25eac45df3479b762 Mon Sep 17 00:00:00 2001 From: david Date: Thu, 23 Sep 2021 16:32:21 +0200 Subject: [PATCH] [FIX] rma: default team and responsible Having a default responsible value as it was defined doesn't behave right when the user it's a portal one or the petition comes from a sudo(). Also, by design it was expected to have a default team if it wasn't defined, but as it was implemented that wasn't possible. TT32056 --- rma/models/rma.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rma/models/rma.py b/rma/models/rma.py index eabfbb00..b5d2c7e9 100644 --- a/rma/models/rma.py +++ b/rma/models/rma.py @@ -50,7 +50,6 @@ class Rma(models.Model): comodel_name="res.users", string="Responsible", index=True, - default=lambda self: self.env.user, tracking=True, states={"locked": [("readonly", True)], "cancelled": [("readonly", True)]}, ) @@ -491,7 +490,7 @@ class Rma(models.Model): ) vals["name"] = ir_sequence.next_by_code("rma") # Assign a default team_id which will be the first in the sequence - if "team_id" not in vals: + if not vals.get("team_id"): vals["team_id"] = self.env["rma.team"].search([], limit=1).id rmas = super().create(vals_list) # Send acknowledge when the RMA is created from the portal and the