Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
3 Risposte
1325 Visualizzazioni

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

Avatar
Abbandona
Risposta migliore

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.

Avatar
Abbandona
Autore Risposta migliore

I'm trying on vers 16.0

Avatar
Abbandona
Risposta migliore

Hello Desi Shofiana Sari

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

Thanks

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
lug 24
2159
1
lug 23
4576
0
mar 24
3353
1
set 22
6284
1
mar 22
6120