[IMP]pms-api-rest: url field changed to url param in send reset mail password service

This commit is contained in:
braisab
2023-05-23 17:41:54 +02:00
committed by Darío Lodeiros
parent b94dd00615
commit 94d832e3b3
8 changed files with 2 additions and 132 deletions

View File

@@ -42,7 +42,6 @@
"data/pms_precheckin_invitation_email_template.xml",
"data/pms_data.xml",
"data/traveller_report_paperformat.xml",
"data/pms_reset_password_email.xml",
"report/pms_folio.xml",
"report/pms_folio_templates.xml",
"report/traveller_report_action.xml",

View File

@@ -1,109 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="pms_reset_password_email" model="mail.template">
<field name="name">Pms Reset Password</field>
<field name="model_id" ref="base.model_res_users"/>
<field name="subject">Restablecer Contraseña</field>
<field name="email_from">"${object.company_id.name | safe}" &lt;${(object.company_id.email or user.email) | safe}&gt;</field>
<field name="email_to">${object.email_formatted | safe}</field>
<field name="body_html" type="html">
<table border="0" cellpadding="0" cellspacing="0" style="padding-top: 16px; background-color: #F1F1F1; font-family:Verdana, Arial,sans-serif; color: #454748; width: 100%; border-collapse:separate;"><tr><td align="center">
<table border="0" cellpadding="0" cellspacing="0" width="590" style="padding: 16px; background-color: white; color: #454748; border-collapse:separate;">
<tbody>
<!-- HEADER -->
<tr>
<td align="center" style="min-width: 590px;">
<table border="0" cellpadding="0" cellspacing="0" width="590" style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;">
<tr><td valign="middle">
<span style="font-size: 10px;">Tu Cuenta en Roomdoo</span><br/>
<span style="font-size: 20px; font-weight: bold;">
${object.name}
</span>
</td><td valign="middle" align="right">
<img src="/logo.png?company=${object.company_id.id}" style="padding: 0px; margin: 0px; height: auto; width: 80px;" alt="${object.company_id.name}"/>
</td></tr>
<tr><td colspan="2" style="text-align:center;">
<hr width="100%" style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;"/>
</td></tr>
</table>
</td>
</tr>
<!-- CONTENT -->
<tr>
<td align="center" style="min-width: 590px;">
<table border="0" cellpadding="0" cellspacing="0" width="590" style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;">
<tr><td valign="top" style="font-size: 13px;">
<div>
${object.name},<br/><br/>
Se solicitó un restablecimiento de contraseña para la cuenta de Roomdoo vinculada a este correo electrónico.
Puede cambiar su contraseña siguiendo este enlace que permanecerá válido durante 15 minutos:<br/>
<!-- % if object.partner_id.signup_expiration &gt; datetime.datetime.now():-->
<div style="margin: 16px 0px 16px 0px;">
<a href="${object.company_id.url_app}/reset-password?token=${object.signup_token}"
style="background-color: #875A7B; padding: 8px 16px 8px 16px; text-decoration: none; color: #fff; border-radius: 5px; font-size:13px;">
Reestablecer contraseña
</a>
</div>
<!-- % else:-->
<!-- <div style="margin: 16px 0px 16px 0px;">-->
<!-- <a href="http://localhost:8080/reset-password"-->
<!-- style="background-color: #875A7B; padding: 8px 16px 8px 16px; text-decoration: none; color: #fff; border-radius: 5px; font-size:13px;">-->
<!-- Reestablecer contraseña-->
<!-- </a>-->
<!-- </div>-->
<!-- % endif-->
Puede ignorar este correo electrónico si no lo esperaba.<br/><br/>
Gracias,
% if user.signature:
<br/>
${user.signature | safe}
% endif
</div>
</td></tr>
<tr><td style="text-align:center;">
<hr width="100%" style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;"/>
</td></tr>
</table>
</td>
</tr>
<!-- FOOTER -->
<tr>
<td align="center" style="min-width: 590px;">
<table border="0" cellpadding="0" cellspacing="0" width="590" style="min-width: 590px; background-color: white; font-size: 11px; padding: 0px 8px 0px 8px; border-collapse:separate;">
<tr><td valign="middle" align="left">
${object.company_id.name}
</td></tr>
<tr><td valign="middle" align="left" style="opacity: 0.7;">
${object.company_id.phone}
% if object.company_id.email
| <a href="'mailto:%s' % ${object.company_id.email}" style="text-decoration:none; color: #454748;">${object.company_id.email}</a>
% endif
% if object.company_id.website
| <a href="'%s' % ${object.company_id.website}" style="text-decoration:none; color: #454748;">
${object.company_id.website}
</a>
% endif
</td></tr>
</table>
</td>
</tr>
</tbody>
</table>
</td></tr>
<!-- POWERED BY -->
<tr><td align="center" style="min-width: 590px;">
<table border="0" cellpadding="0" cellspacing="0" width="590" style="min-width: 590px; background-color: #F1F1F1; color: #454748; padding: 8px; border-collapse:separate;">
<tr><td style="text-align: center; font-size: 13px;">
Powered by <a target="_blank" href="https://www.odoo.com?utm_source=db&amp;utm_medium=auth" style="color: #875A7B;">Odoo</a>
</td></tr>
</table>
</td></tr>
</table>
</field>
<field name="lang">${object.lang}</field>
<field name="auto_delete" eval="True"/>
</record>
</data>
</odoo>

View File

@@ -24,7 +24,6 @@
"data/auth_jwt_validator.xml",
"views/pms_property_views.xml",
"views/res_users_views.xml",
"views/res_company_views.xml",
],
"demo": [
"demo/pms_api_rest_master_data.xml",

View File

@@ -11,6 +11,7 @@ class PmsApiRestUserInput(Datamodel):
userId = fields.Integer(required=False, allow_none=True)
userEmail = fields.String(required=False, allow_none=True)
resetToken = fields.String(required=False, allow_none=True)
url = fields.String(required=False, allow_none=True)
class PmsApiRestUserOutput(Datamodel):

View File

@@ -1,4 +1,3 @@
from . import res_company
from . import pms_property
from . import res_users
from . import account_payment

View File

@@ -1,7 +0,0 @@
from odoo import fields, models
class ResCompany(models.Model):
_inherit = "res.company"
url_app = fields.Char(string="Url App", help="Url to identify the app")

View File

@@ -172,7 +172,7 @@ class PmsRoomTypeClassService(Component):
return False
expiration_datetime = datetime.now() + timedelta(minutes=15)
user.partner_id.sudo().signup_prepare(expiration=expiration_datetime)
template.send_mail(user.id, force_send=True)
template.with_context({'app_url': input_data.url}).send_mail(user.id, force_send=True)
return True
return False

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="company_view_form" model="ir.ui.view">
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='url_advert']" position="after">
<field name="url_app" />
</xpath>
</field>
</record>
</odoo>