[FIX][IMP] fix creation of second user in a row, make user creation view inherit from res_config_view_base

bzr revid: xmo@tinyerp.com-20091208144835-pdf83mwe6x9xd37b
This commit is contained in:
Xavier Morel 2009-12-08 15:48:35 +01:00
parent c2aeae60c4
commit 4dbb8813e4
2 changed files with 43 additions and 43 deletions

View File

@ -201,47 +201,48 @@
<field name="name">res.config.users.confirm.form</field>
<field name="model">res.config.users</field>
<field name="type">form</field>
<field name="inherit_id" ref="res_config_view_base"/>
<field name="arch" type="xml">
<form string="Configure User">
<data>
<form position="attributes">
<attribute name="string">Create User</attribute>
</form>
<group string="res_config_contents" position="replace">
<label colspan="4" align="0.0"
string='You will be able to assign groups to users.
Groups define the access rights of each users on the
different objects of the system.'/>
<separator string="Define New Users" colspan="4"/>
<field name="name" select="1"/>
<field name="active" select="1"/>
<field name="login" select="1"/>
<field name="password" password="True"/>
<notebook colspan="4">
<page string="User">
<field name="address_id"/>
<field name="company_id" required="1"/>
<field name="action_id" required="True"/>
<field domain="[('usage','=','menu')]" name="menu_id" required="True"/>
<field name="context_lang"/>
<field name="context_tz"/>
<field colspan="4" name="signature"/>
</page>
<page string="Groups">
<label string="Groups are used to defined access rights on each screen and menu." align="0.0" colspan="4"/>
<field colspan="4" nolabel="1" name="groups_id"/>
</page>
<page string="Roles">
<label string="Roles are used to defined available actions, provided by workflows." align="0.0" colspan="4"/>
<field colspan="4" nolabel="1" name="roles_id"/>
</page>
</notebook>
<field name="progress" widget="progressbar"
nolabel="1" colspan='1'/>
<label string='' colspan='1'/>
<group col="4" colspan="2">
<button name="action_skip" icon="gtk-cancel" special="cancel"
string='Skip' type='object'/>
<button name='action_new' icon='gtk-ok'
string='Add User' type='object'/>
</group>
</form>
<separator string="Define New Users" colspan="4"/>
<field name="name" select="1"/>
<field name="active" select="1"/>
<field name="login" select="1"/>
<field name="password" password="True"/>
<notebook colspan="4">
<page string="User">
<field name="address_id"/>
<field name="company_id" required="1"/>
<field name="action_id" required="True"/>
<field domain="[('usage','=','menu')]" name="menu_id" required="True"/>
<field name="context_lang"/>
<field name="context_tz"/>
<field colspan="4" name="signature"/>
</page>
<page string="Groups">
<label string="Groups are used to defined access rights on each screen and menu." align="0.0" colspan="4"/>
<field colspan="4" nolabel="1" name="groups_id"/>
</page>
<page string="Roles">
<label string="Roles are used to defined available actions, provided by workflows." align="0.0" colspan="4"/>
<field colspan="4" nolabel="1" name="roles_id"/>
</page>
</notebook>
</group>
<xpath expr='//button[@name="action_next"]' position='attributes'>
<attribute name='string'>Add User</attribute>
</xpath>
</data>
</field>
</record>

View File

@ -251,28 +251,27 @@ users()
class config_users(osv.osv_memory):
_name = 'res.config.users'
_table = 'res_users'
_inherit = 'res.config'
_columns = users._columns
_defaults = users._defaults
def user_data(self, cr, uid, context=None):
def user_data(self, cr, uid, new_id, context=None):
''' Gets the purely user part of the current config_user
instance, without the fields inherited from res.config
'''
return self.read(cr, uid, uid,
return self.read(cr, uid, new_id,
users._columns.keys(),
context=context)
def create_user(self, cr, uid, context=None):
def create_user(self, cr, uid, new_id, context=None):
''' create a new res.user instance from the data stored
in the current res.config.users
'''
self.pool.get('res.users').create(
cr, uid, self.user_data(cr, uid, context), context)
cr, uid, self.user_data(cr, uid, new_id, context), context)
def action_new(self, cr, uid, ids, context=None):
self.create_user(cr, uid, context=context)
def action_next(self, cr, uid, ids, context=None):
self.create_user(cr, uid, ids[0], context=context)
return {
'view_type': 'form',
"view_mode": 'form',