diff --git a/pms/controllers/pms_portal.py b/pms/controllers/pms_portal.py index 0ecf0e989..ef42723c4 100644 --- a/pms/controllers/pms_portal.py +++ b/pms/controllers/pms_portal.py @@ -634,6 +634,6 @@ class PortalPrecheckin(CustomerPortal): ) firstname = kw["firstname"] email = kw["email"] - checkin_partner.write({"firstname": firstname, "email": email}) - checkin_partner.send_portal_invitation_email(firstname, email) - # request.portal_my_folio_precheckin(kw) + if firstname and email: + checkin_partner.write({"firstname": firstname, "email": email}) + checkin_partner.send_portal_invitation_email(firstname, email) diff --git a/pms/static/src/js/send_invitation_data.js b/pms/static/src/js/send_invitation_data.js index f6c9f886e..b5eb4e964 100644 --- a/pms/static/src/js/send_invitation_data.js +++ b/pms/static/src/js/send_invitation_data.js @@ -28,14 +28,40 @@ odoo.define("pms.SendInvitationData", function (require) { .parent() .find("input[name=invitation_email]") .val(); - this._rpc({ - route: "/my/precheckin/send_invitation", - params: { - checkin_partner_id: checkinPartnerId, - firstname: firstname, - email: email, - }, - }); + var error_firstname = $(ev.currentTarget) + .parent() + .parent() + .find("span:first"); + var error_email = $(ev.currentTarget) + .parent() + .parent() + .find("input[name=invitation_email]") + .siblings("span"); + console.log(error_firstname); + console.log(error_email); + if (firstname === "" || email === "") { + if (firstname === "") { + error_firstname.removeClass("d-none"); + } else { + error_firstname.addClass("d-none"); + } + if (email === "") { + error_email.removeClass("d-none"); + } else { + error_email.addClass("d-none"); + } + } else { + error_firstname.addClass("d-none"); + error_email.addClass("d-none"); + this._rpc({ + route: "/my/precheckin/send_invitation", + params: { + checkin_partner_id: checkinPartnerId, + firstname: firstname, + email: email, + }, + }); + } }, }); return publicWidget.registry.SendInvitationData; diff --git a/pms/views/precheckin_portal_templates.xml b/pms/views/precheckin_portal_templates.xml index 07daf756b..b25a7bda8 100644 --- a/pms/views/precheckin_portal_templates.xml +++ b/pms/views/precheckin_portal_templates.xml @@ -927,6 +927,11 @@ t-attf-class="form-control" t-att-value="firstname or (checkin_partner.firstname)" /> + Mandatory Firstname
+ Mandatory Email