mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX] Prepare add missing fields reservation
This commit is contained in:
@@ -270,9 +270,9 @@ class HotelReservation(models.Model):
|
|||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def create(self, vals):
|
def create(self, vals):
|
||||||
vals.update(self._prepare_add_missing_fields(vals))
|
|
||||||
if 'room_id' not in vals:
|
if 'room_id' not in vals:
|
||||||
vals.update(self._autoassign(vals))
|
vals.update(self._autoassign(vals))
|
||||||
|
vals.update(self._prepare_add_missing_fields(vals))
|
||||||
if 'folio_id' in vals:
|
if 'folio_id' in vals:
|
||||||
folio = self.env["hotel.folio"].browse(vals['folio_id'])
|
folio = self.env["hotel.folio"].browse(vals['folio_id'])
|
||||||
vals.update({'channel_type': folio.channel_type})
|
vals.update({'channel_type': folio.channel_type})
|
||||||
@@ -335,7 +335,7 @@ class HotelReservation(models.Model):
|
|||||||
""" Deduce missing required fields from the onchange """
|
""" Deduce missing required fields from the onchange """
|
||||||
res = {}
|
res = {}
|
||||||
onchange_fields = ['room_id', 'reservation_type', 'currency_id', 'name']
|
onchange_fields = ['room_id', 'reservation_type', 'currency_id', 'name']
|
||||||
if values.get('partner_id') and values.get('room_type_id'):
|
if values.get('room_type_id'):
|
||||||
line = self.new(values)
|
line = self.new(values)
|
||||||
if any(f not in values for f in onchange_fields):
|
if any(f not in values for f in onchange_fields):
|
||||||
line.onchange_room_id()
|
line.onchange_room_id()
|
||||||
|
|||||||
Reference in New Issue
Block a user