Hello i have one many2many field called tech_id on which user can select multiple technology like python,react etc. I want to display those selected value on selection field how can i achive this.
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,
Instead of making your Selection field dynamic you can use a Many2One field and add the widget ‘selection’ in the xml file.
First we need to add 2 fields in your python file:
tech_ids = fields.Many2many('model.name')
technology_id = fields.Many2one('model.name')
then we need to add these fields into xml and need to use ‘selection’ widget in your Many2one field:
<field name="partner_ids" widget="many2many_tags"/>
<field name="partner_id" widget="selection"/>
after that we need to define a onchange function:
@api.onchange('partner_ids')
def _compute_new_selection(self):
selected_list = []
for rec in self.tech_ids:
selected_list.append(rec._origin.id)
return {'domain': {'technology_id': [('id', 'in', selected_list )]}}
Regards
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
Hello Cybrosys Techno Solutions Pvt.Ltd thanks for your reply my technology_id(M2o) is inside O2m filed table of tech_ids so in that can how can i add domain to it