Fix
This commit is contained in:
parent
707ce36629
commit
bd3453d21b
52
booking.py
52
booking.py
|
@ -1,10 +1,10 @@
|
|||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from __future__ import with_statement
|
||||
import os
|
||||
from datetime import datetime, timedelta, date
|
||||
from decimal import Decimal
|
||||
|
||||
from trytond.tools import file_open
|
||||
from trytond.model import Workflow, ModelView, ModelSQL, fields
|
||||
from trytond.wizard import (
|
||||
Wizard, StateView, Button, StateTransition, StateReport
|
||||
|
@ -160,6 +160,8 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
])
|
||||
stock_moves = fields.Function(fields.One2Many('stock.move', 'origin', 'Moves',
|
||||
readonly=True), 'get_stock_moves')
|
||||
channel_icon = fields.Function(fields.Char('Channel Icon'),
|
||||
'get_channel_icon')
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
|
@ -194,9 +196,6 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
'not_show': {
|
||||
'invisible': Eval('state') != 'confirmed',
|
||||
},
|
||||
'do_pay': {
|
||||
'invisible': Eval('state').in_(['offer', 'cancelled']),
|
||||
},
|
||||
'do_payment': {
|
||||
'invisible': Eval('state').in_(['offer', 'cancelled']),
|
||||
},
|
||||
|
@ -212,6 +211,21 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
},
|
||||
})
|
||||
|
||||
@staticmethod
|
||||
def default_payment_term():
|
||||
Config = Pool().get('hotel.configuration')
|
||||
config = Config.get_configuration()
|
||||
if config.payment_term:
|
||||
return config.payment_term.id
|
||||
|
||||
def get_channel_icon(self, name):
|
||||
# if self.channel:
|
||||
# return
|
||||
# path = os.path.join('icons/channel-house.png')
|
||||
# with file_open('icons/channel-house.png', mode='r', encoding='utf-8') as fp:
|
||||
# return fp.read()
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def trigger_create(cls, records):
|
||||
cls.set_number(records)
|
||||
|
@ -339,11 +353,6 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
def update_holder(cls, records):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@ModelView.button_action('hotel.wizard_booking_advance_voucher')
|
||||
def do_pay(cls, records):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@ModelView.button_action('hotel.wizard_statement_payment_form')
|
||||
def do_payment(cls, records):
|
||||
|
@ -540,7 +549,7 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
res[party.id] = {
|
||||
'party': party,
|
||||
'currency': bk.currency.id,
|
||||
'payment_term': None,
|
||||
'payment_term': bk.payment_term,
|
||||
'number': bk.number,
|
||||
'guests_qty': len(fo.guests) + 1,
|
||||
'reference': reference,
|
||||
|
@ -585,7 +594,7 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
res[invoice_party.id] = {
|
||||
'party': invoice_party,
|
||||
'currency': bk.currency.id,
|
||||
'payment_term': None,
|
||||
'payment_term': bk.payment_term,
|
||||
'number': bk.number,
|
||||
'reference': charge.folio.registration_card,
|
||||
'lines': [],
|
||||
|
@ -944,7 +953,10 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
advances = Advance.search([('booking', '=', self.id)])
|
||||
res = sum([ad.voucher.amount_to_pay for ad in advances])
|
||||
payments = sum([pay.amount for pay in self.payments])
|
||||
return res + payments + self.channel_commission
|
||||
advance_by_channel = _ZERO
|
||||
if self.channel and self.channel_paymode == 'ota_collect':
|
||||
advance_by_channel = self.channel_commission
|
||||
return res + payments + advance_by_channel
|
||||
|
||||
def get_pending_to_pay(self, name):
|
||||
if self.total_amount:
|
||||
|
@ -1987,9 +1999,21 @@ class WizardStatementPayment(Wizard):
|
|||
raise UserError(gettext(
|
||||
'hotel.msg_missing_party_holder'))
|
||||
|
||||
party = None
|
||||
if booking.channel and booking.channel_paymode == 'ota_collect':
|
||||
for folio in self.lines:
|
||||
if folio.main_guest != booking.channel.agent.party:
|
||||
party = folio.main_guest
|
||||
break
|
||||
else:
|
||||
party = booking.party
|
||||
|
||||
if not party:
|
||||
raise UserError(gettext('hotel.msg_missing_customer'))
|
||||
return {
|
||||
'currency_digits': 2,
|
||||
'party': booking.party.id,
|
||||
'party': party.id,
|
||||
'amount_to_pay': booking.pending_to_pay
|
||||
}
|
||||
|
||||
def transition_pay_(self):
|
||||
|
|
|
@ -65,6 +65,8 @@ class Configuration(ModelSQL, ModelView):
|
|||
'Booking Template Email')
|
||||
storage_by_default = fields.Many2One('stock.location', 'Storage By Default',
|
||||
domain=[('type', '=', 'storage')], required=False)
|
||||
payment_term = fields.Many2One('account.invoice.payment_term',
|
||||
'Payment Term')
|
||||
|
||||
@staticmethod
|
||||
def default_company():
|
||||
|
|
|
@ -50,6 +50,10 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="name">hotel-maintenance</field>
|
||||
<field name="path">icons/maintenance.svg</field>
|
||||
</record>
|
||||
<record model="ir.ui.icon" id="hotel_channel_house_icon">
|
||||
<field name="name">hotel-channel-house</field>
|
||||
<field name="path">icons/channel-house.png</field>
|
||||
</record>
|
||||
|
||||
<menuitem name="Hotel" sequence="10" id="menu_hotel"
|
||||
icon="tryton-hotel"/>
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
|
@ -78,5 +78,8 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<record model="ir.message" id="msg_missing_party_holder">
|
||||
<field name="text">Missing party holder!</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_missing_customer">
|
||||
<field name="text">Missing party or customer to pay!</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[tryton]
|
||||
version=6.0.23
|
||||
version=6.0.24
|
||||
depends:
|
||||
party
|
||||
company
|
||||
|
|
|
@ -28,14 +28,16 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="guarantee"/>
|
||||
<label name="price_list"/>
|
||||
<field name="price_list" widget="selection"/>
|
||||
<group col="2" id="taxes_exception" colspan="2">
|
||||
<label name="payment_term"/>
|
||||
<field name="payment_term" widget="selection"/>
|
||||
<newline />
|
||||
<button name="do_payment" colspan="2" string="Pay / Advance" icon="tryton-currency"/>
|
||||
<button name="select_rooms" colspan="2" string="Rooms" icon="tryton-board"/>
|
||||
<button name="send_email" string="Send Email" icon="tryton-email"/>
|
||||
<group col="2" id="taxes_exception">
|
||||
<label name="taxes_exception"/>
|
||||
<field name="taxes_exception"/>
|
||||
</group>
|
||||
<newline />
|
||||
<button name="do_payment" colspan="2" string="Pay / Advance" icon="tryton-currency"/>
|
||||
<button name="send_email" colspan="2" string="Send Email" icon="tryton-email"/>
|
||||
<button name="select_rooms" colspan="2" string="Rooms" icon="tryton-board"/>
|
||||
<notebook colspan="6">
|
||||
<page string="Lines" id="lines">
|
||||
<field name="lines" colspan="4"
|
||||
|
@ -50,8 +52,6 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="stock_moves" colspan="4"/>
|
||||
</page>
|
||||
<page string="Additional Info" id="additional_info">
|
||||
<label name="payment_term"/>
|
||||
<field name="payment_term" widget="selection"/>
|
||||
<label name="company"/>
|
||||
<field name="company"/>
|
||||
<label name="currency"/>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tree>
|
||||
<field name="channel_icon"/>
|
||||
<field name="number"/>
|
||||
<field name="party" expand="1"/>
|
||||
<field name="contact" expand="1"/>
|
||||
|
|
|
@ -24,12 +24,12 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="cleaning_occupied"/>
|
||||
<label name="storage_by_default"/>
|
||||
<field name="storage_by_default"/>
|
||||
<label name="payment_term"/>
|
||||
<field name="payment_term"/>
|
||||
<label name="default_channel_seller"/>
|
||||
<field name="default_channel_seller"/>
|
||||
<label name="age_children_policy"/>
|
||||
<field name="age_children_policy"/>
|
||||
<label name="quarantine_rooms"/>
|
||||
<field name="quarantine_rooms"/>
|
||||
<label name="booking_email_template"/>
|
||||
<field name="booking_email_template"/>
|
||||
<field name="default_charges" colspan="4"/>
|
||||
|
|
Loading…
Reference in New Issue