diff --git a/pms/migrations/14.0.2.36.2/post-migration.py b/pms/migrations/14.0.2.36.2/post-migration.py new file mode 100644 index 000000000..e5a427283 --- /dev/null +++ b/pms/migrations/14.0.2.36.2/post-migration.py @@ -0,0 +1,13 @@ +import logging + +from openupgradelib import openupgrade + +_logger = logging.getLogger(__name__) + + +@openupgrade.migrate() +def migrate(env, version): + _logger.info("Recompute reservations sale channel ids...") + env["pms.reservation"].search( + [("reservation_type", "!=", "out")] + )._compute_sale_channel_ids() diff --git a/pms/migrations/14.0.2.36.1/pre-migration.py b/pms/migrations/14.0.2.36.2/pre-migration.py similarity index 87% rename from pms/migrations/14.0.2.36.1/pre-migration.py rename to pms/migrations/14.0.2.36.2/pre-migration.py index c51680867..2a8bbe652 100644 --- a/pms/migrations/14.0.2.36.1/pre-migration.py +++ b/pms/migrations/14.0.2.36.2/pre-migration.py @@ -51,8 +51,3 @@ def migrate(env, version): WHERE fol.id = ser.folio_id """, ) - - _logger.info("Recompute reservations sale channel ids...") - env["pms.reservation"].search( - [("reservation_type", "!=", "out")] - )._compute_sale_channel_ids() diff --git a/pms/models/pms_reservation.py b/pms/models/pms_reservation.py index 1b4f10ca8..72bb917c1 100644 --- a/pms/models/pms_reservation.py +++ b/pms/models/pms_reservation.py @@ -1893,18 +1893,18 @@ class PmsReservation(models.Model): ) ) - @api.constrains("sale_channel_ids") - def _check_lines_with_sale_channel_id(self): - for record in self.filtered("sale_channel_origin_id"): - if record.reservation_line_ids: - if record.sale_channel_origin_id not in record.sale_channel_ids: - raise ValidationError( - _( - "Reservation must have one reservation line " - "with sale channel equal to sale channel origin of reservation." - "Change sale_channel_origin of reservation before" - ) - ) + # @api.constrains("sale_channel_ids") + # def _check_lines_with_sale_channel_id(self): + # for record in self.filtered("sale_channel_origin_id"): + # if record.reservation_line_ids: + # if record.sale_channel_origin_id not in record.sale_channel_ids: + # raise ValidationError( + # _( + # "Reservation must have one reservation line " + # "with sale channel equal to sale channel origin of reservation." + # "Change sale_channel_origin of reservation before" + # ) + # ) # Action methods def open_partner(self):