Skip to Content
Menu
This question has been flagged
2 Replies
4123 Views

Hi,

I am finding that I am repeating a lot of duplicate information on my view:

For instance if I have 40 fields that all have the same "attrs" properties.  Instead of needing to repeat this on ever single field, is there a way I can set a variable that contains the string for which I can dynamically add to each field.  I there only need to change the variable in one place instead of every field?

e.g:

<field name="field1" string="Field 1" attrs="+$attrsvariable+" />"

Thanks,
Damien


Avatar
Discard
Author Best Answer

I am not sure this will help, as It is not just about user groups, as you can see I looking at both user groups and also workflow state.  I am ending up repeating the attrs value across everyline.  Is there a way to set this in a variable once and reuse it in each of the lines:

<tr><th nowrap="true">Division Code</th><td><field name="divisionAU" attrs="{'readonly':['&amp;','|','&amp;',('groupEngineering','!=','YES'),('groupMarketing','!=','YES'),('state','=','Completed'),('state','!=','draft')]}"/> Australia | <field name="divisionNZ" attrs="{'readonly':['&amp;','|','&amp;',('groupEngineering','!=','YES'),('groupMarketing','!=','YES'),('state','=','Completed'),('state','!=','draft')]}"/>New Zealand</td></tr> <tr><th nowrap="true">Product Status</th><td><field name="itemStatus" attrs="{'readonly':['&amp;','|','&amp;',('groupEngineering','!=','YES'),('groupMarketing','!=','YES'),('state','=','Completed'),('state','!=','draft')]}"/></td></tr>


Second issue that I am hoping to resolve with the availability of a variable is as follows:


If a certain value is selected in a "type" field it should display the following state line with the appropriate states:

<field name="state" widget="statusbar" statusbar_visible="draft,PendingEng,PendingMan,PendingFinance,PendingApproval,Completed" />

However if the other value is selected, it should use the following:

<field name="state" widget="statusbar" statusbar_visible="draft,PendingEng,,Completed" />

Thoughts?

Damien

Avatar
Discard
Best Answer

Hi Damien, can't say exactly about the dynamic variable functionality which you mentioned,but you can avoid adding the attrs condition to each field using group tag.

You need to add all your fields[where you want to set attrs condition] under a group tag, and add attrs condition to the group tag which will be applying for all the fields.

Avatar
Discard