4 <!--Export edi document -->
6 <record id="ir_actions_server_edi_purchase" model="ir.actions.server">
7 <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>
8 <field name="state">code</field>
9 <field name="type">ir.actions.server</field>
10 <field name="model_id" ref="purchase.model_purchase_order"/>
11 <field name="condition">True</field>
12 <field name="name">Auto-email confirmed purchase orders</field>
16 <!-- EDI related Email Templates menu -->
17 <record model="ir.actions.act_window" id="action_email_templates">
18 <field name="name">Email Templates</field>
19 <field name="res_model">email.template</field>
20 <field name="view_type">form</field>
21 <field name="view_mode">form,tree</field>
22 <field name="view_id" ref="email_template.email_template_tree" />
23 <field name="search_view_id" ref="email_template.view_email_template_search"/>
24 <field name="context" eval="{'search_default_model_id': ref('purchase.model_purchase_order')}"/>
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 -->
33 <record id="purchase.act_confirmed" model="workflow.activity">
34 <field name="action_id" ref="ir_actions_server_edi_purchase"/>
38 <!--Email template -->
39 <record id="email_template_edi_purchase" model="email.template">
40 <field name="name">Automated Purchase Order Notification Mail</field>
41 <field name="email_from">${object.validator.email or ''}</field>
42 <field name="subject">${object.company_id.name} Order (Ref ${object.name or 'n/a' })</field>
43 <field name="email_to">${object.partner_id.email}</field>
44 <field name="model_id" ref="purchase.model_purchase_order"/>
45 <field name="auto_delete" eval="True"/>
46 <field name="body_html"><![CDATA[
47 <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); ">
49 <p>Hello${object.partner_id.name and ' ' or ''}${object.partner_id.name or ''},</p>
51 <p>Here is a ${object.state in ('draft', 'sent') and 'request for quotation' or 'purchase order confirmation'} from ${object.company_id.name}: </p>
53 <p style="border-left: 1px solid #8e0000; margin-left: 30px;">
54 <strong>REFERENCES</strong><br />
55 Order number: <strong>${object.name}</strong><br />
56 Order total: <strong>${object.amount_total} ${object.pricelist_id.currency_id.name}</strong><br />
57 Order date: ${object.date_order}<br />
59 Order reference: ${object.origin}<br />
61 % if object.partner_ref:
62 Your reference: ${object.partner_ref}<br />
64 Your contact: <a href="mailto:${object.validator.email or ''}?subject=Order%20${object.name}">${object.validator.name}</a>
68 You can view the ${object.state in ('draft', 'sent') and 'request for quotation' or 'order confirmation'} document and download it using the following link:
70 <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;"
71 href="${ctx.get('edi_web_url_view') or ''}">View Order</a>
74 <p>If you have any question, do not hesitate to contact us.</p>
78 <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;">
79 <h3 style="margin: 0px; padding: 2px 14px; font-size: 12px; color: #FFF;">
80 <strong style="text-transform:uppercase;">${object.company_id.name}</strong></h3>
82 <div style="width: 347px; margin: 0px; padding: 5px 14px; line-height: 16px; background-color: #F2F2F2;">
83 <span style="color: #222; margin-bottom: 5px; display: block; ">
84 % if object.company_id.street:
85 ${object.company_id.street}<br/>
87 % if object.company_id.street2:
88 ${object.company_id.street2}<br/>
90 % if object.company_id.city or object.company_id.zip:
91 ${object.company_id.zip} ${object.company_id.city}<br/>
93 % if object.company_id.country_id:
94 ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>
97 % if object.company_id.phone:
98 <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; ">
99 Phone: ${object.company_id.phone}
102 % if object.company_id.website:
104 Web : <a href="${object.company_id.website}">${object.company_id.website}</a>