From b01c7f2395d7f9bd3f4bee706153d6b2c9e393ed Mon Sep 17 00:00:00 2001 From: pauboixsom Date: Mon, 14 Oct 2024 12:53:47 +0200 Subject: [PATCH] fix ccpp lead lang --- som_leads_polissa/giscedata_crm_lead.py | 1 + som_polissa_condicions_generals/models/report_backend_ccpp.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/som_leads_polissa/giscedata_crm_lead.py b/som_leads_polissa/giscedata_crm_lead.py index dc7f8f750..fa37692c0 100644 --- a/som_leads_polissa/giscedata_crm_lead.py +++ b/som_leads_polissa/giscedata_crm_lead.py @@ -18,6 +18,7 @@ def contract_pdf(self, cursor, uid, ids, context=None): context["lead"] = True lead = self.browse(cursor, uid, ids[0]) + context["lang"] = lead.lang preus_provisional_energia = { "P1": lead.preu_fix_energia_p1, diff --git a/som_polissa_condicions_generals/models/report_backend_ccpp.py b/som_polissa_condicions_generals/models/report_backend_ccpp.py index 76ab2fa95..afccc5b59 100644 --- a/som_polissa_condicions_generals/models/report_backend_ccpp.py +++ b/som_polissa_condicions_generals/models/report_backend_ccpp.py @@ -30,6 +30,8 @@ def get_lang(self, cursor, uid, record_id, context=None): pol_obj = self.pool.get("giscedata.polissa") lang = pol_obj.browse(cursor, uid, record_id, context=context).titular.lang + if context.get("lang"): + lang = context.get("lang") return lang def get_pas01(self, cursor, uid, pol, context=None): @@ -106,6 +108,8 @@ def get_titular_data(self, cursor, uid, pol, pas01, context=None): data_firma = datetime.today() res['sign_date'] = localize_period(data_firma, pol.titular.lang) res['lang'] = pol.titular.lang + if context.get("lang"): + res['lang'] = context.get("lang") return res