Hi everyone, after much research I find myself asking for help for something, I think, quite simple.
I have a Many2many field, which I fill through a search in a computed one, checking the entered values are correct (I also have another field which with the sum of the ids obtained from the search)
I use the Many2many field in an action to display a treeview with the records that interest me, through the domain.
But I have a problem:
when I call the action check that the Many2many field is empty.
I also tried to enter store = True but to no avail. What am I doing wrong?
Thanks in advance
compute function
@api.multi
def _compute_potential_customer_count(self):
self.potential_customer_ids = self.env["res.partner"].search(
[
("country_id", "=", self.city_id.country_id.id),
("city", "=", self.city_id.name),
("certification_ids", "in", self.certificate_ids.ids),
]
)
self.potential_customer_count = len(self.potential_customer_ids)
action
@api.multi
def action_customer(self):
return {
"name": "Potential Customer",
"type": "ir.actions.act_window",
"res_model": "res.partner",
"view_mode": "tree",
"res_id": False,
"domain": [("id", "in", self.potential_customer_ids.ids)],
"target": "current",
}