~therp-nl/server-env-tools/7.0-fetchmail_attach_from_folder

« back to all changes in this revision

Viewing changes to email_template_template/__openerp__.py

  • Committer: Guewen Baconnier
  • Author(s): Holger Brunn
  • Date: 2013-11-11 15:17:10 UTC
  • mfrom: (50.1.1 server-env-tools-7.0)
  • Revision ID: guewen.baconnier@camptocamp.com-20131111151710-ibkuecchm885dj7p
[FIX] rst-fy email_template_template's description

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
in the other templates. Changing the layout is then only a matter of changing
33
33
the template template.
34
34
 
35
 
 
36
 
Usage:
 
35
-----
 
36
Usage
 
37
-----
37
38
Create an email template with the related document model 'Email Templates'. Now
38
39
most of the fields gray out and you can only edit body_text and body_html. Be
39
40
sure to use ${body_text} and ${body_html} respectively in your template
43
44
templates.
44
45
 
45
46
For example, create a template template
46
 
-----
47
 
Example Corp logo
48
 
Example Corp header
49
 
${object.body_text} <- this gets evaluated to the body_text of a template using this template template
50
 
Example Corp
51
 
Example street 42
52
 
Example city
53
 
Example Corp footer
54
 
-----
 
47
 
 
48
::
 
49
 
 
50
   Example Corp logo
 
51
   Example Corp header
 
52
   ${object.body_text} <- this gets evaluated to the body_text of a template using this template template
 
53
   Example Corp
 
54
   Example street 42
 
55
   Example city
 
56
   Example Corp footer
55
57
 
56
58
Then in your template you write
57
59
 
58
 
-----
59
 
Dear ${object.partner_id.name},
 
60
::
60
61
 
61
 
Your order has been booked on date ${object.date} for a total amount of ${object.sum}.
62
 
-----
 
62
   Dear ${object.partner_id.name},
 
63
   
 
64
   Your order has been booked on date ${object.date} for a total amount of ${object.sum}.
63
65
 
64
66
And it will be evaluated to
65
67
 
66
 
-----
67
 
Example Corp logo
68
 
Example Corp header
69
 
Dear Jane Doe,
70
 
 
71
 
Your order has been booked on date 04/17/2013 for a total amount of 42.
72
 
Example Corp
73
 
Example street 42
74
 
Example city
75
 
Example Corp footer
76
 
-----
 
68
::
 
69
 
 
70
    Example Corp logo
 
71
    Example Corp header
 
72
    Dear Jane Doe,
 
73
 
 
74
    Your order has been booked on date 04/17/2013 for a total amount of 42.
 
75
    Example Corp
 
76
    Example street 42
 
77
    Example city
 
78
    Example Corp footer
77
79
 
78
80
Given the way evaluation works internally (body_text of the template template is evaluated two times, first with the instance of email.template of your own template, then with the object your template refers to), you can do some trickery if you know that a template template is always used with the same kind of model (that is, models that have the same field name):
79
81
 
80
82
In your template template:
81
83
 
82
 
------
83
 
Dear ${'${object.name}'}, <-- gets evaluated to "${object.name}" in the first step, then to the content of object.name
84
 
${object.body_html}
85
 
Best,
86
 
Example Corp
87
 
------""",
 
84
::
 
85
 
 
86
    Dear ${'${object.name}'}, <-- gets evaluated to "${object.name}" in the first step, then to the content of object.name
 
87
    ${object.body_html}
 
88
    Best,
 
89
    Example Corp
 
90
""",
88
91
    'website': 'http://therp.nl',
89
92
    'images': [],
90
93
    'depends': ['email_template'],