openerp-expert-framework team mailing list archive
-
openerp-expert-framework team
-
Mailing list archive
-
Message #00545
Re: _constraints message improvement
A Dimecres, 6 de juliol de 2011 13:26:10, Thibaut DIRLIK va escriure:
> Hi everybody,
>
> I'm not sure this ML is the good place to do framework features request.
> Tell me if it's not.
>
> I think we could improve _constraints error message. Currently, the
> message is static. It would be a good idea to let it be dynamic.
>
> For example, I'm working a module which allocate ressources to a project
> task, and a ressource can't be allocated if an other task already use it
> at the same time.
>
> In the message, we can't tell the user which task is using the
> ressource, because it is static.
>
> A workaround could be to catch an exception like ValidationError or
> ConstraintError (as you want, the name doesn't matter). If such an
> exception is raised, the str() of the exception object could be used
> instead of the default message. This feature will stay compatible with
> the old system and add some flexibility.
>
> I'm pretty sure it's not hard to implement and it could improve user
> experience in some cases for 6.1 modules. What do you think ?
Well, we use an osv.except_osv() instead of returning False. That said, I
think the API should simply not include the possibility of adding a static
text and force the developer to always use the exception. The possibility that
comments Olivier seems to complex to me, compared to how easy it is to raise
an insightful exception.
>
> --
> Thibaut DIRLIK
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openerp-expert-framework
> Post to : openerp-expert-framework@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openerp-expert-framework
> More help : https://help.launchpad.net/ListHelp
--
Albert Cervera i Areny
http://www.NaN-tic.com
OpenERP Partners
Tel: +34 93 553 18 03
http://twitter.com/albertnan
http://www.nan-tic.com/blog
Follow ups
References