Skip to content

Commit

Permalink
[MIG][18.0] web_m2x_options
Browse files Browse the repository at this point in the history
  • Loading branch information
bud-e committed Oct 29, 2024
1 parent d90b2b8 commit 21fbaa1
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 31 deletions.
12 changes: 7 additions & 5 deletions web_m2x_options/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
web_m2x_options
===============

..
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:910793e5ee7f22cb791b406c307d1dbc31d43a5d5131eab0fa5265f79478099b
!! source digest: sha256:36f18dc3f0b0b3d8b91f63aa88d55c4936d53fef5857b1dcb903308b536c79c4
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand All @@ -17,13 +17,13 @@ web_m2x_options
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
:target: https://github.com/OCA/web/tree/17.0/web_m2x_options
:target: https://github.com/OCA/web/tree/18.0/web_m2x_options
:alt: OCA/web
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/web-17-0/web-17-0-web_m2x_options
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=17.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -206,6 +206,8 @@ Contributors
- Valentín Vinagre <[email protected]>
- Harald Panten <[email protected]>

- Siddharth Bhalgami <[email protected]>

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

Expand All @@ -225,6 +227,6 @@ 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.

This module is part of the `OCA/web <https://github.com/OCA/web/tree/17.0/web_m2x_options>`_ project on GitHub.
This module is part of the `OCA/web <https://github.com/OCA/web/tree/18.0/web_m2x_options>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 2 additions & 1 deletion web_m2x_options/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@

{
"name": "web_m2x_options",
"version": "17.0.1.0.4",
"version": "18.0.1.0.0",
"category": "Web",
"author": "initOS GmbH,"
"ACSONE SA/NV, "
"0k.io, "
"Tecnativa, "
"Sygel, "
"Siddharth Bhalgami, "
"Odoo Community Association (OCA)",
"website": "https://github.com/OCA/web",
"license": "AGPL-3",
Expand Down
2 changes: 2 additions & 0 deletions web_m2x_options/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@
- Manuel Regidor \<<[email protected]>\>
- Valentín Vinagre \<<[email protected]>\>
- Harald Panten \<<[email protected]>\>

- Siddharth Bhalgami \<<[email protected]>\>
7 changes: 4 additions & 3 deletions web_m2x_options/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,9 @@ <h1 class="title">web_m2x_options</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:910793e5ee7f22cb791b406c307d1dbc31d43a5d5131eab0fa5265f79478099b
!! source digest: sha256:36f18dc3f0b0b3d8b91f63aa88d55c4936d53fef5857b1dcb903308b536c79c4
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web/tree/17.0/web_m2x_options"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-17-0/web-17-0-web_m2x_options"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web/tree/18.0/web_m2x_options"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-18-0/web-18-0-web_m2x_options"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This modules modifies “many2one” and “many2manytags” form widgets so as
to add some new display control options.</p>
<p>Options provided includes possibility to remove “Create…” and/or
Expand Down Expand Up @@ -535,6 +535,7 @@ <h2><a class="toc-backref" href="#toc-entry-9">Contributors</a></h2>
<li>Harald Panten &lt;<a class="reference external" href="mailto:harald.panten&#64;sygel.es">harald.panten&#64;sygel.es</a>&gt;</li>
</ul>
</li>
<li>Siddharth Bhalgami &lt;<a class="reference external" href="mailto:siddharth.bhalgami&#64;gmail.com">siddharth.bhalgami&#64;gmail.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="other-credits">
Expand All @@ -551,7 +552,7 @@ <h2><a class="toc-backref" href="#toc-entry-11">Maintainers</a></h2>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/17.0/web_m2x_options">OCA/web</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/18.0/web_m2x_options">OCA/web</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
60 changes: 38 additions & 22 deletions web_m2x_options/static/src/components/form.esm.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/** @odoo-module **/
import {registry} from "@web/core/registry";
import {
Many2ManyTagsField,
Many2ManyTagsFieldColorEditable,
Expand Down Expand Up @@ -64,7 +65,7 @@ Many2ManyTagsAvatarField.props = {
};

patch(many2OneField, {
m2o_options_props_create(props, attrs, options) {
m2oOptionsPropsCreate(props, attrs, options) {
const ir_options = session.web_m2x_options;
if (options.create === false) {
props.canQuickCreate = false;
Expand All @@ -88,7 +89,7 @@ patch(many2OneField, {
return props;
},

m2o_options_props_create_edit(props, attrs, options) {
m2oOptionsPropsCreateEdit(props, attrs, options) {
const ir_options = session.web_m2x_options;
if (options.create_edit === false) {
props.canCreateEdit = false;
Expand All @@ -114,7 +115,7 @@ patch(many2OneField, {
return props;
},

m2o_options_props_limit(props, attrs, options) {
m2oOptionsPropsLimit(props, attrs, options) {
const ir_options = session.web_m2x_options;
if (Number(options.limit)) {
props.searchLimit = Number(options.limit);
Expand All @@ -124,7 +125,7 @@ patch(many2OneField, {
return props;
},

m2o_options_props_search_more(props, attrs, options) {
m2oOptionsPropsSearchMore(props, attrs, options) {
const ir_options = session.web_m2x_options;
if (options.search_more) {
props.noSearchMore = false;
Expand All @@ -141,7 +142,7 @@ patch(many2OneField, {
return props;
},

m2o_options_props_open(props, attrs, options) {
m2oOptionsPropsOpen(props, attrs, options) {
const ir_options = session.web_m2x_options;
if (options.open) {
props.canOpen = true;
Expand All @@ -155,12 +156,12 @@ patch(many2OneField, {
return props;
},

m2o_options_props(props, attrs, options) {
props = this.m2o_options_props_create(props, attrs, options);
props = this.m2o_options_props_create_edit(props, attrs, options);
props = this.m2o_options_props_limit(props, attrs, options);
props = this.m2o_options_props_search_more(props, attrs, options);
props = this.m2o_options_props_open(props, attrs, options);
m2oOptionsProps(props, attrs, options) {
props = this.m2oOptionsPropsCreate(props, attrs, options);
props = this.m2oOptionsPropsCreateEdit(props, attrs, options);
props = this.m2oOptionsPropsLimit(props, attrs, options);
props = this.m2oOptionsPropsSearchMore(props, attrs, options);
props = this.m2oOptionsPropsOpen(props, attrs, options);
props.fieldColor = options.field_color;
props.fieldColorOptions = options.colors;
return props;
Expand All @@ -170,7 +171,7 @@ patch(many2OneField, {
{attrs, context, decorations, options, string},
dynamicInfo
);
const new_props = this.m2o_options_props(props, attrs, options);
const new_props = this.m2oOptionsProps(props, attrs, options);
return new_props;
},
});
Expand Down Expand Up @@ -198,7 +199,7 @@ patch(Many2OneField.prototype, {
});

patch(many2ManyTagsField, {
m2m_options_props_create(props, attrs, options) {
m2mOptionsPropsCreate(props, attrs, options) {
const ir_options = session.web_m2x_options;
// Create option already available for m2m fields
if (!options.create) {
Expand All @@ -219,7 +220,7 @@ patch(many2ManyTagsField, {
return props;
},

m2m_options_props_create_edit(props, attrs, options) {
m2mOptionsPropsCreateEdit(props, attrs, options) {
const ir_options = session.web_m2x_options;
if (options.create_edit === false) {
props.canCreateEdit = false;
Expand All @@ -245,7 +246,7 @@ patch(many2ManyTagsField, {
return props;
},

m2m_options_props_limit(props, attrs, options) {
m2mOptionsPropsLimit(props, attrs, options) {
const ir_options = session.web_m2x_options;
if (Number(options.limit) && options.limit > 1) {
props.searchLimit = Number(options.limit) - 1;
Expand All @@ -258,7 +259,7 @@ patch(many2ManyTagsField, {
return props;
},

m2m_options_props_search_more(props, attrs, options) {
m2mOptionsPropsSearchMore(props, attrs, options) {
const ir_options = session.web_m2x_options;
if (options.search_more) {
props.noSearchMore = false;
Expand All @@ -275,18 +276,18 @@ patch(many2ManyTagsField, {
return props;
},

m2m_options_props(props, attrs, options) {
props = this.m2m_options_props_create(props, attrs, options);
props = this.m2m_options_props_create_edit(props, attrs, options);
props = this.m2m_options_props_limit(props, attrs, options);
props = this.m2m_options_props_search_more(props, attrs, options);
m2mOptionsProps(props, attrs, options) {
props = this.m2mOptionsPropsCreate(props, attrs, options);
props = this.m2mOptionsPropsCreateEdit(props, attrs, options);
props = this.m2mOptionsPropsLimit(props, attrs, options);
props = this.m2mOptionsPropsSearchMore(props, attrs, options);
props.fieldColor = options.field_color;
props.fieldColorOptions = options.colors;
return props;
},
extractProps({attrs, options, string}, dynamicInfo) {
const props = super.extractProps({attrs, options, string}, dynamicInfo);
const new_props = this.m2m_options_props(props, attrs, options);
const new_props = this.m2mOptionsProps(props, attrs, options);
return new_props;
},
});
Expand Down Expand Up @@ -378,3 +379,18 @@ patch(FormController.prototype, {
}
},
});

// O.W.L. v18+: schema is validated in dev mode on adding to registry
patch(registry.category("fields").validationSchema, {
m2oOptionsPropsCreate: {type: Function, optional: true},
m2oOptionsPropsCreateEdit: {type: Function, optional: true},
m2oOptionsPropsLimit: {type: Function, optional: true},
m2oOptionsPropsSearchMore: {type: Function, optional: true},
m2oOptionsPropsOpen: {type: Function, optional: true},
m2oOptionsProps: {type: Function, optional: true},
m2mOptionsPropsCreate: {type: Function, optional: true},
m2mOptionsPropsCreateEdit: {type: Function, optional: true},
m2mOptionsPropsLimit: {type: Function, optional: true},
m2mOptionsPropsSearchMore: {type: Function, optional: true},
m2mOptionsProps: {type: Function, optional: true},
});

0 comments on commit 21fbaa1

Please sign in to comment.