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

Hi,

priority

The product name is too long. I want to print the first 10 characters in the output. What is HTML Qweb code?



Thanks.

Аватар
Отменить
Лучший ответ

Hello this is Gulshan Negi

Well, you can do this by using the code below.


< span t-field = "product.name" t-options = '{"widget": "text", "options": {"widget": "text", "truncate": 10}}' / >

I hope it will work.

Thank you

Аватар
Отменить
Лучший ответ

Hi,

You can limit the length of characters of field from python using size attribute.

For that, inherit product.template model and override the name field and give attribute size=10

class ProductTemplate(models.Model):
_inherit = "product.template"
name = fields.Char('Name', index='trigram', required=True, translate=True, size=10)

Regards

Аватар
Отменить
Related Posts Ответы Просмотры Активность
3
апр. 18
4533
0
июн. 25
344
1
авг. 17
5726
0
авг. 15
7027
1
мар. 15
5081