Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
2454 Zobrazení

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.

Avatar
Zrušit
Nejlepší odpověď

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

Avatar
Zrušit
Nejlepší odpověď

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

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
3
dub 18
4584
0
čvn 25
377
1
srp 17
5771
0
srp 15
7049
1
bře 15
5106