Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
4 Trả lời
4130 Lượt xem

using Odoo 13 Community, can someone tell me why this is not working?


<page string="Servicios">
<field name="servicios" context="{'default_albaran': active_id}">
      <tree editable="bottom">
          <field name="prenda" domain="[('albaran','=',default_albaran)]"/>
      </tree>
    </field>
</page>


I get an error saying that 'default_albaran' that is used in the attributes must be present in the view, and it's not...

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

got it working, took out the context and just referenced the parent.id of the form:


<page string="Servicios">
<field name="servicios" options='{"no_open": True}'>
<tree editable="bottom">
<!-- <field name="prenda" options="{'no_quick_create':True,'no_create_edit':True,'no_open': True,}"/>-->
<field name="prenda" domain="[('albaran','=', parent.id)]"/>
<field name="product_category"/>
<field name="servicio" domain="[('categ_id', '=' , product_category)]" options="{'no_quick_create':True,'no_create_edit':True,'no_open': True,}"/>
<field name="cantidad"/>
</tree>
</field>
</page>
Ảnh đại diện
Huỷ bỏ

Hi Asis,

Make sure "albaran" field is present at your module. If yes then firstly restart your Odoo server then upgrade your module after that check .

Thanks

Câu trả lời hay nhất

Hi, Asis

You are getting this issue because "default_albaran" is not present inside your view. Kindly add it on your view. If you don't want to show that field in your view then you can make this field invisible like below code,

<page string="Servicios">
<field name="servicios" context="{'default_albaran': active_id}">
      <tree editable="bottom">
          <field name="default_albaran" invisible="1"/>
          <field name="prenda" domain="[('albaran','=',default_albaran)]"/>
      </tree>
    </field>
</page>

Feel free to ask in case you have any doubt related to the above point.


Thanks,
Ashish Singh (Team Lead)
Webkul Software Private Limited


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

[Edited] Your domain should be something like this:

domain="[('albaran','=', active_id)]"/>

The "default_" is part of the syntax for the Context (there's no field default_albaran). 

(More on Context)

Ảnh đại diện
Huỷ bỏ