** Branch linked: lp:openobject-client-web

** Branch linked: lp:openobject-client-web/5.0

-- 
[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 :)



_______________________________________________
Mailing list: https://launchpad.net/~c2c-oerpscenario
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~c2c-oerpscenario
More help   : https://help.launchpad.net/ListHelp

Reply via email to