Hello,
I want to use domain on field:
[('partner_id', '=', partner id)] <- when partner_id filed is set;
[] <- when partner_id field is empty
How to archive this?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Financeiro
- Inventário
- PoS
- Project
- MRP
Esta pergunta foi sinalizada
2
Respostas
2513
Visualizações
Hi, Grzegorz
You can achieve your requirement using "onchange" decorator in Odoo. Like below example
@api.onchange('partner_id')
def _onchange_partner_id(self):
res = {'domain': {'partner_id': []}}
if self.partner_id:
res['domain']['partner_id'] = [('partner_id', '=', partner_id.id)]
return res
Feel free to ask in case you have any confusion related to the above code.
Thanks,
Ashish Singh (Team Lead)
Webkul Software Private Limited
Thanks for the answer.
This will work only when partner_id is updated, not in existing records with partner_id set earlier.
Any way to trigger this dynamic domain code every time when form view is loaded?
Está gostando da discussão? Não fique apenas lendo, participe!
Crie uma conta hoje mesmo para aproveitar os recursos exclusivos e interagir com nossa incrível comunidade!
Inscreva-se