简体   繁体   中英

call field into other model in odoo | openerp

I want to call following field from _name = "product.template" model :

    `'barcode': fields.related('product_variant_ids', 'barcode', type='char', string='Barcode', oldname='ean13')

above field i wanted to refer in other model named: _name = 'sale.order.line

something like this:

'barcode': fields.char('product.template', 'barcode'),

However above line of code throws error: AssertionError: Char field sale.order.line.barcode with non-integer size 'barcode'

can anyone guide me to call barcode field of one model into other model? thanks in advance

试试以下:

'barcode':fields.related('product_id','ean13',type="char",size=13,string="Barcode")

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