跳至内容
菜单
此问题已终结
3 回复
1310 查看

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
2141
1
7月 23
4567
0
3月 24
3348
1
9月 22
6281
1
3月 22
6111