Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
9596 มุมมอง

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

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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.


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ส.ค. 19
2700
1
ก.พ. 23
1937
2
ก.พ. 23
2744
0
มิ.ย. 22
2338
0
ต.ค. 21
3161