跳至内容
菜单
此问题已终结
4 回复
4125 查看

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...

形象
丢弃
编写者 最佳答案

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>
形象
丢弃

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

最佳答案

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


形象
丢弃
最佳答案

[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)

形象
丢弃