← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 659782] Re: Fields get blued in view mode if attrs is applied.

 

** Changed in: openobject-client-web/trunk
       Status: Confirmed => In Progress

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/659782

Title:
  Fields get blued in view mode if attrs is applied.

Status in OpenObject Web Client:
  In Progress
Status in OpenObject Web Client 5.0 series:
  Won't Fix
Status in OpenObject Web Client trunk series:
  In Progress

Bug description:
  Thank you for your speedy fix to my last problem! :) Unfortunately I've found another bug with conditional formatting:

We have a number of fields conditionally made required (using attrs). When the form is shown in 'view' mode, these fields are incorrectly highlighted blue.

The problem seems to be in the 'form_setRequired()' function in static/javascript/form_state.js. It does not take into account whether the form is editable or not (_terp_editable).

Please see my below suggested fix (starting from line 319 of form_state.js):

var form_setRequired = function(container, field, required) {
    
    var editable = getElement('_terp_editable').value;

    if (editable == 'True') {
        if (required) {
            MochiKit.DOM.addElementClass(field, 'requiredfield');
        } else {
            MochiKit.DOM.removeElementClass(field, 'requiredfield');
        }
    }
    MochiKit.DOM.removeElementClass(field, 'errorfield');

    var kind = MochiKit.DOM.getNodeAttribute(field, 'kind');
    
    if (field.type == 'hidden' && kind == 'many2one') {
        form_setRequired(container, getElement(field.name + '_text'), required);
    }
}





References