diff --git a/click_and_collect_pos/models/sale_order.py b/click_and_collect_pos/models/sale_order.py
index 4bb99d2a6..3faeee954 100644
--- a/click_and_collect_pos/models/sale_order.py
+++ b/click_and_collect_pos/models/sale_order.py
@@ -45,9 +45,15 @@ class SaleOrder(models.Model):
return super(SaleOrder, self)._action_confirm()
def action_split_delivery_order(self):
- """to split delivery order and click and collect order separately"""
+ """To split delivery order and click and collect order separately"""
click_and_collect_list = [line for line in self.order_line.filtered(
lambda l: l.is_click_and_collect)]
+ if len(click_and_collect_list):
+ message = {
+ "channel": 'POS_COLLECT_ORDER',
+ }
+ self.env["bus.bus"]._sendone('POS_COLLECT_ORDER', "notification",
+ message)
for res in click_and_collect_list:
delivery_order = self.env['stock.picking'].create({
'partner_id': self.partner_id.id,
diff --git a/click_and_collect_pos/static/description/assets/screenshots/1.png b/click_and_collect_pos/static/description/assets/screenshots/1.png
new file mode 100644
index 000000000..02a2efc71
Binary files /dev/null and b/click_and_collect_pos/static/description/assets/screenshots/1.png differ
diff --git a/click_and_collect_pos/static/description/index.html b/click_and_collect_pos/static/description/index.html
index 167175ab6..0e6fd74ea 100644
--- a/click_and_collect_pos/static/description/index.html
+++ b/click_and_collect_pos/static/description/index.html
@@ -247,6 +247,24 @@
+
diff --git a/click_and_collect_pos/static/src/audio/notification.wav b/click_and_collect_pos/static/src/audio/notification.wav
new file mode 100644
index 000000000..7e3d6ad1e
Binary files /dev/null and b/click_and_collect_pos/static/src/audio/notification.wav differ
diff --git a/click_and_collect_pos/static/src/js/click_and_collect_screen.js b/click_and_collect_pos/static/src/js/click_and_collect_screen.js
index e9e6d4d5a..890225125 100644
--- a/click_and_collect_pos/static/src/js/click_and_collect_screen.js
+++ b/click_and_collect_pos/static/src/js/click_and_collect_screen.js
@@ -4,7 +4,6 @@ import { jsonrpc } from "@web/core/network/rpc_service";
import { registry } from "@web/core/registry";
// Define a new class that extends PosComponent
export class SaleOrderScreen extends Component {
-
/**
* Override the setup method to perform any additional setup logic.
*/
@@ -16,6 +15,7 @@ export class SaleOrderScreen extends Component {
this.env.services.pos.showScreen("ProductScreen");
}
getSaleOrderListLine() {
+ console.log("SaleOrderListLine")
var order_line_id = [];
this.props.click_and_collect.forEach(function(object) {
if (object.is_click_and_collect == true) {
diff --git a/click_and_collect_pos/static/src/js/navbar.js b/click_and_collect_pos/static/src/js/navbar.js
index ebdf38d92..5ed310ceb 100644
--- a/click_and_collect_pos/static/src/js/navbar.js
+++ b/click_and_collect_pos/static/src/js/navbar.js
@@ -3,10 +3,32 @@ 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"
+import { useService } from "@web/core/utils/hooks";
+import { _t } from "@web/core/l10n/translation";
+var beep = new Audio('/click_and_collect_pos/static/src/audio/notification.wav');
Navbar.components = {...Navbar.components, SetSaleOrderButton}
patch(Navbar.prototype, {
+ setup() {
+ super.setup();
+ this.sound = useService("sound");
+ this.busService = this.env.services.bus_service
+ this.busService.addChannel('POS_COLLECT_ORDER')
+ this.busService.addEventListener("notification", this.onMessage.bind(this))
+ },
+
+ onMessage({detail: notifications}) {
+ notifications = notifications.filter(item => item.payload.channel === 'POS_COLLECT_ORDER')
+ if (notifications){
+ console.log("Notifications")
+ this.env.services.notification.add(
+ _t("One Collect Order Is Created"),
+ { sticky: true ,type: "success",}
+ );
+ beep.play();
+ }
+ },
async onClick() {
const sale_orderSetSaleOrderButton = [];
const stock_picking = this.pos.stock_picking;
@@ -19,9 +41,7 @@ patch(Navbar.prototype, {
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") {
@@ -29,7 +49,6 @@ patch(Navbar.prototype, {
}
});
});
-
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/js/pos_store.js b/click_and_collect_pos/static/src/js/pos_store.js
index dfb8a75b3..b483372a3 100644
--- a/click_and_collect_pos/static/src/js/pos_store.js
+++ b/click_and_collect_pos/static/src/js/pos_store.js
@@ -1,6 +1,11 @@
/** @odoo-module */
import { PosStore } from "@point_of_sale/app/store/pos_store";
import { patch } from "@web/core/utils/patch";
+import { Chrome } from "@point_of_sale/app/pos_app";
+import { useService } from "@web/core/utils/hooks";
+import { _t } from "@web/core/l10n/translation";
+
+
patch(PosStore.prototype, {
/**
*Override PosGlobalState to load fields in pos session
@@ -15,4 +20,4 @@ patch(PosStore.prototype, {
})
this.stock_picking = stock_picking
}
- })
+})
\ No newline at end of file
diff --git a/click_and_collect_pos/static/src/xml/navbar.xml b/click_and_collect_pos/static/src/xml/navbar.xml
index e20745d7f..c0f1ee810 100644
--- a/click_and_collect_pos/static/src/xml/navbar.xml
+++ b/click_and_collect_pos/static/src/xml/navbar.xml
@@ -6,7 +6,7 @@
- Click And Collect
+ Click And Collects