How to pass field data one model to another model.
class one(model.Model):
_name = one.one
x = fields.Integer()
y = fields.Integer()
class two(model.Model):
_name = two.two
p = fields.Integer()
k = fields.Integer()
here i need x field value
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
How to pass field data one model to another model.
class one(model.Model):
_name = one.one
x = fields.Integer()
y = fields.Integer()
class two(model.Model):
_name = two.two
p = fields.Integer()
k = fields.Integer()
here i need x field value
Hello Arjun,
If you want to get data from model one.one's field in model two.two's field, then just take many2one of one.one model in two.two and take related filed of it, let me explain by example:
class one(models.Model):
_name = one.one
x = fields.Integer()
y = fields.Integer()
class two(models.Model):
_name = two.two
one_id = fields.Many2one('one.one', string='One')
x = fields.Integer(related='one_id.x', string="X")
y = fields.Integer()
Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari
x field is computed field that data is stored in database now i want to pass x field data in the second model. but your above method is not working
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 | |
---|---|---|---|---|
|
4
thg 2 25
|
2703 | ||
|
1
thg 8 24
|
2234 | ||
|
2
thg 11 24
|
3371 | ||
|
3
thg 10 23
|
14904 | ||
Data for relations table
Đã xử lý
|
|
1
thg 4 24
|
2320 |