Reputation: 3907
I have this code for a product in my module:
_name = "purchase.requisition.line"
_description="Purchase Requisition Line"
_rec_name = 'product_id'
_columns = {
'descripcion' : fields.char('Descripcion', size=42),
'nrodeparte' : fields.integer('Nro. de Parte'),
'espcifictec' : fields.char('Especificaciones Tecnicas', size=42),
'maquina' : fields.char('Maquina', size=42),
'anexo' : fields.float('Anexo NRo.'),
'product_id': fields.many2one('product.product', 'Product' ),
'product_uom_id': fields.many2one('product.uom', 'Product Unit of Measure'),
'product_qty': fields.float('Quantity', digits_compute=dp.get_precision('Product Unit of Measure')),
'requisition_id' : fields.many2one('purchase.requisition','Purchase Requisition', ondelete='cascade'),
'company_id': fields.related('requisition_id','company_id',type='many2one',relation='res.company',string='Company', store=True, readonly=True),
}
In descripcion
I got a char
field for a description of the product I've inherited from product.product
. Right now it's an independent field, how can I inherit the category of the product I chose in product_id
?
I know the object is categ_id
in the product module, and I tried this
'descripcion': fields.many2one('product.category','Desripcion')
But it doesn't works, how can I achieve this? I need to load automatically the product description (categ_id
) in this field.
Upvotes: 0
Views: 312
Reputation: 11
Try this
'descripcion':fields.many2one('product.category', 'Descripcion', required=True, ondelete='cascade'),
Upvotes: 1