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

So I have this field for the widget:


```widget name="web_ribbon" title="REMISE IMPOSSIBLE" bg_color="bg-danger" class="ribbon ribbon-top-center" attrs="{'invisible': [('discount_rate_sale_count', '!=', True), ('discount_rate_sale_count', '!=', show_ribbon)]}"```


and this code:
    show_ribbon = fields.Boolean(string='Show Ribbon', compute='_compute_show_ribbon', store=True)

    @api.depends('sale')

    def _compute_show_ribbon(self):

        for record in self:

            record.show_ribbon = record.sale> (

                        record.total_price * 0.6) if record.total_price else False


But the ribbon didn't work

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

Hi,

Please try this attrs. 

attrs="{'invisible': [('sale', '!=', show_ribbon)]}"/>

Note: Just add the sale fields before the attrs field.

Up vote if its help you.

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

I'm trying on vers 16.0

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

Hello Desi Shofiana Sari

Can you tell me In which version you are trying this??

Thanks

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.ค. 24
2291
1
ก.ค. 23
4685
0
มี.ค. 24
3421
1
ก.ย. 22
6370
1
มี.ค. 22
6242