From c68f57e21b31700a2824725ad92350cce2514538 Mon Sep 17 00:00:00 2001 From: Juliana <juliana@le-filament.com> Date: Wed, 19 Oct 2022 15:24:50 +0200 Subject: [PATCH] [ADD]Add no reply email --- data/mail_data.xml | 27 +++++++++++++++++---------- data/menu_data.xml | 6 +++--- models/res_partner.py | 16 ++++++++++++---- 3 files changed, 32 insertions(+), 17 deletions(-) diff --git a/data/mail_data.xml b/data/mail_data.xml index eb55481..d8636d6 100644 --- a/data/mail_data.xml +++ b/data/mail_data.xml @@ -5,9 +5,14 @@ <record id="acc_mail_template_data_portal_welcome" model="mail.template"> <field name="name">Portail ACC : nouvel utilisateur</field> <field name="model_id" ref="base.model_res_partner" /> - <field name="subject">Votre espace adhérent ${'list_op' in ctx and ctx['list_op'] or ''}</field> + <field + name="subject" + >Votre espace adhérent ${'list_op' in ctx and ctx['list_op'] or ''}</field> <field name="email_to">${object.email}</field> - <field name="email_from">"${'list_op' in ctx and ctx['list_op'] or ''}" <app@elo.coop></field> + <field name="reply_to">"Elocoop" <bonjour@elo.coop></field> + <field + name="email_from" + >"${'list_op' in ctx and ctx['list_op'] or ''}" <app@elo.coop></field> <field name="body_html" type="html"> <table border="0" @@ -87,19 +92,21 @@ </ul> Voici les informations pour accéder à votre espace adhérent :<br - /> + /> - Votre identifiant (email) : ${object.email or ''}<br - /> - - Votre mot de passe à activer grâce au lien suivant :<br/> + /> + - Votre mot de passe à activer grâce au lien suivant :<br + /> <a - href="${'user_signup_url' in ctx and ctx['user_signup_url'] or ''}" - > + href="${'user_signup_url' in ctx and ctx['user_signup_url'] or ''}" + > ${'user_signup_url' in ctx and ctx['user_signup_url'] or ''} - </a><br/><br/> + </a><br /><br /> Une fois votre mot de passe créé, vous pouvez accéder à votre espace adhérent en suivant ce lien : <a - href="${'portal_url' in ctx and ctx['portal_url'] or ''}" - >${'portal_url' in ctx and ctx['portal_url'] or ''}</a><br/><br/> + href="${'portal_url' in ctx and ctx['portal_url'] or ''}" + >${'portal_url' in ctx and ctx['portal_url'] or ''}</a><br + /><br /> Bonne journée,<br /> Service adhérent ${'list_op' in ctx and ctx['list_op'] or ''} </div> diff --git a/data/menu_data.xml b/data/menu_data.xml index 0d31971..63e7cba 100644 --- a/data/menu_data.xml +++ b/data/menu_data.xml @@ -1,11 +1,11 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8" ?> <odoo> <data> <record id="model_account_move_action_share" model="ir.actions.server"> <field name="name">Donner accès à Elocoop</field> - <field name="model_id" ref="base.model_res_partner"/> - <field name="binding_model_id" ref="base.model_res_partner"/> + <field name="model_id" ref="base.model_res_partner" /> + <field name="binding_model_id" ref="base.model_res_partner" /> <field name="binding_view_types">list</field> <field name="state">code</field> <field name="code">action = records.acces_portal_app()</field> diff --git a/models/res_partner.py b/models/res_partner.py index 8c78478..ddcbd0b 100644 --- a/models/res_partner.py +++ b/models/res_partner.py @@ -120,18 +120,26 @@ class ResPartner(models.Model): # determine subject and body in the portal user's language template = self.env.ref("acc_portal.acc_mail_template_data_portal_welcome") lang = user_portal.lang - company_id = self.env.company - operation_id = self.env["acc.counter"].search([("partner_id", "=", self.id)], limit=1).acc_operation_id + operation_id = ( + self.env["acc.counter"] + .search([("partner_id", "=", self.id)], limit=1) + .acc_operation_id + ) + user_signup_url = self.with_context( signup_force_type_in_url="", lang=lang )._get_signup_url_app()[self.id] - # user_signup_url = self.signup_prepare() + base_url = self.env.company.url_app signup_url = "/login" portal_url = werkzeug.urls.url_join(base_url, signup_url) # Get operations name linked - acc_op_ids = self.env["acc.counter"].search([("partner_id", "=", self.id)]).mapped("acc_operation_id") + acc_op_ids = ( + self.env["acc.counter"] + .search([("partner_id", "=", self.id)]) + .mapped("acc_operation_id") + ) op_str = "" for op in acc_op_ids: if op_str: -- GitLab