Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poder importar ficheros .mako en el cuerpo de la plantilla de Poweremail y nuevas variables en el scope de la plantilla #163

Conversation

lcbautista
Copy link
Member

@lcbautista lcbautista commented Jul 16, 2024

Objetivo

Facilitar el desarrollo de las plantillas de PowerEmail

Comportamiento antiguo

  • No se pueden realizar imports en el cuerpo de la plantilla de Poweremail lo que obliga a que el código HTML del correo esté todo dentro del body de la plantilla.
  • Para obtener determinadas variables muy utilizadas (cursor, uid, etc) se debe repetir siempre el mismo código en cada plantilla (object._cursor, object._uid, etc)

Comportamiento nuevo

  • Ahora se puede modularizar el contenido de la plantilla de Poweremail. Por ejemplo:
<!doctype html>
<%namespace file="/poweremail/emails/generic/components/header.mako" import="*"/>
<%namespace file="/poweremail/emails/generic/components/body.mako" import="*"/>
<%namespace file="/poweremail/emails/generic/components/footer.mako" import="*"/>
<%namespace file="/poweremail/emails/generic/components/css.mako" import="*"/>
...
  • Ahora en el scope de la plantilla se pueden consultar directamente las siguientes variables:
    • pool
    • cursor
    • uid
    • template: browse record de poweremeail.template
    • lang (es_ES, ca_ES, ...)
    • localize: objecte que permet formatar valors en funció de l'idioma de la plantilla. p.e:
    > localize.amount(3.5)
    "3,5"
    > localize.date("2024-02-01")
    "01/02/2024"
    

@lcbautista lcbautista requested a review from AdriaGual July 16, 2024 08:09
@lcbautista lcbautista self-assigned this Jul 16, 2024
@lcbautista lcbautista deployed to AbeERP_PRE July 17, 2024 10:45 Active
@lcbautista lcbautista temporarily deployed to frankenergie-pre July 17, 2024 11:56 Inactive
@lcbautista lcbautista temporarily deployed to frankenergie-erp July 17, 2024 15:53 Inactive
@lcbautista lcbautista temporarily deployed to frankenergie-erp July 17, 2024 16:04 Inactive
@davidrabassa davidrabassa temporarily deployed to gisceerppre July 22, 2024 08:31 Inactive
@lcbautista lcbautista temporarily deployed to gisceerppre July 22, 2024 17:27 Inactive
@lcbautista lcbautista force-pushed the 59452_imp_allow_mako_imports_inside_poweremail_templates branch from 17bc5b1 to a2f2cf8 Compare July 22, 2024 17:30
@lcbautista lcbautista changed the title Poder importar ficheros .mako en el cuerpo de la plantilla de Poweremail Poder importar ficheros .mako en el cuerpo de la plantilla de Poweremail y nuevas variables en el scope de la plantilla Jul 23, 2024
@lcbautista lcbautista force-pushed the 59452_imp_allow_mako_imports_inside_poweremail_templates branch from a2f2cf8 to f069560 Compare July 23, 2024 07:24
@AdriaGual AdriaGual temporarily deployed to gasiluz-pre July 23, 2024 07:34 Inactive
@joanperez1 joanperez1 temporarily deployed to gisceerppre July 24, 2024 08:26 Inactive
@davidrabassa davidrabassa deployed to energetica-pre July 24, 2024 09:51 Active
@roniFCA roniFCA deployed to cerp-pre July 31, 2024 14:38 Active
@lcbautista lcbautista enabled auto-merge August 2, 2024 11:25
Copy link

github-actions bot commented Aug 2, 2024

PY2TestsResults

76 tests   76 ✅  1m 43s ⏱️
 2 suites   0 💤
 2 files     0 ❌

Results for commit f069560.

Copy link

github-actions bot commented Aug 2, 2024

PY3TestsResults

76 tests   76 ✅  1m 44s ⏱️
 2 suites   0 💤
 2 files     0 ❌

Results for commit f069560.

Copy link
Contributor

@AdriaGual AdriaGual left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lcbautista lcbautista merged commit ab05f01 into v5_backport Aug 5, 2024
5 checks passed
@lcbautista lcbautista deleted the 59452_imp_allow_mako_imports_inside_poweremail_templates branch August 5, 2024 07:38
@joanperez1 joanperez1 temporarily deployed to frankenergie-pre August 6, 2024 10:26 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants