This commit is contained in:
oscar alvarez 2022-05-18 14:17:40 -05:00
parent 2497d76753
commit 389719afe1
7 changed files with 22 additions and 23 deletions

View File

@ -372,11 +372,12 @@ class Booking(Workflow, ModelSQL, ModelView):
@ModelView.button @ModelView.button
def bill(cls, records): def bill(cls, records):
for rec in records: for rec in records:
cls.bill_to_channel()
cls.create_invoice(rec.lines) cls.create_invoice(rec.lines)
cls.check_finished(records) cls.check_finished(records)
@classmethod @classmethod
@ModelView.button # @ModelView.button
def bill_to_channel(cls, records): def bill_to_channel(cls, records):
for rec in records: for rec in records:
@ -855,9 +856,13 @@ class Booking(Workflow, ModelSQL, ModelView):
return res return res
def get_channel_commission(self, name): def get_channel_commission(self, name):
res = sum(line.commission_amount for line in self.lines if res = [line.commission_amount for line in self.lines if line.commission_amount]
line.commission_amount) total_commission = sum(res)
return res base_comm = [folio.on_change_with_room_amount() for folio in self.lines]
for comm in self.extra_commissions:
extras = sum(base_comm) * Decimal(comm.commission / 100)
res.append(extras)
return sum(res)
def send_email_to(self): def send_email_to(self):
pool = Pool() pool = Pool()
@ -1301,7 +1306,7 @@ class BookingDailyReport(Report):
], order=[('room.code', 'ASC')]) ], order=[('room.code', 'ASC')])
report_context['records'] = records report_context['records'] = records
report_context['company'] = Company(data['company']).party.name report_context['company'] = Company(data['company'])
report_context['date'] = data['date'] report_context['date'] = data['date']
return report_context return report_context

Binary file not shown.

View File

@ -306,7 +306,8 @@ class Folio(ModelSQL, ModelView):
res = value['base'] + value['amount'] res = value['base'] + value['amount']
return res return res
@fields.depends('unit_price', 'nights_quantity', 'arrival_date', 'departure_date') @fields.depends('unit_price', 'nights_quantity', 'arrival_date',
'departure_date')
def on_change_with_room_amount(self, name=None): def on_change_with_room_amount(self, name=None):
res = 0 res = 0
if self.unit_price and self.nights_quantity: if self.unit_price and self.nights_quantity:

View File

@ -33,10 +33,8 @@ this repository contains the full copyright notices and license terms. -->
<label name="estimated_arrival_time"/> <label name="estimated_arrival_time"/>
<field name="estimated_arrival_time"/> <field name="estimated_arrival_time"/>
<notebook colspan="6"> <notebook colspan="6">
<page string="Charges" id="hotel_charges"> <page string="Charges and Guests" id="hotel_charges">
<field name="charges" colspan="4"/> <field name="charges" colspan="4"/>
</page>
<page string="Guests" id="hotel_guests">
<field name="guests" colspan="4"/> <field name="guests" colspan="4"/>
</page> </page>
<page string="Stock" id="stock"> <page string="Stock" id="stock">

View File

@ -35,10 +35,8 @@ this repository contains the full copyright notices and license terms. -->
<label name="estimated_arrival_time"/> <label name="estimated_arrival_time"/>
<field name="estimated_arrival_time"/> <field name="estimated_arrival_time"/>
<notebook colspan="6"> <notebook colspan="6">
<page string="Charges" id="hotel_charges"> <page string="Charges and Guests" id="hotel_charges">
<field name="charges" colspan="4"/> <field name="charges" colspan="4"/>
</page>
<page string="Guests" id="hotel_guests">
<field name="guests" colspan="4"/> <field name="guests" colspan="4"/>
</page> </page>
<page string="Additional Info" id="folio_additional_info"> <page string="Additional Info" id="folio_additional_info">

View File

@ -22,10 +22,12 @@ this repository contains the full copyright notices and license terms. -->
<field name="channel" widget="selection"/> <field name="channel" widget="selection"/>
<label name="ota_booking_code"/> <label name="ota_booking_code"/>
<field name="ota_booking_code"/> <field name="ota_booking_code"/>
<label name="channel_paymode"/>
<field name="channel_paymode"/>
<label name="price_list"/> <label name="price_list"/>
<field name="price_list" widget="selection"/> <field name="price_list" widget="selection"/>
<button name="select_rooms" string="Select Rooms" <button name="select_rooms" string="Select Rooms"
icon="tryton-open" colspan="4"/> icon="tryton-open" colspan="2"/>
<button name="do_pay" string="Do Pay" icon="tryton-open"/> <button name="do_pay" string="Do Pay" icon="tryton-open"/>
<button name="send_email" string="Send Email" icon="tryton-open"/> <button name="send_email" string="Send Email" icon="tryton-open"/>
<notebook colspan="6"> <notebook colspan="6">
@ -75,6 +77,8 @@ this repository contains the full copyright notices and license terms. -->
<field name="created_channel"/> <field name="created_channel"/>
<label name="channel_commission"/> <label name="channel_commission"/>
<field name="channel_commission"/> <field name="channel_commission"/>
<label name="channel_invoice"/>
<field name="channel_invoice"/>
<field name="extra_commissions" colspan="4"/> <field name="extra_commissions" colspan="4"/>
</page> </page>
</notebook> </notebook>
@ -103,11 +107,4 @@ this repository contains the full copyright notices and license terms. -->
<label name="pending_to_pay"/> <label name="pending_to_pay"/>
<field name="pending_to_pay"/> <field name="pending_to_pay"/>
</group> </group>
<group col="5" colspan="4" xfill="1" id="ota_management">
<label name="channel_paymode"/>
<field name="channel_paymode"/>
<button name="bill_to_channel" string="Bill to Channel"/>
<label name="channel_invoice"/>
<field name="channel_invoice"/>
</group>
</form> </form>

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of <!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. --> this repository contains the full copyright notices and license terms. -->
<tree editable="1"> <tree>
<field name="party" expand="1"/> <field name="party" expand="1"/>
<field name="type_document"/> <field name="type_document"/>
<field name="name" expand="1"/> <field name="name" expand="1"/>