[IMP]base/res_company and res_partner: add photo field and readonly address

bzr revid: kjo@tinyerp.com-20120312084636-ew5j4arua8hjdpih
This commit is contained in:
Kuldeep Joshi (OpenERP)
2012-03-12 14:16:36 +05:30
parent b581a2297a
commit c6e04a4739
4 changed files with 37 additions and 29 deletions
+1 -1
View File
@@ -225,7 +225,7 @@
<field name="parent_id" groups="base.group_multi_company"/>
</group>
<group colspan="2" col="2">
<field name="logo" nolabel="1" widget="image"/>
<field name="photo" nolabel="1" widget="image"/>
</group>
</group>
<notebook colspan="4">
+2 -1
View File
@@ -143,6 +143,7 @@ class res_company(osv.osv):
'vat': fields.related('partner_id', 'vat', string="Tax ID", type="char", size=32),
'company_registry': fields.char('Company Registry', size=64),
'paper_format': fields.selection([('a4', 'A4'), ('us_letter', 'US Letter')], "Paper Format", required=True),
'photo': fields.related('partner_id', 'photo', string="Photo", type="binary"),
}
_sql_constraints = [
('name_uniq', 'unique (name)', 'The company name must be unique !')
@@ -227,7 +228,7 @@ class res_company(osv.osv):
self.cache_restart(cr)
return super(res_company, self).create(cr, uid, vals, context=context)
obj_partner = self.pool.get('res.partner')
partner_id = obj_partner.create(cr, uid, {'name': vals['name']}, context=context)
partner_id = obj_partner.create(cr, uid, {'name': vals['name'],'is_company':1}, context=context)
vals.update({'partner_id': partner_id})
self.cache_restart(cr)
company_id = super(res_company, self).create(cr, uid, vals, context=context)
+8 -1
View File
@@ -104,10 +104,16 @@
</record>
<record id="res_partner_c2c" model="res.partner">
<field name="name">Camptocamp</field>
<field name="is_company">1</field>
<field eval="[(6, 0, [ref('res_partner_category_10'), ref('res_partner_category_5')])]" name="category_id"/>
<field name="supplier">1</field>
<field name="is_company">1</field>
<field name="city">Le Bourget du Lac</field>
<field name="zip">73377</field>
<field name="phone">+41 21 619 10 04 </field>
<field model="res.country" name="country_id" search="[('name','=','France')]"/>
<field name="street">Savoie Technolac, BP 352</field>
<field name="type">default</field>
<field name="email">openerp@camptocamp.com</field>
<field name="website">www.camptocamp.com</field>
</record>
<record id="res_partner_sednacom" model="res.partner">
@@ -539,6 +545,7 @@
<field model="res.country" name="country_id" search="[('name','=','Switzerland')]"/>
<field name="street">PSE-A, EPFL </field>
<field name="type">default</field>
<field name="use_parent_address" eval="0"/>
<field name="parent_id" ref="res_partner_c2c"/>
</record>
<record id="res_partner_address_seagate" model="res.partner">
+26 -26
View File
@@ -358,22 +358,22 @@
on_change="onchange_address(use_parent_address, parent_id)"/>
</group>
<newline/>
<field name="street" colspan="4"/>
<field name="street2" colspan="4"/>
<field name="zip"/>
<field name="city"/>
<field name="country_id"/>
<field name="state_id"/>
<field name="street" colspan="4" attrs="{'readonly': [('parent_id', '!=', False), ('use_parent_address', '=', True)]}"/>
<field name="street2" colspan="4" attrs="{'readonly': [('parent_id', '!=', False), ('use_parent_address', '=', True)]}"/>
<field name="zip" attrs="{'readonly': [('parent_id', '!=', False), ('use_parent_address', '=', True)]}"/>
<field name="city" attrs="{'readonly': [('parent_id', '!=', False), ('use_parent_address', '=', True)]}"/>
<field name="country_id" attrs="{'readonly': [('parent_id', '!=', False), ('use_parent_address', '=', True)]}"/>
<field name="state_id" attrs="{'readonly': [('parent_id', '!=', False), ('use_parent_address', '=', True)]}"/>
</group>
<group colspan="2">
<separator string="Communication" colspan="4"/>
<field name="lang" 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" attrs="{'readonly': [('parent_id', '!=', False), ('use_parent_address', '=', True)]}"/>
<field name="phone" colspan="4" attrs="{'readonly': [('parent_id', '!=', False), ('use_parent_address', '=', True)]}"/>
<field name="mobile" colspan="4" attrs="{'readonly': [('parent_id', '!=', False), ('use_parent_address', '=', True)]}"/>
<field name="fax" colspan="4" attrs="{'readonly': [('parent_id', '!=', False), ('use_parent_address', '=', True)]}"/>
<field name="email" widget="email" colspan="4" attrs="{'readonly': [('parent_id', '!=', False), ('use_parent_address', '=', True)]}"/>
<field name="website" widget="url" colspan="4" attrs="{'readonly': [('parent_id', '!=', False), ('use_parent_address', '=', True)]}"/>
<field name="ref" groups="base.group_extended" colspan="4" attrs="{'readonly': [('parent_id', '!=', False), ('use_parent_address', '=', True)]}"/>
</group>
<group colspan="4" attrs="{'invisible': [('is_company','=', False)]}">
<field name="child_ids" context="{'default_parent_id': active_id}" nolabel="1">
@@ -408,22 +408,22 @@
<field name="use_parent_address" attrs="{'invisible': [('is_company','=', True)]}" on_change="onchange_address(use_parent_address, parent_id)"/>
</group>
<newline/>
<field name="street" colspan="4"/>
<field name="street2" colspan="4"/>
<field name="zip"/>
<field name="city"/>
<field name="country_id"/>
<field name="state_id"/>
<field name="street" colspan="4" attrs="{'readonly': [('use_parent_address', '=', True)]}"/>
<field name="street2" colspan="4" attrs="{'readonly': [('use_parent_address', '=', True)]}"/>
<field name="zip" attrs="{'readonly': [('use_parent_address', '=', True)]}"/>
<field name="city" attrs="{'readonly': [('use_parent_address', '=', True)]}"/>
<field name="country_id" attrs="{'readonly': [('use_parent_address', '=', True)]}"/>
<field name="state_id" attrs="{'readonly': [('use_parent_address', '=', True)]}"/>
</group>
<group colspan="2">
<separator string="Communication" colspan="4"/>
<field name="lang" 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" attrs="{'readonly': [('use_parent_address', '=', True)]}"/>
<field name="phone" colspan="4" attrs="{'readonly': [('use_parent_address', '=', True)]}"/>
<field name="mobile" colspan="4" attrs="{'readonly': [('use_parent_address', '=', True)]}"/>
<field name="fax" colspan="4" attrs="{'readonly': [('use_parent_address', '=', True)]}"/>
<field name="email" widget="email" colspan="4" attrs="{'readonly': [('use_parent_address', '=', True)]}"/>
<field name="website" widget="url" colspan="4" attrs="{'readonly': [('use_parent_address', '=', True)]}"/>
<field name="ref" groups="base.group_extended" colspan="4" attrs="{'readonly': [('use_parent_address', '=', True)]}"/>
</group>
<group colspan="4" attrs="{'invisible': [('is_company','=', False)]}">
<field name="child_ids" domain="[('id','!=',parent_id.id)]" nolabel="1"/>