openerp-expert-framework team mailing list archive
-
openerp-expert-framework team
-
Mailing list archive
-
Message #00544
Re: _constraints message improvement
On 07/06/2011 01:26 PM, Thibaut DIRLIK wrote:
> Hi everybody,
>
> I'm not sure this ML is the good place to do framework features request.
It certainly makes sense to discuss here if framework requests are
useful improvements.
> I think we could improve _constraints error message. Currently, the
> message is static. It would be a good idea to let it be dynamic.
As of 6.0, the message of any _constraint definition may be a callable,
and if it is, the ORM will call it to get the translated error message.
The callable should match the following signature, and is in charge of
doing its own translation of the message:
def msg(model, cr, uid, ids, context=context):
"""Returns the dynamic error message for the constraint.
:return: translated error string, or a (msg,params) pair, to
be formatted (i.e msg % params) before being used.
:rtype: string or pair (string, [params])
"""
return "translated error message"
Does this help for your case?
References