Skip to Content
Menu
This question has been flagged
4 Replies
3513 Views

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

Avatar
Discard
Author Best Answer

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>
Avatar
Discard

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

Best Answer

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


Avatar
Discard
Best Answer

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

Avatar
Discard