overriding _error_messages

Visto 31 veces
Saltar al primer mensaje no leído

Francisco Maria Moyano Casco

no leída,
11 abr 2018, 10:16:1711/4/18
a 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

no leída,
13 abr 2018, 9:58:5913/4/18
a 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

no leída,
20 abr 2018, 10:43:4020/4/18
a 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

Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos