0

How do we open a new xml form in odoo 10 ? I want to open 'views/views.xml' after logging in the system.

My LogIn_SignUp.xml:

    <record model="ir.ui.view" id="LogIn_form_view">
        <field name="name">Logging</field>
        <field name="model">studentmanagement.sinhvien</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
            <form string="Logging">
                <group>
                    <field name="LienLac"/>
                    <field name="MatKhau" type="password"/>
                    <button string="Log In" type="object" name="Log_In"/>
                </group>
            </form>
        </field>
    </record>

function "Log_In()" in python : (If account and password match a record in database, a new form is opened

But it doesn't work : it not only does not change the page, but also inserts a row into the database "studentmanagement.sinhvien" ! So I don't unserstand what happened ! Thanks a lot in advanced !

4

2 回答 2

1

您需要将view_id要返回的字典的 id 更改为视图的 id,即your_module_name.LogIn_form_view

于 2017-02-16T17:02:25.230 回答
0

我想,你需要用你的方法装饰你的方法,@api.model
然后在你的返回dict值上你需要将它更改view_id为这样的东西view_idself.env.ref("module_name.XML_ID").id

XML_IDid在 xml
中定义的,例如:
<record id="view_login_form" model="ir.ui.view"> <field name=""></field> </record>
所以,XML_ID 必须是view_login_form

于 2017-02-17T05:13:20.460 回答