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")
Create an account today to enjoy exclusive features and engage with our awesome community!
Registrar-seRelated Posts | Respostes | Vistes | Activitat | |
---|---|---|---|---|
|
1
de nov. 24
|
20583 | ||
|
1
de set. 23
|
3348 | ||
|
3
de maig 23
|
5941 | ||
|
7
d’abr. 23
|
49371 | ||
Barcode scanner from mobile
Solved
|
|
1
de des. 22
|
8129 |
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 !