[IMP] crm: add menu Miscellaneous
[odoo/odoo.git] / addons / sale / edi / sale_order_action_data.xml
1 <?xml version="1.0" ?>
2 <openerp>
3     <data>
4         <!-- EDI Export + Send email Action  -->
5         <record id="ir_actions_server_edi_sale" model="ir.actions.server">
6             <field name="code">if not object.partner_id.opt_out: object.edi_export_and_email(template_ext_id='sale.email_template_edi_sale', context=context)</field>
7             <field name="state">code</field>
8             <field name="type">ir.actions.server</field>
9             <field name="model_id" ref="sale.model_sale_order"/>
10             <field name="condition">True</field>
11             <field name="name">Auto-email confirmed sale orders</field>
12         </record>
13
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('sale.model_sale_order')}"/>
23         </record>
24         <menuitem id="base.menu_sales_configuration_misc" name="Miscellaneous" parent="base.menu_base_config" sequence="75"/>
25     </data>
26
27
28     <!-- Mail template and workflow bindings are done in a NOUPDATE block
29          so users can freely customize/delete them -->
30     <data noupdate="1">
31          <!-- bind the mailing server action to sale.order confirmed activity -->
32         <record id="sale.act_wait_ship" model="workflow.activity">
33             <field name="action_id" ref="ir_actions_server_edi_sale"/>
34         </record>
35
36
37         <!--Email template -->
38         <record id="email_template_edi_sale" model="email.template">
39             <field name="name">Automated Sale Order Notification Mail</field>
40             <field name="email_from">${object.user_id.user_email or ''}</field>
41             <field name="subject">${object.company_id.name} Order (Ref ${object.name or 'n/a' })</field>
42             <field name="email_to">${object.partner_invoice_id.email}</field>
43             <field name="model_id" ref="sale.model_sale_order"/>
44             <field name="auto_delete" eval="True"/>
45             <field name="body_html"><![CDATA[
46 <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
48     <p>Hello${object.partner_order_id.name and ' ' or ''}${object.partner_order_id.name or ''},</p>
49
50     <p>Here is your order confirmation for ${object.partner_id.name}: </p>
51
52     <p style="border-left: 1px solid #8e0000; margin-left: 30px;">
53        &nbsp;&nbsp;<strong>REFERENCES</strong><br />
54        &nbsp;&nbsp;Order number: <strong>${object.name}</strong><br />
55        &nbsp;&nbsp;Order total: <strong>${object.amount_total} ${object.pricelist_id.currency_id.name}</strong><br />
56        &nbsp;&nbsp;Order date: ${object.date_order}<br />
57        % if object.origin:
58        &nbsp;&nbsp;Order reference: ${object.origin}<br />
59        % endif
60        % if object.client_order_ref:
61        &nbsp;&nbsp;Your reference: ${object.client_order_ref}<br />
62        % endif
63        &nbsp;&nbsp;Your contact: <a href="mailto:${object.user_id.user_email or ''}?subject=Order%20${object.name}">${object.user_id.name}</a>
64     </p>
65
66     <p>
67     You can view the order confirmation document, download it and pay online using the following link:
68     </p>
69             <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;"
70                href="${ctx.get('edi_web_url_view') or ''}">View Order</a>
71
72     % if object.order_policy in ('prepaid','manual') and object.company_id.paypal_account:
73     <%
74     comp_name = quote(object.company_id.name)
75     order_name = quote(object.name)
76     paypal_account = quote(object.company_id.paypal_account)
77     order_amount = quote(str(object.amount_total))
78     cur_name = quote(object.pricelist_id.currency_id.name)
79     paypal_url = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=%s&amp;item_name=%s%%20Order%%20%s" \
80        "&amp;invoice=%s&amp;amount=%s&amp;currency_code=%s&amp;button_subtype=services&amp;no_note=1" \
81        "&amp;bn=OpenERP_Order_PayNow_%s" % \
82        (paypal_account,comp_name,order_name,order_name,order_amount,cur_name,cur_name)
83     %>
84     <br/>
85     <p>It is also possible to directly pay with Paypal:</p>
86         <a style="margin-left: 120px;" href="${paypal_url}">
87             <img class="oe_edi_paypal_button" src="https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif"/>
88         </a>
89     % endif
90
91     <br/>
92     <p>If you have any question, do not hesitate to contact us.</p>
93     <p>Thank you for choosing ${object.company_id.name or 'us'}!</p>
94     <br/>
95     <br/>
96     <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;">
97         <h3 style="margin: 0px; padding: 2px 14px; font-size: 12px; color: #FFF;">
98             <strong style="text-transform:uppercase;">${object.company_id.name}</strong></h3>
99     </div>
100     <div style="width: 347px; margin: 0px; padding: 5px 14px; line-height: 16px; background-color: #F2F2F2;">
101         <span style="color: #222; margin-bottom: 5px; display: block; ">
102         % if object.company_id.street:
103             ${object.company_id.street}<br/>
104         % endif
105         % if object.company_id.street2:
106             ${object.company_id.street2}<br/>
107         % endif
108         % if object.company_id.city or object.company_id.zip:
109             ${object.company_id.zip} ${object.company_id.city}<br/>
110         % endif
111         % if object.company_id.country_id:
112             ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>
113         % endif
114         </span>
115         % if object.company_id.phone:
116             <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; ">
117                 Phone:&nbsp; ${object.company_id.phone}
118             </div>
119         % endif
120         % if object.company_id.website:
121             <div>
122                 Web :&nbsp;<a href="${object.company_id.website}">${object.company_id.website}</a>
123             </div>
124         %endif
125         <p></p>
126     </div>
127 </div>
128             ]]></field>
129             <field name="body_text"><![CDATA[
130 Hello${object.partner_order_id.name and ' ' or ''}${object.partner_order_id.name or ''},
131
132 Here is your order confirmation for ${object.partner_id.name}:
133        | Order number: *${object.name}*
134        | Order total: *${object.amount_total} ${object.pricelist_id.currency_id.name}*
135        | Order date: ${object.date_order}
136        % if object.origin:
137        | Order reference: ${object.origin}
138        % endif
139        % if object.client_order_ref:
140        | Your reference: ${object.client_order_ref}<br />
141        % endif
142        | Your contact: ${object.user_id.name} ${object.user_id.user_email and '<%s>'%(object.user_id.user_email) or ''}
143
144 You can view the order confirmation, download it and even pay online using the following link:
145     ${ctx.get('edi_web_url_view') or 'n/a'}
146
147 % if object.order_policy in ('prepaid','manual') and object.company_id.paypal_account:
148 <%
149 comp_name = quote(object.company_id.name)
150 order_name = quote(object.name)
151 paypal_account = quote(object.company_id.paypal_account)
152 order_amount = quote(str(object.amount_total))
153 cur_name = quote(object.pricelist_id.currency_id.name)
154 paypal_url = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=%s&item_name=%s%%20Order%%20%s&invoice=%s&amount=%s" \
155              "&currency_code=%s&button_subtype=services&no_note=1&bn=OpenERP_Order_PayNow_%s" % \
156              (paypal_account,comp_name,order_name,order_name,order_amount,cur_name,cur_name)
157 %>
158 It is also possible to directly pay with Paypal:
159     ${paypal_url}
160 % endif
161
162 If you have any question, do not hesitate to contact us.
163
164
165 Thank you for choosing ${object.company_id.name}!
166
167
168 --
169 ${object.user_id.name} ${object.user_id.user_email and '<%s>'%(object.user_id.user_email) or ''}
170 ${object.company_id.name}
171 % if object.company_id.street:
172 ${object.company_id.street or ''}
173 % endif
174 % if object.company_id.street2:
175 ${object.company_id.street2}
176 % endif
177 % if object.company_id.city or object.company_id.zip:
178 ${object.company_id.zip or ''} ${object.company_id.city or ''}
179 % endif
180 % if object.company_id.country_id:
181 ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}
182 % endif
183 % if object.company_id.phone:
184 Phone: ${object.company_id.phone}
185 % endif
186 % if object.company_id.website:
187 ${object.company_id.website or ''}
188 % endif
189             ]]></field>
190         </record>
191     </data>
192 </openerp>