コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
2465 ビュー

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
4月 18
4608
0
6月 25
390
1
8月 17
5792
0
8月 15
7068
1
3月 15
5132