Openerp 如何将日期字段与字段访问规则[odoo 10]中的当前日期进行比较
我的记录只能在给定日期之前修改(在字段中) 我考虑过使用记录规则,但无法将日期字段与访问规则中的当前日期进行比较 有什么方法可以进行比较,或者用其他方法来实现这一点Openerp 如何将日期字段与字段访问规则[odoo 10]中的当前日期进行比较,openerp,odoo-10,Openerp,Odoo 10,我的记录只能在给定日期之前修改(在字段中) 我考虑过使用记录规则,但无法将日期字段与访问规则中的当前日期进行比较 有什么方法可以进行比较,或者用其他方法来实现这一点 <record id="my_rule_date_foo" model="ir.rule"> <field name="name">foo bar</field> <field name="model_id" ref="model_my_foo"/> <field name="d
<record id="my_rule_date_foo" model="ir.rule">
<field name="name">foo bar</field>
<field name="model_id" ref="model_my_foo"/>
<field name="domain_force">
[('many2one_field.the_limit_date','≥', 'what_to_put_here_?')]
</field>
<field name="groups" eval="[(4, ref('group_peff'))]"/>
<field name="perm_read" eval="False"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="False"/>
<field name="perm_unlink" eval="False"/>
富吧
[('manyOne'u field.the'u limit'u date','ge;','u to'u put'u here')]
您应该能够在
域中使用context\u today()
或datetime
:
# Should be the best choice, considers user timezone
[('many2one_field.the_limit_date','>=', context_today())]
# If context_today() doesn't work for some reason, you can use datetime
[('many2one_field.the_limit_date','>=', datetime.date.today().strftime('%Y-%m-%d'))]
以下是core和a的截图。截图可能有助于回答@Jean Pernier