← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 659507] Re: [5.0] no span for empty text fields in view mode

 

Hello Russell,

You have pointed out the correct problem/bug on web-client, And yes
thank you for the solution too.

So its fixed in stable and trunk web-client. Please update your code.
Revision-info:
Trunk: 3508 sma@xxxxxxxxxxx-20101013051641-qcevigetczgz9als
Stable: 2941 sma@xxxxxxxxxxx-20101013051933-bdso00i3am6d382m

Thanks.

** Changed in: openobject-client-web
       Status: Confirmed => Fix Released

-- 
[5.0] no span for empty text fields in view mode
https://bugs.launchpad.net/bugs/659507
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to OpenERP OpenObject.

Status in OpenObject Web Client: Fix Released

Bug description:
We had a problem with a form with lots of fields conditionally hidden (using attrs)

We were finding some of the fields were not being hidden in 'view' mode, whereas all the fields were hidden correctly in 'edit' mode. Also a JavaScript error was occuring ('obj' is undefined, on line 828 of MochiKit/DOM.js)

Eventually tracked the problem down to the logic in openerp/widgets/templates/text.mako  :

The original logic:

% if not editable and value:
<span kind="${kind}" id="${name}">
    % for line in value.split('\n'):
    <br>${line}</br>
    % endfor
</span>
% endif

This means a SPAN is only created if there is a value in the field. This causes javascript errors as MochiKit cannot find the field placeholder to modify its properties (i.e. to make it invisible). The fix is just to move the check for 'value' inside of the span tag to ensure it is always created:

% if not editable:
<span kind="${kind}" id="${name}">
  % if value:
    % for line in value.split('\n'):
    <br>${line}</br>
    % endfor
  % endif
</span>
% endif

Job done :)





References