Skip to content

Commit

Permalink
[FIX] rma: move commercial_partner_id definition from rma_account to rma
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPForgeFlow committed Nov 5, 2024
1 parent 255ee40 commit cb571b5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
13 changes: 13 additions & 0 deletions rma/models/rma_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@ def _compute_rma_line_count(self):
def _default_date_rma(self):
return fields.Datetime.now()

@api.depends("partner_id")
def _compute_commercial_partner_id(self):
for rma_line in self:
rma_line.commercial_partner_id = rma_line.partner_id.commercial_partner_id

delivery_address_id = fields.Many2one(
comodel_name="res.partner",
string="Partner delivery address",
Expand Down Expand Up @@ -301,6 +306,14 @@ def _default_date_rma(self):
readonly=True,
states={"draft": [("readonly", False)]},
)
commercial_partner_id = fields.Many2one(
"res.partner",
string="Commercial Entity",
store=True,
readonly=True,
compute="_compute_commercial_partner_id",
ondelete="restrict",
)
sequence = fields.Integer(
default=10, help="Gives the sequence of this line when displaying the rma."
)
Expand Down
14 changes: 0 additions & 14 deletions rma_account/models/rma_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,20 +121,6 @@ def _compute_refund_count(self):
store=True,
)

commercial_partner_id = fields.Many2one(
"res.partner",
string="Commercial Entity",
store=True,
readonly=True,
compute="_compute_commercial_partner_id",
ondelete="restrict",
)

@api.depends("partner_id")
def _compute_commercial_partner_id(self):
for rma_line in self:
rma_line.commercial_partner_id = rma_line.partner_id.commercial_partner_id

@api.onchange("product_id", "partner_id")
def _onchange_product_id(self):
"""Domain for sale_line_id is computed here to make it dynamic."""
Expand Down

0 comments on commit cb571b5

Please sign in to comment.