如何在odoo中创建相关字段?

时间:2021-08-26 20:06:01

I am trying to create related field for displaying customer's balance in sale orders. I think i am creating wrong related field. Can anybody help me how to create related field in odoo?

我正在尝试创建相关字段以显示销售订单中的客户余额。我想我正在创造错误的相关领域。任何人都可以帮我如何在odoo中创建相关字段?

here this is related field i am creating

这是我正在创建的相关领域

customer_balance = fields.Related('partner_id.credit', string='Customer Balance')

customer_balance = fields.Related('partner_id.credit',string ='Customer Balance')

and other one is

而另一个是

customer_balance = fields.Char(related='partner_id.credit', store=True)

customer_balance = fields.Char(related ='partner_id.credit',store = True)

1 个解决方案

#1


2  

Try below code. It will work for you.

试试下面的代码。它会对你有用。

customer_balance = fields.Float(related="partner_id.credit",string="Balance")

Thanks..

谢谢..

#1


2  

Try below code. It will work for you.

试试下面的代码。它会对你有用。

customer_balance = fields.Float(related="partner_id.credit",string="Balance")

Thanks..

谢谢..