Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
3 Odpowiedzi
1491 Widoki

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

Awatar
Odrzuć
Najlepsza odpowiedź

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.

Awatar
Odrzuć
Autor Najlepsza odpowiedź

I'm trying on vers 16.0

Awatar
Odrzuć
Najlepsza odpowiedź

Hello Desi Shofiana Sari

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

Thanks

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
lip 24
2366
1
lip 23
4749
0
mar 24
3516
1
wrz 22
6438
1
mar 22
6359