Methods openerp中的变更方法

Methods openerp中的变更方法,methods,openerp,onchange,Methods,Openerp,Onchange,我正在使用python尝试openerp中的onchange方法程序。但并没有错误,同时并没有响应,而我在字段中更改了名称 xml编码(cus_view.xml) 您在标签上写了onchange,因为它没有响应。试试这个 <label for = "customer_name" string = "Customer Name"/> <field name = "customer_name" onchange="on_change_customer(customer_name)"

我正在使用python尝试openerp中的onchange方法程序。但并没有错误,同时并没有响应,而我在字段中更改了名称

xml编码(cus_view.xml)


您在标签上写了onchange,因为它没有响应。试试这个

<label for = "customer_name" string = "Customer Name"/>
<field name = "customer_name" onchange="on_change_customer(customer_name)" style = "width:10%%"/><br/>

There is one another mistake you have made, improve field name in tree view,

<field name = "customer_country"/>


您犯了另一个错误,改进树状视图中的字段名,
这将起作用。

更新您的xml文件,无需为每个文件编写标签,请尝试此操作
update your xml file, no need to write label for each, try this 

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>

    <!-- ===================== This is tree layout =============================-->

    <record id="custom_tree" model="ir.ui.view">
            <field name="name">Custom</field>
            <field name="model">cus.custom</field>
            <field name="arch" type="xml">
                <tree string="custom">
                    <field name = "customer_name"/>
                    <field name = "customer_street1"/>
                    <field name = "customer_street2"/>
                    <field name = "customer_city"/>
                    <field name = "customer_state"/>
                    <field name = "customer_zip"/>
                    <field name = "customer_country"/>
                    <field name = "customer_mobile"/>
                    <field name = "customer_mail"/>
                </tree>
            </field>
        </record>
<!-- ========================This is Form layout===============================-->
    <record id="custom_form" model="ir.ui.view">
            <field name="name">cus.custom</field>
            <field name="model">cus.custom</field>
            <field name="arch" type="xml">
                <form string="custom" version="7.0">
                    <label for="name" class="oe_edit_only"/>
                    <h1><field name="name"/></h1>
                    <group>
                        <field name = "customer_name" on_change="on_change_customer(customer_name)"/>
                        <field name = "customer_street1"/>
                        <field name = "customer_street2"/>
                        <field name = "customer_city"/>
                        <field name = "customer_state"/>
                        <field name = "customer_zip"/>
                        <field name = "customer_country"/>
                        <field name = "customer_mobile"/>
                        <field name = "customer_mail"/>
                    </group>
                </form>
           </field>
        </record>


    <!-- ========================= Action Layout ============================= -->

        <record id="action_custom" model="ir.actions.act_window">
            <field name="name">Custom</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">cus.custom</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="view_id" ref="custom_form"/>

        </record>

    <!-- ===========================Menu Settings=========================== -->

        <menuitem name = "Lab Information" id = "menu_cus_custom" action = "action_custom"/>
</data>
</openerp>
习俗 定制 定制 定制 习俗 ir.actions.act\u窗口 定制 形式 树
我不知道;我不明白。做一个详细的编码plsi已经改变了对字段元素的更改。但它给出了同样的反应,我改变了两个国家作为一个国家的变化。和字段标记上的onchane方法。但同样的回答,没有输出,这应该是关于改变而不是一次改变同样的问题,甚至我改变了关于改变而不是一次改变谢谢。但它显示了以下错误:AttributeError:“cus”对象没有“on\u change\u customer”属性。请检查我的python代码。当我在客户名称中选择时,会显示以下错误:AttributeError:“cus”对象没有“on_change_customer”属性,因为您的类中没有包含on_change方法,所以会出现错误。在这里,它显示了课堂之外的情况。一定要缩进得那么好。你的问题会解决的。:)谢谢,它正在运行。我在python中有一个意图错误。清除以上错误。嗨,我是班加罗尔的巴拉克里希纳。我是一家IT公司的openerp开发人员。如果你不是我的,给你python的邮件id和openerp说明。如果可以的话,我会提供我的邮件id。
<label for = "customer_name" string = "Customer Name"/>
<field name = "customer_name" onchange="on_change_customer(customer_name)" style = "width:10%%"/><br/>

There is one another mistake you have made, improve field name in tree view,

<field name = "customer_country"/>
update your xml file, no need to write label for each, try this 

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>

    <!-- ===================== This is tree layout =============================-->

    <record id="custom_tree" model="ir.ui.view">
            <field name="name">Custom</field>
            <field name="model">cus.custom</field>
            <field name="arch" type="xml">
                <tree string="custom">
                    <field name = "customer_name"/>
                    <field name = "customer_street1"/>
                    <field name = "customer_street2"/>
                    <field name = "customer_city"/>
                    <field name = "customer_state"/>
                    <field name = "customer_zip"/>
                    <field name = "customer_country"/>
                    <field name = "customer_mobile"/>
                    <field name = "customer_mail"/>
                </tree>
            </field>
        </record>
<!-- ========================This is Form layout===============================-->
    <record id="custom_form" model="ir.ui.view">
            <field name="name">cus.custom</field>
            <field name="model">cus.custom</field>
            <field name="arch" type="xml">
                <form string="custom" version="7.0">
                    <label for="name" class="oe_edit_only"/>
                    <h1><field name="name"/></h1>
                    <group>
                        <field name = "customer_name" on_change="on_change_customer(customer_name)"/>
                        <field name = "customer_street1"/>
                        <field name = "customer_street2"/>
                        <field name = "customer_city"/>
                        <field name = "customer_state"/>
                        <field name = "customer_zip"/>
                        <field name = "customer_country"/>
                        <field name = "customer_mobile"/>
                        <field name = "customer_mail"/>
                    </group>
                </form>
           </field>
        </record>


    <!-- ========================= Action Layout ============================= -->

        <record id="action_custom" model="ir.actions.act_window">
            <field name="name">Custom</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">cus.custom</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="view_id" ref="custom_form"/>

        </record>

    <!-- ===========================Menu Settings=========================== -->

        <menuitem name = "Lab Information" id = "menu_cus_custom" action = "action_custom"/>
</data>
</openerp>