I create a model that inherit Project.Project, in this model have a field name "Customer".
I create another model that inherit Project.Task, and create a new field that I want this field will related to the field "Customer". When i change value in Customer, it will be changed in the new field in my model Project.Task. Can someone help me?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
Hi LaoThai,
Related Field
There is not anymore fields.related
fields.
Instead you just set the name argument related to your model:
participant_nick = fields.Char(string='Nick name',
related='partner_id.name')
The type
kwarg is not needed anymore.
Setting the store
kwarg will automatically store the value in database. With new API the value of the related field will be automatically updated, sweet.
participant_nick = fields.Char(string='Nick name',
store=True,
related='partner_id.name')
Note
When updating any related field not all translations of related field are translated if field is stored!!
Chained related fields modification will trigger invalidation of the cache for all elements of the chain.
for more details, please refer this link for related field: \Related Field
\https://www.youtube.com/watch?v=mwQ4Nm4f4V4&list=UUZVWw0iLx0pFTzUzvl_XpcA&index=6
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
9
Jun 23
|
11133 | ||
|
2
Jan 22
|
2736 | ||
|
2
Dec 21
|
6275 | ||
|
0
Jun 21
|
1007 | ||
|
0
Feb 21
|
1542 |