Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
2 Antworten
2502 Ansichten

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
Verwerfen
Beste Antwort

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
Verwerfen
Beste Antwort

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
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
3
Apr. 18
4643
0
Juni 25
440
1
Aug. 17
5821
0
Aug. 15
7133
1
März 15
5179