Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I have defined a string variable 'desc' as below:
'desc': fields.char('Description', size=50),
Now i can enter upto 50 chars in form. But i have set limit only for 20 chars when displays this field in report.Give me python methods to solve this.Thanks
It is simple because string is allowed subscripting ([ ]) in python. So, according to that your requirement will be fulfill as like below.
As your field named "desc" will take 50 characters and you want print only 20 in report. Just make this line inside your report, requirement will fulfill.
1) object.desc[0:20] #It will only takes 20 character from desc field.
2) object.desc if len(object.desc) < 20 else "%s..." %(object.desc[0:18])
I hope you will get what you want.
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 11/25/15, 11:36 PM|
|Seen: 831 times|
|Last updated: 11/26/15, 12:28 AM|