mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[ADD] Reservation amount total services
This commit is contained in:
@@ -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):
|
||||
"""
|
||||
|
||||
@@ -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"/>
|
||||
|
||||
Reference in New Issue
Block a user