forked from Techsystech/web
manage tabindex and autofocus + flake8
parent
bfb5a0686f
commit
a30452cdfb
|
@ -65,7 +65,8 @@ Example
|
|||
widget="boolean_switch"
|
||||
attrs="{'readonly': [('login', '=', 'admin')]}"
|
||||
context="{'fake_parameter': 'foo'}"
|
||||
options="{'quick_edit': True, 'extra': {'onText': 'Yes', 'offText': 'No'}}"/>
|
||||
options="{'quick_edit': True, 'extra': {'onText': 'Yes',
|
||||
'offText': 'No'}}"/>
|
||||
```
|
||||
|
||||
Options
|
||||
|
@ -127,7 +128,8 @@ context
|
|||
special needs with the quick edition.
|
||||
|
||||
|
||||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
||||
.. image:: https://odoo-community.org/website/image/ir.attachment/
|
||||
5784_f2813bd/datas
|
||||
:alt: Try me on Runbot
|
||||
:target: https://runbot.odoo-community.org/runbot/162/7.0
|
||||
|
||||
|
|
|
@ -45,11 +45,12 @@
|
|||
<field name="name">res.users.tree</field>
|
||||
<field name="model">res.users</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Users" editable="top">
|
||||
<tree string="Users" editable="top" version="7.0">
|
||||
<field name="name"/>
|
||||
<field name="login"/>
|
||||
<field name="lang"/>
|
||||
<field name="active" widget="boolean_switch"
|
||||
tabindex="-1"
|
||||
attrs="{'readonly': [('login', '=', 'admin')]}"
|
||||
options="{'quick_edit': True, 'extra': {'onText': 'Yes', 'offText': 'No'}}"
|
||||
context="{'test': 'test value'}" />
|
||||
|
|
|
@ -170,11 +170,17 @@ openerp.web_widget_boolean_switch = function(instance){
|
|||
},
|
||||
|
||||
_format: function (row_data, options, readonly) {
|
||||
return _.str.sprintf('<input type="checkbox" %s %s data-rowid="%d"/>',
|
||||
options = options ? options : {};
|
||||
var autofocus = this.hasOwnProperty('autofocus') ? true : false;
|
||||
var tabindex = this.hasOwnProperty('tabindex') ?
|
||||
parseInt(this.tabindex) : 0;
|
||||
return _.str.sprintf('<input type="checkbox" %s %s data-rowid="%d" %s %s/>',
|
||||
row_data[this.id].value ? 'checked="checked"' : '',
|
||||
readonly ? 'readonly' : '',
|
||||
row_data.hasOwnProperty('id') && _.isNumber(row_data.id.value) ?
|
||||
row_data.id.value : -1);
|
||||
row_data.id.value : -1,
|
||||
autofocus ? 'autofocus' : '',
|
||||
'tabindex="' + tabindex + '"');
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue