mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP] pms: restrict that reservation_lines haven't sale channels other than sales origin of reservation
This commit is contained in:
committed by
Darío Lodeiros
parent
cc03cc2d67
commit
f98a467749
@@ -1879,6 +1879,18 @@ class PmsReservation(models.Model):
|
||||
)
|
||||
)
|
||||
|
||||
@api.constrains("sale_channel_ids")
|
||||
def _check_lines_with_sale_channel_id(self):
|
||||
for record in self:
|
||||
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):
|
||||
"""Utility method used to add an "View Customer" button in reservation views"""
|
||||
|
||||
Reference in New Issue
Block a user