Guys I want use one of the fields from product_template in my module.
And it seems that field related will/should be the best option. How should it look like if I would like to use field named product_size_id from product_template (it's custom field but anyway, if I would like to use any other existing field like .... sale_ok)?
'size': fields.char(related='product_template.product_size_id', string="Size/PT"), ???
EDIT:
Got it,
'size': fields.related('product_template','product_casesize_id', string="Size/PT", type="char"),
But what if it is many2one field and I would like to use whole content of this table ?
class product_casesize(orm.Model):
_name = 'product.casesize'
_columns = {
'name': fields.char('Case size'),
}
class product_template(orm.Model):
_inherit = 'product.template'
_columns = {
'product_casesize_id': fields.many2one(
'product.casesize',
'Case size', help='Select size of the case.', ondelete='restrict'),
}
Whatever I do still getting error wrong co-model.
What am I doing wrong ?