mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP]pms: improv cancel/confirm prepare vals confirm value in create
This commit is contained in:
@@ -2132,13 +2132,22 @@ class PmsReservation(models.Model):
|
||||
vals["reservation_type"] = (
|
||||
folio.reservation_type if folio.reservation_type else "normal"
|
||||
)
|
||||
# Avoid send state field in vals, with the propouse to
|
||||
# use action_confirm or action_cancel methods
|
||||
reservation_state = False
|
||||
if "state" in vals:
|
||||
reservation_state = vals["state"]
|
||||
vals.pop("state")
|
||||
record = super(PmsReservation, self).create(vals)
|
||||
record._check_capacity()
|
||||
if record.preconfirm and record.state == "draft":
|
||||
if (
|
||||
record.preconfirm and record.state == "draft"
|
||||
) or reservation_state == "confirm":
|
||||
record.action_confirm()
|
||||
elif reservation_state == "cancel":
|
||||
record.action_cancel()
|
||||
|
||||
record._check_services(vals)
|
||||
|
||||
return record
|
||||
|
||||
def write(self, vals):
|
||||
|
||||
Reference in New Issue
Block a user