[MIG] rma_reason_code: Migration to 17.0

This commit is contained in:
Meritxell Abellan
2024-12-16 15:59:38 +01:00
parent d1d42fb6d8
commit 1802c71d8a
9 changed files with 40 additions and 22 deletions

View File

@@ -13,14 +13,15 @@ class RMAReasonCode(models.Model):
return randint(1, 11)
name = fields.Char("Code", required=True)
description = fields.Text("Description")
type = fields.Selection(
description = fields.Text()
rma_type = fields.Selection(
[
("customer", "Customer RMA"),
("supplier", "Supplier RTV"),
("both", "Both Customer and Supplier"),
],
default="both",
string="RMA Type",
required=True,
)
color = fields.Integer("Color", default=_get_default_color)
color = fields.Integer(default=_get_default_color)

View File

@@ -24,9 +24,9 @@ class RMAOrderLine(models.Model):
for rec in self:
codes = self.env["rma.reason.code"]
if rec.type == "customer":
codes = codes.search([("type", "in", ["customer", "both"])])
codes = codes.search([("rma_type", "in", ["customer", "both"])])
else:
codes = codes.search([("type", "in", ["supplier", "both"])])
codes = codes.search([("rma_type", "in", ["supplier", "both"])])
rec.allowed_reason_code_ids = codes
@api.constrains("reason_code_ids", "product_id")