Skip to content

Commit

Permalink
[MIG]web_m2x_options: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelregidor committed Jul 23, 2024
1 parent 3469ab8 commit 3ffb55c
Show file tree
Hide file tree
Showing 9 changed files with 289 additions and 593 deletions.
19 changes: 7 additions & 12 deletions web_m2x_options/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,11 @@ in the field's options dict
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 and one2many rows buttons that open the linked
resource

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

Deactivates the color picker on many2many_tags buttons to do nothing
(ignored if open is set)

ir.config_parameter options
---------------------------

Expand Down Expand Up @@ -155,7 +144,7 @@ Your XML form view definition could contain:
.. code:: xml
...
<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':'type', 'colors':{'contact':'green', 'invoice': 'red', 'delivery': 'blue'}}"/>
...
Known issues / Roadmap
Expand Down Expand Up @@ -226,6 +215,12 @@ Contributors

- Hoang Diep <hoang@trobz.com>

- `Sygel <https://sygel.es>`__:

- Manuel Regidor <manuel.regidor@sygel.es>
- Valentín Vinagre <valentin.vinagre@sygel.es>
- Harald Panten <harald.panten@sygel.es>

Other credits
-------------

Expand Down
13 changes: 11 additions & 2 deletions web_m2x_options/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

{
"name": "web_m2x_options",
"version": "16.0.1.1.3",
"version": "17.0.1.0.0",
"category": "Web",
"author": "initOS GmbH,"
"ACSONE SA/NV, "
Expand All @@ -16,6 +16,15 @@
"website": "https://github.com/OCA/web",
"license": "AGPL-3",
"depends": ["web"],
"assets": {"web.assets_backend": ["web_m2x_options/static/src/components/*"]},
"assets": {
"web.assets_backend": [
(
"before",
"web/static/src/views/fields/*",
"web_m2x_options/static/src/components/form.esm.js",
),
"web_m2x_options/static/src/components/base.xml",
]
},
"installable": True,
}
1 change: 1 addition & 0 deletions web_m2x_options/models/ir_config_parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def get_web_m2x_options(self):
"web_m2x_options.search_more",
"web_m2x_options.m2o_dialog",
"web_m2x_options.field_limit_entries",
"web_m2x_options.open",
]
values = self.sudo().search_read([["key", "in", opts]], ["key", "value"])
return {res["key"]: res["value"] for res in values}
5 changes: 5 additions & 0 deletions web_m2x_options/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@

- [Trobz](https://trobz.com):
- Hoang Diep \<<hoang@trobz.com>\>

- [Sygel](https://sygel.es):
- Manuel Regidor \<<manuel.regidor@sygel.es>\>
- Valentín Vinagre \<<valentin.vinagre@sygel.es>\>
- Harald Panten \<<harald.panten@sygel.es>\>
13 changes: 1 addition & 12 deletions web_m2x_options/readme/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,11 @@
> 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 and one2many rows buttons that open the linked
> resource
`no_color_picker` *boolean* (Default: `False`)

> Deactivates the color picker on many2many_tags buttons to do nothing
> (ignored if open is set)
## ir.config_parameter options

Now you can disable "Create..." and "Create and Edit..." entry for all
Expand Down Expand Up @@ -101,6 +90,6 @@ Your XML form view definition could contain:

``` xml
...
<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':'type', 'colors':{'contact':'green', 'invoice': 'red', 'delivery': 'blue'}}"/>
...
```
23 changes: 4 additions & 19 deletions web_m2x_options/static/src/components/base.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,17 @@
</xpath>
</t>

<t
<t
t-name="web_m2x_options.Many2ManyTagsField"
t-inherit="web.Many2ManyTagsField"
t-inherit-mode="extension"
owl="1"
>
<xpath expr="//Many2XAutocomplete" position="attributes">
<attribute name="nodeOptions">props.nodeOptions</attribute>
<attribute name="searchLimit">props.searchLimit</attribute>
<attribute name="fieldColor">props.fieldColor</attribute>
<attribute name="fieldColorOptions">props.fieldColorOptions</attribute>
</xpath>
</t>

<t t-name="web_m2x_options.Many2OneField.CreateConfirmationDialog" owl="1">
<Dialog title="title" size="'md'">
<div>
You are creating a new <strong t-esc="props.value" /> as a new <t
t-esc="props.name"
/>, are you sure it does not exist yet?
</div>
<t t-set-slot="footer">
<button class="btn btn-primary" t-on-click="onCreate">Create</button>
<button
class="btn btn-primary"
t-on-click="onCreateEdit"
>Create and Edit</button>
<button class="btn" t-on-click="() => props.close()">Discard</button>
</t>
</Dialog>
</t>
</templates>
Loading

0 comments on commit 3ffb55c

Please sign in to comment.