[RFC]pms: Refactor origin sale channel

This commit is contained in:
Darío Lodeiros
2022-07-24 17:02:32 +02:00
parent 0ba03ba29c
commit 3deda9f413
4 changed files with 4 additions and 28 deletions

View File

@@ -1507,18 +1507,6 @@ class PmsFolio(models.Model):
("sale_line_ids.invoice_lines.move_id", operator, value),
]
# @api.constrains("agency_id", "channel_type_id")
# def _check_only_one_channel(self):
# for record in self:
# if (
# record.agency_id
# and record.channel_type_id.channel_type
# != record.agency_id.sale_channel_id.channel_type
# ):
# raise models.ValidationError(
# _("The Sale Channel does not correspond to the agency's")
# )
@api.constrains("name")
def _check_required_partner_name(self):
for record in self:

View File

@@ -844,13 +844,6 @@
enable_counters="1"
select="multi"
/>
<!-- <field-->
<!-- name="channel_type_id"-->
<!-- string="Channel"-->
<!-- enable_counters="1"-->
<!-- icon="fa-sitemap"-->
<!-- expand="1"-->
<!-- />-->
</searchpanel>
</search>
</field>

View File

@@ -1089,13 +1089,6 @@
icon="fa-bookmark"
color="#875A7B"
/>
<!-- <field-->
<!-- name="channel_type_id"-->
<!-- string="Channel"-->
<!-- enable_counters="1"-->
<!-- icon="fa-sitemap"-->
<!-- expand="1"-->
<!-- />-->
</searchpanel>
</search>
</field>

View File

@@ -145,7 +145,9 @@ class BookingDuplicate(models.TransientModel):
def _compute_channel_type_id(self):
for record in self.filtered("reference_folio_id"):
if record.reference_folio_id.agency_id == record.agency_id:
record.channel_type_id = record.reference_folio_id.channel_type_id
record.channel_type_id = (
record.reference_folio_id.sale_channel_origin_id
)
elif record.agency_id:
record.channel_type_id = record.agency_id.sale_channel_id.id
@@ -301,7 +303,7 @@ class BookingDuplicate(models.TransientModel):
"partner_name": self.partner_name,
"pms_property_id": self.pms_property_id.id,
"agency_id": self.agency_id.id,
"channel_type_id": self.channel_type_id.id,
"sale_channel_origin_id": self.channel_type_id.id,
"segmentation_ids": [(6, 0, self.segmentation_ids.ids)],
"internal_comment": self.internal_comment,
}