mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX]pms: migration post compute
This commit is contained in:
13
pms/migrations/14.0.2.36.2/post-migration.py
Normal file
13
pms/migrations/14.0.2.36.2/post-migration.py
Normal file
@@ -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()
|
||||||
@@ -51,8 +51,3 @@ def migrate(env, version):
|
|||||||
WHERE fol.id = ser.folio_id
|
WHERE fol.id = ser.folio_id
|
||||||
""",
|
""",
|
||||||
)
|
)
|
||||||
|
|
||||||
_logger.info("Recompute reservations sale channel ids...")
|
|
||||||
env["pms.reservation"].search(
|
|
||||||
[("reservation_type", "!=", "out")]
|
|
||||||
)._compute_sale_channel_ids()
|
|
||||||
@@ -1893,18 +1893,18 @@ class PmsReservation(models.Model):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.constrains("sale_channel_ids")
|
# @api.constrains("sale_channel_ids")
|
||||||
def _check_lines_with_sale_channel_id(self):
|
# def _check_lines_with_sale_channel_id(self):
|
||||||
for record in self.filtered("sale_channel_origin_id"):
|
# for record in self.filtered("sale_channel_origin_id"):
|
||||||
if record.reservation_line_ids:
|
# if record.reservation_line_ids:
|
||||||
if record.sale_channel_origin_id not in record.sale_channel_ids:
|
# if record.sale_channel_origin_id not in record.sale_channel_ids:
|
||||||
raise ValidationError(
|
# raise ValidationError(
|
||||||
_(
|
# _(
|
||||||
"Reservation must have one reservation line "
|
# "Reservation must have one reservation line "
|
||||||
"with sale channel equal to sale channel origin of reservation."
|
# "with sale channel equal to sale channel origin of reservation."
|
||||||
"Change sale_channel_origin of reservation before"
|
# "Change sale_channel_origin of reservation before"
|
||||||
)
|
# )
|
||||||
)
|
# )
|
||||||
|
|
||||||
# Action methods
|
# Action methods
|
||||||
def open_partner(self):
|
def open_partner(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user