Skip to content

Commit

Permalink
[MIG] Migrate module pos_reset_search to v14.
Browse files Browse the repository at this point in the history
  • Loading branch information
dsolanki-initos committed Jul 13, 2021
1 parent 66fd02e commit 0aab88c
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pos_reset_search/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Point of Sale - Clear product search on click",
"version": "12.0.1.0.0",
"version": "14.0.1.0.0",
"category": "Point of Sale",
"summary": "Point of Sale - Clear product search when user clicks on a product.",
"author": "Le Nid, Odoo Community Association (OCA)",
Expand Down
2 changes: 2 additions & 0 deletions pos_reset_search/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
- Le Nid
- CoopITEasy

* Dhara Solanki <dhara.solanki@initos.com>
38 changes: 29 additions & 9 deletions pos_reset_search/static/src/js/reset.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
odoo.define("product_click_search_reset", function (require) {
"use strict";
var screens = require("point_of_sale.screens");

screens.ProductScreenWidget.include({
click_product: function (product) {
var self = this;
self._super(product);
self.product_categories_widget.clear_search();
},
});

const ProductScreen = require("point_of_sale.ProductScreen");
const Registries = require("point_of_sale.Registries");

const PosProductScreen = (ProductScreen) =>
class extends ProductScreen {
async _clickProduct(event) {
const ProductScreenChildren = this.__owl__.children;

const ProductWidget = ProductScreenChildren.find(
(child) => child.el.className === "products-widget"
);
if (ProductWidget) {
const ProductWidgetChildren = ProductWidget.__owl__.children;

const ProductsWidgetControlPanel = ProductWidgetChildren.find(
(child) => child.el.className === "products-widget-control"
);
if (ProductsWidgetControlPanel) {
ProductsWidgetControlPanel.clearSearch();
}
}
return super._clickProduct(event);
}
};

Registries.Component.extend(ProductScreen, PosProductScreen);

return ProductScreen;
});

0 comments on commit 0aab88c

Please sign in to comment.