Browse Source

Merge pull request #559 from legalsylvain/9.0_PORT_web_listview_custom_element_number

[PORT] 9.0 web_listview_custom_element_number
pull/560/head
Pedro M. Baeza 8 years ago
committed by GitHub
parent
commit
cf45c6dcaa
  1. 83
      web_listview_custom_element_number/README.rst
  2. 31
      web_listview_custom_element_number/__openerp__.py
  3. 26
      web_listview_custom_element_number/i18n/ar.po
  4. 26
      web_listview_custom_element_number/i18n/de.po
  5. 26
      web_listview_custom_element_number/i18n/es.po
  6. 26
      web_listview_custom_element_number/i18n/fi.po
  7. 19
      web_listview_custom_element_number/i18n/fr.po
  8. 26
      web_listview_custom_element_number/i18n/it.po
  9. 26
      web_listview_custom_element_number/i18n/pt_BR.po
  10. 26
      web_listview_custom_element_number/i18n/sl.po
  11. 26
      web_listview_custom_element_number/i18n/tr.po
  12. 4
      web_listview_custom_element_number/i18n/web_listview_custom_element_number.pot
  13. 24
      web_listview_custom_element_number/static/src/css/web_listview_custom_element_number.css
  14. BIN
      web_listview_custom_element_number/static/src/img/screnshot_chrome.png
  15. BIN
      web_listview_custom_element_number/static/src/img/screnshot_firefox.png
  16. BIN
      web_listview_custom_element_number/static/src/img/screnshot_partner_limit.png
  17. 53
      web_listview_custom_element_number/static/src/js/web_listview_custom_element_number.js
  18. 29
      web_listview_custom_element_number/views/templates.xml

83
web_listview_custom_element_number/README.rst

@ -1,14 +1,40 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
=========================================================================
Allow users to set manually a quantity of items to display in a tree view Allow users to set manually a quantity of items to display in a tree view
========================================================================= =========================================================================
By default, in Odoo, user can display 80 / 200 / 500 / 2000 elements in
a tree view. With that module, user can select a custom number of items to
display;
This module extends the functionality of web module, to improve list views and
to allow users to display custom quantity of items.
(By default, in Odoo, user can only display 80 / 200 / 500 / 2000 elements in
a tree view)
Usage
=====
To use this module, you need to:
#. Go to a list view
#. Click on the item '1 - 80 of xxx'
#. Tip a custom quantity of item you want to see, and then press return
Sample for res.partner model with a limit of 3:
.. image:: ./web_listview_custom_element_number/static/src/img/screnshot_partner_limit.png
.. 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/9.0
Technical information Technical information
---------------------
=====================
* replace a select element by an input with datalist option. That allows
* Replace a select element by an input with datalist option. That allows
to set a custom value, or to select an option. (same options as before: to set a custom value, or to select an option. (same options as before:
80 / 200 / 500 / 2000 / unlimited); 80 / 200 / 500 / 2000 / unlimited);
@ -17,38 +43,26 @@ Technical information
user to select manually a value); user to select manually a value);
See browser Support: http://www.w3schools.com/tags/tag_datalist.asp See browser Support: http://www.w3schools.com/tags/tag_datalist.asp
* The display of the datalist input can be different depending of the browser.
* FireFox Display:
.. image:: ./web_listview_custom_element_number/static/src/img/screnshot_firefox.png
* Chrome Display:
.. image:: ./web_listview_custom_element_number/static/src/img/screnshot_chrome.png
Usage
-----
* Sample for res.partner model with a limit of 3:
.. image:: web_listview_custom_element_number/static/src/img/screnshot_partner_limit.png
The display of the datalist input can be different depending of the browser.
* FireFox Display:
.. image:: web_listview_custom_element_number/static/src/img/screnshot_firefox.png
* Chrome Display:
Known issues / Roadmap
======================
.. image:: web_listview_custom_element_number/static/src/img/screnshot_chrome.png
Limits / Roadmap
================
* When pressing Esc key, it could be user friendly to return to the previous * When pressing Esc key, it could be user friendly to return to the previous
state (before editing the quantity). state (before editing the quantity).
Bug Tracker Bug Tracker
=========== ===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback
`here <https://github.com/OCA/web/issues/new?body=module:%20web_listview_custom_element_number%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/web/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smash it by providing detailed and welcomed feedback.
Credits Credits
======= =======
@ -58,12 +72,19 @@ Contributors
* Sylvain LE GAL (https://twitter.com/legalsylvain) * Sylvain LE GAL (https://twitter.com/legalsylvain)
Funders
-------
The development of this module has been financially supported by:
* Akretion (http://www.akretion.com)
Maintainer Maintainer
---------- ----------
.. image:: http://odoo-community.org/logo.png
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association :alt: Odoo Community Association
:target: http://odoo-community.org
:target: https://odoo-community.org
This module is maintained by the OCA. This module is maintained by the OCA.
@ -71,4 +92,4 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
To contribute to this module, please visit http://odoo-community.org.
To contribute to this module, please visit https://odoo-community.org.

31
web_listview_custom_element_number/__openerp__.py

@ -1,33 +1,16 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Web - Custom Element Number in ListView module for Odoo
# -*- coding: utf-8 -*-
# Copyright (C) 2015-Today Akretion (http://www.akretion.com) # Copyright (C) 2015-Today Akretion (http://www.akretion.com)
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{ {
'name': 'Web - Custom Element Number in ListView', 'name': 'Web - Custom Element Number in ListView',
'summary': 'Allow users to set manually a quantity of items to display' 'summary': 'Allow users to set manually a quantity of items to display'
' in a tree view', ' in a tree view',
'version': '8.0.1.0.0',
'version': '9.0.1.0.0',
'category': 'web', 'category': 'web',
'author': "Akretion,Odoo Community Association (OCA)",
'website': 'http://www.akretion.com',
'author': "GRAP,Akretion,Odoo Community Association (OCA)",
'website': 'https://odoo-community.org/',
'license': 'AGPL-3', 'license': 'AGPL-3',
'depends': [ 'depends': [
'web', 'web',
@ -35,5 +18,5 @@
'data': [ 'data': [
'views/templates.xml', 'views/templates.xml',
], ],
'installable': False,
'installable': True,
} }

26
web_listview_custom_element_number/i18n/ar.po

@ -0,0 +1,26 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_listview_custom_element_number
#
# Translators:
# SaFi J. <safi2266@gmail.com>, 2015
msgid ""
msgstr ""
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-12-16 07:41+0000\n"
"PO-Revision-Date: 2015-12-16 17:31+0000\n"
"Last-Translator: SaFi J. <safi2266@gmail.com>\n"
"Language-Team: Arabic (http://www.transifex.com/oca/OCA-web-8-0/language/ar/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: ar\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"
#. module: web_listview_custom_element_number
#. openerp-web
#: code:addons/web_listview_custom_element_number/static/src/js/web_listview_custom_element_number.js:42
#, python-format
msgid "Unlimited"
msgstr "بلاحدود"

26
web_listview_custom_element_number/i18n/de.po

@ -0,0 +1,26 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_listview_custom_element_number
#
# Translators:
# Rudolf Schnapka <rs@techno-flex.de>, 2016
msgid ""
msgstr ""
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-01-10 07:31+0000\n"
"PO-Revision-Date: 2016-01-18 20:15+0000\n"
"Last-Translator: Rudolf Schnapka <rs@techno-flex.de>\n"
"Language-Team: German (http://www.transifex.com/oca/OCA-web-8-0/language/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: web_listview_custom_element_number
#. openerp-web
#: code:addons/web_listview_custom_element_number/static/src/js/web_listview_custom_element_number.js:42
#, python-format
msgid "Unlimited"
msgstr "Unbegrenzt"

26
web_listview_custom_element_number/i18n/es.po

@ -0,0 +1,26 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_listview_custom_element_number
#
# Translators:
# Pedro M. Baeza <pedro.baeza@gmail.com>, 2015
msgid ""
msgstr ""
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-11-23 13:46+0000\n"
"PO-Revision-Date: 2015-11-07 11:28+0000\n"
"Last-Translator: Pedro M. Baeza <pedro.baeza@gmail.com>\n"
"Language-Team: Spanish (http://www.transifex.com/oca/OCA-web-8-0/language/es/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: web_listview_custom_element_number
#. openerp-web
#: code:addons/web_listview_custom_element_number/static/src/js/web_listview_custom_element_number.js:42
#, python-format
msgid "Unlimited"
msgstr "Ilimitado"

26
web_listview_custom_element_number/i18n/fi.po

@ -0,0 +1,26 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_listview_custom_element_number
#
# Translators:
# Jarmo Kortetjärvi <jarmo.kortetjarvi@gmail.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-01-10 07:31+0000\n"
"PO-Revision-Date: 2016-02-01 09:54+0000\n"
"Last-Translator: Jarmo Kortetjärvi <jarmo.kortetjarvi@gmail.com>\n"
"Language-Team: Finnish (http://www.transifex.com/oca/OCA-web-8-0/language/fi/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: fi\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: web_listview_custom_element_number
#. openerp-web
#: code:addons/web_listview_custom_element_number/static/src/js/web_listview_custom_element_number.js:42
#, python-format
msgid "Unlimited"
msgstr "Rajaton"

19
web_listview_custom_element_number/i18n/fr.po

@ -1,23 +1,24 @@
# Translation of OpenERP Server.
# Translation of Odoo Server.
# This file contains the translation of the following modules: # This file contains the translation of the following modules:
# * web_listview_custom_element_number
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-06-07 23:26+0000\n"
"PO-Revision-Date: 2015-06-07 23:26+0000\n"
"POT-Creation-Date: 2017-02-17 22:55+0000\n"
"PO-Revision-Date: 2017-02-17 22:55+0000\n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n" "Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: web_listview_custom_element_number #. module: web_listview_custom_element_number
#. openerp-web #. openerp-web
#: code:addons/web_listview_custom_element_number/static/src/js/web_listview_custom_element_number.js:56
#: code:addons/web_listview_custom_element_number/static/src/js/web_listview_custom_element_number.js:42
#, python-format #, python-format
msgid "0 (Unlimited)"
msgstr "0 (Illimité)"
msgid "Unlimited"
msgstr "Illimité"

26
web_listview_custom_element_number/i18n/it.po

@ -0,0 +1,26 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_listview_custom_element_number
#
# Translators:
# Paolo Valier, 2016
msgid ""
msgstr ""
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-03-17 07:29+0000\n"
"PO-Revision-Date: 2016-03-19 10:10+0000\n"
"Last-Translator: Paolo Valier\n"
"Language-Team: Italian (http://www.transifex.com/oca/OCA-web-8-0/language/it/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: it\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: web_listview_custom_element_number
#. openerp-web
#: code:addons/web_listview_custom_element_number/static/src/js/web_listview_custom_element_number.js:42
#, python-format
msgid "Unlimited"
msgstr "Illimitato"

26
web_listview_custom_element_number/i18n/pt_BR.po

@ -0,0 +1,26 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_listview_custom_element_number
#
# Translators:
# danimaribeiro <danimaribeiro@gmail.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-03-11 02:17+0000\n"
"PO-Revision-Date: 2016-03-05 16:20+0000\n"
"Last-Translator: danimaribeiro <danimaribeiro@gmail.com>\n"
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/OCA-web-8-0/language/pt_BR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: pt_BR\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: web_listview_custom_element_number
#. openerp-web
#: code:addons/web_listview_custom_element_number/static/src/js/web_listview_custom_element_number.js:42
#, python-format
msgid "Unlimited"
msgstr "ilimitado"

26
web_listview_custom_element_number/i18n/sl.po

@ -0,0 +1,26 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_listview_custom_element_number
#
# Translators:
# Matjaž Mozetič <m.mozetic@matmoz.si>, 2015
msgid ""
msgstr ""
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-11-23 13:46+0000\n"
"PO-Revision-Date: 2015-11-08 05:45+0000\n"
"Last-Translator: Matjaž Mozetič <m.mozetic@matmoz.si>\n"
"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-web-8-0/language/sl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: sl\n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
#. module: web_listview_custom_element_number
#. openerp-web
#: code:addons/web_listview_custom_element_number/static/src/js/web_listview_custom_element_number.js:42
#, python-format
msgid "Unlimited"
msgstr "neomejeno"

26
web_listview_custom_element_number/i18n/tr.po

@ -0,0 +1,26 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_listview_custom_element_number
#
# Translators:
# Ahmet Altınışık <aaltinisik@altinkaya.com.tr>, 2015
msgid ""
msgstr ""
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-01-08 21:34+0000\n"
"PO-Revision-Date: 2015-12-30 21:59+0000\n"
"Last-Translator: Ahmet Altınışık <aaltinisik@altinkaya.com.tr>\n"
"Language-Team: Turkish (http://www.transifex.com/oca/OCA-web-8-0/language/tr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: tr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: web_listview_custom_element_number
#. openerp-web
#: code:addons/web_listview_custom_element_number/static/src/js/web_listview_custom_element_number.js:42
#, python-format
msgid "Unlimited"
msgstr "sınırsız"

4
web_listview_custom_element_number/i18n/web_listview_custom_element_number.pot

@ -16,8 +16,8 @@ msgstr ""
#. module: web_listview_custom_element_number #. module: web_listview_custom_element_number
#. openerp-web #. openerp-web
#: code:addons/web_listview_custom_element_number/static/src/js/web_listview_custom_element_number.js:56
#: code:addons/web_listview_custom_element_number/static/src/js/web_listview_custom_element_number.js:42
#, python-format #, python-format
msgid "0 (Unlimited)"
msgid "Unlimited"
msgstr "" msgstr ""

24
web_listview_custom_element_number/static/src/css/web_listview_custom_element_number.css

@ -1,22 +1,10 @@
/******************************************************************************
Web - Custom Element Number in ListView module for Odoo
Copyright (C) 2015-Today Akretion (http://www.akretion.com)
@author Sylvain LE GAL (https://twitter.com/legalsylvain)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
/*
Copyright (C) 2015-Today Akretion (http://www.akretion.com)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
*/
.custom_element_number { .custom_element_number {
width:80px; width:80px;
height: 29px;
} }

BIN
web_listview_custom_element_number/static/src/img/screnshot_chrome.png

Before

Width: 460  |  Height: 180  |  Size: 9.6 KiB

After

Width: 270  |  Height: 177  |  Size: 6.1 KiB

BIN
web_listview_custom_element_number/static/src/img/screnshot_firefox.png

Before

Width: 460  |  Height: 180  |  Size: 15 KiB

After

Width: 260  |  Height: 154  |  Size: 7.2 KiB

BIN
web_listview_custom_element_number/static/src/img/screnshot_partner_limit.png

Before

Width: 745  |  Height: 243  |  Size: 28 KiB

After

Width: 744  |  Height: 251  |  Size: 27 KiB

53
web_listview_custom_element_number/static/src/js/web_listview_custom_element_number.js

@ -1,40 +1,28 @@
/******************************************************************************
Web - Custom Element Number in ListView module for Odoo
Copyright (C) 2015-Today Akretion (http://www.akretion.com)
@author Sylvain LE GAL (https://twitter.com/legalsylvain)
/*
Copyright (C) 2015-Today Akretion (http://www.akretion.com)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
*/
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
odoo.define('web.web_listview_custom_element_number',function (require) {
"use strict";
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
var core = require('web.core');
var ListView = require('web.ListView');
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
openerp.web_listview_custom_element_number = function (instance) {
module = instance.web;
_t = module._t;
var _t = core._t;
/*************************************************************************** /***************************************************************************
Extend the widget 'instance.web.ListView' to replace the select tag by an
Extend the widget 'web.ListView' to replace the select tag by an
input with datalist option. input with datalist option.
***************************************************************************/ ***************************************************************************/
module.ListView.include({
ListView.include({
/**
* Overload 'load_list' function:
*/
load_list: function(data) {
render_pager: function($node) {
// Call Original function
var self = this; var self = this;
this._super.apply(this, arguments);
this._super($node);
if (this.$pager){
// unbind previous function that added a select tag // unbind previous function that added a select tag
this.$pager.find('.oe_list_pager_state').unbind("click"); this.$pager.find('.oe_list_pager_state').unbind("click");
@ -51,7 +39,7 @@ openerp.web_listview_custom_element_number = function (instance) {
'<option value="200">' + '<option value="200">' +
'<option value="500">' + '<option value="500">' +
'<option value="2000">' + '<option value="2000">' +
'<option value="0" label="'+_t("0 (Unlimited)") + '">' +
'<option value="0" label="'+_t("Unlimited") + '">' +
'</datalist>') '</datalist>')
.change(function () { .change(function () {
var val = parseInt($select.val(), 10); var val = parseInt($select.val(), 10);
@ -65,7 +53,8 @@ openerp.web_listview_custom_element_number = function (instance) {
self.page = 0; self.page = 0;
self.reload_content(); self.reload_content();
} }
}).blur(function() {
})
.blur(function() {
$(this).trigger('change'); $(this).trigger('change');
}) })
.keypress(function(e) { .keypress(function(e) {
@ -73,9 +62,11 @@ openerp.web_listview_custom_element_number = function (instance) {
$(this).trigger('change'); $(this).trigger('change');
} }
}) })
.bind('select', function () {
$(this).trigger('change');
})
.focus() .focus()
}); });
}
}, },
}); });
};
});

29
web_listview_custom_element_number/views/templates.xml

@ -1,30 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!--***************************************************************************
Web - Custom Element Number in ListView module for Odoo
Copyright (C) 2015-Today Akretion (http://www.akretion.com)
@author Sylvain LE GAL (https://twitter.com/legalsylvain)
<!--
Copyright (C) 2015-Today Akretion (http://www.akretion.com)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
<odoo>
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************-->
<openerp>
<data>
<template id="assets_backend" name="web_listview_custom_element_number assets" inherit_id="web.assets_backend"> <template id="assets_backend" name="web_listview_custom_element_number assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside"> <xpath expr="." position="inside">
<link rel="stylesheet" href="/web_listview_custom_element_number/static/src/css/web_listview_custom_element_number.css"/> <link rel="stylesheet" href="/web_listview_custom_element_number/static/src/css/web_listview_custom_element_number.css"/>
<script type="text/javascript" src="/web_listview_custom_element_number/static/src/js/web_listview_custom_element_number.js"></script> <script type="text/javascript" src="/web_listview_custom_element_number/static/src/js/web_listview_custom_element_number.js"></script>
</xpath> </xpath>
</template> </template>
</data>
</openerp>
</odoo>
Loading…
Cancel
Save