Fix
This commit is contained in:
parent
92cfb69491
commit
2497d76753
|
@ -28,7 +28,6 @@ def register():
|
||||||
room.RoomTemplate,
|
room.RoomTemplate,
|
||||||
city.MigrationCity,
|
city.MigrationCity,
|
||||||
location.HotelLocation,
|
location.HotelLocation,
|
||||||
channel.SaleChannel,
|
|
||||||
policy.HotelPolicyCancellation,
|
policy.HotelPolicyCancellation,
|
||||||
company.Company,
|
company.Company,
|
||||||
configuration.ConfigurationProduct,
|
configuration.ConfigurationProduct,
|
||||||
|
@ -41,12 +40,15 @@ def register():
|
||||||
housekeeping.Housekeeping,
|
housekeeping.Housekeeping,
|
||||||
housekeeping.HousekeepingCleaningType,
|
housekeeping.HousekeepingCleaningType,
|
||||||
party.Party,
|
party.Party,
|
||||||
|
channel.SaleChannel,
|
||||||
channel.ChannelTax,
|
channel.ChannelTax,
|
||||||
|
channel.ChannelCommission,
|
||||||
booking.SelectRoomsAsk,
|
booking.SelectRoomsAsk,
|
||||||
booking.BookingVoucher,
|
booking.BookingVoucher,
|
||||||
booking.RoomsOccupancyStart,
|
booking.RoomsOccupancyStart,
|
||||||
booking.BookingForecastStart,
|
booking.BookingForecastStart,
|
||||||
booking.UpdateHolderStart,
|
booking.UpdateHolderStart,
|
||||||
|
booking.BookingChannelCommision,
|
||||||
folio.FolioGuest,
|
folio.FolioGuest,
|
||||||
folio.GuestsListStart,
|
folio.GuestsListStart,
|
||||||
folio.StatisticsByMonthStart,
|
folio.StatisticsByMonthStart,
|
||||||
|
|
15
booking.py
15
booking.py
|
@ -154,6 +154,10 @@ class Booking(Workflow, ModelSQL, ModelView):
|
||||||
)
|
)
|
||||||
invoices = fields.Function(fields.Many2Many('account.invoice',
|
invoices = fields.Function(fields.Many2Many('account.invoice',
|
||||||
None, None, 'Invoices'), 'get_invoices')
|
None, None, 'Invoices'), 'get_invoices')
|
||||||
|
extra_commissions = fields.Many2Many('hotel.booking-channel.commission',
|
||||||
|
'booking', 'commission', 'Channel Commission', domain=[
|
||||||
|
('channel', '=', Eval('channel'))
|
||||||
|
])
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def __setup__(cls):
|
def __setup__(cls):
|
||||||
|
@ -1716,6 +1720,15 @@ class ManagerReport(Report):
|
||||||
report_context['guests_by_city'] = guests_by_city.values()
|
report_context['guests_by_city'] = guests_by_city.values()
|
||||||
report_context['company'] = Company(data['company'])
|
report_context['company'] = Company(data['company'])
|
||||||
user_id = Transaction().context.get('user')
|
user_id = Transaction().context.get('user')
|
||||||
print(user_id)
|
|
||||||
report_context['user'] = User(user_id)
|
report_context['user'] = User(user_id)
|
||||||
return report_context
|
return report_context
|
||||||
|
|
||||||
|
|
||||||
|
class BookingChannelCommision(ModelSQL):
|
||||||
|
'Booking Channel Commision'
|
||||||
|
__name__ = 'hotel.booking-channel.commission'
|
||||||
|
_table = 'hotel_booking_channel_commission_rel'
|
||||||
|
commission = fields.Many2One('hotel.channel.commission', 'Channel Commission',
|
||||||
|
ondelete='CASCADE', select=True, required=True)
|
||||||
|
booking = fields.Many2One('hotel.booking', 'Booking', ondelete='RESTRICT',
|
||||||
|
required=True)
|
||||||
|
|
19
channel.py
19
channel.py
|
@ -8,6 +8,15 @@ from trytond.pool import Pool
|
||||||
from .constants import PAYMENT_METHOD_CHANNEL
|
from .constants import PAYMENT_METHOD_CHANNEL
|
||||||
|
|
||||||
|
|
||||||
|
class ChannelCommission(ModelSQL, ModelView):
|
||||||
|
'Channel Commission Extra'
|
||||||
|
__name__ = 'hotel.channel.commission'
|
||||||
|
channel = fields.Many2One('hotel.channel', 'Sale Channel',
|
||||||
|
ondelete='CASCADE', select=True, required=True)
|
||||||
|
name = fields.Char('Name', required=True)
|
||||||
|
commission = fields.Float('Commission', required=True, digits=(4, 2))
|
||||||
|
|
||||||
|
|
||||||
class SaleChannel(ModelSQL, ModelView):
|
class SaleChannel(ModelSQL, ModelView):
|
||||||
'Sale Channel'
|
'Sale Channel'
|
||||||
__name__ = 'hotel.channel'
|
__name__ = 'hotel.channel'
|
||||||
|
@ -45,15 +54,17 @@ class SaleChannel(ModelSQL, ModelView):
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
currency = fields.Many2One('currency.currency', 'Currency',
|
currency = fields.Many2One('currency.currency', 'Currency',
|
||||||
required=True)
|
required=True)
|
||||||
price_list = fields.Many2One('product.price_list', 'Price List')
|
price_list = fields.Many2One('product.price_list', 'Price List')
|
||||||
payment_method = fields.Selection(PAYMENT_METHOD_CHANNEL,
|
payment_method = fields.Selection(PAYMENT_METHOD_CHANNEL, 'Payment Method')
|
||||||
'Payment Method')
|
|
||||||
collection_mode = fields.Selection([
|
collection_mode = fields.Selection([
|
||||||
('', ''),
|
('', ''),
|
||||||
('anticipated', 'Anticipated'),
|
('anticipated', 'Anticipated'),
|
||||||
('after_sale', 'After-Sale'),
|
('after_sale', 'After-Sale'),
|
||||||
], 'Collection Mode', required=False, help="Commission collection mode")
|
], 'Collection Mode', required=False,
|
||||||
|
help="Commission collection mode")
|
||||||
|
extra_commissions = fields.One2Many('hotel.channel.commission',
|
||||||
|
'channel', 'Extra Commissions')
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def default_company():
|
def default_company():
|
||||||
|
|
11
channel.xml
11
channel.xml
|
@ -4,6 +4,17 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<tryton>
|
<tryton>
|
||||||
<data>
|
<data>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="hotel_channel_commission_view_tree">
|
||||||
|
<field name="model">hotel.channel.commission</field>
|
||||||
|
<field name="type">tree</field>
|
||||||
|
<field name="name">channel_commission_tree</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.ui.view" id="hotel_channel_commission_view_form">
|
||||||
|
<field name="model">hotel.channel.commission</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="name">channel_commission_form</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
<record model="ir.ui.view" id="hotel_channel_view_tree">
|
<record model="ir.ui.view" id="hotel_channel_view_tree">
|
||||||
<field name="model">hotel.channel</field>
|
<field name="model">hotel.channel</field>
|
||||||
<field name="type">tree</field>
|
<field name="type">tree</field>
|
||||||
|
|
|
@ -75,6 +75,7 @@ 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"/>
|
||||||
|
<field name="extra_commissions" colspan="4"/>
|
||||||
</page>
|
</page>
|
||||||
</notebook>
|
</notebook>
|
||||||
<group col="5" colspan="4" id="buttons">
|
<group col="5" colspan="4" id="buttons">
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||||
|
this repository contains the full copyright notices and license terms. -->
|
||||||
|
<form>
|
||||||
|
<label name="name"/>
|
||||||
|
<field name="name"/>
|
||||||
|
<label name="commission"/>
|
||||||
|
<field name="commission"/>
|
||||||
|
</form>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!-- 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="name"/>
|
||||||
|
<field name="commission"/>
|
||||||
|
</tree>
|
|
@ -25,4 +25,5 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<label name="price_list"/>
|
<label name="price_list"/>
|
||||||
<field name="price_list"/>
|
<field name="price_list"/>
|
||||||
<field name="taxes" colspan="4"/>
|
<field name="taxes" colspan="4"/>
|
||||||
|
<field name="extra_commissions" colspan="4"/>
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Reference in New Issue