Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
4928 Представления

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

Аватар
Отменить
Related Posts Ответы Просмотры Активность
2
янв. 24
1407
0
окт. 22
3411
0
июл. 20
2193
3
янв. 25
4928
2
февр. 16
5779