mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[WIP] Wizard Node Reservation
This commit is contained in:
@@ -40,6 +40,7 @@ class HotelNodeReservationWizard(models.TransientModel):
|
||||
|
||||
room_type_wizard_ids = fields.One2many('node.room.type.wizard', 'node_reservation_wizard_id',
|
||||
string="Room Types")
|
||||
price_total = fields.Float(string='Total Price', default=250.0)
|
||||
|
||||
@api.onchange('node_id')
|
||||
def _onchange_node_id(self):
|
||||
@@ -124,8 +125,6 @@ class HotelNodeReservationWizard(models.TransientModel):
|
||||
}))
|
||||
vals.update({'room_lines': room_lines})
|
||||
|
||||
wdb.set_trace()
|
||||
|
||||
x = noderpc.env['hotel.reservation'].create(vals)
|
||||
|
||||
noderpc.logout()
|
||||
@@ -150,18 +149,17 @@ class NodeRoomTypeWizard(models.TransientModel):
|
||||
room_type_id = fields.Many2one('hotel.node.room.type', 'Rooms Type')
|
||||
room_type_name = fields.Char('Name', related='room_type_id.name')
|
||||
room_type_availability = fields.Integer('Availability') #, compute="_compute_room_type_availability")
|
||||
rooms_qty = fields.Integer('Quantity', default=0)
|
||||
room_qty = fields.Integer('Quantity', default=0)
|
||||
|
||||
checkin = fields.Date('Check In', required=True,
|
||||
default=_default_checkin)
|
||||
checkout = fields.Date('Check Out', required=True,
|
||||
default=_default_checkout)
|
||||
|
||||
price_unit = fields.Float('Unit Price', required=True,
|
||||
digits=dp.get_precision('Unit Price'),
|
||||
default=0.0)
|
||||
discount = fields.Float(string='Discount (%)',
|
||||
digits=dp.get_precision('Discount'), default=0.0)
|
||||
price_unit = fields.Float(string='Room Price', required=True, default=0.0)
|
||||
discount = fields.Float(string='Discount (%)', default=0.0)
|
||||
price_total = fields.Float(string='Total Price', compute="_compute_price_total")
|
||||
|
||||
# price_total #compute
|
||||
# json_days #enchufar como texto literal la cadena devuelta por el método prepare_reservation_lines del hotel.reservation del nodo.(para que funcione
|
||||
# #es necesario que Darío modifique el método en el modulo Hotel haciendolo independiente del self.
|
||||
@@ -180,8 +178,11 @@ class NodeRoomTypeWizard(models.TransientModel):
|
||||
# Conectar con nodo para traer dispo(availability) y precio por habitación(price_unit)
|
||||
# availability: search de hotel.room.type.availability filtrando por room_type y date y escogiendo el min avail en el rango
|
||||
# preci_unit y json_days: usando prepare_reservation_lines
|
||||
#
|
||||
# @api.onchange('rooms_qty')
|
||||
# def _compute_price_total(self):
|
||||
# # Unidades x precio unidad (el precio de unidad ya incluye el conjunto de días)
|
||||
#
|
||||
|
||||
@api.onchange('rooms_qty')
|
||||
def _compute_price_total(self):
|
||||
self.price_total
|
||||
for record in self:
|
||||
record.price_total = record.room_qty * (record.price_unit * record.discount * 0.01)
|
||||
# Unidades x precio unidad (el precio de unidad ya incluye el conjunto de días)
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
attrs="{'readonly': [('node_id', '!=', False)]}"/>
|
||||
</h1>
|
||||
</div>
|
||||
<group attrs="{'invisible':[('node_id','=',False)]}">
|
||||
<group attrs="{'invisible':[('node_id','=',False)]}">
|
||||
<group>
|
||||
<field name="checkin" required="1" widget="date" />
|
||||
<field name="checkout" required="1" widget="date" />
|
||||
@@ -21,25 +21,27 @@
|
||||
<group>
|
||||
<field name="partner_id"/>
|
||||
</group>
|
||||
</group>
|
||||
<group attrs="{'invisible':[('node_id','=',False)]}">
|
||||
<field name="room_type_wizard_ids" nolabel="1">
|
||||
<tree editable="bottom" create="false" delete="false">
|
||||
<field name="room_type_id" string="Room Type" readonly="1" force_save="1"/>
|
||||
<field name="room_type_availability" readonly="1" force_save="1"/>
|
||||
<field name="rooms_qty"/>
|
||||
<field name="price_unit" widget="monetary" readonly="1" force_save="1"/>
|
||||
<!--<field name="currency_id" invisible="1"/>-->
|
||||
<field name="discount" widget="monetary"/>
|
||||
<field name="checkin" widget="date" />
|
||||
<field name="checkout" widget="date" />
|
||||
<!--<field name="discount" attrs="{'readonly': [('can_confirm','=',False)]}"/>-->
|
||||
<!--<field name="price" attrs="{'readonly': [('can_confirm','=',False)]}"/>-->
|
||||
<!--<field name="amount_reservation" readonly="1" />-->
|
||||
<!--<field name="total_price" invisible="1" />-->
|
||||
<!--<field name="can_confirm" invisible="1" />-->
|
||||
</tree>
|
||||
</field>
|
||||
<group colspan="2">
|
||||
<field name="room_type_wizard_ids" nolabel="1">
|
||||
<tree editable="bottom" create="false" delete="false">
|
||||
<field name="room_type_id" string="Room Type" readonly="1" force_save="1"/>
|
||||
<field name="room_type_availability" readonly="1" force_save="1"/>
|
||||
<field name="room_qty"/>
|
||||
<field name="price_unit" widget="monetary" readonly="1" force_save="1"/>
|
||||
<!--<field name="currency_id" invisible="1"/>-->
|
||||
<field name="discount" widget="monetary"/>
|
||||
<field name="checkin" widget="date" />
|
||||
<field name="checkout" widget="date" />
|
||||
<!--<field name="price" attrs="{'readonly': [('can_confirm','=',False)]}"/>-->
|
||||
<!--<field name="amount_reservation" readonly="1" />-->
|
||||
<!--<field name="total_price" invisible="1" />-->
|
||||
<!--<field name="can_confirm" invisible="1" />-->
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
<group>
|
||||
<field name="price_total" widget="monetary" readonly="1" force_save="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<!--<field name="confirm" invisible="1"/>-->
|
||||
<!--<group colspan="2" class="oe_subtotal_footer">-->
|
||||
|
||||
Reference in New Issue
Block a user