I would like to ask how to get definite value from different model. I am developing customized CRM module. Lead and Pipeline Stages forms are different. I have 2 models, Lead and Pipeline. In Lead, I stored Lead Name and some fields. I want to get definite Lead Name when going to pipeline stages form via Lead Form. Currently I got all Lead Name with drop box but I want definite lead name only. Please let me request to give me suggestion for this problem. Thanks in advanced.
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
1
Reply
562
Views
Hi,
Seems you have to apply domain for the field or for the records.
If you need to show only some values in the many2one field, you can apply domain for the field. If you need to filter the records which is returned from an action, apply domain in that action.
Sample of applying domain for field:
tags = fields.Many2many('test_new_api.multi.tag', domain=[('name', 'ilike', 'a')])
Domain for an action:
result = {
"type": "ir.actions.act_window",
"res_model": "account.move",
"domain": [('id', 'in', self.line_ids.move_id.move_id.ids), ('move_type', 'in', self.env['account.move'].get_purchase_types())],
"context": {"create": False},
"name": "Vendor Bills",
'view_mode': 'tree,form',
}
return result
Thanks
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