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")
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
1
thg 11 24
|
20749 | ||
|
1
thg 9 23
|
3518 | ||
|
3
thg 5 23
|
6140 | ||
|
7
thg 4 23
|
49525 | ||
Barcode scanner from mobile
Đã xử lý
|
|
1
thg 12 22
|
8250 |
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 !