Browse Source

Merge pull request #564 from tarteo/90_mig_web_shortcuts

[9.0][MIG][web_shortcut]
pull/690/head
Eric @ Elico Corp 7 years ago
committed by GitHub
parent
commit
47f80ab17d
  1. 4
      web_shortcut/LICENSE
  2. 64
      web_shortcut/README.rst
  3. 5
      web_shortcut/__init__.py
  4. 24
      web_shortcut/__openerp__.py
  5. 4
      web_shortcut/i18n/ar.po
  6. 4
      web_shortcut/i18n/bs.po
  7. 4
      web_shortcut/i18n/cs.po
  8. 4
      web_shortcut/i18n/da.po
  9. 4
      web_shortcut/i18n/de.po
  10. 4
      web_shortcut/i18n/el.po
  11. 4
      web_shortcut/i18n/en_GB.po
  12. 4
      web_shortcut/i18n/es.po
  13. 4
      web_shortcut/i18n/fi.po
  14. 4
      web_shortcut/i18n/fr.po
  15. 4
      web_shortcut/i18n/gl.po
  16. 4
      web_shortcut/i18n/hr.po
  17. 4
      web_shortcut/i18n/hu.po
  18. 4
      web_shortcut/i18n/it.po
  19. 4
      web_shortcut/i18n/lt.po
  20. 4
      web_shortcut/i18n/mk.po
  21. 4
      web_shortcut/i18n/mn.po
  22. 4
      web_shortcut/i18n/nl.po
  23. 4
      web_shortcut/i18n/pl.po
  24. 4
      web_shortcut/i18n/pt.po
  25. 4
      web_shortcut/i18n/pt_BR.po
  26. 4
      web_shortcut/i18n/ro.po
  27. 4
      web_shortcut/i18n/ru.po
  28. 4
      web_shortcut/i18n/sl.po
  29. 4
      web_shortcut/i18n/sv.po
  30. 4
      web_shortcut/i18n/th.po
  31. 4
      web_shortcut/i18n/tr.po
  32. 4
      web_shortcut/i18n/vi.po
  33. 6
      web_shortcut/i18n/web_shortcut.pot
  34. 4
      web_shortcut/i18n/zh_CN.po
  35. 4
      web_shortcut/i18n/zh_TW.po
  36. 6
      web_shortcut/models/__init__.py
  37. 16
      web_shortcut/models/ir_ui_menu.py
  38. 37
      web_shortcut/models/web_shortcut.py
  39. 0
      web_shortcut/security/ir.model.access.csv
  40. 0
      web_shortcut/static/description/icon.png
  41. 26
      web_shortcut/static/src/css/web_shortcut.css
  42. 167
      web_shortcut/static/src/js/web_shortcut.js
  43. 25
      web_shortcut/static/src/xml/web_shortcut.xml
  44. 13
      web_shortcut/templates/assets.xml
  45. 5
      web_shortcut/tests/__init__.py
  46. 31
      web_shortcut/tests/test_web_shortcut.py
  47. 7
      web_shortcuts/README.rst
  48. 21
      web_shortcuts/__init__.py
  49. 37
      web_shortcuts/__openerp__.py
  50. 30
      web_shortcuts/model/__init__.py
  51. 66
      web_shortcuts/model/web_shortcut.py
  52. 82
      web_shortcuts/static/src/css/web_shortcuts.css
  53. BIN
      web_shortcuts/static/src/img/add-shortcut.png
  54. 150
      web_shortcuts/static/src/js/web_shortcuts.js
  55. 27
      web_shortcuts/static/src/xml/web_shortcuts.xml
  56. 12
      web_shortcuts/view/web_shortcuts.xml

4
web_shortcuts/LICENSE → web_shortcut/LICENSE

@ -1,5 +1,5 @@
OpenERP, Open Source Management Solution
Copyright © 2010-2011 OpenERP SA (<http://openerp.com>).
Odoo, Open Source Management Solution
Copyright © 2010-2011 Odoo SA (<http://odoo.com>).
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as it under the terms of the GNU Affero General Public License as

64
web_shortcut/README.rst

@ -0,0 +1,64 @@
.. 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
=============
Shortcut Menu
=============
Adds a button to the top menu which opens a menu containing the user's shortcuts.
Configuration
=============
To configure this module, you need to:
#. Go to any view;
#. click on the star icon besides the title to add / remove a shortcut.
Usage
=====
To use this module, you need to:
#. Click on the star icon in the right corner of the top menu;
#. click the shortcut you want.
.. 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
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.
Credits
=======
Contributors
------------
* Adrien Peiffer
* Dennis Sluijk <d.sluijk@onestein.nl>
* Odoo SA
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit https://odoo-community.org.
**This module is a port from Odoo SA and as such, it is not included in the OCA CLA. That means we do not have a copy of the copyright on it like all other OCA modules.**

5
web_shortcut/__init__.py

@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2010 Odoo SA (<http://odoo.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import models

24
web_shortcut/__openerp__.py

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# Copyright 2010-2011 Odoo SA (<http://odoo.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Shortcut Menu',
'version': '9.0.1.0.0',
'category': 'Web',
'author': 'Odoo SA,Odoo Community Association (OCA)',
'website': 'http://openerp.com',
'depends': [
'base',
'web'
],
'data': [
'security/ir.model.access.csv',
'templates/assets.xml',
],
'qweb': [
'static/src/xml/web_shortcut.xml'
],
'installable': True,
'auto_install': False,
'license': 'AGPL-3',
}

4
web_shortcuts/i18n/ar.po → web_shortcut/i18n/ar.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2013-11-27 05:39+0000\n" "X-Launchpad-Export-Date: 2013-11-27 05:39+0000\n"
"X-Generator: Launchpad (build 16845)\n" "X-Generator: Launchpad (build 16845)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:20
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "إضافة / إزالة مختَصَر" msgstr "إضافة / إزالة مختَصَر"

4
web_shortcuts/i18n/bs.po → web_shortcut/i18n/bs.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n" "X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n"
"X-Generator: Launchpad (build 16831)\n" "X-Generator: Launchpad (build 16831)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:20
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "Dodaj / Ukloni pračicu..." msgstr "Dodaj / Ukloni pračicu..."

4
web_shortcuts/i18n/cs.po → web_shortcut/i18n/cs.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n" "X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n"
"X-Generator: Launchpad (build 16831)\n" "X-Generator: Launchpad (build 16831)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:21
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "Přidat / Odebrat zkratku..." msgstr "Přidat / Odebrat zkratku..."

4
web_shortcuts/i18n/da.po → web_shortcut/i18n/da.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n" "X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n"
"X-Generator: Launchpad (build 16831)\n" "X-Generator: Launchpad (build 16831)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:20
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "Tilføj/fjern genvej ..." msgstr "Tilføj/fjern genvej ..."

4
web_shortcuts/i18n/de.po → web_shortcut/i18n/de.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n" "X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n"
"X-Generator: Launchpad (build 16831)\n" "X-Generator: Launchpad (build 16831)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:20
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "Hinzufügen/Entfernen Lesezeichen ..." msgstr "Hinzufügen/Entfernen Lesezeichen ..."

4
web_shortcuts/i18n/el.po → web_shortcut/i18n/el.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n" "X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n"
"X-Generator: Launchpad (build 16831)\n" "X-Generator: Launchpad (build 16831)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:20
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "" msgstr ""

4
web_shortcuts/i18n/en_GB.po → web_shortcut/i18n/en_GB.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n" "X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n"
"X-Generator: Launchpad (build 16831)\n" "X-Generator: Launchpad (build 16831)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:20
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "Add / Remove Shortcut..." msgstr "Add / Remove Shortcut..."

4
web_shortcuts/i18n/es.po → web_shortcut/i18n/es.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n" "X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n"
"X-Generator: Launchpad (build 16831)\n" "X-Generator: Launchpad (build 16831)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:20
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "Añadir / Eliminar acceso directo..." msgstr "Añadir / Eliminar acceso directo..."

4
web_shortcuts/i18n/fi.po → web_shortcut/i18n/fi.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n" "X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n"
"X-Generator: Launchpad (build 16831)\n" "X-Generator: Launchpad (build 16831)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:20
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "Lisää / Poista pikavalinta..." msgstr "Lisää / Poista pikavalinta..."

4
web_shortcuts/i18n/fr.po → web_shortcut/i18n/fr.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n" "X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n"
"X-Generator: Launchpad (build 16831)\n" "X-Generator: Launchpad (build 16831)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:20
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "Ajouter / supprimer un raccourci..." msgstr "Ajouter / supprimer un raccourci..."

4
web_shortcuts/i18n/gl.po → web_shortcut/i18n/gl.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2014-02-06 06:25+0000\n" "X-Launchpad-Export-Date: 2014-02-06 06:25+0000\n"
"X-Generator: Launchpad (build 16916)\n" "X-Generator: Launchpad (build 16916)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:20
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "Engadir / Eliminar atallo..." msgstr "Engadir / Eliminar atallo..."

4
web_shortcuts/i18n/hr.po → web_shortcut/i18n/hr.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n" "X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n"
"X-Generator: Launchpad (build 16831)\n" "X-Generator: Launchpad (build 16831)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:20
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "Dodaj / ukloni prečac..." msgstr "Dodaj / ukloni prečac..."

4
web_shortcuts/i18n/hu.po → web_shortcut/i18n/hu.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n" "X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n"
"X-Generator: Launchpad (build 16831)\n" "X-Generator: Launchpad (build 16831)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:20
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "Billentyűkombináció hozzáadása/eltávolítása" msgstr "Billentyűkombináció hozzáadása/eltávolítása"

4
web_shortcuts/i18n/it.po → web_shortcut/i18n/it.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n" "X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n"
"X-Generator: Launchpad (build 16831)\n" "X-Generator: Launchpad (build 16831)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:20
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "Aggiungi / Rimuovi Scorciatoia..." msgstr "Aggiungi / Rimuovi Scorciatoia..."

4
web_shortcuts/i18n/lt.po → web_shortcut/i18n/lt.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n" "X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n"
"X-Generator: Launchpad (build 16831)\n" "X-Generator: Launchpad (build 16831)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:20
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "Pridėti / pašalinti trumpinį..." msgstr "Pridėti / pašalinti trumpinį..."

4
web_shortcuts/i18n/mk.po → web_shortcut/i18n/mk.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n" "X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n"
"X-Generator: Launchpad (build 16831)\n" "X-Generator: Launchpad (build 16831)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:20
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "Додади / Отстрани кратенка" msgstr "Додади / Отстрани кратенка"

4
web_shortcuts/i18n/mn.po → web_shortcut/i18n/mn.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n" "X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n"
"X-Generator: Launchpad (build 16831)\n" "X-Generator: Launchpad (build 16831)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:20
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "Шуут холбоосыг Нэмэх / Устгах ..." msgstr "Шуут холбоосыг Нэмэх / Устгах ..."

4
web_shortcuts/i18n/nl.po → web_shortcut/i18n/nl.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n" "X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n"
"X-Generator: Launchpad (build 16831)\n" "X-Generator: Launchpad (build 16831)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:20
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "Toevoegen/verwijderen snelkoppeling" msgstr "Toevoegen/verwijderen snelkoppeling"

4
web_shortcuts/i18n/pl.po → web_shortcut/i18n/pl.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n" "X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n"
"X-Generator: Launchpad (build 16831)\n" "X-Generator: Launchpad (build 16831)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:20
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "Dodaj / Usuń skrót" msgstr "Dodaj / Usuń skrót"

4
web_shortcuts/i18n/pt.po → web_shortcut/i18n/pt.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n" "X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n"
"X-Generator: Launchpad (build 16831)\n" "X-Generator: Launchpad (build 16831)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:20
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "Adicionar / Remover atalho..." msgstr "Adicionar / Remover atalho..."

4
web_shortcuts/i18n/pt_BR.po → web_shortcut/i18n/pt_BR.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n" "X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n"
"X-Generator: Launchpad (build 16831)\n" "X-Generator: Launchpad (build 16831)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:20
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "Adicionar / Remover atalho ..." msgstr "Adicionar / Remover atalho ..."

4
web_shortcuts/i18n/ro.po → web_shortcut/i18n/ro.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n" "X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n"
"X-Generator: Launchpad (build 16831)\n" "X-Generator: Launchpad (build 16831)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:20
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "Adauga / Sterge Shortcut..." msgstr "Adauga / Sterge Shortcut..."

4
web_shortcuts/i18n/ru.po → web_shortcut/i18n/ru.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n" "X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n"
"X-Generator: Launchpad (build 16831)\n" "X-Generator: Launchpad (build 16831)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:20
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "Добавить / Удалить ярлык..." msgstr "Добавить / Удалить ярлык..."

4
web_shortcuts/i18n/sl.po → web_shortcut/i18n/sl.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n" "X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n"
"X-Generator: Launchpad (build 16831)\n" "X-Generator: Launchpad (build 16831)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:20
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "Dodaj / Odstrani bližnjico..." msgstr "Dodaj / Odstrani bližnjico..."

4
web_shortcuts/i18n/sv.po → web_shortcut/i18n/sv.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n" "X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n"
"X-Generator: Launchpad (build 16831)\n" "X-Generator: Launchpad (build 16831)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:20
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "Lägg till/ta bort genväg..." msgstr "Lägg till/ta bort genväg..."

4
web_shortcuts/i18n/th.po → web_shortcut/i18n/th.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n" "X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n"
"X-Generator: Launchpad (build 16831)\n" "X-Generator: Launchpad (build 16831)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:21
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "เพิ่ม / ลบ ทางลัด ..." msgstr "เพิ่ม / ลบ ทางลัด ..."

4
web_shortcuts/i18n/tr.po → web_shortcut/i18n/tr.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n" "X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n"
"X-Generator: Launchpad (build 16831)\n" "X-Generator: Launchpad (build 16831)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:21
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "Kısayol Ekle/Kaldır..." msgstr "Kısayol Ekle/Kaldır..."

4
web_shortcuts/i18n/vi.po → web_shortcut/i18n/vi.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n" "X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n"
"X-Generator: Launchpad (build 16831)\n" "X-Generator: Launchpad (build 16831)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:20
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "Thêm / Xóa đường dẫn ...." msgstr "Thêm / Xóa đường dẫn ...."

6
web_shortcuts/i18n/web_shortcuts.pot → web_shortcut/i18n/web_shortcut.pot

@ -1,6 +1,6 @@
# Translation of OpenERP Server. # Translation of OpenERP Server.
# This file contains the translation of the following modules: # This file contains the translation of the following modules:
# * web_shortcuts
# * web_shortcut
# #
msgid "" msgid ""
msgstr "" msgstr ""
@ -15,9 +15,9 @@ msgstr ""
"Content-Transfer-Encoding: \n" "Content-Transfer-Encoding: \n"
"Plural-Forms: \n" "Plural-Forms: \n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:20
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "" msgstr ""

4
web_shortcuts/i18n/zh_CN.po → web_shortcut/i18n/zh_CN.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n" "X-Launchpad-Export-Date: 2013-11-21 06:38+0000\n"
"X-Generator: Launchpad (build 16831)\n" "X-Generator: Launchpad (build 16831)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:20
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "添加/删除快捷方式..." msgstr "添加/删除快捷方式..."

4
web_shortcuts/i18n/zh_TW.po → web_shortcut/i18n/zh_TW.po

@ -17,9 +17,9 @@ msgstr ""
"X-Launchpad-Export-Date: 2013-12-30 05:07+0000\n" "X-Launchpad-Export-Date: 2013-12-30 05:07+0000\n"
"X-Generator: Launchpad (build 16877)\n" "X-Generator: Launchpad (build 16877)\n"
#. module: web_shortcuts
#. module: web_shortcut
#. openerp-web #. openerp-web
#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
#: code:addons/web_shortcut/static/src/xml/web_shortcut.xml:20
#, python-format #, python-format
msgid "Add / Remove Shortcut..." msgid "Add / Remove Shortcut..."
msgstr "新增/移除捷徑..." msgstr "新增/移除捷徑..."

6
web_shortcut/models/__init__.py

@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2014 Acsone SA/NV (http://www.acsone.eu)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import web_shortcut
from . import ir_ui_menu

16
web_shortcut/models/ir_ui_menu.py

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Copyright 2004-today Odoo SA (<http://www.odoo.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, api
class IrUiView(models.Model):
_inherit = 'ir.ui.menu'
@api.multi
def unlink(self):
res = super(IrUiView, self).unlink()
shortcuts = self.env['web.shortcut'].search([('menu_id', '=', False)])
shortcuts.unlink()
return res

37
web_shortcut/models/web_shortcut.py

@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
# Copyright 2004-today Odoo SA (<http://www.odoo.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields, api
class WebShortcut(models.Model):
_name = 'web.shortcut'
name = fields.Char('Shortcut Name', size=64)
menu_id = fields.Many2one('ir.ui.menu', ondelete='cascade')
user_id = fields.Many2one('res.users', 'User Ref.', required=True,
ondelete='cascade', select=True,
default=lambda obj, cr, uid, context: uid)
_sql_constraints = [
('shortcut_unique', 'unique(menu_id,user_id)',
'Shortcut for this menu already exists!'),
]
@api.model
def get_user_shortcuts(self):
shortcuts = self.search([('user_id', '=', self.env.user.id)])
res = []
for shortcut in shortcuts.filtered('menu_id'):
_name = shortcut.menu_id.name_get()
_name = _name[0][1] if len(_name) else ''
_id = shortcut.menu_id.id
res.append(
{
'id': shortcut.id,
'name': _name,
'menu_id': (_id, _name)
}
)
return res

0
web_shortcuts/security/ir.model.access.csv → web_shortcut/security/ir.model.access.csv

0
web_shortcuts/static/description/icon.png → web_shortcut/static/description/icon.png

Before

Width: 80  |  Height: 80  |  Size: 5.2 KiB

After

Width: 80  |  Height: 80  |  Size: 5.2 KiB

26
web_shortcut/static/src/css/web_shortcut.css

@ -0,0 +1,26 @@
.oe_shortcut_toggle {
height: 20px;
margin-top: 9px;
width: 24px;
cursor: pointer;
display: block;
font-size: 20px;
float: left;
color: #a8a8a8;
}
.oe_shortcut_toggle:focus {
color: #a8a8a8;
}
.oe_shortcut_toggle:hover {
color: #ffd700;
}
.oe_shortcut_remove {
color: #ffd700;
}
.oe_shortcut_remove:focus {
color: #ffd700;
}

167
web_shortcut/static/src/js/web_shortcut.js

@ -0,0 +1,167 @@
/* Copyright 2004-today Odoo SA (<http://www.odoo.com>)
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
odoo.define('web.shortcut', function(require) {
var Widget = require('web.Widget'),
UserMenu = require('web.UserMenu'),
WebClient = require('web.WebClient'),
ViewManager = require('web.ViewManager'),
ActionManager = require('web.ActionManager'),
core = require('web.core'),
qweb = core.qweb,
DataModel = require('web.DataModel'),
session = require('web.session');
var ShortcutMenu = Widget.extend({
template: 'Systray.ShortcutMenu',
init: function() {
this._super();
this.on('load', this, this.load);
this.on('add', this, this.add);
this.on('display', this, this.display);
this.on('remove', this, this.remove);
this.model = new DataModel('web.shortcut');
},
start: function() {
var self = this;
this._super();
this.trigger('load');
this.$el.on('click', '.oe_systray_shortcut_menu a', function() {
self.click($(this));
});
},
load: function() {
var self = this;
this.$el.find('.oe_systray_shortcut_menu').empty();
return this.model.call('get_user_shortcuts', [
]).done(function(shortcuts) {
_.each(shortcuts, function(sc) {
self.trigger('display', sc);
});
});
},
add: function (sc) {
var self = this;
this.model.call('create', [sc]).then(function(out){
self.trigger('load');
});
},
display: function(sc) {
var self = this;
this.$el.find('.oe_systray_shortcut_menu').append();
var $sc = $(qweb.render('Systray.ShortcutMenu.Item', {'shortcut': sc}));
$sc.appendTo(self.$el.find('.oe_systray_shortcut_menu'));
},
remove: function (menu_id) {
var menu_id = this.session.active_id;
var $shortcut = this.$el.find('.oe_systray_shortcut_menu li a[data-id=' + menu_id + ']');
var shortcut_id = $shortcut.data('shortcut-id');
$shortcut.remove();
this.model.call('unlink', [shortcut_id]);
},
click: function($link) {
var self = this,
action_id = $link.data('id');
new DataModel('ir.ui.menu').query(['action']).filter([['id', '=', action_id]]).context(null).all().then(function(menu) {
var action_str = menu[0].action;
var action_str_parts = action_str.split(',');
action_id = parseInt(action_str_parts[1]);
self.trigger('click', action_id);
});
},
has: function(menu_id) {
return !!this.$el.find('a[data-id=' + menu_id + ']').length;
}
});
UserMenu.include({
start: function() {
var res = this._super.apply(this, arguments);
this.shortcuts = new ShortcutMenu(self);
this.shortcuts.prependTo(this.$el.parent());
return res;
},
do_update: function() {
var self = this;
this._super.apply(this, arguments);
this.update_promise.done(function() {
self.shortcuts.trigger('load');
});
},
});
WebClient.include({
show_application: function() {
var self = this;
var res = this._super.apply(this, arguments);
this.user_menu.shortcuts.on('click', this, function(action_id) {
self.do_action(action_id, {
clear_breadcrumbs: true,
replace_breadcrumb: true
});
});
return res;
}
});
ViewManager.include({
switch_mode: function (view_type, no_store) {
var self = this;
return this._super.apply(this, arguments).done(function() {
self.shortcut_check(self.views[view_type]);
});
},
shortcut_check: function(view) {
var self = this;
// Child view managers
if (!this.action_manager) {
return;
}
// display shortcuts if on the first view for the action
var $shortcut_toggle = this.action_manager.$el.find('.oe_shortcut_toggle');
if (!this.action.name ||
!(view.view_type === this.view_stack[0].view_type &&
view.view_id === this.view_stack[0].view_id)
) {
$shortcut_toggle.addClass('hidden');
return;
}
$shortcut_toggle.removeClass('hidden');
// Anonymous users don't have user_menu
var shortcuts_menu = this.action_manager.webclient.user_menu.shortcuts;
if (shortcuts_menu) {
$shortcut_toggle.toggleClass('oe_shortcut_remove', shortcuts_menu.has(self.session.active_id));
$shortcut_toggle.unbind("click").click(function() {
if ($shortcut_toggle.hasClass("oe_shortcut_remove")) {
shortcuts_menu.trigger('remove', self.session.active_id);
} else {
shortcuts_menu.trigger('add', {
'user_id': session.uid,
'menu_id': session.active_id,
'name': session.name
});
}
$shortcut_toggle.toggleClass("oe_shortcut_remove");
});
}
}
});
ActionManager.include({
do_action: function() {
this.$el.find('.oe_shortcut_toggle').addClass('hidden');
return this._super.apply(this, arguments);
}
});
return ShortcutMenu;
});

25
web_shortcut/static/src/xml/web_shortcut.xml

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates>
<t t-name="Systray.ShortcutMenu">
<li class="dropdown">
<a href="#" class="dropdown-toggle o_priority_star fa fa-star" data-toggle="dropdown"/>
<ul class="oe_systray_shortcut_menu dropdown-menu">
</ul>
</li>
</t>
<t t-name="Systray.ShortcutMenu.Item">
<li>
<a href="#" t-att-data-id="shortcut.menu_id[0]" t-att-data-shortcut-id="shortcut.id">
<t t-esc="shortcut.name"/>
</a>
</li>
</t>
<t t-extend="ControlPanel">
<t t-jquery="ol.oe-view-title" t-operation="before">
<a class="oe_shortcut_toggle hidden o_priority_star fa fa-star" title="Add / Remove Shortcut..."
href="javascript: void(0)"> </a>
</t>
</t>
</templates>

13
web_shortcut/templates/assets.xml

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="assets_backend" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/web_shortcut/static/src/css/web_shortcut.css"/>
<script type="text/javascript" src="/web_shortcut/static/src/js/web_shortcut.js"></script>
</xpath>
</template>
</data>
</openerp>

5
web_shortcut/tests/__init__.py

@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2017-today Onestein (<http://www.onestein.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import test_web_shortcut

31
web_shortcut/tests/test_web_shortcut.py

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
# Copyright 2017-today Onestein (<http://www.onestein.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp.tests.common import TransactionCase
class TestWebShortcut(TransactionCase):
def setUp(self, *args, **kwargs):
super(TestWebShortcut, self).setUp(*args, **kwargs)
self.shortcut_obj = self.env['web.shortcut']
self.menu_obj = self.env['ir.ui.menu']
self.menu = self.env.ref('base.menu_ir_property')
self.user = self.env.ref('base.user_root')
self.shortcut_obj.search([('user_id', '=', self.user.id)]).unlink()
def test_web_shortcut(self):
res = self.shortcut_obj.get_user_shortcuts()
self.assertEqual(len(res), 0)
self.shortcut_obj.create({
'name': 'Test',
'menu_id': self.menu.id,
'user_id': self.env.user.id
})
res = self.shortcut_obj.get_user_shortcuts()
self.assertEqual(len(res), 1)
self.menu.unlink()
res = self.shortcut_obj.get_user_shortcuts()
self.assertEqual(len(res), 0)

7
web_shortcuts/README.rst

@ -1,7 +0,0 @@
Enable shortcuts feature in the web client.
===========================================
Add a Shortcut icon in the systray in order to access the user's shortcuts
(if any).
Add a Shortcut icon besides the views title in order to add/remove a shortcut.

21
web_shortcuts/__init__.py

@ -1,21 +0,0 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010 OpenERP s.a. (<http://openerp.com>).
#
# 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/>.
#
##############################################################################
from . import model

37
web_shortcuts/__openerp__.py

@ -1,37 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-2011 OpenERP s.a. (<http://openerp.com>).
#
# 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/>.
#
##############################################################################
{
'name': 'Web Shortcuts',
'version': '8.0.1.0.0',
'category': 'Tools',
'author': "OpenERP SA,Odoo Community Association (OCA)",
'website': 'http://openerp.com',
'depends': ['base'],
'data': [
'security/ir.model.access.csv',
'view/web_shortcuts.xml',
],
'qweb': ['static/src/xml/web_shortcuts.xml'],
'installable': False,
'auto_install': False,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

30
web_shortcuts/model/__init__.py

@ -1,30 +0,0 @@
# -*- coding: utf-8 -*-
#
#
# Authors: Adrien Peiffer
# Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
# All Rights Reserved
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs.
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly advised to contact a Free Software
# Service Company.
#
# 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/>.
#
#
from . import web_shortcut

66
web_shortcuts/model/web_shortcut.py

@ -1,66 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-today OpenERP SA (<http://www.openerp.com>)
#
# 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/>.
#
##############################################################################
from openerp import models, fields, api
class WebShortcut(models.Model):
_name = 'web.shortcut'
name = fields.Char('Shortcut Name', size=64)
menu_id = fields.Many2one('ir.ui.menu', ondelete='cascade')
user_id = fields.Many2one('res.users', 'User Ref.', required=True,
ondelete='cascade', select=True,
default=lambda obj, cr, uid, context: uid)
_sql_constraints = [
('shortcut_unique', 'unique(menu_id,user_id)',
'Shortcut for this menu already exists!'),
]
@api.model
def get_user_shortcuts(self, user_id):
shortcuts = self.search([('user_id', '=', user_id)])
res = []
for shortcut in shortcuts.filtered('menu_id'):
_name = shortcut.menu_id.name_get()
_name = _name[0][1] if len(_name) else ''
_id = shortcut.menu_id.id
res.append(
{
'id': shortcut.id,
'name': _name,
'menu_id': (_id, _name)
}
)
return res
class IrUiView(models.Model):
_inherit = 'ir.ui.menu'
@api.multi
def unlink(self):
res = super(IrUiView, self).unlink()
shortcuts = self.env['web.shortcut'].search([('menu_id', '=', False)])
for shortcut in shortcuts:
shortcut.unlink()
return res

82
web_shortcuts/static/src/css/web_shortcuts.css

@ -1,82 +0,0 @@
/* Shortcuts*/
.oe_systray_shortcuts .oe_star_off {
color: #eee;
}
.oe_shortcuts_toggle {
height: 20px;
margin-top: 3px;
padding: 0;
width: 24px;
cursor: pointer;
display: block;
background: url(/web/static/src/img/add-shortcut.png) no-repeat center center;
float: left;
}
.oe_shortcuts_remove{
background: url(/web/static/src/img/remove-shortcut.png) no-repeat center center;
}
.oe_shortcuts {
position: absolute;
margin: 0;
padding: 6px 15px;
top: 37px;
left: 197px;
right: 0;
height: 17px;
line-height: 1.2;
}
.oe_shortcuts ul {
display: block;
overflow: hidden;
list-style: none;
white-space: nowrap;
padding: 0;
margin: 0;
}
.oe_shortcuts li {
cursor: pointer;
display: -moz-inline-stack;
display: inline-block;
display: inline; /*IE7 */
color: #fff;
text-align: center;
border-left: 1px solid #909090;
padding: 0 4px;
font-size: 80%;
font-weight: normal;
vertical-align: top;
}
.oe_shortcuts li:hover {
background-color: #666;
}
.oe_shortcuts li:first-child {
border-left: none;
padding-left: 0;
}
.openerp .oe_topbar .oe_topbar_item {
display: block;
padding: 5px 10px 7px;
line-height: 20px;
height: 20px;
text-decoration: none;
color: #eeeeee;
vertical-align: top;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
-webkit-transition: all 0.2s ease-out;
-moz-transition: all 0.2s ease-out;
-ms-transition: all 0.2s ease-out;
-o-transition: all 0.2s ease-out;
transition: all 0.2s ease-out;
}
.openerp .oe_topbar .oe_topbar_item:hover {
background: rgba(0, 0, 0, 0.2);
text-shadow: black 0px 0px 3px;
color: white;
-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4) inset;
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4) inset;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4) inset;
}

BIN
web_shortcuts/static/src/img/add-shortcut.png

Before

Width: 16  |  Height: 16  |  Size: 337 B

150
web_shortcuts/static/src/js/web_shortcuts.js

@ -1,150 +0,0 @@
/*############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011-2012 OpenERP SA (<http://openerp.com>).
#
# 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/>.
#
############################################################################*/
openerp.web_shortcuts = function (instance) {
var QWeb = instance.web.qweb,
_t = instance.web._t;
instance.web_shortcuts.Shortcuts = instance.web.Widget.extend({
template: 'Systray.Shortcuts',
init: function() {
this._super();
this.on('load', this, this.load);
this.on('add', this, this.add);
this.on('display', this, this.display);
this.on('remove', this, this.remove);
this.on('click', this, this.click);
this.model = new instance.web.Model('web.shortcut');
},
start: function() {
var self = this;
this._super();
this.trigger('load');
this.$el.on('click', '.oe_systray_shortcuts_items a', function() {
self.trigger('click', $(this));
});
},
load: function() {
var self = this;
this.$el.find('.oe_systray_shortcuts_items').empty();
return this.model.call('get_user_shortcuts', [
instance.session.uid,
instance.web.pyeval.eval('context', {})
]).done(function(shortcuts) {
_.each(shortcuts, function(sc) {
self.trigger('display', sc);
});
});
},
add: function (sc) {
var self = this;
this.model.call('create', [sc]).then(function(out){
self.trigger('load');
});
},
display: function(sc) {
var self = this;
this.$el.find('.oe_systray_shortcuts_items').append();
var $sc = $(QWeb.render('Systray.Shortcuts.Item', {'shortcut': sc}));
$sc.appendTo(self.$el.find('.oe_systray_shortcuts_items'));
},
remove: function (menu_id) {
var menu_id = this.session.active_id;
var $shortcut = this.$el.find('.oe_systray_shortcuts_items li a[data-id=' + menu_id + ']');
var shortcut_id = $shortcut.data('shortcut-id');
$shortcut.remove();
this.model.call('unlink', [shortcut_id]);
},
click: function($link) {
var self = this,
id = $link.data('id');
self.session.active_id = id;
// TODO: Use do_action({menu_id: id, type: 'ir.actions.menu'})
new instance.web.Model('ir.ui.menu').query(['action']).filter([['id', '=', id]]).context(null).all().then(function(menu) {
var action_str = menu[0].action;
var action_str_parts = action_str.split(',');
var action_id = parseInt(action_str_parts[1])
self.rpc('/web/action/load', {'action_id': action_id}).done(function(action) {
instance.webclient.on_menu_action({action_id: action.id});
});
});
this.$el.find('.oe_systray_shortcuts').trigger('mouseout');
},
has: function(menu_id) {
return !!this.$el.find('a[data-id=' + menu_id + ']').length;
}
});
instance.web.UserMenu.include({
do_update: function() {
var self = this;
this._super.apply(this, arguments);
this.update_promise.done(function() {
if (self.shortcuts) {
self.shortcuts.trigger('load');
} else {
self.shortcuts = new instance.web_shortcuts.Shortcuts(self);
self.shortcuts.appendTo(instance.webclient.$el.find('.oe_systray'));
}
});
},
});
instance.web.ViewManagerAction.include({
switch_mode: function (view_type, no_store) {
var self = this;
this._super.apply(this, arguments).done(function() {
self.shortcut_check(self.views[view_type]);
});
},
shortcut_check : function(view) {
var self = this;
var shortcuts_menu = instance.webclient.user_menu.shortcuts;
var grandparent = this.getParent() && this.getParent().getParent();
// display shortcuts if on the first view for the action
var $shortcut_toggle = this.$el.find('.oe_shortcuts_toggle');
if (!this.action.name ||
!(view.view_type === this.views_src[0].view_type
&& view.view_id === this.views_src[0].view_id)) {
$shortcut_toggle.hide();
return;
}
// Anonymous users don't have user_menu
if (shortcuts_menu) {
$shortcut_toggle.toggleClass('oe_shortcuts_remove', shortcuts_menu.has(self.session.active_id));
$shortcut_toggle.unbind("click").click(function() {
if ($shortcut_toggle.hasClass("oe_shortcuts_remove")) {
shortcuts_menu.trigger('remove', self.session.active_id);
} else {
shortcuts_menu.trigger('add', {
'user_id': self.session.uid,
'menu_id': self.session.active_id,
'name': self.action.name
});
}
$shortcut_toggle.toggleClass("oe_shortcuts_remove");
});
}
}
});
};

27
web_shortcuts/static/src/xml/web_shortcuts.xml

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- vim:fdl=1:
-->
<templates id="template" xml:space="preserve">
<t t-name="Systray.Shortcuts">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<img src="/web_shortcuts/static/src/img/add-shortcut.png"/>
</a>
<ul class="oe_systray_shortcuts_items dropdown-menu">
</ul>
</li>
</t>
<t t-name="Systray.Shortcuts.Item">
<li>
<a href="#" t-att-data-id="shortcut.menu_id[0]" t-att-data-shortcut-id="shortcut.id">
<t t-esc="shortcut.name"/>
</a>
</li>
</t>
<t t-extend="ViewManagerAction">
<t t-jquery="h2.oe_view_title" t-operation="prepend">
<a t-if="widget.flags.display_title !== false" class="oe_shortcuts_toggle" title="Add / Remove Shortcut..."
href="javascript: void(0)"> </a>
</t>
</t>
</templates>

12
web_shortcuts/view/web_shortcuts.xml

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Include JS file for the custom view to select domain from filters -->
<template id="assets_backend" name="filter_selection" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/web_shortcuts/static/src/css/web_shortcuts.css"/>
<script type="text/javascript" src="/web_shortcuts/static/src/js/web_shortcuts.js"></script>
</xpath>
</template>
</data>
</openerp>
Loading…
Cancel
Save