← Back to team overview

c2c-oerpscenario team mailing list archive

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

 

Hello,

Our R&D Teams are focused on the latest OpenERP version, and this issue
does not affect it.

Thanks.

** Changed in: openobject-client-web/5.0
       Status: New => Won't Fix

** Changed in: openobject-client-web/trunk
   Importance: Undecided => Low

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

** Changed in: openobject-client-web/trunk
     Assignee: (unassigned) => OpenERP SA's Web Client R&D (openerp-dev-web)

-- 
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:
  Confirmed
Status in OpenObject Web Client 5.0 series:
  Won't Fix
Status in OpenObject Web Client trunk series:
  Confirmed

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