mirror of
https://github.com/OCA/rma.git
synced 2025-02-16 17:11:47 +02:00
[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
This commit is contained in:
@@ -50,7 +50,6 @@ class Rma(models.Model):
|
|||||||
comodel_name="res.users",
|
comodel_name="res.users",
|
||||||
string="Responsible",
|
string="Responsible",
|
||||||
index=True,
|
index=True,
|
||||||
default=lambda self: self.env.user,
|
|
||||||
tracking=True,
|
tracking=True,
|
||||||
states={"locked": [("readonly", True)], "cancelled": [("readonly", 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"])
|
ir_sequence = ir_sequence.with_company(vals["company_id"])
|
||||||
vals["name"] = ir_sequence.next_by_code("rma")
|
vals["name"] = ir_sequence.next_by_code("rma")
|
||||||
# Assign a default team_id which will be the first in the sequence
|
# 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
|
vals["team_id"] = self.env["rma.team"].search([], limit=1).id
|
||||||
rmas = super().create(vals_list)
|
rmas = super().create(vals_list)
|
||||||
# Send acknowledge when the RMA is created from the portal and the
|
# Send acknowledge when the RMA is created from the portal and the
|
||||||
|
|||||||
Reference in New Issue
Block a user