[ADD] Reservation amount total services

This commit is contained in:
Dario Lodeiros
2018-12-10 10:25:20 +01:00
parent 4ff6b1b329
commit 4930804d58
2 changed files with 20 additions and 0 deletions

View File

@@ -258,6 +258,14 @@ class HotelReservation(models.Model):
readonly=True,
store=True,
compute='_compute_amount_reservation')
price_services = fields.Monetary(string='Services Total',
readonly=True,
store=True,
compute='_compute_amount_room_services')
price_room_services_set = fields.Monetary(string='Room Services Total',
readonly=True,
store=True,
compute='_compute_amount_set')
# FIXME discount per night
discount = fields.Float(string='Discount (%)', digits=dp.get_precision('Discount'), default=0.0)
@@ -710,6 +718,16 @@ class HotelReservation(models.Model):
"""
PRICE PROCESS ------------------------------------------------------
"""
@api.depends('service_ids.price_total')
def _compute_amount_room_services(self):
for record in self:
record.price_services = sum(record.mapped('service_ids.price_total'))
@api.depends('price_services','price_total')
def _compute_amount_set(self):
for record in self:
record.price_room_services_set = record.price_services + record.price_total
@api.multi
def compute_price_out_vals(self, vals):
"""

View File

@@ -224,6 +224,8 @@
<!-- <field name="customer_lead" invisible="1"/> -->
<field name="currency_id" invisible="1"/>
<field name="price_subtotal" widget="monetary"/>
<field name="price_services" widget="monetary"/>
<field name="price_room_services_set" widget="monetary"/>
</group>
</group>
<field name="folio_internal_comment" nolabel="1" placeholder="Reservation Notes"/>