4 <!--Export edi document -->
5 <record id="ir_actions_server_edi_purchase" model="ir.actions.server">
6 <field name="code">if not object.partner_id.opt_out: object.edi_export_and_email(template_ext_id='purchase.email_template_edi_purchase', context=context)</field>
7 <field name="state">code</field>
8 <field name="type">ir.actions.server</field>
9 <field name="model_id" ref="purchase.model_purchase_order"/>
10 <field name="condition">True</field>
11 <field name="name">Auto-email confirmed purchase orders</field>
14 <!-- EDI related Email Templates menu -->
15 <record model="ir.actions.act_window" id="action_email_templates">
16 <field name="name">Email Templates</field>
17 <field name="res_model">email.template</field>
18 <field name="view_type">form</field>
19 <field name="view_mode">form,tree</field>
20 <field name="view_id" ref="email_template.email_template_tree" />
21 <field name="search_view_id" ref="email_template.view_email_template_search"/>
22 <field name="context" eval="{'search_default_model_id': ref('purchase.model_purchase_order')}"/>
24 <menuitem id="menu_configuration_misc" name="Miscellaneous" parent="menu_purchase_config_purchase" sequence="30"/>
25 <menuitem id="menu_email_templates" parent="menu_configuration_misc" action="action_email_templates" sequence="30"/>
28 <!-- Mail template and workflow bindings are done in a NOUPDATE block
29 so users can freely customize/delete them -->
31 <!-- bind the mailing server action to purchase.order confirmed activity -->
32 <record id="purchase.act_confirmed" model="workflow.activity">
33 <field name="action_id" ref="ir_actions_server_edi_purchase"/>
36 <!--Email template -->
37 <record id="email_template_edi_purchase" model="email.template">
38 <field name="name">Automated Purchase Order Notification Mail</field>
39 <field name="email_from">${object.validator.user_email or ''}</field>
40 <field name="subject">${object.company_id.name} Order (Ref ${object.name or 'n/a' })</field>
41 <field name="email_to">${object.partner_address_id.email}</field>
42 <field name="model_id" ref="purchase.model_purchase_order"/>
43 <field name="auto_delete" eval="True"/>
44 <field name="body_html"><![CDATA[
45 <div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: rgb(255, 255, 255); ">
47 <p>Hello${object.partner_address_id.name and ' ' or ''}${object.partner_address_id.name or ''},</p>
49 <p>Here is a purchase order confirmation from ${object.company_id.name}: </p>
51 <p style="border-left: 1px solid #8e0000; margin-left: 30px;">
52 <strong>REFERENCES</strong><br />
53 Order number: <strong>${object.name}</strong><br />
54 Order total: <strong>${object.amount_total} ${object.pricelist_id.currency_id.name}</strong><br />
55 Order date: ${object.date_order}<br />
57 Order reference: ${object.origin}<br />
59 % if object.partner_ref:
60 Your reference: ${object.partner_ref}<br />
62 Your contact: <a href="mailto:${object.validator.user_email or ''}?subject=Order%20${object.name}">${object.validator.name}</a>
66 You can view the order confirmation document and download it using the following link:
68 <a style="display:block; width: 150px; height:20px; margin-left: 120px; color: #FFF; font-family: 'Lucida Grande', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; text-align: center; text-decoration: none !important; line-height: 1; padding: 5px 0px 0px 0px; background-color: #8E0000; border-radius: 5px 5px; background-repeat: repeat no-repeat;"
69 href="${ctx.get('edi_web_url_view') or ''}">View Order</a>
72 <p>If you have any question, do not hesitate to contact us.</p>
76 <div style="width: 375px; margin: 0px; padding: 0px; background-color: #8E0000; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; background-repeat: repeat no-repeat;">
77 <h3 style="margin: 0px; padding: 2px 14px; font-size: 12px; color: #FFF;">
78 <strong style="text-transform:uppercase;">${object.company_id.name}</strong></h3>
80 <div style="width: 347px; margin: 0px; padding: 5px 14px; line-height: 16px; background-color: #F2F2F2;">
81 <span style="color: #222; margin-bottom: 5px; display: block; ">
82 % if object.company_id.street:
83 ${object.company_id.street}<br/>
85 % if object.company_id.street2:
86 ${object.company_id.street2}<br/>
88 % if object.company_id.city or object.company_id.zip:
89 ${object.company_id.zip} ${object.company_id.city}<br/>
91 % if object.company_id.country_id:
92 ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>
95 % if object.company_id.phone:
96 <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">
97 Phone: ${object.company_id.phone}
100 % if object.company_id.website:
102 Web : <a href="${object.company_id.website}">${object.company_id.website}</a>
109 <field name="body_text"><![CDATA[
110 Hello${object.partner_address_id.name and ' ' or ''}${object.partner_address_id.name or ''},
112 Here is a purchase order confirmation from ${object.company_id.name}:
113 | Order number: *${object.name}*
114 | Order total: *${object.amount_total} ${object.pricelist_id.currency_id.name}*
115 | Order date: ${object.date_order}
117 | Order reference: ${object.origin}
119 % if object.partner_ref:
120 | Your reference: ${object.partner_ref}<br />
122 | Your contact: ${object.validator.name} ${object.validator.user_email and '<%s>'%(object.validator.user_email) or ''}
124 You can view the order confirmation and download it using the following link:
125 ${ctx.get('edi_web_url_view') or 'n/a'}
127 If you have any question, do not hesitate to contact us.
133 ${object.validator.name} ${object.validator.user_email and '<%s>'%(object.validator.user_email) or ''}
134 ${object.company_id.name}
135 % if object.company_id.street:
136 ${object.company_id.street or ''}
138 % if object.company_id.street2:
139 ${object.company_id.street2}
141 % if object.company_id.city or object.company_id.zip:
142 ${object.company_id.zip or ''} ${object.company_id.city or ''}
144 % if object.company_id.country_id:
145 ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}
147 % if object.company_id.phone:
148 Phone: ${object.company_id.phone}
150 % if object.company_id.website:
151 ${object.company_id.website or ''}