configuring rental model email
This commit is contained in:
parent
f248b631c1
commit
f642e9a7df
|
@ -38,6 +38,8 @@ def register():
|
|||
equipment.RentalEquipment,
|
||||
dash.DashApp,
|
||||
dash.AppRental,
|
||||
dash.AppRentalb,
|
||||
dash.AppWebBookingRental,
|
||||
|
||||
module='rental', type_='model')
|
||||
Pool.register(
|
||||
|
|
32
booking.py
32
booking.py
|
@ -135,6 +135,7 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
@ModelView.button
|
||||
@Workflow.transition('draft')
|
||||
def draft(cls, records):
|
||||
print("¡Transición a estado 'draft' realizada con éxito!")
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
|
@ -146,7 +147,6 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
@classmethod
|
||||
@ModelView.button
|
||||
@Workflow.transition('booking')
|
||||
#fix me
|
||||
def booking(cls, records):
|
||||
cls.set_number(records)
|
||||
for rec in records:
|
||||
|
@ -156,8 +156,23 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
'status': 'success',
|
||||
'msg': 'Booking succesful, please check your mail for more details!'
|
||||
}
|
||||
return res
|
||||
# return res
|
||||
|
||||
# @classmethod
|
||||
# def create(cls, vlist):
|
||||
# bookings = super(Booking, cls).create(vlist)
|
||||
# print('paso por aca')
|
||||
|
||||
# for boo in bookings:
|
||||
# boo.send_email_confirmation()
|
||||
# return bookings
|
||||
|
||||
def send_email_confirmation(self):
|
||||
pool = Pool()
|
||||
config = pool.get('rental.configuration')(1)
|
||||
Template = pool.get('email.template')
|
||||
return Template.send(config.email_booking_customer, self, self.email)
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
def send_notification_pickup(cls, records):
|
||||
|
@ -255,8 +270,17 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
pool = Pool()
|
||||
config = pool.get('rental.configuration')(1)
|
||||
Template = pool.get('email.template')
|
||||
Template.send(config.email_booking_customer, self, self.email)
|
||||
Template.send(config.email_booking_company, self, self.company.party.email)
|
||||
try:
|
||||
response = Template.send(config.email_booking_customer, self, self.email)
|
||||
if response.status_code == 202:
|
||||
print('correo enviado')
|
||||
else:
|
||||
response.json()
|
||||
Template.send(config.email_booking_company, self, self.company.party.email)
|
||||
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
|
||||
def create_service(self):
|
||||
pool = Pool()
|
||||
|
|
|
@ -14,15 +14,13 @@ class Configuration(ModelSingleton, ModelSQL, ModelView):
|
|||
], required=True)
|
||||
rental_service_sequence = fields.Many2One('ir.sequence',
|
||||
'Rental Service Sequence', domain=[
|
||||
('company', 'in', [Eval('context', {}).get('company', 0), None]),
|
||||
('sequence_type', '=',
|
||||
Id('rental', 'sequence_type_rental_service')),
|
||||
Id('rental', 'sequence_type_rental')),
|
||||
], required=True)
|
||||
rental_booking_sequence = fields.Many2One('ir.sequence',
|
||||
'Rental Booking Sequence', domain=[
|
||||
('company', 'in', [Eval('context', {}).get('company', 0), None]),
|
||||
('sequence_type', '=',
|
||||
Id('rental', 'sequence_type_rental_service')),
|
||||
Id('rental', 'sequence_type_rental')),
|
||||
], required=True)
|
||||
value_early_return = fields.Numeric('Value to Early Return', digits=(16, 2),
|
||||
required=True)
|
||||
|
|
14
dash.py
14
dash.py
|
@ -13,6 +13,8 @@ class DashApp(metaclass=PoolMeta):
|
|||
origins.extend(
|
||||
[
|
||||
"dash.app.rental",
|
||||
"dash.app.rentalb",
|
||||
"dash.app.web_booking_rental",
|
||||
]
|
||||
)
|
||||
return origins
|
||||
|
@ -23,6 +25,8 @@ class DashApp(metaclass=PoolMeta):
|
|||
options.extend(
|
||||
[
|
||||
("rental", "Rental"),
|
||||
("rentalb", "Rentalb"),
|
||||
("web_booking_rental", "Web Booking Rental"),
|
||||
]
|
||||
)
|
||||
return options
|
||||
|
@ -32,3 +36,13 @@ class AppRental(DashAppBase):
|
|||
"Sale rental"
|
||||
__name__ = "dash.app.rental"
|
||||
|
||||
class AppRentalb(DashAppBase):
|
||||
"Sale rentalb"
|
||||
__name__ = "dash.app.rentalb"
|
||||
|
||||
class AppWebBookingRental(DashAppBase):
|
||||
"App Web BookingRental"
|
||||
__name__ = "dash.app.web_booking_rental"
|
||||
|
||||
|
||||
|
||||
|
|
25
dash.xml
25
dash.xml
|
@ -14,6 +14,31 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="active">True</field>
|
||||
<field name="app_name">rental</field>
|
||||
</record>
|
||||
<record model="dash.app.rentalb" id="dash_app_rentalb">
|
||||
<field name="company">1</field>
|
||||
<field name="icon">th</field>
|
||||
<field name="kind">internal</field>
|
||||
</record>
|
||||
<record model="dash.app" id="app_rentalb">
|
||||
<field name="name">Sale rentalb</field>
|
||||
<field name="origin">dash.app.rentalb,1</field>
|
||||
<field name="active">True</field>
|
||||
<field name="app_name">rentalb</field>
|
||||
</record>
|
||||
<record model="dash.app.web_booking_rental" id="dash_app_web_booking_rental">
|
||||
<field name="company">1</field>
|
||||
<field name="icon">key</field>
|
||||
<field name="kind">external</field>
|
||||
</record>
|
||||
<record model="dash.app" id="app_web_booking_rental">
|
||||
<field name="name">App Web BookingRental</field>
|
||||
<field name="origin">dash.app.web_booking_rental,1</field>
|
||||
<field name="active">True</field>
|
||||
<field name="app_name">web_booking_rental</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
|
||||
</data>
|
||||
</tryton>
|
||||
|
|
|
@ -8,7 +8,7 @@ depends:
|
|||
account_voucher
|
||||
maintenance
|
||||
dash
|
||||
# email
|
||||
email
|
||||
xml:
|
||||
rental.xml
|
||||
configuration.xml
|
||||
|
|
Loading…
Reference in New Issue