mirror of
https://bitbucket.org/presik/trytonpsk-rental.git
synced 2023-12-14 06:53:01 +01:00
add field signature
This commit is contained in:
parent
2ce574b7b6
commit
bf16874954
5 changed files with 41 additions and 30 deletions
64
booking.py
64
booking.py
|
@ -18,7 +18,7 @@ class Booking(Workflow, ModelSQL, ModelView):
|
||||||
'Rental Booking'
|
'Rental Booking'
|
||||||
__name__ = 'rental.booking'
|
__name__ = 'rental.booking'
|
||||||
_rec_name = 'number'
|
_rec_name = 'number'
|
||||||
number = fields.Char('Number', readonly=True, select=True)
|
number = fields.Char('Number', readonly=True)
|
||||||
equipment = fields.Many2One('maintenance.equipment', 'Equipment',
|
equipment = fields.Many2One('maintenance.equipment', 'Equipment',
|
||||||
states=STATES)
|
states=STATES)
|
||||||
type_document = fields.Selection([
|
type_document = fields.Selection([
|
||||||
|
@ -27,18 +27,19 @@ class Booking(Workflow, ModelSQL, ModelView):
|
||||||
('driver_license', 'Driver License'),
|
('driver_license', 'Driver License'),
|
||||||
('medicare_card', 'Medicare Card'),
|
('medicare_card', 'Medicare Card'),
|
||||||
], 'Document Type', states=STATES)
|
], 'Document Type', states=STATES)
|
||||||
doc_number = fields.Char('Doc. Number', required=True, select=True)
|
doc_number = fields.Char('Doc. Number', required=True)
|
||||||
party = fields.Many2One('party.party', 'Customer', select=True,
|
party = fields.Many2One('party.party', 'Customer',
|
||||||
states=STATES)
|
states=STATES)
|
||||||
first_name = fields.Char('First Name', required=True, select=True)
|
first_name = fields.Char('First Name', required=True)
|
||||||
last_name = fields.Char('Last Name', required=True, select=True)
|
last_name = fields.Char('Last Name', required=True)
|
||||||
mobile = fields.Char('Mobile', required=True, select=True)
|
mobile = fields.Char('Mobile', required=True)
|
||||||
email = fields.Char('Email', required=True, select=True)
|
email = fields.Char('Email', required=True)
|
||||||
|
signature = fields.Char('signature', required=False)
|
||||||
subdivision = fields.Many2One('country.subdivision', 'Subdivision')
|
subdivision = fields.Many2One('country.subdivision', 'Subdivision')
|
||||||
address = fields.Char('Address', select=True, states=STATES)
|
address = fields.Char('Address', states=STATES)
|
||||||
city = fields.Char('City', select=True, states=STATES)
|
city = fields.Char('City', states=STATES)
|
||||||
suburb = fields.Char('Suburb', select=True, states=STATES)
|
suburb = fields.Char('Suburb', states=STATES)
|
||||||
post_code = fields.Char('Post Code', select=True, states=STATES)
|
post_code = fields.Char('Post Code', states=STATES)
|
||||||
company = fields.Many2One('company.company', 'Company', required=True,
|
company = fields.Many2One('company.company', 'Company', required=True,
|
||||||
states=STATES, domain=[
|
states=STATES, domain=[
|
||||||
('id', If(In('company', Eval('context', {})), '=', '!='),
|
('id', If(In('company', Eval('context', {})), '=', '!='),
|
||||||
|
@ -53,6 +54,7 @@ class Booking(Workflow, ModelSQL, ModelView):
|
||||||
start_date = fields.DateTime('Start Date', states=STATES)
|
start_date = fields.DateTime('Start Date', states=STATES)
|
||||||
end_date = fields.DateTime('End Date', states=STATES)
|
end_date = fields.DateTime('End Date', states=STATES)
|
||||||
comment = fields.Char('Comment', states=STATES)
|
comment = fields.Char('Comment', states=STATES)
|
||||||
|
signature = fields.Char('Signature', states=STATES)
|
||||||
notification_pickup = fields.Boolean('SMS Notification Pickup')
|
notification_pickup = fields.Boolean('SMS Notification Pickup')
|
||||||
state = fields.Selection([
|
state = fields.Selection([
|
||||||
('draft', 'Draft'),
|
('draft', 'Draft'),
|
||||||
|
@ -149,13 +151,13 @@ class Booking(Workflow, ModelSQL, ModelView):
|
||||||
@Workflow.transition('booking')
|
@Workflow.transition('booking')
|
||||||
def booking(cls, records):
|
def booking(cls, records):
|
||||||
cls.set_number(records)
|
cls.set_number(records)
|
||||||
for rec in records:
|
# for rec in records:
|
||||||
rec.send_emails()
|
# rec.send_emails()
|
||||||
|
|
||||||
res = {
|
# res = {
|
||||||
'status': 'success',
|
# 'status': 'success',
|
||||||
'msg': 'Booking succesful, please check your mail for more details!'
|
# 'msg': 'Booking succesful, please check your mail for more details!'
|
||||||
}
|
# }
|
||||||
# return res
|
# return res
|
||||||
|
|
||||||
# @classmethod
|
# @classmethod
|
||||||
|
@ -168,10 +170,12 @@ class Booking(Workflow, ModelSQL, ModelView):
|
||||||
# return bookings
|
# return bookings
|
||||||
|
|
||||||
def send_email_confirmation(self):
|
def send_email_confirmation(self):
|
||||||
|
print(self, "self")
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
config = pool.get('rental.configuration')(1)
|
config = pool.get('rental.configuration')(1)
|
||||||
Template = pool.get('email.template')
|
Template = pool.get('email.template')
|
||||||
return Template.send(config.email_booking_customer, self, self.email)
|
return Template.send(config.email_booking_customer, self, self.email)
|
||||||
|
# return Template.send(config.email_booking_customer, self, self.email, attach=True)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ModelView.button
|
@ModelView.button
|
||||||
|
@ -184,8 +188,12 @@ class Booking(Workflow, ModelSQL, ModelView):
|
||||||
@ModelView.button
|
@ModelView.button
|
||||||
@Workflow.transition('processed')
|
@Workflow.transition('processed')
|
||||||
def process(cls, records):
|
def process(cls, records):
|
||||||
|
|
||||||
|
print("cls", cls)
|
||||||
|
print("record", record)
|
||||||
for record in records:
|
for record in records:
|
||||||
record.create_service()
|
record.create_service()
|
||||||
|
record.send_emails()
|
||||||
|
|
||||||
@fields.depends('lapse_time', 'start_date', 'end_date')
|
@fields.depends('lapse_time', 'start_date', 'end_date')
|
||||||
def on_change_with_end_date(self, name=None):
|
def on_change_with_end_date(self, name=None):
|
||||||
|
@ -270,13 +278,16 @@ class Booking(Workflow, ModelSQL, ModelView):
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
config = pool.get('rental.configuration')(1)
|
config = pool.get('rental.configuration')(1)
|
||||||
Template = pool.get('email.template')
|
Template = pool.get('email.template')
|
||||||
|
print("template", config.email_rental_customer )
|
||||||
|
print("selft", self )
|
||||||
|
print("self.email", self.email )
|
||||||
try:
|
try:
|
||||||
response = Template.send(config.email_booking_customer, self, self.email)
|
response = Template.send(config.email_rental_customer, self, self.email)
|
||||||
if response.status_code == 202:
|
if response.status_code == 202:
|
||||||
print('correo enviado')
|
print('correo enviado')
|
||||||
else:
|
else:
|
||||||
response.json()
|
response.json()
|
||||||
Template.send(config.email_booking_company, self, self.company.party.email)
|
Template.send(config.email_rental_company, self, self.company.party.email)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
@ -285,19 +296,11 @@ class Booking(Workflow, ModelSQL, ModelView):
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
config = pool.get('rental.configuration')(1)
|
config = pool.get('rental.configuration')(1)
|
||||||
Template = pool.get('email.template')
|
Template = pool.get('email.template')
|
||||||
try:
|
return Template.send(config.emaild_rental_customer, self, self.email)
|
||||||
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):
|
def create_service(self):
|
||||||
|
print(self, "paso por aca para crear el servicio")
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
Party = pool.get('party.party')
|
Party = pool.get('party.party')
|
||||||
Rental = pool.get('rental.service')
|
Rental = pool.get('rental.service')
|
||||||
|
@ -305,7 +308,7 @@ class Booking(Workflow, ModelSQL, ModelView):
|
||||||
Equipment = pool.get('maintenance.equipment')
|
Equipment = pool.get('maintenance.equipment')
|
||||||
Item = pool.get('product.check_list_item')
|
Item = pool.get('product.check_list_item')
|
||||||
ProductCheckList = pool.get('rental.service.product_check_list')
|
ProductCheckList = pool.get('rental.service.product_check_list')
|
||||||
config = Config(1)
|
config = Config(1)
|
||||||
|
|
||||||
values = {
|
values = {
|
||||||
'name': self.first_name + ' ' + self.last_name,
|
'name': self.first_name + ' ' + self.last_name,
|
||||||
|
@ -334,6 +337,7 @@ class Booking(Workflow, ModelSQL, ModelView):
|
||||||
'party': party.id,
|
'party': party.id,
|
||||||
'booking': self.id,
|
'booking': self.id,
|
||||||
'service_product': config.default_service.id,
|
'service_product': config.default_service.id,
|
||||||
|
'photo_link_signature': self.signature,
|
||||||
'service_date': self.booking_date,
|
'service_date': self.booking_date,
|
||||||
'start_date': date.today(),
|
'start_date': date.today(),
|
||||||
'state': 'draft'
|
'state': 'draft'
|
||||||
|
|
2
dash.py
2
dash.py
|
@ -46,3 +46,5 @@ class AppWebBookingRental(DashAppBase):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -134,6 +134,7 @@ class Service(Workflow, ModelSQL, ModelView):
|
||||||
cover_prices = fields.Boolean('Cover Prices')
|
cover_prices = fields.Boolean('Cover Prices')
|
||||||
customer_contract_agree = fields.Boolean('Customer Contract Agree')
|
customer_contract_agree = fields.Boolean('Customer Contract Agree')
|
||||||
photo_link_agree = fields.Char('Photo Link Contract Agree')
|
photo_link_agree = fields.Char('Photo Link Contract Agree')
|
||||||
|
photo_link_signature = fields.Char('Photo Link Signature')
|
||||||
photo_link_party_id = fields.Char('Photo Link Party ID')
|
photo_link_party_id = fields.Char('Photo Link Party ID')
|
||||||
photo_return_device = fields.Char('Photo Return Device')
|
photo_return_device = fields.Char('Photo Return Device')
|
||||||
id_number = fields.Function(fields.Char('ID Number'), 'get_party_info')
|
id_number = fields.Function(fields.Char('ID Number'), 'get_party_info')
|
||||||
|
|
|
@ -50,6 +50,8 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<field name="company"/>
|
<field name="company"/>
|
||||||
<label name="comment"/>
|
<label name="comment"/>
|
||||||
<field name="comment"/>
|
<field name="comment"/>
|
||||||
|
<label name="signature"/>
|
||||||
|
<field name="signature" widget="url"/>
|
||||||
<label name="notification_pickup"/>
|
<label name="notification_pickup"/>
|
||||||
<field name="notification_pickup"/>
|
<field name="notification_pickup"/>
|
||||||
</page>
|
</page>
|
||||||
|
|
|
@ -99,6 +99,8 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<field name="odometer_end"/>
|
<field name="odometer_end"/>
|
||||||
<label name="photo_link_agree"/>
|
<label name="photo_link_agree"/>
|
||||||
<field name="photo_link_agree" widget="url"/>
|
<field name="photo_link_agree" widget="url"/>
|
||||||
|
<label name="photo_link_signature"/>
|
||||||
|
<field name="photo_link_signature" widget="url"/>
|
||||||
<label name="photo_link_party_id"/>
|
<label name="photo_link_party_id"/>
|
||||||
<field name="photo_link_party_id" widget="url"/>
|
<field name="photo_link_party_id" widget="url"/>
|
||||||
<label name="photo_return_device"/>
|
<label name="photo_return_device"/>
|
||||||
|
|
Loading…
Reference in a new issue