From 4857c4c7d19c42f4561bfb6dcc9e3ec6dc0d509e Mon Sep 17 00:00:00 2001 From: Cybrosys Technologies Date: Thu, 26 Dec 2024 10:45:10 +0530 Subject: [PATCH] Dec 26: [FIX] Bug Fixed 'click_and_collect_pos' --- click_and_collect_pos/__manifest__.py | 2 +- click_and_collect_pos/doc/RELEASE_NOTES.md | 5 ++ .../static/description/index.html | 2 +- click_and_collect_pos/static/src/js/navbar.js | 52 +++++++++---------- .../static/src/xml/navbar.xml | 4 +- 5 files changed, 35 insertions(+), 30 deletions(-) diff --git a/click_and_collect_pos/__manifest__.py b/click_and_collect_pos/__manifest__.py index 8f08e7717..9a15cffe6 100644 --- a/click_and_collect_pos/__manifest__.py +++ b/click_and_collect_pos/__manifest__.py @@ -20,7 +20,7 @@ ############################################################################# { 'name': 'Click And Collect PoS', - 'version': '17.0.1.0.0', + 'version': '17.0.1.0.1', 'category': 'Point of Sale', 'summary': """With this module, customers may place product orders online and pick them up from the closest shop.""", diff --git a/click_and_collect_pos/doc/RELEASE_NOTES.md b/click_and_collect_pos/doc/RELEASE_NOTES.md index ad52dbcf2..59804c7ca 100644 --- a/click_and_collect_pos/doc/RELEASE_NOTES.md +++ b/click_and_collect_pos/doc/RELEASE_NOTES.md @@ -4,3 +4,8 @@ #### Version 17.0.1.0.0 #### ADD - Initial commit for Click and Collect POS + +#### 01.02.2024 +#### Version 17.0.1.0.1 +#### FIX +- Fixed the issue in pos session closing and optimised the Navbar component diff --git a/click_and_collect_pos/static/description/index.html b/click_and_collect_pos/static/description/index.html index 807b47e07..167175ab6 100644 --- a/click_and_collect_pos/static/description/index.html +++ b/click_and_collect_pos/static/description/index.html @@ -319,7 +319,7 @@ style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
Version - 17.0.1.0.0|Released on:01st February 2024
diff --git a/click_and_collect_pos/static/src/js/navbar.js b/click_and_collect_pos/static/src/js/navbar.js index ba6ff72b2..ebdf38d92 100644 --- a/click_and_collect_pos/static/src/js/navbar.js +++ b/click_and_collect_pos/static/src/js/navbar.js @@ -1,37 +1,37 @@ /** @odoo-module **/ -import { Navbar } from "@point_of_sale/app/navbar/navbar"; -import { jsonrpc } from "@web/core/network/rpc_service"; -import { patch } from "@web/core/utils/patch"; +import {Navbar} from "@point_of_sale/app/navbar/navbar"; +import {jsonrpc} from "@web/core/network/rpc_service"; +import {patch} from "@web/core/utils/patch"; +import {SetSaleOrderButton} from "@pos_sale/app/set_sale_order_button/set_sale_order_button" + +Navbar.components = {...Navbar.components, SetSaleOrderButton} patch(Navbar.prototype, { - setup() { - super.setup(); - }, async onClick() { - var self = this; - var sale_order = []; - var stock_picking = self.pos.stock_picking; - var session_id = self.pos.pos_session.config_id - var sale_order_line = await jsonrpc("/web/dataset/call_kw", { + const sale_orderSetSaleOrderButton = []; + const stock_picking = this.pos.stock_picking; + const session_id = this.pos.pos_session.config_id + const sale_order_line = await jsonrpc("/web/dataset/call_kw", { model: "sale.order.line", method: "search_read", args: [], - kwargs: {}, + kwargs: { + domain: [['state', '=', 'sale'], ['pos_config_id', '=', session_id[0]]], + }, + }); + + const line_ids = [] + + stock_picking.forEach(function (lines) { + lines.move_ids_without_package.forEach(function (line) { + if (line.sale_line_id[0] && line.state !== "done") { + line_ids.push(line.sale_line_id[0]); + } + }); }); - sale_order_line.forEach(function (object) { - if (object.state == "sale" && session_id[0] == object.pos_config_id[0]) { - stock_picking.forEach(function (lines) { - let plan_arr = null; - plan_arr = lines.move_ids_without_package.flat(1); - plan_arr.forEach(function (line) { - if (object.id == line.sale_line_id[0] && line.state != "done" ) { - sale_order.push(object); - } - }); - }); - } - }); - self.pos.showScreen("SaleOrderScreen", { + + const sale_order = sale_order_line.filter((line) => line_ids.includes(line.id)); + this.pos.showScreen("SaleOrderScreen", { click_and_collect: sale_order, }); }, diff --git a/click_and_collect_pos/static/src/xml/navbar.xml b/click_and_collect_pos/static/src/xml/navbar.xml index 2bd22608c..e20745d7f 100644 --- a/click_and_collect_pos/static/src/xml/navbar.xml +++ b/click_and_collect_pos/static/src/xml/navbar.xml @@ -2,7 +2,7 @@ + t-inherit-mode="extension">