Odoo Help

0

How to restrict the characters in HTML field in odoo

By
Arunagiri
on 10/20/16, 6:01 AM 395 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--
6263
| 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

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

Question tools

1 follower(s)

Stats

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