← Back to team overview

openerp-expert-framework team mailing list archive

Re: Improve user / integrator experience

 

On Tue, Dec 8, 2009 at 7:40 AM, Sharoon Thomas
<sharoonthomas@xxxxxxxxxxxx>wrote:

> Hi all,
>
> This is a very good proposal and we had proposed this as a blueprint to the
> report-openoffice team as well.
> This is not just in the case of reporting but also in the case of general
> coding & modules like poweremail, smtpclient etc.
>
> The generic issue IMHO is the open erp browse object/class which has two
> problems:
>
>    1. raises an error when the expression is wrong eg.
>    user.partner_id.name (if partner id doesnt exist or is false it returns
>    err so we are forced to write user.partner_id and user.partner_id.name)
>    2. if a field is empty it return False, it should be possible to
>    selectively change what should be the return value if database/computed
>    value is null. So if we can selectively opt to choose like
>    self.pool.get('model').browse(cr,uid,ids,context={'null_value' = ''}) and if
>    browse object respects this, there should be no problem.
>
> In the case of relatorio (open Office reports) I understand that its a
> field by fields computation. This makes it go for an easy workaround which
> would be to wrap in a try:..except:..else..
>
>  For other engines like mako/cheetah/django which generate the whole report
> at once, any wrong expression would mean an empty report.
>


Hello, I'm back on that one because I could take about it to Quentin and
Fabien from Tiny.

For 1)
Fabien said he doesn't want to avoid raising an exception when we search a
field upon an undefined object because he fairs side effects. Given the low
test suite coverage, I tend to understand.

However he suggested something that might work in most of cases where it's
currently a hassle:
we could instead raise some specific exception (something like
NoneTypeFieldException)
Then a template engine could catch that exception specifically and replace
it by "" whenever it happens.
It fixes 1) in most cases, though in some edge cases it will just skip the
further evaluation you would have expect if you don't pay attention. But
currently you already have to pay attention to those cases so it's by no
means harder, it's rather a good step forward already.

For 2)
Also, he told he doesn't want to give the ability to select an other value
instead of False as the return type when the field is undefined.
He advise each template engine does it at it's own level: if an expression
is evaluated to False, then only "" is appended in the flow, not "False".
That fixes 2) but requires each engine to take care of it.


My question is: could we experiment on this and look how much it simplifies
the reporting work? Could the report_openoffice implement it so we test the
concept and then eventually toss Tiny so they do it to in their own
reporting engine? 2) is doable already, 1) would require a small patch in
the server, but that's something we can ask for v5.2 at least if we prove
the concept is valid.
Do you need further details, is something not clear?

Follow ups

References