LaOsaCoop/Odoo16#14 migration pos_customer_required
This commit is contained in:
parent
b062c383d5
commit
08fca37c6d
27 changed files with 1438 additions and 0 deletions
37
pos_customer_required/static/src/js/PaymentScreen.js
Normal file
37
pos_customer_required/static/src/js/PaymentScreen.js
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/* Copyright apertoso NV- Jos DE GRAEVE <Jos.DeGraeve@apertoso.be>
|
||||
Copyright La Louve - Sylvain LE GAL <https://twitter.com/legalsylvain>
|
||||
Copyright NuoBiT - Eric Antones <eantones@nuobit.com>
|
||||
Copyright NuoBiT - Kilian Niubo <kniubo@nuobit.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) */
|
||||
odoo.define("pos_customer_required.PaymentScreen", function (require) {
|
||||
"use strict";
|
||||
|
||||
const PaymentScreen = require("point_of_sale.PaymentScreen");
|
||||
const Registries = require("point_of_sale.Registries");
|
||||
const core = require("web.core");
|
||||
const _t = core._t;
|
||||
|
||||
const PosRequiredCustomerPaymentScreen = (PaymentScreen) =>
|
||||
class extends PaymentScreen {
|
||||
async _isOrderValid(isForceValidate) {
|
||||
if (
|
||||
this.env.pos.config.require_customer === "payment" &&
|
||||
!this.env.pos.get_order().get_partner()
|
||||
) {
|
||||
const result = await this.showPopup("ConfirmPopup", {
|
||||
title: _t("An anonymous order cannot be confirmed"),
|
||||
body: _t("Please select a customer for this order."),
|
||||
});
|
||||
if (result.confirmed) {
|
||||
this.selectClient();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return super._isOrderValid(isForceValidate);
|
||||
}
|
||||
};
|
||||
|
||||
Registries.Component.extend(PaymentScreen, PosRequiredCustomerPaymentScreen);
|
||||
|
||||
return PosRequiredCustomerPaymentScreen;
|
||||
});
|
||||
38
pos_customer_required/static/src/js/ProductScreen.js
Normal file
38
pos_customer_required/static/src/js/ProductScreen.js
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/** @odoo-module **/
|
||||
|
||||
import {Component} from "point_of_sale.Registries";
|
||||
import ProductScreen from "point_of_sale.ProductScreen";
|
||||
const { onMounted } = owl;
|
||||
|
||||
const PosRequiredCustomerProductScreen = (ProductScreen) =>
|
||||
class extends ProductScreen {
|
||||
|
||||
setup() {
|
||||
super.setup();
|
||||
onMounted(async () => {
|
||||
if (
|
||||
this.env.pos.config.require_customer === "order" &&
|
||||
!this.env.pos.get_order().get_partner()
|
||||
) {
|
||||
this.onClickPartner();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async _onClickPay() {
|
||||
if (
|
||||
(this.env.pos.config.require_customer === "order" ||
|
||||
this.env.pos.config.require_customer === "payment") &&
|
||||
!this.env.pos.get_order().get_partner()
|
||||
) {
|
||||
this.onClickPartner();
|
||||
}
|
||||
else {
|
||||
return super._onClickPay(...arguments);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Component.extend(ProductScreen, PosRequiredCustomerProductScreen);
|
||||
export default ProductScreen;
|
||||
Loading…
Add table
Add a link
Reference in a new issue