overriding _error_messages

31 views
Skip to first unread message

Francisco Maria Moyano Casco

unread,
Apr 11, 2018, 10:16:17 AM4/11/18
to tryton
Hi,
I'm using tryton 3.8. Is there anyway to override an _error_messages on a class extension?

For example, in the original class I got this:

............
@classmethod
def __setup__(cls):
super(My_class, cls).__setup__()
cls._error_messages.update({
'only_capital_letters':
'You have to write the field on CAPITAL LETTERS',
})

..........

On the extension, I need somthing like this (I know this is the wrong way):
............
@classmethod
def __setup__(cls):
super(My_class, cls).__setup__()
cls._error_messages.update({
'only_capital_letters': continue,
})
..........

Thanks. Regards
Francisco

Maxime Richez

unread,
Apr 13, 2018, 9:58:59 AM4/13/18
to tryton
> On the extension, I need somthing like this (I know this is the wrong way):
> ............
> @classmethod
> def __setup__(cls):
> super(My_class, cls).__setup__()
> cls._error_messages.update({
> 'only_capital_letters': continue,
> })

try this : cls._error_messages['only_capital_letters'] = 'your text'

Francisco Maria Moyano Casco

unread,
Apr 20, 2018, 10:43:40 AM4/20/18
to tryton
Hi,

> try this : cls._error_messages['only_capital_letters'] = 'your text'

Thank you, but that's not what I am lookin for. I need to change the behaviour itself.

Best regards
Francisco

Reply all
Reply to author
Forward
0 new messages