How do I do this?
Cheers,
Rob
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
How do I do this?
Cheers,
Rob
Hi Robert Price,
you can using related="..." for new api:
ex:
product_tmpl_id = fields.Many2one( 'product.template', 'Product Template', related='product_id.product_tmpl_id', help="Technical: used in views")
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
RegistrarsePublicaciones relacionadas | Respuestas | Vistas | Actividad | |
---|---|---|---|---|
|
1
nov 24
|
20593 | ||
|
1
sept 23
|
3361 | ||
|
3
may 23
|
5952 | ||
|
7
abr 23
|
49392 | ||
Barcode scanner from mobile
Resuelto
|
|
1
dic 22
|
8137 |
I know how to create fields related to fields that I can edit. What I want to do is pick up description_picking from the products on the BOMS. I'm not sure how to use the suggested answer.
Hi, you can override the attribute you need :
Class the_old_you_need_to_change
_inherit=the_old_class
description_picking = fields.One2many('model', 'the attribute you want to link', [...] )
Class you_class
your_attribute_to_link = [...]
I hope this help !
I get an error when I try to do this (help please? Thanks for the help so far):
class sms(models.Model):
_inherit = 'mrp.bom.line'
sms_location = fields.One2many(string='StockLoc', related='product_id.description_picking', readonly='True')
If I understand well, you have :
class ProductTemplate(models.Model):
[...]
description_picking = fields.Text('Description on Picking', translate=True)
[...]
this already exist and you are creating this
class sms(models.Model):
_inherit = 'mrp.bom.line'
sms_location = fields.One2many(string='StockLoc', related='product_id.description_picking', readonly='True')
where you want sms_location to be equal to the "description_picking" field of the product linked to you class (by product_id).
So your sms_location is also a String ?
If it is, try this
sms_location =fields.Text(string='StockLoc', related='product_id.description_picking', readonly='True')
If it don't work or don't do what you want, can you give more details about the error you get ?
That makes perfect sense. Will try it in a minute. Thanks,
Now I just need to add it to the BOM lines. Do you know how to add it to the BOM reports? Or should I start a new question for that?
Rob
Sorry I don't know anything about report. Good luck with you project !