I want to filter a domain with a function instead of a variable in order to show only some registers in the view. I have done this:
class SaleOrderExt(models.Model):
_inherit = ['sale.order']
@api.multi
def custom_funct_date(self):
my_date = ... (some stuff)
return my_date
Then, in the view, I have filtered the domain:
<?xml version="1.0"?>
<openerp>
<data>
<record id='action_menu_custom_date' model='ir.actions.act_window'>
<field name="name">This is a test</field>
<field name="res_model">sale.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('date_order','>=',custom_funct_date)]</field>
</record>
</data>
</openerp>
But this is giving me an error:
ValueError: "name 'custom_funct_date' is not defined" while evaluating
u"[('date_order','>=',custom_funct_date)]"