Skip to content

Commit

Permalink
ADD template company banner
Browse files Browse the repository at this point in the history
  • Loading branch information
AdriaGual committed Jul 24, 2024
1 parent 2c7c657 commit ac148ce
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 6 deletions.
1 change: 1 addition & 0 deletions poweremail_generic_template/__terp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"data/banners/banner_generic_email_template_body.xml",
"data/banners/banner_generic_email_template_footer.xml",
"data/banners/banner_generic_email_template_css.xml",
"data/banners/banner_generic_email_template_company.xml",
],
"active": False,
"installable": True
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record model="report.banner" id="banner_generic_email_template_company">
<field name="name">Email genérico (TEMPLATE): compañia (company)</field>
<field name="code">generic_email_template_company</field>
<field name="start_date">2000-01-01</field>
<field name="sequence">0</field>
<field name="res_model">no.required</field>
<field name="description">La compañia a la que hace referencia la plantilla</field>
<field name="html[en_US]" file="emails/generic/components/company/en.mako"/>
<field name="html[ca_ES]" file="emails/generic/components/company/ca.mako"/>
<field name="html[es_ES]" file="emails/generic/components/company/es.mako"/>
</record>
</data>
</openerp>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
object.company_id
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% company = object.company_id %>
<% company = env['company'] %>
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="content-block">
Expand Down
16 changes: 11 additions & 5 deletions poweremail_generic_template/emails/generic/index.mako
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
from datetime import datetime
from poweremail.poweremail_template import get_value
pool = object.pool
cursor = object._cr
uid = object._uid
today = datetime.today().date().strftime('%Y-%m-%d')
banner_o = pool.get('report.banner')
Expand All @@ -15,8 +12,17 @@ banners = banner_o.get_report_banners(
today, object.id, context={'lang': lang}
)
body_html = get_value(cursor, uid, object.id, message=banners['generic_email_template_body'], template=template, context={'lang': lang})
footer_html = get_value(cursor, uid, object.id, message=banners['generic_email_template_footer'], template=template, context={'lang': lang})
company = eval(banners['generic_email_template_company'])
env['company'] = company
ctx = {
'lang': lang,
'raise_exception': True,
}
ctx.update(env)
body_html = get_value(cursor, uid, object.id, message=banners['generic_email_template_body'], template=template, context=ctx)
footer_html = get_value(cursor, uid, object.id, message=banners['generic_email_template_footer'], template=template, context=ctx)
%>
<html>
<head>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
from oopgrade.oopgrade import load_data


def up(cursor, installed_version):
if not installed_version:
return
load_data(cursor, 'poweremail_generic_template', 'data/banners/banner_generic_email_template_company.xml')


def down(cursor, installed_version):
pass

migrate = up

0 comments on commit ac148ce

Please sign in to comment.