Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
9419 Zobrazení

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",
        }

Avatar
Zrušit
Nejlepší odpověď

1. set store = True on an field.

2. on compute functions need @api.depends('field_triggered')

3. try put your function below.

4 . after all this , try uninstall the module and install for store that field.


Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
srp 19
2561
1
úno 23
1762
2
úno 23
2584
0
čvn 22
2183
0
říj 21
2926