تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
4034 أدوات العرض

To add a new field to a form in XML you just type:

    <record model="ir.ui.view" id="sale_margin_percent_3">
<field name="name">sale.order.line.tree.margin.view.form</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='order_line']/tree//field[@name='price_unit']" position="after">
<field name="sale_margin_percent" groups="base.group_user"/>
</xpath>
</field>
</record>

which would add "sale_margin_percent" field after "price_unit" in "order_line".

So far, so good.

However, what would you need to add to specify that the new field has a given "on_change" attribute?


الصورة الرمزية
إهمال
أفضل إجابة

Try this:

<field name="sale_margin_percent" on_change="here_your_method(...)" groups="base.group_user"/> 
الصورة الرمزية
إهمال
الكاتب

So simple, thanks!

المنشورات ذات الصلة الردود أدوات العرض النشاط
2
مارس 17
7709
2
يوليو 15
6068
1
يوليو 15
7009
2
يوليو 15
5391
1
يناير 23
2610