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:
Ernad Husremovic 2025-08-30 17:15:35 +02:00
parent 3791451dc1
commit 377f346a99
2675 changed files with 93308 additions and 0 deletions

View file

@ -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);

View file

@ -0,0 +1,10 @@
.pos .button.error_risk {
background: $warning !important;
border-color: $warning !important;
color: black !important;
}
.payment-red {
background: rgba(255, 0, 0, 0.6);
cursor: not-allowed;
}

View file

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates id="template" xml:space="preserve">
<t t-inherit="point_of_sale.PaymentScreen" t-inherit-mode="extension" owl="1">
<xpath
expr="//t[@t-foreach='payment_methods_from_config']"
position="attributes"
>
<attribute name="t-foreach">paymentMethodsUnlock</attribute>
</xpath>
<xpath expr="//div[hasclass('paymentmethods')]" position="after">
<div class="paymentmethods" t-if="paymentMethodsLock.length > 0">
<p class="title-category">Blocked due to credit limit reached</p>
<t
t-foreach="paymentMethodsLock"
t-as="paymentMethod"
t-key="paymentMethod.id"
>
<div class="button paymentmethod">
<div class="payment-name payment-red">
<s t-esc="paymentMethod.name" />
</div>
</div>
</t>
</div>
</xpath>
<xpath
expr="//div[hasclass('payment-buttons')]/div[hasclass('partner-button')]/div[hasclass('button')]"
position="attributes"
>
<attribute name="t-att-class">{
highlight: currentOrder.get_partner(),
error_risk: currentOrder.get_partner() &amp;&amp; riskLimit > 0 &amp;&amp; remainderLimit &lt;= 0 }
</attribute>
</xpath>
<xpath
expr="//div[hasclass('payment-buttons')]/div[hasclass('partner-button')]//t[@t-esc='partner.name']"
position="after"
>
<span t-if="riskLimit > 0"> (remainder <t t-esc="remainderLimit" />$)</span>
</xpath>
</t>
</templates>