コンテンツへスキップ
メニュー
この質問にフラグが付けられました
3 返信
1334 ビュー

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

アバター
破棄
関連投稿 返信 ビュー 活動
1
7月 24
2186
1
7月 23
4590
0
3月 24
3361
1
9月 22
6289
1
3月 22
6138