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

Hello, I want to add a field to a tree view in Odoo 9. In Odoo 8 I can do this searching where want I put the field with <xpath expr="//field[@name='price_subtotal']" position="replace"> but in Odoo 9 this not works. I can install my custom module OK but then fields is not displayed.

Thanks!    


الصورة الرمزية
إهمال

"not work" - can you provide more information. The XPATH syntax you posted should work just fine with version 9, as long as the anchor field (price_subtotal) exists in the view you are inheriting.

أفضل إجابة

just to ensure, have you add in _openerp__.py your xml file and the module sale in the depends clausule?

the sintax you use is correct, but what view are you inheriting?

if you are inheriting a view of model sale.order.line it's correct, but price_subtotal also appears in tree view of model sale_order, in the one2many field order_line, so you have to do something like,

<xpath expr="//field[@name='order_line']/tree/field[@name='price_subtotal']" position="replace">


Kind regards.

الصورة الرمزية
إهمال
الكاتب

There is my mistake. I need to inherite the purchase.order.form view, and not the purchase.order.line.form view. Thanks!

أفضل إجابة

Hello, I have faced this serveral times. Personally, I solved this in 2 ways:

1. Don't type the code, yes, you have to be lazy, but don't type it your self, just copy code from some where you trust and paste in to your inherit view. Then edit things like 'price_subtotal'. This sounds crazy but I once spent the whole morning looked at my code, nothing's wrong, it just did not work and the log showed nothing. When i copy and paste, it worked like a charm.

2. Use new syntax:

<field name="price_subtotal" position="replace">

    <field name="your_field/>

</field>

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
19
مايو 24
96635
1
أغسطس 16
3490
0
أغسطس 16
4665
2
مايو 16
11516
2
مايو 16
11534