[IMP] res_users: removed hack about redirecting the fields view get. Added a simplified contact form the the user, used for example when viewing a salesman profile.

bzr revid: tde@openerp.com-20121115103412-jl0o40t8d3d76ysd
This commit is contained in:
Thibault Delavallée 2012-11-15 11:34:12 +01:00
parent f0569f7133
commit 29e0ab965f
2 changed files with 43 additions and 11 deletions

View File

@ -250,17 +250,6 @@ class res_users(osv.osv):
'image': lambda self, cr, uid, ctx={}: self.pool.get('res.partner')._get_default_image(cr, uid, False, ctx, colorize=True),
}
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
""" Override of res.users fields_view_get.
- if the view is specified: resume with normal behavior
- else: the default view is overrided and redirected to the partner
view
"""
#made a lot of views crash because methods of open chatter are not available on users
#if not view_id and view_type == 'form':
# return self.pool.get('res.partner').fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu)
return super(res_users, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu)
# User can write on a few of his own fields (but not his groups for example)
SELF_WRITEABLE_FIELDS = ['password', 'signature', 'action_id', 'company_id', 'email', 'name', 'image', 'image_medium', 'image_small', 'lang', 'tz']
# User can read a few of his own fields

View File

@ -83,6 +83,49 @@
<!-- res.users -->
<record id="view_users_simple_form" model="ir.ui.view">
<field name="name">res.users.simplified.form</field>
<field name="model">res.users</field>
<field name="priority">1</field>
<field name="arch" type="xml">
<form string="Contact" version="7.0">
<sheet>
<field name="image" widget='image' class="oe_left oe_avatar" options='{"preview_image": "image_medium", "size": [90, 90]}'/>
<div class="oe_title">
<div class="oe_edit_only">
<label for="name"/> (
</div>
<h1>
<field name="name" default_focus="1" placeholder="Name" />
</h1>
<field name="category_id" widget="many2many_tags" placeholder="Tags..."/>
</div>
<group>
<group>
<label for="street" string="Address"/>
<div>
<field name="street" placeholder="Street..."/>
<field name="street2"/>
<div class="address_format">
<field name="city" placeholder="City" style="width: 40%%"/>
<field name="state_id" class="oe_no_button" placeholder="State" style="width: 37%%" options='{"no_open": True}' on_change="onchange_state(state_id)"/>
<field name="zip" placeholder="ZIP" style="width: 20%%"/>
</div>
<field name="country_id" placeholder="Country" class="oe_no_button" options='{"no_open": True}'/>
</div>
<field name="website" widget="url" placeholder="e.g. www.openerp.com"/>
</group>
<group>
<field name="phone" placeholder="e.g. +32.81.81.37.00"/>
<field name="mobile"/>
<field name="fax"/>
<field name="email" widget="email"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<record id="view_users_form" model="ir.ui.view">
<field name="name">res.users.form</field>
<field name="model">res.users</field>