From dc839392e9de94539ead2e88cd5c762eda83d4d9 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 b825c576..d6d35a24 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)]}, ) @@ -509,7 +508,7 @@ class Rma(models.Model): ir_sequence = ir_sequence.with_company(vals["company_id"]) 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