mirror of
https://bitbucket.org/presik/trytonpsk-hotel.git
synced 2023-12-14 07:52:52 +01:00
Fix
This commit is contained in:
parent
fdf276695b
commit
377e011b4c
|
@ -20,6 +20,7 @@ from . import statement
|
|||
from . import stock
|
||||
from . import operation
|
||||
from . import ir
|
||||
from . import email_activity
|
||||
|
||||
|
||||
def register():
|
||||
|
@ -45,8 +46,7 @@ def register():
|
|||
booking.BookingStatementLine,
|
||||
booking.StatementPaymentForm,
|
||||
statement.StatementLine,
|
||||
# housekeeping.Housekeeping,
|
||||
# housekeeping.HousekeepingCleaningType,
|
||||
email_activity.EmailActivity,
|
||||
party.Party,
|
||||
channel.SaleChannel,
|
||||
channel.ChannelTax,
|
||||
|
|
15
booking.py
15
booking.py
|
@ -167,6 +167,13 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
readonly=True), 'get_stock_moves')
|
||||
channel_icon = fields.Function(fields.Char('Channel Icon'),
|
||||
'get_channel_icon')
|
||||
emails = fields.One2Many('email.activity', 'origin',
|
||||
'Emails', readonly=True,
|
||||
# domain=[
|
||||
# ('patient', '=', Eval('patient')),
|
||||
# ('urgent', '=', True),
|
||||
# ]
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
|
@ -1075,13 +1082,19 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
pool = Pool()
|
||||
config = pool.get('hotel.configuration')(1)
|
||||
Template = pool.get('email.template')
|
||||
Activity = pool.get('email.activity')
|
||||
email = self.party.email
|
||||
template = getattr(config, name)
|
||||
if not template:
|
||||
return
|
||||
template.subject = f'{template.subject} No. {self.number}'
|
||||
if email:
|
||||
Template.send(template, self, email, attach=True)
|
||||
res = Template.send(template, self, email, attach=True)
|
||||
Activity.create([{
|
||||
'template': template.id,
|
||||
'origin': str(self),
|
||||
'status': 'sended',
|
||||
}])
|
||||
else:
|
||||
raise UserError(gettext('hotel.msg_missing_party_email'))
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<div style="text-align: center;">
|
||||
<img alt="image_logo" src="{{record.company.logo_link}}" />
|
||||
<img width="220" alt="image_logo" src="{{record.company.logo_link}}" />
|
||||
</div>
|
||||
<br />
|
||||
<p>Estimado cliente</p>
|
||||
|
@ -36,7 +36,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>Canal / Channel:</td>
|
||||
<td><b>{{record.channel and record.channel.name}}</b></td>
|
||||
<td><b>{{record.channel and record.channel.name or ''}}</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Fecha de llegada / Arrival date:</td>
|
||||
|
|
27
email_activity.py
Normal file
27
email_activity.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
# 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 trytond.pool import PoolMeta
|
||||
from trytond.model import fields, ModelView, ModelSQL
|
||||
from trytond.transaction import Transaction
|
||||
|
||||
|
||||
class EmailActivity(metaclass=PoolMeta):
|
||||
__name__ = 'email.activity'
|
||||
|
||||
@classmethod
|
||||
def _get_origin(cls):
|
||||
origins = super(EmailActivity, cls)._get_origin()
|
||||
origins.extend([
|
||||
'hotel.booking',
|
||||
])
|
||||
return origins
|
||||
|
||||
# @classmethod
|
||||
# def get_selection(cls):
|
||||
# options = super(DashApp, cls).get_selection()
|
||||
# options.extend([
|
||||
# ('hotel_planner', 'Planner'),
|
||||
# ('housekeeping', 'Housekeeping'),
|
||||
# ('web_checkin', 'Housekeeping'),
|
||||
# ])
|
||||
# return options
|
|
@ -30,10 +30,14 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="price_list" widget="selection"/>
|
||||
<label name="payment_term"/>
|
||||
<field name="payment_term" widget="selection"/>
|
||||
<group col="5" id="actions_taxes" colspan="6">
|
||||
<group col="5" id="actions" colspan="5">
|
||||
<button name="do_payment" string="Pay / Advance" icon="tryton-currency"/>
|
||||
<button name="select_rooms" string="Rooms" icon="tryton-board"/>
|
||||
<button name="send_email_booking" string="Send Email" icon="tryton-email"/>
|
||||
</group>
|
||||
<group col="4" id="add_info_group_taxes" colspan="1">
|
||||
<label name="group"/>
|
||||
<field name="group"/>
|
||||
<label name="taxes_exception"/>
|
||||
<field name="taxes_exception"/>
|
||||
</group>
|
||||
|
@ -92,6 +96,9 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="channel_invoice"/>
|
||||
<field name="extra_commissions" colspan="4"/>
|
||||
</page>
|
||||
<page string="Notifications" id="notifications">
|
||||
<field name="emails" colspan="4"/>
|
||||
</page>
|
||||
</notebook>
|
||||
<group col="7" colspan="4" id="buttons">
|
||||
<button name="cancel" string="Cancel" icon="tryton-cancel"/>
|
||||
|
|
Loading…
Reference in a new issue