Reputation: 307
Im doing the odoo getting started tutorial and I get an error that I dont understand and dont know how to debug it. Im adding the search record, and have the following now.
<record id="estate_property_search" model="ir.ui.view">
<field name="name">estate.property.view.search</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<search string="Search Opportunities">
<field name="name"/>
<field name="postcode"/>
<field name="expected_price"/>
<field name="bedrooms"/>
<field name="living_area"/>
<field name="facades"/>
<filter string="Available" name="available" domain="[('date_availability', '=', context_today() )]"/>
<filter string="Archived" name="inactive" domain=" [('active', '=', False )]"/>
</search>
</field>
</record>
The archived filter is working correctly, the available filter is giving me the error:
Error: Control panel model extension failed to evaluate domain:/n{}
I'm pretty sure that this error is the result of code that is not correct because if I replace it False
, then it works, and if I replace it with something random like toooday()
then i get the same error. However, I see many examples on the internet using this code so I think it should work. I also tried odoo.fields.Date.context_today()
and that doesnt work either.
Upvotes: 1
Views: 951
Reputation: 14776
It could be that Odoo is evaluating the domain on module update to get a safe domain for later use.
So context_today()
alone is not working when evaluating because you can't use a pure date
object in a domain. Just add .strftime('%Y-%m-%d')
to it, and it should evaluate without an error.
Upvotes: 1