</field>
</record>
- <record id="view_users_configuration_form" model="ir.ui.view">
- <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">
- <data>
- <form position="attributes">
- <attribute name="string">Create User</attribute>
- </form>
- <xpath expr='//separator[@string="title"]' position='attributes'>
- <attribute name='string'>New User</attribute>
- </xpath>
- <xpath expr="//label[@string='description']"
- position="attributes">
- <attribute name="string">Create additional users and assign them groups that will allow them to have access to selected functionalities within the system. Click on 'Done' if you do not wish to add more users at this stage, you can always do this later.</attribute>
- </xpath>
- <xpath expr='//separator[@string="vsep"]' position='attributes'>
- <attribute name='string'></attribute>
- </xpath>
- <group string="res_config_contents" position="replace">
- <field name="name"/>
- <field name="email"/>
- <field name="login"/>
- <field name="password" password="True"/>
- <field name="context_lang"/>
- <field name="context_tz"/>
-
- <separator string="Group" colspan="4"/>
- <label align="0.0" colspan="4" string="Groups are used to define access rights on objects and the visibility of screens and menus"/>
- <field colspan="4" nolabel="1" name="groups_id"/>
- </group>
-
- <xpath expr='//button[@name="action_next"]'
- position='attributes'>
- <attribute name="name">action_add</attribute>
- <attribute name='string'>Add User</attribute>
- <attribute name='icon'>gtk-add</attribute>
- </xpath>
-
- <xpath expr='//button[@name="action_skip"]'
- position='attributes'>
- <!-- if this one is performed first, it transforms
- the action_skip into action_next, and the
- transformation of action_next to action_add,
- since it uses first-match, transforms the same
- button. And we end up with [add] [next] instead
- of [next] [add]
-
- Would probably be simpler to just replace both
- by nothing and create a pair of brand new
- buttons... but we'd have to handle the groups
- around the buttons... oh well...
- -->
- <attribute name="name">action_next</attribute>
- <attribute name='string'>Done</attribute>
- <attribute name='icon'>gtk-go-forward</attribute>
- </xpath>
- </data>
- </field>
- </record>
-
<record id="view_confirm_simple_view_form" model="ir.ui.view">
<field name="name">Configure Your Interface</field>
<field name="model">res.config.view</field>
users()
-class config_users(osv.osv_memory):
- _name = 'res.config.users'
- _inherit = ['res.users', 'res.config']
-
- def _generate_signature(self, cr, name, email, context=None):
- return _('--\n%(name)s %(email)s\n') % {
- 'name': name or '',
- 'email': email and ' <'+email+'>' or '',
- }
-
- 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.
-
- If an email address was filled in for the user, sends a mail
- composed of the return values of ``get_welcome_mail_subject``
- and ``get_welcome_mail_body`` (which should be unicode values),
- with the user's data %-formatted into the mail body
- """
- base_data = self.read(cr, uid, new_id, context=context)
- partner_id = self.pool.get('res.partner').main_partner(cr, uid)
- address = self.pool.get('res.partner.address').create(
- cr, uid, {'name': base_data['name'],
- 'email': base_data['email'],
- 'partner_id': partner_id,},
- context)
- user_data = dict(
- base_data,
- signature=self._generate_signature(
- cr, base_data['name'], base_data['email'], context=context),
- address_id=address,
- )
- new_user = self.pool.get('res.users').create(
- cr, uid, user_data, context)
- self.send_welcome_email(cr, uid, new_user, context=context)
- def execute(self, cr, uid, ids, context=None):
- 'Do nothing on execution, just launch the next action/todo'
- pass
- def action_add(self, cr, uid, ids, context=None):
- 'Create a user, and re-display the view'
- self.create_user(cr, uid, ids[0], context=context)
- return {
- 'view_type': 'form',
- "view_mode": 'form',
- 'res_model': 'res.config.users',
- 'view_id':self.pool.get('ir.ui.view')\
- .search(cr,uid,[('name','=','res.config.users.confirm.form')]),
- 'type': 'ir.actions.act_window',
- 'target':'new',
- }
-config_users()
-
class groups2(osv.osv): ##FIXME: Is there a reason to inherit this object ?
_inherit = 'res.groups'
_columns = {