简体   繁体   中英

How to create related field in odoo?

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?

here this is related field i am creating

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

and other one is

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

Try below code. It will work for you.

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

Thanks..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM