[FIX] mail: model can be None or uninstalled
[odoo/odoo.git] / addons / sale / res_partner_view.xml
1 <?xml version="1.0"?>
2 <openerp>
3     <data>
4         <record id="act_res_partner_2_sale_order" model="ir.actions.act_window">
5             <field name="name">Quotations and Sales</field>
6             <field name="res_model">sale.order</field>
7             <field name="view_type">form</field>
8             <field name="view_mode">tree,form,graph</field>
9             <field name="context">{'search_default_partner_id': active_id}</field>
10             <field name="groups_id" eval="[(4, ref('base.group_sale_salesman'))]"/>
11             <field name="help" type="html">
12               <p class="oe_view_nocontent_create">
13                 Click to create a quotation or sales order for this customer.
14               </p><p>
15                 Odoo will help you efficiently handle the complete sale flow:
16                 quotation, sales order, delivery, invoicing and
17                 payment.
18               </p><p>
19                 The social feature helps you organize discussions on each sales
20                 order, and allow your customer to keep track of the evolution
21                 of the sales order.
22               </p>
23             </field>
24         </record>
25
26         <!-- Partner kanban view inherte -->
27         <record model="ir.ui.view" id="crm_lead_partner_kanban_view">
28             <field name="name">res.partner.kanban.saleorder.inherit</field>
29             <field name="model">res.partner</field>
30             <field name="inherit_id" ref="base.res_partner_kanban_view"/>
31             <field name="priority" eval="20"/>
32             <field name="arch" type="xml">
33                 <field name="mobile" position="after">
34                     <field name="sale_order_count"/>
35                 </field>
36                 <xpath expr="//div[@class='oe_kanban_partner_links']" position="inside">
37                     <a name="%(sale.act_res_partner_2_sale_order)d" type="action" t-if="record.sale_order_count.value>0">
38                         <t t-esc="record.sale_order_count.value"/> Sales
39                     </a>
40                 </xpath>
41             </field>
42         </record>
43
44         <record id="res_partner_view_buttons" model="ir.ui.view">
45             <field name="name">res.partner.view.buttons</field>
46             <field name="model">res.partner</field>
47             <field name="inherit_id" ref="base.view_partner_form" />
48             <field name="priority" eval="20"/>
49             <field name="groups_id" eval="[(4, ref('base.group_sale_salesman'))]"/>
50             <field name="arch" type="xml">
51                 <xpath expr="//div[@name='buttons']" position="inside">
52                     <button class="oe_inline oe_stat_button" type="action" name="%(sale.act_res_partner_2_sale_order)d" 
53                         attrs="{'invisible': [('customer', '=', False)]}"
54                         icon="fa-strikethrough">
55                         <field string="Sales" name="sale_order_count" widget="statinfo"/>
56                     </button>     
57                 </xpath>
58             </field>
59         </record>
60
61         <record id="res_partner_address_type" model="ir.ui.view">
62             <field name="name">res.partner.view.address_type</field>
63             <field name="model">res.partner</field>
64             <field name="inherit_id" ref="base.view_partner_form" />
65             <field name="arch" type="xml">
66                 <xpath expr="//label[@for='type']" position="attributes">
67                     <attribute name="groups">sale.group_delivery_invoice_address</attribute>
68                     <attribute name="invisible">False</attribute>
69                 </xpath>
70                 <xpath expr="//div[@name='div_type']" position="attributes">
71                     <attribute name="invisible">False</attribute>
72                     <attribute name="groups">sale.group_delivery_invoice_address</attribute>
73                 </xpath>
74                 <!--  Version-specific hacks to avoid breaking view inheritance when the sale module
75                       is installed on top of an older 7.0 version of the base module
76                       (as the second embedded div_type was added later in the 7.0 release)
77                       TODO: remove the hacks in trunk -->
78                 <xpath expr="//div[@name='div_type'][field[@name='use_parent_address']] | //field[@name='child_ids']//div[@name='div_type']" position="attributes">
79                     <attribute name="invisible">False</attribute>
80                     <attribute name="groups">sale.group_delivery_invoice_address</attribute>
81                 </xpath>
82                 <xpath expr="//label[@for='type'][following-sibling::div[@name='div_type']/field[@name='use_parent_address']] | //field[@name='child_ids']//label[@for='type']" position="attributes">
83                     <attribute name="invisible">False</attribute>
84                     <attribute name="groups">sale.group_delivery_invoice_address</attribute>
85                 </xpath>
86             </field>
87         </record>
88
89     </data>
90 </openerp>
91