hi! all, i have two class one is patient and second is doctor. and i have to create many2one fields in both side to relate each other. now i want when patient class many2one fields is selected a doctor record then automatically that patient record id or name is filled in doctor class many2one fields in tree view and only read-only.
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
Here is what you probably want:
1. A one2many field in doctor. You don't want to have a many2many record for each doctor record pointing to all its patients. That is inneficcient. You just need to retrive all patients that reference this doctor. That is what a one2many field does.
2. To automatically fill in information about a doctor what you need is:
1. A related field
2. Mark fields as readonly in the python source code
Read about related fields here:
https://www.odoo.com/documentation/11.0/reference/orm.html#related-fields
The whole document itself is really good. It also talks about one2many fields.
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up