mirror of
https://github.com/bringout/oca-pos.git
synced 2026-04-22 22:42:03 +02:00
Move all OCA POS modules from oca-technical to dedicated oca-pos submodule
Reorganized 74 POS-related modules for better structure: - Moved all odoo-bringout-oca-pos-* packages from packages/oca-technical/ - Now organized in dedicated packages/oca-pos/ submodule - Includes payment, receipt, loyalty, order, product, and partner modules - Maintains all module functionality while improving project organization This creates a cleaner separation between general technical modules and Point of Sale specific functionality. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
3791451dc1
commit
377f346a99
2675 changed files with 93308 additions and 0 deletions
|
|
@ -0,0 +1,76 @@
|
|||
/** @odoo-module **/
|
||||
|
||||
import PaymentScreen from "point_of_sale.PaymentScreen";
|
||||
import Registries from "point_of_sale.Registries";
|
||||
|
||||
export const PaymentScreenRisk = (OriginalPaymentScreen) =>
|
||||
class extends OriginalPaymentScreen {
|
||||
setup() {
|
||||
super.setup();
|
||||
this.paymentMethodsFromConfigBase = this.payment_methods_from_config;
|
||||
this.paymentMethodsUnlock = [];
|
||||
this.paymentMethodsLock = [];
|
||||
this.remainderLimit = 0.0;
|
||||
this.riskLimit = 0.0;
|
||||
this.updatePaymentMethod();
|
||||
}
|
||||
|
||||
async selectPartner() {
|
||||
await super.selectPartner();
|
||||
await this.updatePaymentMethod();
|
||||
}
|
||||
|
||||
updatePaymentMethod() {
|
||||
const order = this.currentOrder;
|
||||
const partner = order.partner;
|
||||
if (!partner) {
|
||||
this.paymentMethodsUnlock = this.paymentMethodsFromConfigBase;
|
||||
this.paymentMethodsLock = [];
|
||||
this.render(true);
|
||||
return;
|
||||
}
|
||||
const paymentCreditLimit =
|
||||
this.env.pos.config.payment_credit_limit_restricted_ids;
|
||||
const orderTotal =
|
||||
order.get_total_with_tax() + order.get_rounding_applied();
|
||||
this.rpc({
|
||||
model: "res.partner",
|
||||
method: "read",
|
||||
args: [
|
||||
partner.id,
|
||||
["risk_remaining_value", "risk_exception", "credit_limit"],
|
||||
],
|
||||
}).then((partnerFields) => {
|
||||
const riskRemainingValue = partnerFields[0].risk_remaining_value;
|
||||
const riskException = partnerFields[0].risk_exception;
|
||||
const creditLimit = partnerFields[0].credit_limit;
|
||||
|
||||
if (
|
||||
riskException ||
|
||||
(creditLimit > 0 && orderTotal > riskRemainingValue)
|
||||
) {
|
||||
if (paymentCreditLimit.length > 0) {
|
||||
this.paymentMethodsUnlock =
|
||||
this.paymentMethodsFromConfigBase.filter(
|
||||
(method) => !paymentCreditLimit.includes(method.id)
|
||||
);
|
||||
} else {
|
||||
this.paymentMethodsUnlock =
|
||||
this.paymentMethodsFromConfigBase.filter(
|
||||
(method) => !method.credit_limit_restricted
|
||||
);
|
||||
}
|
||||
} else {
|
||||
this.paymentMethodsUnlock = this.paymentMethodsFromConfigBase;
|
||||
}
|
||||
this.riskLimit = riskRemainingValue;
|
||||
this.remainderLimit = (riskRemainingValue - orderTotal).toFixed(2);
|
||||
this.paymentMethodsLock = this.paymentMethodsFromConfigBase.filter(
|
||||
(method) => !this.paymentMethodsUnlock.includes(method)
|
||||
);
|
||||
this.render(true);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Registries.Component.extend(PaymentScreen, PaymentScreenRisk);
|
||||
Loading…
Add table
Add a link
Reference in a new issue