Skip to Content
Menu
This question has been flagged
1 Reply
562 Views

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.

Avatar
Discard
Best Answer

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

Avatar
Discard