Reputation: 401
I want to add a new category of Salary Structure by data file. Here is my current code
<record id="MEALS" model="hr.salary.rule.category">
<field name="name">Meals</field>
<field name="code">MEALS</field>
<field name="parent_id" eval=""></field>
</record>
All I need is a category with no parent category but with these code parent category of it is Base for new structures. I've tried with evals="0", evals = " " or remove field parent_id out of .How can I add null value into this field ?
Upvotes: 0
Views: 3612
Reputation: 9624
This behaviour is a little weird .AFAIK If you don't include the parent_id
field, it should work and have a null value because that field doesn't have a default value on it. (Except you've extended the model and added a default
on that field).
The only fields where null values don't work in the Odoo ORM are Integer
and float
fields. (That's the reason they always have an initial value of 0 or 0.0 in a form view).
quoting the docs:
field
Each record can be composed of field tags, defining values to set when creating the record. A record with no field will use all default values (creation) or do nothing (update).
A field has a mandatory name attribute, the name of the field to set, and various methods to define the value itself:
Nothing
if no value is provided for the field, an implicit False will be set on the field. Can be used to clear a field, or avoid using a default value for the field.
Try this <field name="parent_id" />
or <field name="parent_id" eval="False"
/>
If the above don't work then double check your codebase and make sure you're not setting any default value on the field.
Upvotes: 1