Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
1357 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

I'm trying on vers 16.0

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello Desi Shofiana Sari

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

Thanks

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 7 24
2208
1
thg 7 23
4642
0
thg 3 24
3381
1
thg 9 22
6309
1
thg 3 22
6175