[IMP] pms: delete compute of sale_channel_origin through agency_id

This commit is contained in:
Sara Lago
2022-03-25 13:48:08 +01:00
committed by Darío Lodeiros
parent f98a467749
commit 72d502aee7
4 changed files with 10 additions and 14 deletions

View File

@@ -226,8 +226,6 @@ class PmsFolio(models.Model):
string="Sale Channel Origin",
help="Sale Channel through which folio was created, the original",
comodel_name="pms.sale.channel",
store=True,
compute="_compute_sale_channel_origin_id",
)
transaction_ids = fields.Many2many(
@@ -1063,12 +1061,6 @@ class PmsFolio(models.Model):
if reservation.commission_amount != 0:
folio.commission = folio.commission + reservation.commission_amount
@api.depends("agency_id")
def _compute_sale_channel_origin_id(self):
for folio in self:
if folio.agency_id:
folio.sale_channel_origin_id = folio.agency_id.sale_channel_id.id
@api.depends("reservation_ids", "reservation_ids.sale_channel_ids")
def _compute_sale_channel_ids(self):
for record in self:

View File

@@ -1891,6 +1891,7 @@ class PmsReservation(models.Model):
"Change sale_channel_origin of reservation before"
)
)
# Action methods
def open_partner(self):
"""Utility method used to add an "View Customer" button in reservation views"""
@@ -2026,7 +2027,7 @@ class PmsReservation(models.Model):
vals.update(default_vals)
elif (
"pms_property_id" in vals
and ("sale_channel_origin_id" in vals or "agency_id" in vals)
and "sale_channel_origin_id" in vals
and ("partner_name" in vals or "partner_id" in vals or "agency_id" in vals)
):
folio_vals = {