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

Hello everyone, here's a question

How can I show a computed field (without store=True) in the qweb view of the website?
I added this field to product.template:

    es_novedad = fields.Boolean(string="Es una novedad", compute="_check_novedad", readonly=True)

    @api.one     def _check_novedad(self):         if datetime.datetime.strptime(self.create_date, '%Y-%m-%d %H:%M:%S') +
relativedelta(days=self.env.user.company_id.dias_novedad) >= datetime.datetime.now():             self.es_novedad = True         else:             self.es_novedad = False


But now there's no way I can show this field at the qweb...

Appreciate any effort trying to help me.

形象
丢弃
最佳答案

Hello,

You can use t-field to get computed fields in q-web templates

<span t-field="option.your_computed_field"/>

Hope this helps

形象
丢弃
相关帖文 回复 查看 活动
2
1月 24
1412
0
10月 22
3419
0
7月 20
2197
3
1月 25
4932
2
2月 16
5780