[IMP] res_partner view change
authorKuldeep Joshi (OpenERP) <kjo@tinyerp.com>
Wed, 22 Feb 2012 13:00:20 +0000 (18:30 +0530)
committerKuldeep Joshi (OpenERP) <kjo@tinyerp.com>
Wed, 22 Feb 2012 13:00:20 +0000 (18:30 +0530)
bzr revid: kjo@tinyerp.com-20120222130020-mt336dpul07b9cgt

openerp/addons/base/res/res_partner.py
openerp/addons/base/res/res_partner_view.xml

index 73c633d..4127d6f 100644 (file)
@@ -160,6 +160,7 @@ class res_partner(osv.osv):
         'company_id': fields.many2one('res.company', 'Company',select=1),
         'is_company': fields.boolean('Company', help="Check the field to create company otherwise it is personal contacts"),
         'color': fields.integer('Color Index'),
+        'is_company_address': fields.boolean('Company Address', help="Check the field to use the company address"),
     }
     def _default_category(self, cr, uid, context=None):
         if context is None:
index 6d95335..15b6d0e 100644 (file)
             <field name="arch" type="xml">
                 <tree string="Contacts">
                     <field name="name"/>
-                    <field name="ref" groups="base.group_extended"/>
+                    <field name="function"/>
                     <field name="phone"/>
                     <field name="email"/>
-                    <field name="city"/>
                     <!--field name="country"/-->
                     <field name="user_id"/>
-                    <field name="parent_id" string="Company"/>
                 </tree>
             </field>
         </record>
             <field name="type">form</field>
             <field name="arch" type="xml">
                 <form string="Partners" col='1'>
-                    <group col="6" colspan="4">
-                        <group colspan="5" col="6">
+                    <group col="8" colspan="4">
+                        <group colspan="5" col="4">
                             <field name="name" select="1"/>
-                            <field name="ref" groups="base.group_extended"/>
+                            <field name="function"/>
                             <field name="title" size="0" groups="base.group_extended"/>
-                            <field name="lang"/>
+                            <field name="parent_id" string="Parent Company" groups="base.group_extended" attrs="{'invisible': [('is_company','=', True)]}"/>
+                        </group>
+                        <group col="2">
+                            <field name="customer" select="1"/>
+                            <field name="supplier"/>
                         </group>
-                        <group colspan="1" col="2">
+                        <group col="2">
                             <field name="is_company" select="1"/>
+                            <field name="is_company_address"/>
                         </group>
                     </group>
                     <notebook colspan="4">
                         <page string="General">
-                            <group col="2">
-                                <field name="function"/>
-                            </group>
                             <newline/>
-                            <group colspan="2" col="4">
-                                <separator string="Postal Address" colspan="4" col="4" />
-                                    <field name="type" string="Type" colspan="2"/>
+                            <group colspan="4" attrs="{'invisible': [('is_company_address', '=', True)]}">
+                            <group colspan="2" col="4" >
+                                <separator string="Address" colspan="4" col="4" />
+                                    <field name="type" string="Type" colspan="2" attrs="{'invisible': [('is_company', '=', True)]}"/>
                                     <field name="street" colspan="4"/>
                                     <field name="street2" colspan="4"/>
                                     <field name="zip"/>
                                     <field name="country_id" completion="1"/>
                                     <field name="state_id"/>
                             </group>
-                             <group colspan="2" col="2">
-                                <separator string="Communication" colspan="2" col="2" />
-                                <field name="phone"/>
-                                <field name="mobile"/>
-                                <field name="fax"/>
-                                <field name="email" widget="email"/>
+                             <group colspan="2" col="4">
+                                <separator string="Communication" colspan="4"/>
+                                <field name="phone" colspan="4"/>
+                                <field name="mobile" colspan="4"/>
+                                <field name="fax" colspan="4"/>
+                                <field name="email" widget="email" colspan="4"/>
+                                <field name="website" widget="url" colspan="4"/>
+                                <field name="ref" groups="base.group_extended" colspan="4"/>
+                                <field name="lang" colspan="4"/>
+                             </group>
                              </group>
-                            <group colspan="8" attrs="{'invisible': [('is_company','=', False)]}">
+                            <group colspan="4" attrs="{'invisible': [('is_company','=', False)]}">
                                 <field name="child_ids" nolabel="1"/>
                             </group>
                         </page>
-                        <page string="Sales &amp; Purchases">
+                        <page string="Sales &amp; Purchases" attrs="{'invisible': [('customer', '=', False), ('supplier', '=', False)]}">
                             <separator string="General Information" colspan="4"/>
                             <field name="user_id"/>
                             <field name="active" groups="base.group_extended"/>
-                            <field name="website" widget="url"/>
                             <field name="date"/>
-                            <field name="parent_id" string="Parent Company" groups="base.group_extended" attrs="{'invisible': [('is_company','=', True)]}"/>
                             <field name="company_id" groups="base.group_multi_company" widget="selection"/>
                             <newline/>
-                            <field name="customer" select="1"/>
-                            <field name="supplier"/>
                         </page>
                         <page string="History" groups="base.group_extended" invisible="True">
                         </page>