未更新ODOO 10相关字段
此相关字段在未更新ODOO 10相关字段,odoo,odoo-10,Odoo,Odoo 10,此相关字段在odoo 9中工作正常,但在odoo 10中工作不正常。使用nomor\u hp\u id创建新记录时,customer\u id字段未更新 nomor\u hp\u id=fields.manyOne( string='Nomor hp', comodel_name='nomor.hp', ondelete='cascade', ) customer_id=fields.manyOne( string='Customer', 相关class='nomor\u hp\u id.客户\
odoo 9
中工作正常,但在odoo 10
中工作不正常。使用nomor\u hp\u id
创建新记录时,customer\u id
字段未更新
nomor\u hp\u id=fields.manyOne(
string='Nomor hp',
comodel_name='nomor.hp',
ondelete='cascade',
)
customer_id=fields.manyOne(
string='Customer',
相关class='nomor\u hp\u id.客户\u id',
ondelete='cascade',
store=True,
readonly=True,
)
尝试启动新数据库,但结果仍然没有更新。这种方法对我来说很好
customer\u id=fields.manyOne(
string='Customer',
相关class='nomor\u hp\u id.客户\u id',
store=True,
)
您必须在manyOne
字段中给出comodel名称,要么是正常的manyOne
要么是相关的manyOne
。请看下面的代码。你会得到答案的
nomor\u hp\u id=fields.manyOne(string='nomor hp',comodel\u name='nomor.hp',ondelete='cascade',)
customer\u id=fields.manyOne(string='customer',comodel\u name='res.partner',related='nomor\u hp\u id.customer\u id',ondelete='cascade',readonly=True,)
您必须定义哪个表的引用。此处customer\u id
是“res\u partner
”表或“res.partner
”模型的参考字段