mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[WIP]pms: changes in pms portal
This commit is contained in:
@@ -81,6 +81,7 @@
|
||||
"views/reservation_portal_templates.xml",
|
||||
"views/res_company_views.xml",
|
||||
"views/traveller_report_template.xml",
|
||||
"views/assets.xml",
|
||||
"wizards/wizard_split_join_swap_reservation.xml",
|
||||
"views/pms_automated_mails_views.xml",
|
||||
"views/precheckin_portal_templates.xml",
|
||||
|
||||
@@ -128,6 +128,16 @@ class PortalFolio(CustomerPortal):
|
||||
return request.redirect("/my")
|
||||
values.update(self._folio_get_page_view_values(folio_sudo, access_token, **kw))
|
||||
values.update({"no_breadcrumbs": True, "error": {}})
|
||||
country_ids = request.env['res.country'].search([])
|
||||
state_ids = request.env['res.country.state'].search([])
|
||||
doc_type_ids = request.env["res.partner.id_category"].sudo().search([])
|
||||
values.update(
|
||||
{
|
||||
"country_ids": country_ids,
|
||||
"state_ids": state_ids,
|
||||
"doc_type_ids": doc_type_ids,
|
||||
}
|
||||
)
|
||||
return request.render("pms.portal_my_folio_precheckin", values)
|
||||
|
||||
|
||||
@@ -261,21 +271,6 @@ class PortalReservation(CustomerPortal):
|
||||
|
||||
|
||||
class PortalPrecheckin(CustomerPortal):
|
||||
def _prepare_home_portal_values(self, counters):
|
||||
partner = request.env.user.partner_id
|
||||
values = super()._prepare_home_portal_values(counters)
|
||||
Reservation = request.env["pms.reservation"].search(
|
||||
[("partner_id", "=", partner.id)]
|
||||
)
|
||||
if "checkin_count" in counters:
|
||||
checkin_partner_count = len(Reservation.checkin_partner_ids)
|
||||
values["checkin_count"] = (
|
||||
checkin_partner_count
|
||||
if Reservation.check_access_rights("read", raise_exception=False)
|
||||
else 0
|
||||
)
|
||||
return values
|
||||
|
||||
def _precheckin_get_page_view_values(self, checkin_partner, access_token, **kwargs):
|
||||
values = {"checkin_partner": checkin_partner, "token": access_token}
|
||||
return self._get_page_view_values(
|
||||
@@ -303,77 +298,95 @@ class PortalPrecheckin(CustomerPortal):
|
||||
except (AccessError, MissingError):
|
||||
return request.redirect("/my")
|
||||
values = self._precheckin_get_page_view_values(checkin_sudo, access_token, **kw)
|
||||
values.update({"no_breadcrumbs": True, "error": {}})
|
||||
country_ids = request.env['res.country'].search([])
|
||||
state_ids = request.env['res.country.state'].search([])
|
||||
doc_type_ids = request.env['res.partner.id_category'].sudo().search([])
|
||||
values.update(
|
||||
{
|
||||
"doc_type_ids": doc_type_ids,
|
||||
"country_ids": country_ids,
|
||||
"state_ids": state_ids,
|
||||
"no_breadcrumbs": True,
|
||||
"error": {}
|
||||
}
|
||||
)
|
||||
return request.render("pms.portal_my_precheckin_detail", values)
|
||||
|
||||
@http.route(["/my/precheckin"], type="http", auth="user", website=True, csrf=False)
|
||||
def portal_precheckin_submit(self, access_token=None, **kw):
|
||||
|
||||
values = dict()
|
||||
checkin_partner = request.env["pms.checkin.partner"].browse(
|
||||
int(kw.get("id"))
|
||||
)
|
||||
values.update(
|
||||
{
|
||||
"checkin_partner": checkin_partner,
|
||||
"error": {},
|
||||
"error_message": [],
|
||||
"error_message": {},
|
||||
}
|
||||
)
|
||||
country_ids = request.env['res.country'].search([])
|
||||
state_ids = request.env['res.country.state'].search([])
|
||||
doc_type_ids = request.env["res.partner.id_category"].sudo().search([])
|
||||
if kw:
|
||||
error, error_message = self.form_validate(kw, None)
|
||||
values.update(
|
||||
{
|
||||
"no_breadcrumbs": True,
|
||||
"error": error,
|
||||
"error_message": error_message,
|
||||
"country_ids": country_ids,
|
||||
"state_ids": state_ids,
|
||||
"doc_type_ids": doc_type_ids,
|
||||
}
|
||||
)
|
||||
if not error:
|
||||
values = kw
|
||||
checkin_partner = request.env["pms.checkin.partner"].browse(
|
||||
int(kw.get("id"))
|
||||
)
|
||||
if not values.get("birthdate_date"):
|
||||
values.update({"birthdate_date": False})
|
||||
if not values.get("document_expedition_date"):
|
||||
values.update({"document_expedition_date": False})
|
||||
lastname = True if values.get("lastname") else False
|
||||
firstname = True if values.get("firstname") else False
|
||||
lastname2 = True if values.get("lastname2") else False
|
||||
if not checkin_partner.partner_id and (
|
||||
lastname or firstname or lastname2
|
||||
):
|
||||
ResPartner = request.env["res.partner"]
|
||||
res_partner = ResPartner.create(values)
|
||||
if error:
|
||||
|
||||
return request.render("pms.portal_my_precheckin_detail", values)
|
||||
else:
|
||||
try:
|
||||
values = kw
|
||||
if values.get("document_type"):
|
||||
doc_type = request.env["res.partner.id_category"].sudo().search([("name", "=", values.get("document_type"))])
|
||||
values.update(
|
||||
{
|
||||
"document_type": doc_type,
|
||||
}
|
||||
)
|
||||
request.env["pms.checkin.partner"].sudo()._save_data_from_portal(values)
|
||||
doc_type_ids = request.env['res.partner.id_category'].sudo().search([])
|
||||
values.update(
|
||||
{
|
||||
"partner_id": res_partner.id,
|
||||
"doc_type_ids": doc_type_ids,
|
||||
}
|
||||
)
|
||||
elif checkin_partner.partner_id:
|
||||
res_partner = checkin_partner.partner_id
|
||||
res_partner.write(values)
|
||||
|
||||
checkin_partner.write(values)
|
||||
values1 = dict()
|
||||
values1.update(
|
||||
{
|
||||
"success": True,
|
||||
"checkin_partner": checkin_partner,
|
||||
"no_breadcrumbs": True,
|
||||
"error": {},
|
||||
}
|
||||
)
|
||||
return request.render("pms.portal_my_precheckin_detail", values1)
|
||||
try:
|
||||
checkin_partner = request.env["pms.checkin.partner"].browse(
|
||||
int(kw.get("id"))
|
||||
)
|
||||
values.update(
|
||||
{
|
||||
"checkin_partner": checkin_partner,
|
||||
"no_breadcrumbs": True,
|
||||
}
|
||||
)
|
||||
return request.render("pms.portal_my_precheckin_detail", values)
|
||||
except (AccessError, MissingError):
|
||||
return request.redirect("/my")
|
||||
# if values.get("document_type"):
|
||||
# doc_type_id = values.get("document_type")
|
||||
# doc_type = request.env["res.partner.id_category"].sudo().search([("id", "=", doc_type_id)])
|
||||
# values.update(
|
||||
# {
|
||||
# "document_type": doc_type,
|
||||
# }
|
||||
# )
|
||||
country_ids = request.env['res.country'].search([])
|
||||
state_ids = request.env['res.country.state'].search([])
|
||||
values.update(
|
||||
{
|
||||
"country_ids": country_ids,
|
||||
"state_ids": state_ids,
|
||||
}
|
||||
)
|
||||
values.update(
|
||||
{
|
||||
"success": True,
|
||||
"checkin_partner": checkin_partner,
|
||||
"no_breadcrumbs": True,
|
||||
"error": {},
|
||||
}
|
||||
)
|
||||
return request.render("pms.portal_my_precheckin_detail", values)
|
||||
except (AccessError, MissingError):
|
||||
return request.redirect("/my")
|
||||
|
||||
@http.route(
|
||||
["/my/precheckin/folio_reservation"],
|
||||
@@ -384,7 +397,7 @@ class PortalPrecheckin(CustomerPortal):
|
||||
)
|
||||
def portal_precheckin_folio_submit(self, **kw):
|
||||
errors = {}
|
||||
e_messages = []
|
||||
e_messages = {}
|
||||
counter = 1
|
||||
has_error = False
|
||||
checkin_partners = False
|
||||
@@ -396,47 +409,51 @@ class PortalPrecheckin(CustomerPortal):
|
||||
int(kw.get("reservation_id"))
|
||||
)
|
||||
checkin_partners = reservation.checkin_partner_ids
|
||||
country_ids = request.env['res.country'].search([])
|
||||
state_ids = request.env['res.country.state'].search([])
|
||||
doc_type_ids = request.env["res.partner.id_category"].sudo().search([])
|
||||
values = {
|
||||
"no_breadcrumbs": True,
|
||||
"country_ids": country_ids,
|
||||
"state_ids": state_ids,
|
||||
"doc_type_ids": doc_type_ids,
|
||||
}
|
||||
for checkin in checkin_partners:
|
||||
values = {
|
||||
"firstname": kw.get("firstname-" + str(counter)),
|
||||
"lastname": kw.get("lastname-" + str(counter)),
|
||||
"lastname2": kw.get("lastname2-" + str(counter)),
|
||||
"gender": kw.get("gender-" + str(counter)),
|
||||
"birthdate_date": kw.get("birthdate_date-" + str(counter))
|
||||
if kw.get("birthdate_date-" + str(counter))
|
||||
else False,
|
||||
"document_type": kw.get("document_type-" + str(counter)),
|
||||
"document_number": kw.get("document_number-" + str(counter)),
|
||||
"document_expedition_date": kw.get(
|
||||
"document_expedition_date-" + str(counter)
|
||||
values.update(
|
||||
{
|
||||
"id": kw.get("id-" + str(counter)),
|
||||
"firstname": kw.get("firstname-" + str(counter)),
|
||||
"lastname": kw.get("lastname-" + str(counter)),
|
||||
"lastname2": kw.get("lastname2-" + str(counter)),
|
||||
"gender": kw.get("gender-" + str(counter)),
|
||||
"birthdate_date": kw.get("birthdate_date-" + str(counter))
|
||||
if kw.get("birthdate_date-" + str(counter))
|
||||
else False,
|
||||
"document_type": kw.get("document_type-" + str(counter)),
|
||||
"document_number": kw.get("document_number-" + str(counter)),
|
||||
"document_expedition_date": kw.get(
|
||||
"document_expedition_date-" + str(counter)
|
||||
)
|
||||
if kw.get("document_expedition_date-" + str(counter))
|
||||
else False,
|
||||
"mobile": kw.get("mobile-" + str(counter)),
|
||||
"email": kw.get("email-" + str(counter)),
|
||||
}
|
||||
)
|
||||
if values.get("document_type"):
|
||||
doc_type_code = values.get("document_type")
|
||||
doc_type = request.env["res.partner.id_category"].sudo().search([("code", "=", doc_type_code)])
|
||||
values.update(
|
||||
{
|
||||
"document_type": doc_type,
|
||||
}
|
||||
)
|
||||
if kw.get("document_expedition_date-" + str(counter))
|
||||
else False,
|
||||
"mobile": kw.get("mobile-" + str(counter)),
|
||||
"email": kw.get("email-" + str(counter)),
|
||||
}
|
||||
error, error_message = self.form_validate(kw, counter)
|
||||
errors.update(error)
|
||||
if error_message:
|
||||
for e in error_message:
|
||||
e_messages.append(e)
|
||||
has_error = True
|
||||
else:
|
||||
lastname = True if kw.get("lastname-" + str(counter)) else False
|
||||
firstname = True if kw.get("firstname-" + str(counter)) else False
|
||||
lastname2 = True if kw.get("lastname2-" + str(counter)) else False
|
||||
if not checkin.partner_id and (lastname or firstname or lastname2):
|
||||
ResPartner = request.env["res.partner"]
|
||||
res_partner = ResPartner.create(values)
|
||||
values.update(
|
||||
{
|
||||
"partner_id": res_partner.id,
|
||||
}
|
||||
)
|
||||
elif checkin.partner_id:
|
||||
res_partner = checkin.partner_id
|
||||
res_partner.write(values)
|
||||
checkin.write(values)
|
||||
checkin.sudo()._save_data_from_portal(values)
|
||||
counter = counter + 1
|
||||
values = {"no_breadcrumbs": True}
|
||||
|
||||
@@ -480,7 +497,7 @@ class PortalPrecheckin(CustomerPortal):
|
||||
data[mobile],
|
||||
):
|
||||
error[mobile] = "error"
|
||||
error_message.append("Invalid phone")
|
||||
error_message[mobile] = "Invalid phone"
|
||||
birthdate_date = (
|
||||
"birthdate_date"
|
||||
if "birthdate_date" in keys
|
||||
@@ -488,32 +505,22 @@ class PortalPrecheckin(CustomerPortal):
|
||||
)
|
||||
if data[birthdate_date] and data[birthdate_date] > str(fields.Datetime.today()):
|
||||
error[birthdate_date] = "error"
|
||||
error_message.append("Birthdate must be less than today")
|
||||
document_expedition_date = (
|
||||
"document_expedition_date"
|
||||
if "document_expedition_date" in keys
|
||||
else "document_expedition_date-" + str(counter)
|
||||
)
|
||||
if data[document_expedition_date] and data[document_expedition_date] > str(
|
||||
fields.Datetime.today()
|
||||
):
|
||||
error[document_expedition_date] = "error"
|
||||
error_message.append("Expedition Date must be less than today")
|
||||
error_message[birthdate_date] = "Birthdate must be less than today"
|
||||
email = "email" if "email" in keys else "email-" + str(counter)
|
||||
if data[email] and not tools.single_email_re.match(data[email]):
|
||||
error[email] = "error"
|
||||
error_message.append("Email format is wrong")
|
||||
error_message[email] = "Email format is wrong"
|
||||
firstname = "firstname" if "firstname" in keys else "firstname-" + str(counter)
|
||||
lastname = "lastname" if "lastname" in keys else "lastname-" + str(counter)
|
||||
lastname2 = "lastname2" if "lastname2" in keys else "lastname2-" + str(counter)
|
||||
if not data[firstname] and not data[lastname] and not data[lastname2]:
|
||||
error[firstname] = "error"
|
||||
error_message.append("Firstname or any lastname are not included")
|
||||
error_message[firstname] = "Firstname or any lastname are not included"
|
||||
return error, error_message
|
||||
|
||||
def form_document_validate(self, data, counter):
|
||||
error = dict()
|
||||
error_message = []
|
||||
error_message = {}
|
||||
keys = data.keys()
|
||||
document_number = (
|
||||
"document_number"
|
||||
@@ -525,28 +532,23 @@ class PortalPrecheckin(CustomerPortal):
|
||||
if "document_type" in keys
|
||||
else "document_type-" + str(counter)
|
||||
)
|
||||
checkin_partner_id = "id" if "id" in keys else "id-" + str(counter)
|
||||
checkin_partner = request.env["pms.checkin.partner"].search(
|
||||
[("id", "=", data[checkin_partner_id])]
|
||||
document_expedition_date = (
|
||||
"document_expedition_date"
|
||||
if "document_expedition_date" in keys
|
||||
else "document_expedition_date-" + str(counter)
|
||||
)
|
||||
partner_id = checkin_partner.partner_id.id
|
||||
if partner_id:
|
||||
partners = request.env["res.partner"].search(
|
||||
[("id", "!=", str(partner_id))]
|
||||
)
|
||||
if data[document_expedition_date] and not data[document_number]:
|
||||
error[document_expedition_date] = "error"
|
||||
error_message[document_expedition_date] = "Document Number not entered and Document Type is not selected"
|
||||
if data[document_number]:
|
||||
for partner in partners:
|
||||
if data[document_number] == partner.document_number:
|
||||
error[document_number] = "error"
|
||||
error_message.append("Document Number already exists")
|
||||
if not data[document_type]:
|
||||
error[document_type] = "error"
|
||||
error_message.append("Document Type is not selected")
|
||||
error_message[document_type] ="Document Type is not selected"
|
||||
if data[document_type] == "D":
|
||||
if len(data[document_number]) == 9 or len(data[document_number]) == 10:
|
||||
if not re.match(r"^\d{8}[ -]?[a-zA-Z]$", data[document_number]):
|
||||
error[document_number] = "error"
|
||||
error_message.append("The DNI format is wrong")
|
||||
error_message[document_number] = "The DNI format is wrong"
|
||||
letters = {
|
||||
0: "T",
|
||||
1: "R",
|
||||
@@ -574,30 +576,44 @@ class PortalPrecheckin(CustomerPortal):
|
||||
}
|
||||
dni_number = data[document_number][0:8]
|
||||
dni_letter = data[document_number][
|
||||
len(data[document_number]) - 1 : len(data[document_number])
|
||||
]
|
||||
len(data[document_number]) - 1 : len(data[document_number])
|
||||
]
|
||||
if letters.get(int(dni_number) % 23) != dni_letter.upper():
|
||||
error[document_number] = "error"
|
||||
error_message.append("DNI is invalid")
|
||||
error_message[document_number] = "DNI format is invalid"
|
||||
else:
|
||||
error[document_number] = "error"
|
||||
error_message.append("DNI is invalid")
|
||||
error_message[document_number] = "DNI is invalid"
|
||||
if data[document_type] == "C" and not re.match(
|
||||
r"^\d{8}[ -]?[a-zA-Z]$", data[document_number]
|
||||
):
|
||||
error[document_number] = "error"
|
||||
error_message.append("The Driving License format is wrong")
|
||||
error_message[document_number] = "The Driving License format is wrong"
|
||||
if data[document_type] == "N" and not re.match(
|
||||
r"^[X|Y]{1}[ -]?\d{7,8}[ -]?[a-zA-Z]$", data[document_number]
|
||||
):
|
||||
error[document_number] = "error"
|
||||
error_message.append("The Spanish Residence Permit format is wrong")
|
||||
error_message[document_number] = "The Spanish Residence Permit format is wrong"
|
||||
if data[document_type] == "X" and not re.match(
|
||||
r"^[X|Y]{1}[ -]?\d{7,8}[ -]?[a-zA-Z]$", data[document_number]
|
||||
):
|
||||
error[document_number] = "error"
|
||||
error_message.append("The European Residence Permit format is wrong")
|
||||
error_message[document_number] = "The European Residence Permit format is wrong"
|
||||
elif data[document_type]:
|
||||
error[document_number] = "error"
|
||||
error_message.append("Document Number not entered")
|
||||
error_message[document_number] = "Document Number not entered"
|
||||
return error, error_message
|
||||
|
||||
|
||||
@http.route(
|
||||
["/my/precheckin/send_invitation"],
|
||||
auth="user",
|
||||
website=True,
|
||||
csrf=False,
|
||||
)
|
||||
def portal_precheckin_folio_send_invitation(self, **kw):
|
||||
print(kw)
|
||||
# checkin_partner_id = kw.get("checkin_partner_id")
|
||||
# checkin_partner = request.env["pms.checkin.partner"].search([("id", "=", checkin_partner_id)])
|
||||
# print(checkin_partner)
|
||||
return request.redirect("/my")
|
||||
|
||||
44
pms/data/precheckin_invitation_email_template.xml
Normal file
44
pms/data/precheckin_invitation_email_template.xml
Normal file
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record>
|
||||
<field id="precheckin_invitation_email" model="mail.template">
|
||||
<field name="name">Precheckin </field>
|
||||
<field name="model_id" ref="pms.model_pms_reservation" />
|
||||
<field
|
||||
name="subject"
|
||||
>${object.company_id.name} has confirmed your reservation in ${object.pms_property_id.name}</field>
|
||||
<field
|
||||
name="email_from"
|
||||
>${object.pms_property_id.partner_id.email | safe}</field>
|
||||
<field
|
||||
name="email_to"
|
||||
>${(object.email and '"%s" <%s>' % (object.name, object.email) or object.partner_id.email_formatted or '') | safe}</field>
|
||||
<field name="body_html" type="html">
|
||||
<p style="font-size: 2em; line_height=0px; color: #45C2B1;">__</p>
|
||||
Make your check-in now and save time
|
||||
<br/>
|
||||
Access our<strong>quick registration system</strong>. In a few steps you will be able to register your data in an agile, simple and secure way,<strong>avoiding queues at reception</strong>.
|
||||
If you register your data in our system, <strong>your passage through reception will be much faster</strong>, being able to enjoy the comfort of your room right away.
|
||||
<table>
|
||||
<tr>
|
||||
<td align="center" style="padding: 20px 0 0px 0; ">
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<p>
|
||||
<a href="${object.room_lines[0].fc_url}" target="_blank" style="text-decoration: none; color: #FFFFFF; font-size: 2em; padding: 10px 20px 10px 20px;">
|
||||
<div style="padding: 0.5em; background-color: #45C2B1; border-color: #45C2B1; border-width: 2px;border-style:solid; border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-style: solid;-webkit-border-radius: 10; -moz-border-radius: 10; border-radius: 10px;font-size: 12px;">Check-in
|
||||
</div>
|
||||
<center><img src="https://www.aldahotels.es/firma/email/llegada/check-in.png" alt="Hacer check-in" width="80px" height="80px" href="${object.room_lines[0].fc_url}"/></center></a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -7,6 +7,9 @@ import json
|
||||
from odoo import _, api, fields, models
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
from odoo.tools.safe_eval import safe_eval
|
||||
from datetime import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT
|
||||
|
||||
|
||||
class PmsCheckinPartner(models.Model):
|
||||
@@ -670,6 +673,26 @@ class PmsCheckinPartner(models.Model):
|
||||
checkin_vals[key] = value
|
||||
checkin.write(checkin_vals)
|
||||
|
||||
@api.model
|
||||
def calculate_doc_type_expedition_date_from_validity_date(self, doc_type, doc_date, birthdate):
|
||||
today = fields.datetime.today()
|
||||
datetime_doc_date = datetime.strptime(doc_date, DEFAULT_SERVER_DATE_FORMAT)
|
||||
if datetime_doc_date < today:
|
||||
return datetime_doc_date
|
||||
datetime_birthdate = datetime.strptime(birthdate, DEFAULT_SERVER_DATE_FORMAT)
|
||||
age = today.year - datetime_birthdate.year
|
||||
document_type = self.env["res.partner.id_category"].search([("id", "=", doc_type)])
|
||||
document_expedition_date = False
|
||||
if document_type.code == "D" or document_type.code == "P":
|
||||
if age < 30:
|
||||
document_expedition_date = datetime_doc_date - relativedelta(years=5)
|
||||
else:
|
||||
document_expedition_date = datetime_doc_date - relativedelta(years=10)
|
||||
if document_type.code == "C":
|
||||
if age < 70:
|
||||
document_expedition_date = datetime_doc_date - relativedelta(years=10)
|
||||
return document_expedition_date
|
||||
|
||||
def action_on_board(self):
|
||||
for record in self:
|
||||
if record.reservation_id.checkin > fields.Date.today():
|
||||
@@ -725,3 +748,31 @@ class PmsCheckinPartner(models.Model):
|
||||
"type": "ir.actions.act_window",
|
||||
"context": ctx,
|
||||
}
|
||||
def _save_data_from_portal(self, values):
|
||||
checkin_partner = self.env["pms.checkin.partner"].browse(int(values.get("id")))
|
||||
if values.get("nationality_id"):
|
||||
nationality_id = self.env['res.country'].search([("id", "=", values.get("nationality_id"))])
|
||||
values.update({"nationality_id": nationality_id.id})
|
||||
else:
|
||||
values.update({"nationality_id": False})
|
||||
if not values.get("document_type"):
|
||||
values.update({"document_type": False})
|
||||
# else:
|
||||
# doc_type_id = values.get("document_type")
|
||||
# document_type = self.env["res.partner.id_category"].search([("id", "=", doc_type_id)])
|
||||
# values.update({"document_type": document_type.id})
|
||||
if values.get("state"):
|
||||
state_id = self.env["res.country.state"].search([("id", "=", values.get("state"))])
|
||||
values.update(
|
||||
{
|
||||
"state_id": state_id
|
||||
}
|
||||
)
|
||||
values.pop("state")
|
||||
if values.get("document_expedition_date"):
|
||||
doc_type = values.get("document_type")
|
||||
doc_date = values.get("document_expedition_date")
|
||||
birthdate = values.get("birthdate_date")
|
||||
document_expedition_date = self.calculate_doc_type_expedition_date_from_validity_date(doc_type, doc_date, birthdate)
|
||||
values.update({"document_expedition_date": document_expedition_date})
|
||||
checkin_partner.sudo().write(values)
|
||||
|
||||
@@ -64,3 +64,4 @@ user_access_pms_automated_mails,user_access_pms_automated_mails,model_pms_automa
|
||||
access_pms_several_partners_wizard,access_pms_several_partners_wizard,model_pms_several_partners_wizard,base.group_user,1,1,1,1
|
||||
user_access_pms_precheckin_portal,user_access_pms_precheckin_portal,model_pms_checkin_partner,base.group_portal,1,0,0,0
|
||||
user_access_res_partner_portal,user_access_res_partner_portal,model_res_partner,base.group_portal,1,1,1,1
|
||||
user_access_pms_precheckin_portal,user_access_pms_precheckin_portal,model_pms_checkin_partner,base.group_portal,1,1,1,1
|
||||
|
||||
|
@@ -251,5 +251,12 @@
|
||||
<field name="groups" eval="[(4, ref('base.group_portal'))]" />
|
||||
<field name="perm_read" eval="True" />
|
||||
</record>
|
||||
<record id="res_checkin_partner_rule_portal" model="ir.rule">
|
||||
<field name="name">Portal Checkin Partner Rule</field>
|
||||
<field name="model_id" ref="model_pms_checkin_partner" />
|
||||
<field name="domain_force">[]</field>
|
||||
<field name="groups" eval="[(4, ref('base.group_portal'))]" />
|
||||
<field name="perm_read" eval="True"/>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
|
||||
68
pms/static/src/js/send_invitation_data.js
Normal file
68
pms/static/src/js/send_invitation_data.js
Normal file
@@ -0,0 +1,68 @@
|
||||
odoo.define('pms', function (require) {
|
||||
'use strict';
|
||||
|
||||
var core = require('web.core');
|
||||
var _t = core._t;
|
||||
var utils = require('web.utils');
|
||||
var publicWidget = require('web.public.widget');
|
||||
|
||||
publicWidget.registry.SendInvitationData = publicWidget.Widget.extend({
|
||||
selector: '.o_send_invitation_js',
|
||||
events: {
|
||||
'click': '_onReminderToggleClick',
|
||||
},
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
// init: function () {
|
||||
// this._super.apply(this, arguments);
|
||||
// this._onReminderToggleClick = _.debounce(this._onReminderToggleClick, 500, true);
|
||||
// },
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Handlers
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {Event} ev
|
||||
*/
|
||||
_onReminderToggleClick: function (ev) {
|
||||
// var self = this;
|
||||
// var $checkinPartner = $(ev.currentTarget).find('i');
|
||||
|
||||
this._rpc({
|
||||
route: '/my/precheckin/send_invitation',
|
||||
params: {
|
||||
checkin_partner_id: $checkinPartner.data('checkin_partner_id'),
|
||||
},
|
||||
})/*.then(function (result) {*/
|
||||
// if (result.error && result.error === 'ignored') {
|
||||
// self.displayNotification({
|
||||
// type: 'info',
|
||||
// title: _t('Error'),
|
||||
// message: _.str.sprintf(_t('Talk already in your Favorites')),
|
||||
// });
|
||||
// } else {
|
||||
// self.reminderOn = reminderOnValue;
|
||||
// var reminderText = self.reminderOn ? _t('Favorite On') : _t('Set Favorite');
|
||||
// self.$('.o_wetrack_js_reminder_text').text(reminderText);
|
||||
// self._updateDisplay();
|
||||
// var message = self.reminderOn ? _t('Talk added to your Favorites') : _t('Talk removed from your Favorites');
|
||||
// self.displayNotification({
|
||||
// type: 'info',
|
||||
// title: message
|
||||
// });
|
||||
// }
|
||||
// if (result.visitor_uuid) {
|
||||
// utils.set_cookie('visitor_uuid', result.visitor_uuid);
|
||||
// }
|
||||
// });
|
||||
},
|
||||
|
||||
|
||||
});
|
||||
return publicWidget.registry.SendInvitationData;
|
||||
|
||||
});
|
||||
10
pms/views/assets.xml
Normal file
10
pms/views/assets.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<template id="assets_frontend">
|
||||
<xpath expr="//script[last()]" position="after">
|
||||
<script type="text/javascript" src="/pms/static/src/js/send_invitation_data.js"></script>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
</odoo>
|
||||
@@ -4,9 +4,9 @@
|
||||
<t t-call="portal.portal_layout">
|
||||
<t t-set="additional_title">Contact Details</t>
|
||||
<form action="/my/precheckin" method="post">
|
||||
<div t-if="error_message" class="alert alert-danger" role="alert">
|
||||
<t t-foreach="error_message" t-as="err"><t t-esc="err" /><br /></t>
|
||||
</div>
|
||||
<!-- <div t-if="error_message" class="alert alert-danger" role="alert">-->
|
||||
<!-- <t t-foreach="error_message" t-as="err"><t t-esc="err" /><br /></t>-->
|
||||
<!-- </div>-->
|
||||
<div t-if="success" class="alert alert-success" role="alert">
|
||||
<span>Data saved successfully!</span>
|
||||
</div>
|
||||
@@ -22,7 +22,7 @@
|
||||
</div>
|
||||
<div class="col-lg-12">
|
||||
<div class="row">
|
||||
<div t-attf-class="form-group col-xl-6">
|
||||
<div t-attf-class="form-group col-xl-4 pb-xl-5 pt-xl-5">
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="firstname"
|
||||
@@ -33,8 +33,11 @@
|
||||
t-attf-class="form-control #{error.get('firstname') and 'is-invalid' or ''}"
|
||||
t-att-value="firstname or checkin_partner.firstname"
|
||||
/>
|
||||
<t t-if="error_message">
|
||||
<span class="text-danger" t-esc="error_message.get('firstname')"/>
|
||||
</t>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-xl-6">
|
||||
<div t-attf-class="form-group col-xl-4 pt-xl-5">
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="lastname"
|
||||
@@ -46,7 +49,7 @@
|
||||
t-att-value="lastname or checkin_partner.lastname"
|
||||
/>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-xl-6">
|
||||
<div t-attf-class="form-group col-xl-4 pt-xl-5">
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="lastname2"
|
||||
@@ -58,7 +61,63 @@
|
||||
t-att-value="lastname2 or checkin_partner.lastname2"
|
||||
/>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-xl-6">
|
||||
<div t-attf-class="form-group col-xl-4 pb-xl-5">
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="document_type"
|
||||
>Doc. Type</label>
|
||||
<select class="form-control #{error.get('document_type') and 'is-invalid' or ''}" name='document_type'>
|
||||
<option value="">Select an option</option>
|
||||
<t t-foreach="doc_type_ids" t-as='doc_type'>
|
||||
<option
|
||||
t-att-value="doc_type.name"
|
||||
t-att-selected="doc_type.id == checkin_partner.document_type.id"
|
||||
>
|
||||
<t t-esc='doc_type.name'/>
|
||||
</option>
|
||||
</t>
|
||||
</select>
|
||||
<t t-if="error_message">
|
||||
<span class="text-danger" t-esc="error_message.get('document_type')"/>
|
||||
</t>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-xl-4">
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="document_number"
|
||||
>Doc. Number</label>
|
||||
<input
|
||||
type="text"
|
||||
name="document_number"
|
||||
t-attf-class="form-control #{error.get('document_number') and 'is-invalid' or ''}"
|
||||
t-att-value="doc_number or checkin_partner.document_number"
|
||||
/>
|
||||
<t t-if="error_message">
|
||||
<span class="text-danger" t-esc="error_message.get('document_number')"/>
|
||||
</t>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-xl-4">
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="document_expedition_date"
|
||||
>Doc. Expedition Date/Doc. Validity Date</label>
|
||||
<span
|
||||
class="fa fa-question-circle fa-lg"
|
||||
data-toggle="tooltip"
|
||||
title="If you enter the validity date of the document, the expedition date will be automatically calculated and entered depending on the document type."
|
||||
style = "margin-left: 70px;"
|
||||
/>
|
||||
<input
|
||||
type="date"
|
||||
name="document_expedition_date"
|
||||
t-attf-class="form-control #{error.get('document_expedition_date') and 'is-invalid' or ''}"
|
||||
t-att-value="doc_exp_date or checkin_partner.document_expedition_date"
|
||||
/>
|
||||
<t t-if="error_message">
|
||||
<span class="text-danger" t-esc="error_message.get('document_expedition_date')"/>
|
||||
</t>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-xl-4 pb-xl-5">
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="birthdate_date"
|
||||
@@ -69,74 +128,11 @@
|
||||
t-attf-class="form-control #{error.get('birthdate_date') and 'is-invalid' or ''}"
|
||||
t-att-value="birth_date or checkin_partner.birthdate_date"
|
||||
/>
|
||||
<t t-if="error_message">
|
||||
<span class="text-danger" t-esc="error_message.get('birthdate_date')"/>
|
||||
</t>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-xl-6">
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="gender"
|
||||
>Gender</label>
|
||||
<div class="d-none"><p id="genderId"><t
|
||||
t-esc="checkin_partner.gender"
|
||||
/></p></div>
|
||||
<select
|
||||
class="form-control"
|
||||
id="gender"
|
||||
name="gender"
|
||||
t-att-value="gender or checkin_partner.gender"
|
||||
>
|
||||
<option value="">Select an option</option>
|
||||
<option value="female">Female</option>
|
||||
<option value="male">Male</option>
|
||||
<option value="other">Other</option>
|
||||
</select>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-xl-6">
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="document_type"
|
||||
>Doc. type</label>
|
||||
<div class="d-none"><p id="docTypeId"><t
|
||||
t-esc="checkin_partner.document_type"
|
||||
/></p></div>
|
||||
<select
|
||||
t-attf-class="form-control #{error.get('document_type') and 'is-invalid' or ''}"
|
||||
id="doc_type_id"
|
||||
name="document_type"
|
||||
t-att-value="document_type or checkin_partner.document_type"
|
||||
>
|
||||
<option value="">Select an option</option>
|
||||
<option value="D">DNI</option>
|
||||
<option value="C">Driving License</option>
|
||||
<option value="I">Identification Document</option>
|
||||
<option value="N">Spanish residence permit</option>
|
||||
<option value="X">European residence permit</option>
|
||||
</select>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-xl-6">
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="document_number"
|
||||
>Doc. number</label>
|
||||
<input
|
||||
type="text"
|
||||
name="document_number"
|
||||
t-attf-class="form-control #{error.get('document_number') and 'is-invalid' or ''}"
|
||||
t-att-value="doc_number or checkin_partner.document_number"
|
||||
/>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-xl-6">
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="document_expedition_date"
|
||||
>Doc. expedition date</label>
|
||||
<input
|
||||
type="date"
|
||||
name="document_expedition_date"
|
||||
t-attf-class="form-control #{error.get('document_expedition_date') and 'is-invalid' or ''}"
|
||||
t-att-value="doc_exp_date or checkin_partner.document_expedition_date"
|
||||
/>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-xl-6">
|
||||
<div t-attf-class="form-group col-xl-4">
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="mobile"
|
||||
@@ -147,8 +143,11 @@
|
||||
t-attf-class="form-control #{error.get('mobile') and 'is-invalid' or ''}"
|
||||
t-att-value="mobile or checkin_partner.mobile"
|
||||
/>
|
||||
<t t-if="error_message">
|
||||
<span class="text-danger" t-esc="error_message.get('mobile')"/>
|
||||
</t>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-xl-6">
|
||||
<div t-attf-class="form-group col-xl-4">
|
||||
<label class="col-form-label" for="email">Email</label>
|
||||
<input
|
||||
type="email"
|
||||
@@ -156,11 +155,79 @@
|
||||
t-attf-class="form-control #{error.get('email') and 'is-invalid' or ''}"
|
||||
t-att-value="email or checkin_partner.email"
|
||||
/>
|
||||
<t t-if="error_message">
|
||||
<span class="text-danger" t-esc="error_message.get('email')"/>
|
||||
</t>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-xl-4 pb-xl-5">
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="gender"
|
||||
>Gender</label>
|
||||
<div class="d-none"><p id="genderId"><t
|
||||
t-esc="checkin_partner.gender"
|
||||
/></p></div>
|
||||
<select
|
||||
class="form-control"
|
||||
name="gender"
|
||||
t-att-value="checkin_partner.gender"
|
||||
>
|
||||
<option value="">Select an option</option>
|
||||
<option
|
||||
value="female"
|
||||
t-att-selected="'female' == checkin_partner.gender"
|
||||
>
|
||||
Female
|
||||
</option>
|
||||
<option
|
||||
value="male"
|
||||
t-att-selected="'male' == checkin_partner.gender"
|
||||
>
|
||||
Male
|
||||
</option>
|
||||
<option
|
||||
value="other"
|
||||
t-att-selected="'other' == checkin_partner.gender"
|
||||
>
|
||||
Other
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-xl-4">
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="nationality_id"
|
||||
>Nationality</label>
|
||||
<select class="form-control" id="country" name='nationality_id'>
|
||||
<option value="">Select an option</option>
|
||||
<t t-foreach="country_ids" t-as='country_id'>
|
||||
<option
|
||||
t-att-value="country_id.id"
|
||||
t-att-selected="country_id.id == checkin_partner.nationality_id.id"
|
||||
>
|
||||
<t t-esc='country_id.name'/>
|
||||
</option>
|
||||
</t>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-xl-4">
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="state"
|
||||
>Country State</label>
|
||||
<select class="form-control" id="state" name='state'>
|
||||
<option value="">Select an option</option>
|
||||
<t t-foreach="state_ids" t-as='state'>
|
||||
<option t-att-value="state.id" t-att-country_id="state.country_id.id" t-att-selected="state.id == checkin_partner.state_id.id">
|
||||
<t t-esc="state.name" />
|
||||
</option>
|
||||
</t>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix">
|
||||
<div>
|
||||
<button type="submit" class="btn btn-primary float-right mb32 ">
|
||||
Confirm
|
||||
<span class="fa fa-long-arrow-right" />
|
||||
@@ -168,36 +235,56 @@
|
||||
</div>
|
||||
</form>
|
||||
</t>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
var select_doc_type = document.getElementById("doc_type_id")
|
||||
var document_type_value = document.getElementById("docTypeId").textContent
|
||||
for (let i=0;i<select_doc_type.length;i++){
|
||||
if (select_doc_type[i].value == document_type_value){
|
||||
select_doc_type[i].setAttribute("selected","True")
|
||||
}
|
||||
if (select_doc_type[i].value == document_type_value){
|
||||
select_doc_type[i].setAttribute("selected","True")
|
||||
}
|
||||
}
|
||||
|
||||
var select_gender = document.getElementById("gender")
|
||||
var gender_value = document.getElementById("genderId").textContent
|
||||
for (let i=0;i<select_gender.length;i++){
|
||||
if(select_gender[i].value==gender_value){
|
||||
select_gender[i].setAttribute("selected","True")
|
||||
}
|
||||
if(select_gender[i].value==gender_value){
|
||||
select_gender[i].setAttribute("selected","True")
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
let select_country = document.getElementById('country')
|
||||
|
||||
select_country.addEventListener("change", () => {
|
||||
let country_value = select_country.value
|
||||
Array.from(document.getElementById('state').options).forEach(element => {
|
||||
if (element.getAttribute('country_id') == country_value ) {
|
||||
element.style="";
|
||||
} else {
|
||||
element.style="display:none";
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
</template>
|
||||
<template id="portal_my_reservation_precheckin" name="Precheckin Reservation">
|
||||
<t t-call="portal.portal_layout">
|
||||
<t t-if="not reservation.checkin_partner_ids">
|
||||
<p
|
||||
>There are currently no precheckins in this reserva for your account.</p>
|
||||
>There are currently no precheckins in this reservation for your account.</p>
|
||||
</t>
|
||||
<t t-if="reservation.checkin_partner_ids" t-call="portal.portal_table">
|
||||
<thead>
|
||||
<tr class="active">
|
||||
<th>PreCheckin in Reservation <span
|
||||
t-field="reservation.name"
|
||||
/></th>
|
||||
t-field="reservation.name"
|
||||
/></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -209,7 +296,7 @@
|
||||
role="alert"
|
||||
>
|
||||
<t t-foreach="error_message" t-as="err"><t t-esc="err" /><br
|
||||
/></t>
|
||||
/></t>
|
||||
</div>
|
||||
<div t-if="success" class="alert alert-success" role="alert">
|
||||
<span>Data saved successfully!</span>
|
||||
@@ -241,165 +328,165 @@
|
||||
</a>
|
||||
|
||||
<div class="row o_portal_details">
|
||||
<div class="col-lg-8">
|
||||
<div
|
||||
<div class="col-lg-8">
|
||||
<div
|
||||
class="row collapse"
|
||||
t-att-id="id1"
|
||||
>
|
||||
<div
|
||||
<div
|
||||
t-attf-class="form-group col-xl-6"
|
||||
>
|
||||
<label
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="firstname"
|
||||
>Name</label>
|
||||
<input
|
||||
<input
|
||||
type="text"
|
||||
t-att-name="'firstname-' + str(count)"
|
||||
t-attf-class="form-control #{error.get('firstname-'+str(count)) and 'is-invalid' or ''}"
|
||||
t-att-value="firstname or (checkin_partner.firstname)"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
</div>
|
||||
<div
|
||||
t-attf-class="form-group col-xl-6"
|
||||
>
|
||||
<label
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="lastname"
|
||||
>Lastname</label>
|
||||
<input
|
||||
<input
|
||||
type="text"
|
||||
t-att-name="'lastname-' + str(count)"
|
||||
t-attf-class="form-control"
|
||||
t-att-value="lastname or checkin_partner.lastname"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
</div>
|
||||
<div
|
||||
t-attf-class="form-group col-xl-6"
|
||||
>
|
||||
<label
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="lastname2"
|
||||
> Second Lastname</label>
|
||||
<input
|
||||
<input
|
||||
type="text"
|
||||
t-att-name="'lastname2-' + str(count)"
|
||||
t-attf-class="form-control"
|
||||
t-att-value="lastname2 or checkin_partner.lastname2"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
</div>
|
||||
<div
|
||||
t-attf-class="form-group col-xl-6"
|
||||
>
|
||||
<label
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="birthdate_date"
|
||||
> Birth Date</label>
|
||||
<input
|
||||
<input
|
||||
type="date"
|
||||
t-att-name="'birthdate_date-'+ str(count)"
|
||||
t-attf-class="form-control #{error.get('birthdate_date-'+str(count)) and 'is-invalid' or ''}"
|
||||
t-att-value="birthdate_date or checkin_partner.birthdate_date"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
</div>
|
||||
<div
|
||||
t-attf-class="form-group col-xl-6"
|
||||
>
|
||||
<label
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="gender"
|
||||
>Gender</label>
|
||||
<div class="d-none"><p
|
||||
class="gender_class"
|
||||
t-att-id="'genderId'+str(count)"
|
||||
><t
|
||||
t-esc="checkin_partner.gender"
|
||||
/></p></div>
|
||||
class="gender_class"
|
||||
t-att-id="'genderId'+str(count)"
|
||||
><t
|
||||
t-esc="checkin_partner.gender"
|
||||
/></p></div>
|
||||
<select
|
||||
class="form-control select_gender_class"
|
||||
t-att-id="'gender-'+ str(count)"
|
||||
t-att-name="'gender-'+ str(count)"
|
||||
t-att-value="gender or checkin_partner.gender"
|
||||
>
|
||||
<option
|
||||
<option
|
||||
value=""
|
||||
>Select an option</option>
|
||||
<option
|
||||
<option
|
||||
value="female"
|
||||
>Female</option>
|
||||
<option
|
||||
<option
|
||||
value="male"
|
||||
>Male</option>
|
||||
<option
|
||||
<option
|
||||
value="other"
|
||||
>Other</option>
|
||||
</select>
|
||||
</div>
|
||||
<div
|
||||
</select>
|
||||
</div>
|
||||
<div
|
||||
t-attf-class="form-group col-xl-6"
|
||||
>
|
||||
<label
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="document_type"
|
||||
>Doc. type</label>
|
||||
|
||||
<div class="d-none"><p
|
||||
class="doc_type_class"
|
||||
t-att-id="'docTypeId'+str(count)"
|
||||
><t
|
||||
t-esc="checkin_partner.document_type"
|
||||
/></p></div>
|
||||
class="doc_type_class"
|
||||
t-att-id="'docTypeId'+str(count)"
|
||||
><t
|
||||
t-esc="checkin_partner.document_type"
|
||||
/></p></div>
|
||||
<select
|
||||
t-attf-class="form-control select_doc_type_class #{error.get('document_type-'+ str(count)) and 'is-invalid' or ''}"
|
||||
t-att-id="'doc_type_id'+str(count)"
|
||||
t-att-name="'document_type-'+ str(count)"
|
||||
t-att-value="document_type or checkin_partner.document_type"
|
||||
>
|
||||
<option
|
||||
<option
|
||||
value=""
|
||||
>Select an option</option>
|
||||
<option
|
||||
<option
|
||||
value="D"
|
||||
>DNI</option>
|
||||
<option
|
||||
<option
|
||||
value="P"
|
||||
>Passport</option>
|
||||
<option
|
||||
<option
|
||||
value="C"
|
||||
>Driving License</option>
|
||||
<option
|
||||
<option
|
||||
value="I"
|
||||
>Identification Document</option>
|
||||
<option
|
||||
<option
|
||||
value="N"
|
||||
>Spanish residence permit</option>
|
||||
<option
|
||||
<option
|
||||
value="X"
|
||||
>European residence permit</option>
|
||||
</select>
|
||||
</div>
|
||||
<div
|
||||
</select>
|
||||
</div>
|
||||
<div
|
||||
t-attf-class="form-group col-xl-6"
|
||||
>
|
||||
<label
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="document_number"
|
||||
>Doc. number</label>
|
||||
<input
|
||||
<input
|
||||
type="text"
|
||||
t-att-name="'document_number-'+ str(count)"
|
||||
t-attf-class="form-control #{error.get('document_number-'+str(count)) and 'is-invalid' or ''}"
|
||||
t-att-value="document_number or checkin_partner.document_number"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
</div>
|
||||
<div
|
||||
t-attf-class="form-group col-xl-6"
|
||||
>
|
||||
<label
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="document_expedition_date"
|
||||
>Doc. expedition date</label>
|
||||
<input
|
||||
<input
|
||||
type="date"
|
||||
t-att-name="'document_expedition_date-'+ str(count)"
|
||||
t-attf-class="form-control #{error.get('document_expedition_date-'+str(count)) and 'is-invalid' or ''}"
|
||||
@@ -411,40 +498,40 @@
|
||||
class="col-form-label"
|
||||
for="mobile"
|
||||
>Mobile</label>
|
||||
<input
|
||||
<input
|
||||
type="phone"
|
||||
t-att-name="'mobile-'+ str(count)"
|
||||
t-attf-class="form-control #{error.get('mobile-'+str(count)) and 'is-invalid' or ''}"
|
||||
t-att-value="mobile or checkin_partner.mobile"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
</div>
|
||||
<div
|
||||
t-attf-class="form-group col-xl-6"
|
||||
>
|
||||
<label
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="email"
|
||||
>Email</label>
|
||||
<input
|
||||
<input
|
||||
type="email"
|
||||
t-att-name="'email-'+ str(count)"
|
||||
t-attf-class="form-control #{error.get('email-'+str(count)) and 'is-invalid' or ''}"
|
||||
t-att-value="email or checkin_partner.email"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
</div>
|
||||
<div
|
||||
t-attf-class="form-group col-xl-6 d-none"
|
||||
>
|
||||
<input
|
||||
<input
|
||||
type="text"
|
||||
t-att-name="'id-'+ str(count)"
|
||||
t-attf-class="form-control"
|
||||
t-att-value="id or checkin_partner.id"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</t>
|
||||
@@ -477,31 +564,31 @@
|
||||
<script>
|
||||
let listaElementos = document.getElementsByClassName("fa-sm");
|
||||
for(i=0; i<listaElementos.length; i++){
|
||||
let element =document.getElementById(i+1)
|
||||
element.addEventListener('click', function(){
|
||||
element.classList.toggle("fa-chevron-down");
|
||||
element.classList.toggle("fa-chevron-up");
|
||||
},false);
|
||||
let element =document.getElementById(i+1)
|
||||
element.addEventListener('click', function(){
|
||||
element.classList.toggle("fa-chevron-down");
|
||||
element.classList.toggle("fa-chevron-up");
|
||||
}, false);
|
||||
}
|
||||
let selects_doc_type = document.getElementsByClassName("select_doc_type_class");
|
||||
let doc_type_values = document.getElementsByClassName("doc_type_class");
|
||||
for(i=0;i<selects_doc_type.length;i++){
|
||||
let doc_type_value = doc_type_values[i].textContent;
|
||||
for(x=0;x<selects_doc_type[i].length;x++){
|
||||
if(selects_doc_type[i][x].value == doc_type_value){
|
||||
selects_doc_type[i][x].setAttribute("selected","True")
|
||||
}
|
||||
}
|
||||
let doc_type_value = doc_type_values[i].textContent;
|
||||
for(x=0;x<selects_doc_type[i].length;x++){
|
||||
if(selects_doc_type[i][x].value == doc_type_value){
|
||||
selects_doc_type[i][x].setAttribute("selected","True")
|
||||
}
|
||||
}
|
||||
}
|
||||
let selects_gender = document.getElementsByClassName("select_gender_class");
|
||||
let gender_values = document.getElementsByClassName("gender_class");
|
||||
for(i=0;i<selects_gender.length;i++){
|
||||
let gender_value = gender_values[i].textContent;
|
||||
for(x=0;x<selects_gender[i].length;x++){
|
||||
if(selects_gender[i][x].value == gender_value){
|
||||
selects_gender[i][x].setAttribute("selected","True")
|
||||
}
|
||||
}
|
||||
let gender_value = gender_values[i].textContent;
|
||||
for(x=0;x<selects_gender[i].length;x++){
|
||||
if(selects_gender[i][x].value == gender_value){
|
||||
selects_gender[i][x].setAttribute("selected","True")
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</template>
|
||||
@@ -519,6 +606,10 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<t t-set="count" t-value="0" />
|
||||
|
||||
<div t-if="success" class="alert alert-success" role="alert">
|
||||
<span>Data saved successfully!</span>
|
||||
</div>
|
||||
<form action="/my/precheckin/folio_reservation" method="post">
|
||||
<div
|
||||
t-if="error_message"
|
||||
@@ -526,17 +617,16 @@
|
||||
role="alert"
|
||||
>
|
||||
<t t-foreach="error_message" t-as="err"><t t-esc="err" /><br
|
||||
/></t>
|
||||
</div>
|
||||
<div t-if="success" class="alert alert-success" role="alert">
|
||||
<span>Data saved successfully!</span>
|
||||
/></t>
|
||||
</div>
|
||||
|
||||
<t t-foreach="folio.reservation_ids" t-as="reservation">
|
||||
<t t-set="count_reservation" t-value="0" />
|
||||
<tr class="bg-light">
|
||||
<td colspan="4"><em
|
||||
class="font-weight-normal text-muted"
|
||||
><span />Reservation: </em>
|
||||
<td colspan="4">
|
||||
<em class="font-weight-normal text-muted">
|
||||
Reservation:
|
||||
</em>
|
||||
<a
|
||||
t-att-href="reservation.get_portal_url(suffix='/precheckin')"
|
||||
t-att-title="reservation.name"
|
||||
@@ -545,6 +635,7 @@
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<t
|
||||
t-foreach="reservation.checkin_partner_ids"
|
||||
t-as="checkin_partner"
|
||||
@@ -561,21 +652,79 @@
|
||||
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<a
|
||||
t-att-href="checkin_partner.get_portal_url()"
|
||||
>
|
||||
Checkin <t t-esc="count_reservation" />
|
||||
</a>
|
||||
<a
|
||||
data-toggle="collapse"
|
||||
t-att-data-target="id3"
|
||||
class="text-primary"
|
||||
>
|
||||
<span
|
||||
t-att-id="count"
|
||||
class="fa fa-chevron-down fa-sm"
|
||||
/>
|
||||
</a>
|
||||
<t t-if = "not checkin_partner.firstname">
|
||||
<a
|
||||
t-att-href="checkin_partner.get_portal_url()"
|
||||
>
|
||||
Host <t t-esc="count_reservation" />
|
||||
</a>
|
||||
<a
|
||||
data-toggle="collapse"
|
||||
t-att-data-target="id3"
|
||||
class="text-primary"
|
||||
>
|
||||
<span
|
||||
t-att-id="count"
|
||||
class="fa fa-chevron-down fa-sm"
|
||||
/>
|
||||
</a>
|
||||
<div class="row col-12">
|
||||
<div
|
||||
t-attf-class="form-group col-lg-4"
|
||||
>
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="invitation_firstname"
|
||||
>
|
||||
Name
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
t-att-name="'invitation_firstname'"
|
||||
t-attf-class="form-control"
|
||||
t-att-value="firstname or (checkin_partner.firstname)"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
t-attf-class="form-group col-4"
|
||||
>
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="email"
|
||||
>
|
||||
Email
|
||||
</label>
|
||||
<input
|
||||
type="email"
|
||||
t-att-name="'invitation_email'"
|
||||
t-attf-class="form-control "
|
||||
t-att-value="invitation_email or checkin_partner.email"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
t-attf-class="form-group col-2"
|
||||
>
|
||||
<input type="submit" value="Send Invitation" t-att-class="'o_send_invitation_js'" style="margin-top:35px"/>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<a
|
||||
t-att-href="checkin_partner.get_portal_url()"
|
||||
>
|
||||
<t t-esc="checkin_partner.firstname" />
|
||||
</a>
|
||||
<a
|
||||
data-toggle="collapse"
|
||||
t-att-data-target="id3"
|
||||
class="text-primary"
|
||||
>
|
||||
<span
|
||||
t-att-id="count"
|
||||
class="fa fa-chevron-down fa-sm"
|
||||
/>
|
||||
</a>
|
||||
</t>
|
||||
<div class="row o_portal_details">
|
||||
<div class="col-lg-8">
|
||||
<div
|
||||
@@ -646,11 +795,11 @@
|
||||
for="gender"
|
||||
>Gender</label>
|
||||
<div class="d-none"><p
|
||||
class="gender_class"
|
||||
t-att-id="'genderId'+str(count)"
|
||||
><t
|
||||
t-esc="checkin_partner.gender"
|
||||
/></p></div>
|
||||
class="gender_class"
|
||||
t-att-id="'genderId'+str(count)"
|
||||
><t
|
||||
t-esc="checkin_partner.gender"
|
||||
/></p></div>
|
||||
<select
|
||||
class="form-control select_gender_class"
|
||||
id="gender"
|
||||
@@ -674,44 +823,34 @@
|
||||
<div
|
||||
t-attf-class="form-group col-xl-6"
|
||||
>
|
||||
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="document_type"
|
||||
>Doc. type</label>
|
||||
<div class="d-none"><p
|
||||
class="doc_type_class"
|
||||
t-att-id="'docTypeId'+str(count)"
|
||||
><t
|
||||
t-esc="checkin_partner.document_type"
|
||||
/></p></div>
|
||||
<select
|
||||
t-attf-class="form-control select_doc_type_class #{error.get('document_type-'+ str(count)) and 'is-invalid' or ''}"
|
||||
t-att-id="'doc_type_id'+str(count)"
|
||||
t-att-name="'document_type-'+ str(count)"
|
||||
t-att-value="document_type or checkin_partner.document_type"
|
||||
>
|
||||
<option
|
||||
value=""
|
||||
>Select an option</option>
|
||||
<option
|
||||
value="D"
|
||||
>DNI</option>
|
||||
<option
|
||||
value="P"
|
||||
>Passport</option>
|
||||
<option
|
||||
value="C"
|
||||
>Driving License</option>
|
||||
<option
|
||||
value="I"
|
||||
>Identification Document</option>
|
||||
<option
|
||||
value="N"
|
||||
>Spanish residence permit</option>
|
||||
<option
|
||||
value="X"
|
||||
>European residence permit</option>
|
||||
</select>
|
||||
class="doc_type_class"
|
||||
t-att-id="'docTypeId'+str(count)"
|
||||
><t
|
||||
t-esc="checkin_partner.document_type"
|
||||
/></p></div>
|
||||
<!-- <select-->
|
||||
<!-- t-attf-class="form-control select_doc_type_class #{error.get('document_type-'+ str(count)) and 'is-invalid' or ''}"-->
|
||||
<!-- t-att-id="'doc_type_id'+str(count)"-->
|
||||
<!-- t-att-name="'document_type-'+ str(count)"-->
|
||||
<!-- t-att-value="document_type or checkin_partner.document_type"-->
|
||||
<!-- >-->
|
||||
<select class="form-control select_doc_type_class #{error.get('document_type-'+ str(count)) and 'is-invalid' or ''}" name="'doc_type_id'+str(count)">
|
||||
<option value="">Select an option</option>
|
||||
<t t-foreach="doc_type_ids" t-as='doc_type'>
|
||||
<option
|
||||
t-att-value="doc_type.name"
|
||||
t-att-selected="doc_type.id == checkin_partner.document_type.id"
|
||||
>
|
||||
<t t-esc='doc_type.name'/>
|
||||
</option>
|
||||
</t>
|
||||
</select>
|
||||
</div>
|
||||
<div
|
||||
t-attf-class="form-group col-xl-6"
|
||||
@@ -769,6 +908,37 @@
|
||||
t-att-value="email or checkin_partner.email"
|
||||
/>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-xl-6">
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="nationality_id"
|
||||
>Nationality</label>
|
||||
<select class="form-control" id="country" name='nationality_id'>
|
||||
<option value="">Select an option</option>
|
||||
<t t-foreach="country_ids" t-as='country_id'>
|
||||
<option
|
||||
t-att-value="country_id.id"
|
||||
t-att-selected="country_id.id == checkin_partner.nationality_id.id"
|
||||
>
|
||||
<t t-esc='country_id.name'/>
|
||||
</option>
|
||||
</t>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-xl-6">
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="state"
|
||||
>Country State</label>
|
||||
<select class="form-control" id="state" name='state'>
|
||||
<option value="">Select an option</option>
|
||||
<t t-foreach="state_ids" t-as='state'>
|
||||
<option t-att-value="state.id" t-att-country_id="state.country_id.id" t-att-selected="state.id == checkin_partner.state_id.id">
|
||||
<t t-esc="state.name" />
|
||||
</option>
|
||||
</t>
|
||||
</select>
|
||||
</div>
|
||||
<div
|
||||
t-attf-class="form-group col-xl-6 d-none"
|
||||
>
|
||||
@@ -779,6 +949,7 @@
|
||||
t-att-value="id or checkin_partner.id"
|
||||
/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -814,31 +985,31 @@
|
||||
<script>
|
||||
let listaElementos = document.getElementsByClassName("fa-sm");
|
||||
for(i=0; i<listaElementos.length; i++){
|
||||
let element =document.getElementById(i+1)
|
||||
element.addEventListener('click', function(){
|
||||
element.classList.toggle("fa-chevron-down")
|
||||
element.classList.toggle("fa-chevron-up")
|
||||
},false);
|
||||
let element =document.getElementById(i+1)
|
||||
element.addEventListener('click', function(){
|
||||
element.classList.toggle("fa-chevron-down")
|
||||
element.classList.toggle("fa-chevron-up")
|
||||
},false);
|
||||
}
|
||||
let selects_doc_type = document.getElementsByClassName("select_doc_type_class");
|
||||
let doc_type_values = document.getElementsByClassName("doc_type_class");
|
||||
for(i=0;i<selects_doc_type.length;i++){
|
||||
let doc_type_value = doc_type_values[i].textContent;
|
||||
for(x=0;x<selects_doc_type[i].length;x++){
|
||||
if(selects_doc_type[i][x].value == doc_type_value){
|
||||
selects_doc_type[i][x].setAttribute("selected","True")
|
||||
}
|
||||
}
|
||||
let doc_type_value = doc_type_values[i].textContent;
|
||||
for(x=0;x<selects_doc_type[i].length;x++){
|
||||
if(selects_doc_type[i][x].value == doc_type_value){
|
||||
selects_doc_type[i][x].setAttribute("selected","True")
|
||||
}
|
||||
}
|
||||
}
|
||||
let selects_gender = document.getElementsByClassName("select_gender_class");
|
||||
let gender_values = document.getElementsByClassName("gender_class");
|
||||
for(i=0;i<selects_gender.length;i++){
|
||||
let gender_value = gender_values[i].textContent;
|
||||
for(x=0;x<selects_gender[i].length;x++){
|
||||
if(selects_gender[i][x].value == gender_value){
|
||||
selects_gender[i][x].setAttribute("selected","True")
|
||||
}
|
||||
}
|
||||
let gender_value = gender_values[i].textContent;
|
||||
for(x=0;x<selects_gender[i].length;x++){
|
||||
if(selects_gender[i][x].value == gender_value){
|
||||
selects_gender[i][x].setAttribute("selected","True")
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user