Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to create a wizard sequence?

By
Jo
on 8/25/14, 5:12 AM 1,214 views

Hello everyone,

Here i want to create a wizard for adding  new users,

in my 1st wizard step,

enter some fields such as name, user_login, email, password

my 2nd wizard step,

select access rihts groups to this user by using many2many relations

here is my code.

in res_users.py

class res_users(osv.osv):

    _name = 'res.users'
    _description = 'Creating new user'
    _columns = {
        'name': fields.char('Name'),
        'user_login': fields.char('Login'),
        'mail': fields.char('Mail'),
        'password': fields.char('Password'),
    }

class access_rights_wizard(osv.TransientModel):

    _name = 'access.righs.wizard'
    _description = 'Give access rights for this user'
    _columns = {
        'groups_id': fields.many2many('res.groups', 'res_groups_users_rel', 'uid', 'gid', 'Groups'),
    }

in my res_users_view.xml

    <!-- Access Rights Wizard Start form view-->

        <record id="access_rights_form_view" model="ir.ui.view">
            <field name="name">Give access Rights</field>
            <field name="model">access.righs.wizard</field>
            <field name="arch" type="xml">
                <form string="Access Rights">
                    <field name="groups_id"/>
                 <footer>
                 <button string="Save Rights" type="object" name="action_next" class="oe_link"/>
                  </footer>                                                                                                    
                </form>
            </field>
        </record>

    <!-- Access Rights Wizard form view End -->      

    <!-- Access rights Wizard Action Start -->

        <act_window id="change_password_wizard_action"
            name="Change Password"
            src_model="res.users"
            res_model="access.righs.wizard"
            view_type="form" view_mode="form"
            key2="client_action_multi" target="new"/>

    <!-- Access rights Wizard Action Start -->

    <!-- User Creation Wizard Form view Start -->

        <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="Users" version="7.0">
                    <sheet>
                        <field name="name"/>
                        <field name="user_login"/>
                        <field name="mail"/>
                        <field name="password"/>
                 <footer>
                 <button string="Change Password" type="action" name="%(change_password_wizard_action)d" class="oe_link"/>
                  </footer>                                                                                                    
                    </sheet>
                </form>
            </field>
        </record>

    <!-- User Creation Wizard Form view end -->

    <!-- User Creation Wizard Action Start -->

        <record id="action_res_users" model="ir.actions.act_window">
            <field name="name">Users</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">res.users</field>
            <field name="view_type">form</field>
            <field name="target">new</field>            
            <field name="view_id" ref="view_users_simple_form"/>
        </record>

    <!-- User Creation Wizard Action end -->

        <menuitem action="action_res_users" id="menu_action_res_users" parent="base.menu_users"/>                

Please correct my code.

Thanks in advance...

 

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 8/25/14, 5:12 AM
Seen: 1214 times
Last updated: 3/16/15, 8:10 AM