[MIG] web_widget_domain_editor_dialog: Migration to 15.0

This commit is contained in:
Carlos Lopez
2022-01-27 02:06:23 -05:00
parent 57341007c8
commit 070f1871ef
7 changed files with 32 additions and 41 deletions

View File

@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" 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" 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" href="https://github.com/OCA/web/tree/14.0/web_widget_domain_editor_dialog"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/web-14-0/web-14-0-web_widget_domain_editor_dialog"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/162/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" 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" 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" href="https://github.com/OCA/web/tree/15.0/web_widget_domain_editor_dialog"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/web-15-0/web-15-0-web_widget_domain_editor_dialog"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/162/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>Since v11 introduced the new domain editor widget its not possible to edit
the selected records from the current domain.</p>
<p>This module reintroduces that dialog to complement the current widget with the
@@ -408,7 +408,7 @@ records and those unfolded groups will be set as filters to.</li>
</blockquote>
<p>You can still edit the filter with Odoos widget after that.</p>
<div class="figure align-center">
<img alt="https://raw.githubusercontent.com/OCA/web/14.0/web_widget_domain_editor_dialog/static/src/img/behaviour.gif" src="https://raw.githubusercontent.com/OCA/web/14.0/web_widget_domain_editor_dialog/static/src/img/behaviour.gif" style="width: 600px;" />
<img alt="https://raw.githubusercontent.com/OCA/web/15.0/web_widget_domain_editor_dialog/static/src/img/behaviour.gif" src="https://raw.githubusercontent.com/OCA/web/15.0/web_widget_domain_editor_dialog/static/src/img/behaviour.gif" style="width: 600px;" />
</div>
</div>
<div class="section" id="bug-tracker">
@@ -416,7 +416,7 @@ records and those unfolded groups will be set as filters to.</li>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_widget_domain_editor_dialog%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_widget_domain_editor_dialog%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
@@ -438,6 +438,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
</li>
<li>Darshan Patel &lt;<a class="reference external" href="mailto:darshan.barcelona&#64;gmail.com">darshan.barcelona&#64;gmail.com</a>&gt;</li>
<li>Helly kapatel &lt;<a class="reference external" href="mailto:helly.kapatel&#64;initos.com">helly.kapatel&#64;initos.com</a>&gt;</li>
<li>Carlos Lopez &lt;<a class="reference external" href="mailto:celm1990&#64;gmail.com">celm1990&#64;gmail.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
@@ -447,7 +448,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<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/14.0/web_widget_domain_editor_dialog">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/15.0/web_widget_domain_editor_dialog">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>

View File

@@ -4,12 +4,11 @@
odoo.define("web_widget_domain_editor_dialog.basic_fields", function (require) {
"use strict";
const core = require("web.core");
const basic_fields = require("web.basic_fields");
const {_t} = require("web.core");
const {FieldDomain} = require("web.basic_fields");
const DomainEditorDialog = require("web_widget_domain_editor_dialog.DomainEditorDialog");
const _t = core._t;
basic_fields.FieldDomain.include({
FieldDomain.include({
_onShowSelectionButtonClick: function (event) {
event.preventDefault();
const _this = this;
@@ -30,9 +29,11 @@ odoo.define("web_widget_domain_editor_dialog.basic_fields", function (require) {
_this.domainSelector
.setDomain(this.get_domain(selected_ids))
.then(_this._replaceContent.bind(_this));
_this.trigger_up("domain_changed", {
// Trigger from domainSelector instead of _this
// for execute https://github.com/odoo/odoo/blob/15.0/addons/web/static/src/legacy/js/widgets/domain_selector.js#L623
_this.domainSelector.trigger_up("domain_changed", {
child: _this,
alreadyRedrawn: true,
noRedraw: true,
});
},
}).open();

View File

@@ -4,21 +4,19 @@
odoo.define("web_widget_domain_editor_dialog.DomainEditorDialog", function (require) {
"use strict";
const core = require("web.core");
const view_dialogs = require("web.view_dialogs");
const {_t} = require("web.core");
const {SelectCreateDialog} = require("web.view_dialogs");
const Domain = require("web.Domain");
const _t = core._t;
const DomainEditorDialog = view_dialogs.SelectCreateDialog.extend({
const DomainEditorDialog = SelectCreateDialog.extend({
init: function () {
this._super.apply(this, arguments);
const _this = this;
this.options = _.defaults(this.options, {
dynamicFilters: [
{
description: _.str.sprintf(_t("Selected domain")),
description: _t("Selected domain"),
domain: Domain.prototype.stringToArray(
_this.options.default_domain
this.options.default_domain
),
},
],
@@ -62,7 +60,7 @@ odoo.define("web_widget_domain_editor_dialog.DomainEditorDialog", function (requ
return domain.concat(group_domain);
},
on_view_list_loaded: () => {
on_view_list_loaded: function () {
this.$(".o_list_record_selector input").prop("checked", true);
this.$footer
.find(".o_selectcreatepopup_search_select")