跳至內容
選單
此問題已被標幟
1 回覆
5017 瀏覽次數


Hello everyone, I have the following Error,
Error: QWeb2 - template['ListView.rows']: Runtime Error: Error: QWeb2 - template['ListView.row']: Runtime Error: Error: Campo desconocido state en el dominio [["state","in",["draft"]]]
this is the view code:
<group col="2" colspan="2">
        <field name="id_orden_servicio" />
</group>
and in a .py file.
state = fields.Selection([('draft', 'draft')], default='draft')
id_orden_servicio = fields.Many2one("dfsismet_orden_servicio", onupdate='cascade', ondelete='cascade',                                    string="Orden Servicio",                                    index=True, required=True,                                    states={'draft': [('readonly', True)]},                                    domain="""[('state','!=','Calibracion'),                                    ('id_calibrar_orden', '=', False),('instrumento_tipo','=','1')]""")

Thanks a lot.


頭像
捨棄
最佳答案

Define state field in the view, if it is not need, still define and make it invisible.

Because whenever you add state property in your .py to control the field, then odoo builds the XML Views Arch with modifers stating the state property, so in order to achieve that odoo tries to find the value of state, but when it couldn't  find  the state field itself, then the above error will be raised.

So change your view accordingly as below

    <field name="id_orden_servicio" />
<field name="state" invisible="1"/>
</group>
頭像
捨棄