在 Odoo 中对表单进行测试时,为字段分配值时,假设为 field_name,
my_form = Form(self.env['my.model'])
my_form.field_name = 'test'
立即抛出错误:
AssertionError: field_name was not found in the view
田野就在视野中。但它有一个修饰符:
<field name="field_name" groups="base.group_no_one"/>
使用
self.debug_mode()
:
my_form = Form(self.env['my.model'])
my_form.field_name = 'test'```