تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
2452 أدوات العرض

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

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
3
أبريل 18
4584
0
يونيو 25
375
1
أغسطس 17
5770
0
أغسطس 15
7048
1
مارس 15
5106