Odoo Help

Welcome!

This community 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.

0

How to restrict the characters in HTML field in odoo

By
Arunagiri
on 10/20/16, 6:01 AM 216 views

I want to only limited characters display in my Html Field 

for example :

note=field.Html(size=250)

but this is not worked 

1

zbik

--zbik--
5941
| 6 4 7
Lodz, Poland
--zbik--


zbik
On 10/20/16, 7:22 AM

You use constrains decorator, for example:

@api.one
@api.constrains('note')
def _check_len_html(self):
    if len(self.note)>250:
        raise ValidationError("Html is too long")

how self.html works any idea it will get an error object has no attribute html i've tried this but it wont work

Arunagiri
on 10/20/16, 7:52 AM

Sorry, my mistake, should be len(self.note)

zbik
on 10/20/16, 7:55 AM

Thanks for your help i done this

Arunagiri
on 10/20/16, 8:34 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 10/20/16, 6:01 AM
Seen: 216 times
Last updated: 10/20/16, 8:34 AM