Browse Source

Jan 17: [FIX] Bug Fixed 'click_and_collect_pos'

pull/309/head
Cybrosys Technologies 3 months ago
parent
commit
6f5da3f31f
  1. 8
      click_and_collect_pos/models/sale_order.py
  2. BIN
      click_and_collect_pos/static/description/assets/screenshots/1.png
  3. 18
      click_and_collect_pos/static/description/index.html
  4. BIN
      click_and_collect_pos/static/src/audio/notification.wav
  5. 2
      click_and_collect_pos/static/src/js/click_and_collect_screen.js
  6. 25
      click_and_collect_pos/static/src/js/navbar.js
  7. 7
      click_and_collect_pos/static/src/js/pos_store.js
  8. 2
      click_and_collect_pos/static/src/xml/navbar.xml

8
click_and_collect_pos/models/sale_order.py

@ -45,9 +45,15 @@ class SaleOrder(models.Model):
return super(SaleOrder, self)._action_confirm() return super(SaleOrder, self)._action_confirm()
def action_split_delivery_order(self): 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( click_and_collect_list = [line for line in self.order_line.filtered(
lambda l: l.is_click_and_collect)] 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: for res in click_and_collect_list:
delivery_order = self.env['stock.picking'].create({ delivery_order = self.env['stock.picking'].create({
'partner_id': self.partner_id.id, 'partner_id': self.partner_id.id,

BIN
click_and_collect_pos/static/description/assets/screenshots/1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

18
click_and_collect_pos/static/description/index.html

@ -247,6 +247,24 @@
</p> </p>
</div> </div>
</div> </div>
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/1.png"
class="img-responsive" width="100%"
height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
Sound Notification In POS</h4>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
When creating a collection order a sound notification will be displayed on pos.
</p>
</div>
</div>
</div> </div>
<div class="col-lg-12 py-2" <div class="col-lg-12 py-2"
style="padding: 1rem 4rem !important;"> style="padding: 1rem 4rem !important;">

BIN
click_and_collect_pos/static/src/audio/notification.wav

Binary file not shown.

2
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"; import { registry } from "@web/core/registry";
// Define a new class that extends PosComponent // Define a new class that extends PosComponent
export class SaleOrderScreen extends Component { export class SaleOrderScreen extends Component {
/** /**
* Override the setup method to perform any additional setup logic. * 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"); this.env.services.pos.showScreen("ProductScreen");
} }
getSaleOrderListLine() { getSaleOrderListLine() {
console.log("SaleOrderListLine")
var order_line_id = []; var order_line_id = [];
this.props.click_and_collect.forEach(function(object) { this.props.click_and_collect.forEach(function(object) {
if (object.is_click_and_collect == true) { if (object.is_click_and_collect == true) {

25
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 {jsonrpc} from "@web/core/network/rpc_service";
import {patch} from "@web/core/utils/patch"; import {patch} from "@web/core/utils/patch";
import {SetSaleOrderButton} from "@pos_sale/app/set_sale_order_button/set_sale_order_button" 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} Navbar.components = {...Navbar.components, SetSaleOrderButton}
patch(Navbar.prototype, { 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() { async onClick() {
const sale_orderSetSaleOrderButton = []; const sale_orderSetSaleOrderButton = [];
const stock_picking = this.pos.stock_picking; const stock_picking = this.pos.stock_picking;
@ -19,9 +41,7 @@ patch(Navbar.prototype, {
domain: [['state', '=', 'sale'], ['pos_config_id', '=', session_id[0]]], domain: [['state', '=', 'sale'], ['pos_config_id', '=', session_id[0]]],
}, },
}); });
const line_ids = [] const line_ids = []
stock_picking.forEach(function (lines) { stock_picking.forEach(function (lines) {
lines.move_ids_without_package.forEach(function (line) { lines.move_ids_without_package.forEach(function (line) {
if (line.sale_line_id[0] && line.state !== "done") { 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)); const sale_order = sale_order_line.filter((line) => line_ids.includes(line.id));
this.pos.showScreen("SaleOrderScreen", { this.pos.showScreen("SaleOrderScreen", {
click_and_collect: sale_order, click_and_collect: sale_order,

7
click_and_collect_pos/static/src/js/pos_store.js

@ -1,6 +1,11 @@
/** @odoo-module */ /** @odoo-module */
import { PosStore } from "@point_of_sale/app/store/pos_store"; import { PosStore } from "@point_of_sale/app/store/pos_store";
import { patch } from "@web/core/utils/patch"; 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, { patch(PosStore.prototype, {
/** /**
*Override PosGlobalState to load fields in pos session *Override PosGlobalState to load fields in pos session
@ -15,4 +20,4 @@ patch(PosStore.prototype, {
}) })
this.stock_picking = stock_picking this.stock_picking = stock_picking
} }
}) })

2
click_and_collect_pos/static/src/xml/navbar.xml

@ -6,7 +6,7 @@
<xpath expr="//div[hasclass('status-buttons')]//CashierName" position="before"> <xpath expr="//div[hasclass('status-buttons')]//CashierName" position="before">
<div class="sale-order-button" t-on-click="onClick" style="margin-right:490px; "> <div class="sale-order-button" t-on-click="onClick" style="margin-right:490px; ">
<i class="fa fa-hand-pointer-o" aria-hidden="true"/> <i class="fa fa-hand-pointer-o" aria-hidden="true"/>
<span style="padding-left: 10px;">Click And Collect</span> <span style="padding-left: 10px;">Click And Collects</span>
</div> </div>
</xpath> </xpath>
<xpath expr="//li[@t-if='showCashMoveButton']" position="after"> <xpath expr="//li[@t-if='showCashMoveButton']" position="after">

Loading…
Cancel
Save