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
62
booking.py
62
booking.py
|
@ -18,7 +18,7 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
'Rental Booking'
|
||||
__name__ = 'rental.booking'
|
||||
_rec_name = 'number'
|
||||
number = fields.Char('Number', readonly=True, select=True)
|
||||
number = fields.Char('Number', readonly=True)
|
||||
equipment = fields.Many2One('maintenance.equipment', 'Equipment',
|
||||
states=STATES)
|
||||
type_document = fields.Selection([
|
||||
|
@ -27,18 +27,19 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
('driver_license', 'Driver License'),
|
||||
('medicare_card', 'Medicare Card'),
|
||||
], 'Document Type', states=STATES)
|
||||
doc_number = fields.Char('Doc. Number', required=True, select=True)
|
||||
party = fields.Many2One('party.party', 'Customer', select=True,
|
||||
doc_number = fields.Char('Doc. Number', required=True)
|
||||
party = fields.Many2One('party.party', 'Customer',
|
||||
states=STATES)
|
||||
first_name = fields.Char('First Name', required=True, select=True)
|
||||
last_name = fields.Char('Last Name', required=True, select=True)
|
||||
mobile = fields.Char('Mobile', required=True, select=True)
|
||||
email = fields.Char('Email', required=True, select=True)
|
||||
first_name = fields.Char('First Name', required=True)
|
||||
last_name = fields.Char('Last Name', required=True)
|
||||
mobile = fields.Char('Mobile', required=True)
|
||||
email = fields.Char('Email', required=True)
|
||||
signature = fields.Char('signature', required=False)
|
||||
subdivision = fields.Many2One('country.subdivision', 'Subdivision')
|
||||
address = fields.Char('Address', select=True, states=STATES)
|
||||
city = fields.Char('City', select=True, states=STATES)
|
||||
suburb = fields.Char('Suburb', select=True, states=STATES)
|
||||
post_code = fields.Char('Post Code', select=True, states=STATES)
|
||||
address = fields.Char('Address', states=STATES)
|
||||
city = fields.Char('City', states=STATES)
|
||||
suburb = fields.Char('Suburb', states=STATES)
|
||||
post_code = fields.Char('Post Code', states=STATES)
|
||||
company = fields.Many2One('company.company', 'Company', required=True,
|
||||
states=STATES, domain=[
|
||||
('id', If(In('company', Eval('context', {})), '=', '!='),
|
||||
|
@ -53,6 +54,7 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
start_date = fields.DateTime('Start Date', states=STATES)
|
||||
end_date = fields.DateTime('End Date', states=STATES)
|
||||
comment = fields.Char('Comment', states=STATES)
|
||||
signature = fields.Char('Signature', states=STATES)
|
||||
notification_pickup = fields.Boolean('SMS Notification Pickup')
|
||||
state = fields.Selection([
|
||||
('draft', 'Draft'),
|
||||
|
@ -149,13 +151,13 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
@Workflow.transition('booking')
|
||||
def booking(cls, records):
|
||||
cls.set_number(records)
|
||||
for rec in records:
|
||||
rec.send_emails()
|
||||
# for rec in records:
|
||||
# rec.send_emails()
|
||||
|
||||
res = {
|
||||
'status': 'success',
|
||||
'msg': 'Booking succesful, please check your mail for more details!'
|
||||
}
|
||||
# res = {
|
||||
# 'status': 'success',
|
||||
# 'msg': 'Booking succesful, please check your mail for more details!'
|
||||
# }
|
||||
# return res
|
||||
|
||||
# @classmethod
|
||||
|
@ -168,10 +170,12 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
# return bookings
|
||||
|
||||
def send_email_confirmation(self):
|
||||
print(self, "self")
|
||||
pool = Pool()
|
||||
config = pool.get('rental.configuration')(1)
|
||||
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, attach=True)
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
|
@ -184,8 +188,12 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
@ModelView.button
|
||||
@Workflow.transition('processed')
|
||||
def process(cls, records):
|
||||
|
||||
print("cls", cls)
|
||||
print("record", record)
|
||||
for record in records:
|
||||
record.create_service()
|
||||
record.send_emails()
|
||||
|
||||
@fields.depends('lapse_time', 'start_date', 'end_date')
|
||||
def on_change_with_end_date(self, name=None):
|
||||
|
@ -270,13 +278,16 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
pool = Pool()
|
||||
config = pool.get('rental.configuration')(1)
|
||||
Template = pool.get('email.template')
|
||||
print("template", config.email_rental_customer )
|
||||
print("selft", self )
|
||||
print("self.email", self.email )
|
||||
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:
|
||||
print('correo enviado')
|
||||
else:
|
||||
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:
|
||||
print(e)
|
||||
|
@ -285,19 +296,11 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
pool = Pool()
|
||||
config = pool.get('rental.configuration')(1)
|
||||
Template = pool.get('email.template')
|
||||
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)
|
||||
return Template.send(config.emaild_rental_customer, self, self.email)
|
||||
|
||||
|
||||
def create_service(self):
|
||||
print(self, "paso por aca para crear el servicio")
|
||||
pool = Pool()
|
||||
Party = pool.get('party.party')
|
||||
Rental = pool.get('rental.service')
|
||||
|
@ -334,6 +337,7 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
'party': party.id,
|
||||
'booking': self.id,
|
||||
'service_product': config.default_service.id,
|
||||
'photo_link_signature': self.signature,
|
||||
'service_date': self.booking_date,
|
||||
'start_date': date.today(),
|
||||
'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')
|
||||
customer_contract_agree = fields.Boolean('Customer 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_return_device = fields.Char('Photo Return Device')
|
||||
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"/>
|
||||
<label name="comment"/>
|
||||
<field name="comment"/>
|
||||
<label name="signature"/>
|
||||
<field name="signature" widget="url"/>
|
||||
<label name="notification_pickup"/>
|
||||
<field name="notification_pickup"/>
|
||||
</page>
|
||||
|
|
|
@ -99,6 +99,8 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="odometer_end"/>
|
||||
<label name="photo_link_agree"/>
|
||||
<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"/>
|
||||
<field name="photo_link_party_id" widget="url"/>
|
||||
<label name="photo_return_device"/>
|
||||
|
|
Loading…
Reference in a new issue