Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
0831ddc
support 'open' on many2many_tags
hbrunn Jul 10, 2015
2986129
adapt README.rst to OCA template
hbrunn Sep 15, 2015
aeb69ac
@pedrobaeza's proposals to roadmap
hbrunn Sep 15, 2015
b06a541
missing word in readme
hbrunn Sep 28, 2015
a030ab4
this week's pylint errors
hbrunn Sep 28, 2015
7c39fe4
web_m2x_options check Many2one and Many2many options
antespi Nov 16, 2015
4bd1e86
Fix many2many JS error
antespi Nov 16, 2015
08bbc42
OCA Transbot updated translations from Transifex
oca-transbot Nov 24, 2015
33a3b44
OCA Transbot updated translations from Transifex
oca-transbot Dec 20, 2015
d5eef66
OCA Transbot updated translations from Transifex
oca-transbot Jan 10, 2016
e6aad8e
OCA Transbot updated translations from Transifex
oca-transbot Jan 31, 2016
3be8ab1
OCA Transbot updated translations from Transifex
oca-transbot Feb 7, 2016
ab6502a
Limit name_search to 160 like Odoo core does
antespi Feb 10, 2016
9d5e776
OCA Transbot updated translations from Transifex
oca-transbot Feb 28, 2016
4732585
OCA Transbot updated translations from Transifex
oca-transbot Mar 13, 2016
d89cd06
OCA Transbot updated translations from Transifex
oca-transbot Mar 20, 2016
4fc2c3a
OCA Transbot updated translations from Transifex
oca-transbot May 1, 2016
aa58a0e
OCA Transbot updated translations from Transifex
oca-transbot May 8, 2016
fa45965
Normalize version number
sbidoul May 28, 2016
b4b64fd
remove en.po that was erroneously created by transbot
sbidoul Aug 15, 2016
7115953
[9.0][MIG] Migration of module web_m2x_options.
zakmak88 Sep 11, 2016
6f364fd
[9.0][MIG] Migration of module web_m2x_options.
zakmak88 Sep 13, 2016
8cf6b2e
[FIX] Add $ variable and replace jquery staments by $
zakmak88 Sep 14, 2016
cbd8d73
add is_option_set function to check whether an option is set or not i…
zakmak88 Sep 14, 2016
0006450
[IMP] Make sure to use is_option_set everytime we check if an option …
zakmak88 Sep 14, 2016
5d8de13
[FIX] Override the .badge click event to open the clicked ressource i…
zakmak88 Sep 14, 2016
9079e0d
[FIX] Fix condition when options tag is defined but create or create_…
zakmak88 Sep 15, 2016
c90b8fe
[FIX] Fix condition when options tag is defined but create or create_…
zakmak88 Sep 15, 2016
ec53572
[FIX] Fix line numbers in the .po files
zakmak88 Sep 15, 2016
07589f7
[FIX] add require('_')
zakmak88 Sep 18, 2016
7f9bbea
[IMP] Add classname compatiblity to odoo versions
zakmak88 Sep 19, 2016
069a1e7
[IMP] Add Most Recently Used Option to M20 Field.
zakmak88 Sep 14, 2016
0ebe462
[IMP] Update the readme file the new option added
zakmak88 Sep 14, 2016
95f1b18
[REF] Refactore the update_mru_list method to always put the selected…
zakmak88 Sep 15, 2016
3032236
[FIX] Add codeview button to translate HTML fields
antespi Sep 13, 2016
28fb5b8
[REF] Refactore compute_mru_key
zakmak88 Sep 18, 2016
bb37283
[FIX] Revert changes on .po files
zakmak88 Sep 18, 2016
9f41010
[FIX] Remove unused session variable and fix bug
zakmak88 Sep 19, 2016
c46818b
[FIX] Fix bug in line 148
zakmak88 Sep 19, 2016
d40f3bc
[REF] remove debuging statement in line 108
zakmak88 Sep 19, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions setup/web_m2x_options/odoo_addons/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)
1 change: 1 addition & 0 deletions setup/web_m2x_options/odoo_addons/web_m2x_options
6 changes: 6 additions & 0 deletions setup/web_m2x_options/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
110 changes: 86 additions & 24 deletions web_m2x_options/README.rst
Original file line number Diff line number Diff line change
@@ -1,35 +1,41 @@
.. 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

==================================
Add new options for many2one field
==================================


Description
-----------

This modules modifies "many2one" and "many2manytags" form widgets so as to add some new display
control options.

**New: support many2manytags widget !**

**New: support global option management with ir.config_parameter !**

Options provided includes possibility to remove "Create..." and/or "Create and
Edit..." entries from many2one drop down. You can also change default number of
proposition appearing in the drop-down. Or prevent the dialog box poping in
case of validation error.

If not specified, the module will avoid proposing any of the create options
if the current user have no permission rights to create the related object.
if the current user has no permission rights to create the related object.

The options provided includes as well, the possibility to propose the Most
Recently used (MRU) values stored in the localstorage if nothing has been typed
in the field and the uer desplays the drop-down. When the user start typing the
field falls back to the normal behaviour.

Requirements
------------

Was tested on openerp 8.0, trunk, saas-5 branch. New way to import js file. (thanks to tfossoul)
Usage
=====

.. 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/8.0

For further information, please visit:

* https://www.odoo.com/forum/help-1

New options
-----------
in the field's options dict
---------------------------

``create`` *boolean* (Default: depends if user have create rights)

Expand All @@ -47,21 +53,31 @@ New options

Number of displayed record in drop-down panel

``search_more`` *boolean*
``search_more`` *boolean*

Used to force disable/enable search more button.

``field_color`` *string*

A string to define the field used to define color.
This option has to be used with colors.

``colors`` *dictionary*

A dictionary to link field value with a HTML color.
This option has to be used with field_color.


``no_open_edit`` *boolean* (Default: value of ``no_open`` which is ``False`` if not set)

Causes a many2one not to offer to click through in edit mode, but well in read mode

``open`` *boolean* (Default: ``False``)

Makes many2many_tags buttons that open the linked resource

``search_mru`` *boolean* (Default: ``False``)

Display the MRU list stored in the localstorage before the user start typing.

ir.config_parameter options
---------------------------
Expand Down Expand Up @@ -89,27 +105,73 @@ If you disable one option, you can enable it for particular field by setting "cr

Whether the field should always show "Search more..." entry or not.

``web_m2x_options.search_mru`` *boolean* (Default: default value is ``False``)

Display the MRU list stored in the localstorage before the user start typing.

To add these parameters go to Configuration -> Technical -> Parameters -> System Parameters and add new parameters like:

- web_m2x_options.create: False
- web_m2x_options.create_edit: False
- web_m2x_options.m2o_dialog: False
- web_m2x_options.limit: 10
- web_m2x_options.search_more: True

- web_m2x_options.search_mru: False

Example
-------

Your XML form view definition could contain::

...
<field name="partner_id" options="{'limit': 10, 'create': false, 'create_edit': false, 'search_more':true 'field_color':'state', 'colors':{'active':'green'}}"/>
<field name="partner_id" options="{'limit': 10, 'create': false, 'create_edit': false, 'search_more':true 'field_color':'state', 'colors':{'active':'green'}, 'search_mru':true}"/>
...

Note
----
Known issues
============

Double check that you have no inherited view that remove ``options`` you set on a field !
If nothing works, add a debugger in the first line of ``get_search_result method`` and enable debug mode in Odoo. When you write something in a many2one field, javascript debugger should pause. If not verify your installation.

Roadmap
=======

- Instead of making the tags rectangle clickable, I think it's better to put the text as a clickable link, so we will get a consistent behaviour/aspect with other clickable elements (many2one...).
- In edit mode, it would be great to add an icon like the one on many2one fields to allow to open the many2many in a popup window.
- Include this feature as a configurable option via parameter to have this behaviour by default in all many2many tags.

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_m2x_options%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Credits
=======

Contributors
------------

* David Coninckx <davconinckx@gmail.com>
* Emanuel Cino <ecino@compassion.ch>
* Holger Brunn <hbrunn@therp.nl>
* Nicolas JEUDY <nicolas@sudokeys.com>
* Yannick Vaucher <yannick.vaucher@camptocamp.com>
* Zakaria Makrelouf <z.makrelouf@gmail.com>

Maintainer
----------

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

This module is maintained by the OCA.

Double check that you have no inherited view that remote ``options`` you set on a field !
If nothing work, add a debugger in the first ligne of ``get_search_result method`` and enable debug mode in OpenERP. When you write something in a many2one field, javascript debugger should pause. If not verify your installation.
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 http://odoo-community.org.
1 change: 1 addition & 0 deletions web_m2x_options/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# coding: utf-8
11 changes: 7 additions & 4 deletions web_m2x_options/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@

{
"name": 'web_m2x_options',
"version": "8.0.0.2",
"version": "9.0.1.0.0",
"depends": [
'base',
'web',
],
'qweb': [
'static/src/xml/base.xml',
],
'license': 'AGPL-3',
'data': ['views/view.xml'],
"author": "0k.io,Odoo Community Association (OCA)",
'installable': False,
"active": False,
"author": "ACSONE SA/NV, 0k.io,Odoo Community Association (OCA)",
'installable': True,
}
43 changes: 43 additions & 0 deletions web_m2x_options/i18n/ar.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_m2x_options
#
# Translators:
# SaFi J. <safi2266@gmail.com>, 2015
msgid ""
msgstr ""
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-02-26 02:05+0000\n"
"PO-Revision-Date: 2015-12-16 17:30+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_m2x_options
#. openerp-web
#: code:addons/web_m2x_options/static/src/js/form.js:219
#: code:addons/web_m2x_options/static/src/js/form.js:373
#, python-format
msgid "Create \"<strong>%s</strong>\""
msgstr "إنشاء \"<strong>%s</strong>\""

#. module: web_m2x_options
#. openerp-web
#: code:addons/web_m2x_options/static/src/js/form.js:237
#: code:addons/web_m2x_options/static/src/js/form.js:392
#, python-format
msgid "Create and Edit..."
msgstr "إنشاء وتحرير ..."

#. module: web_m2x_options
#. openerp-web
#: code:addons/web_m2x_options/static/src/js/form.js:188
#: code:addons/web_m2x_options/static/src/js/form.js:349
#, python-format
msgid "Search More..."
msgstr "البحث عن المزيد ..."
43 changes: 43 additions & 0 deletions web_m2x_options/i18n/de.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_m2x_options
#
# 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-02-26 02:05+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_m2x_options
#. openerp-web
#: code:addons/web_m2x_options/static/src/js/form.js:219
#: code:addons/web_m2x_options/static/src/js/form.js:373
#, python-format
msgid "Create \"<strong>%s</strong>\""
msgstr "Anlegen \"<strong>%s</strong>"

#. module: web_m2x_options
#. openerp-web
#: code:addons/web_m2x_options/static/src/js/form.js:237
#: code:addons/web_m2x_options/static/src/js/form.js:392
#, python-format
msgid "Create and Edit..."
msgstr "Anlegen und Bearbeiten"

#. module: web_m2x_options
#. openerp-web
#: code:addons/web_m2x_options/static/src/js/form.js:188
#: code:addons/web_m2x_options/static/src/js/form.js:349
#, python-format
msgid "Search More..."
msgstr "Suche weitere..."
43 changes: 43 additions & 0 deletions web_m2x_options/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_m2x_options
#
# 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: 2016-02-26 02:05+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_m2x_options
#. openerp-web
#: code:addons/web_m2x_options/static/src/js/form.js:219
#: code:addons/web_m2x_options/static/src/js/form.js:373
#, python-format
msgid "Create \"<strong>%s</strong>\""
msgstr "Crear \"<strong>%s</strong>\""

#. module: web_m2x_options
#. openerp-web
#: code:addons/web_m2x_options/static/src/js/form.js:237
#: code:addons/web_m2x_options/static/src/js/form.js:392
#, python-format
msgid "Create and Edit..."
msgstr "Crear y editar..."

#. module: web_m2x_options
#. openerp-web
#: code:addons/web_m2x_options/static/src/js/form.js:188
#: code:addons/web_m2x_options/static/src/js/form.js:349
#, python-format
msgid "Search More..."
msgstr "Buscar más..."
43 changes: 43 additions & 0 deletions web_m2x_options/i18n/fi.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_m2x_options
#
# 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-02-26 02:05+0000\n"
"PO-Revision-Date: 2016-02-01 09:52+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_m2x_options
#. openerp-web
#: code:addons/web_m2x_options/static/src/js/form.js:219
#: code:addons/web_m2x_options/static/src/js/form.js:373
#, python-format
msgid "Create \"<strong>%s</strong>\""
msgstr "Luo \"<strong>%s</strong>\""

#. module: web_m2x_options
#. openerp-web
#: code:addons/web_m2x_options/static/src/js/form.js:237
#: code:addons/web_m2x_options/static/src/js/form.js:392
#, python-format
msgid "Create and Edit..."
msgstr "Luo ja muokkaa..."

#. module: web_m2x_options
#. openerp-web
#: code:addons/web_m2x_options/static/src/js/form.js:188
#: code:addons/web_m2x_options/static/src/js/form.js:349
#, python-format
msgid "Search More..."
msgstr "Hae lisää..."
Loading