chore: import enterprise addons 19.0 bulk snapshot

This commit is contained in:
1b-agent committed 2026-09-16 10:13:08 +00:00
commit ca4af030d3
39951 files changed
+15570005

No files matched your search

@@ -0,0 +1,20 @@
import { Dialog } from "@web/core/dialog/dialog";
import { usePos } from "@point_of_sale/app/hooks/pos_hook";
import { Component, useState } from "@odoo/owl";
export class AddInfoPopup extends Component {
static template = "l10n_pe_edi_pos.AddInfoPopup";
static components = { Dialog };
setup() {
this.pos = usePos();
this.state = useState({
l10n_pe_edi_refund_reason: this.props.order.l10n_pe_edi_refund_reason || "01",
});
}
async confirm() {
this.props.getPayload(this.state);
this.props.close();
}
}
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="l10n_pe_edi_pos.AddInfoPopup">
<Dialog title.translate="Additional Refund Information">
<div class="mb-3">
<label for="pe_refund_reason" class="form-label">Refund Reason: </label>
<select class="detail form-select" id="pe_refund_reason" name="l10n_pe_edi_refund_reason" t-model="state.l10n_pe_edi_refund_reason">
<t t-foreach="pos.config._l10n_pe_edi_refund_reason" t-as="l10n_pe_edi_refund_reason" t-key="l10n_pe_edi_refund_reason.value">
<option t-att-value="l10n_pe_edi_refund_reason.value"
t-att-selected="l10n_pe_edi_refund_reason.value === state.l10n_pe_edi_refund_reason ? 'selected' : undefined">
<t t-out="l10n_pe_edi_refund_reason.name"/>
</option>
</t>
</select>
</div>
<t t-set-slot="footer">
<button class="btn btn-primary o-default-button" t-on-click="confirm">Ok</button>
</t>
</Dialog>
</t>
</templates>
@@ -0,0 +1,21 @@
import { generateQRCodeDataUrl } from "@point_of_sale/utils";
import { OrderReceipt } from "@point_of_sale/app/screens/receipt_screen/receipt/order_receipt";
import { patch } from "@web/core/utils/patch";
patch(OrderReceipt.prototype, {
get peEdiQrcode() {
if (this.order.l10n_pe_edi_data?.qr_str) {
return generateQRCodeDataUrl(this.order.l10n_pe_edi_data.qr_str);
}
return "";
},
get amountToText() {
return this.order.l10n_pe_edi_data?.amount_to_text;
},
get summary() {
const data = this.order.l10n_pe_edi_data?.qr_str.split("|");
return data[data.length - 2];
},
});
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="OrderReceipt" t-inherit="point_of_sale.OrderReceipt" t-inherit-mode="extension">
<xpath expr="//div[@t-if='order.company.point_of_sale_use_ticket_qr_code and order.finalized']" position="before">
<t t-if="order.company.country_id?.code === 'PE' and Object.keys(this.order.l10n_pe_edi_data).length !== 0">
<div class="mt-2 text-center">
<b>Amount In Word:</b> <t t-out="this.amountToText"/>
</div>
<div class="gap-2 d-flex flex-row pt-3" style="font-size: 75%;">
<div>
<img t-if="this.peEdiQrcode" id="pe_edi_data_qr" t-att-src="this.peEdiQrcode" class="mt-1"/>
</div>
<div class="w-100 ms-1">
<div class="fw-bolder">
Summary:
</div>
<div class="portal-url text-break">
<t t-out="this.summary"/>
</div>
</div>
</div>
</t>
</xpath>
</t>
</templates>
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="ReceiptHeader" t-inherit="point_of_sale.ReceiptHeader" t-inherit-mode="extension">
<xpath expr="//img[@class='pos-receipt-logo']" position="after">
<t t-if="order.company.country_id?.code === 'PE' and order.to_invoice">
<div class="text-center fw-bold mt-2">
<div t-out="order.company.name" />
<div t-out="order.account_move.l10n_latam_document_type_id?.report_name"/>
<div t-out="order.invoiceName"/>
</div>
</t>
</xpath>
</t>
</templates>
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="ReceiptScreen" t-inherit="point_of_sale.ReceiptScreen" t-inherit-mode="extension">
<xpath expr="//div[hasclass('notice')]" position="after">
<t t-if="currentOrder.company.country_id?.code === 'PE' and this.currentOrder.to_invoice and Object.keys(this.currentOrder.l10n_pe_edi_data).length === 0">
<div class="d-flex flex-column align-items-center mb-3 p-1 p-lg-3 border border-warning rounded-3 bg-warning-subtle text-warning fs-3">
<i t-if="!ui.isSmall" class="fa fa-fw fa-2x fa-exclamation-triangle"/>
<span class="fs-3 fw-bolder">
EDI Processing Issue
</span>
<div class="fs-4 fw-bold d-flex justify-content-center align-items-center text-center gap-2">
The electronic invoice process returned an error.
Please review the invoice details from the backend to print the SUNAT compliant electronic document.
</div>
</div>
</t>
</xpath>
</t>
</templates>
@@ -0,0 +1,20 @@
import { patch } from "@web/core/utils/patch";
import { TicketScreen } from "@point_of_sale/app/screens/ticket_screen/ticket_screen";
import { makeAwaitable } from "@point_of_sale/app/utils/make_awaitable_dialog";
import { AddInfoPopup } from "@l10n_pe_edi_pos/app/components/popups/add_info_popup/add_info_popup";
patch(TicketScreen.prototype, {
//@override
async addAdditionalRefundInfo(order, destinationOrder) {
// Open the popup 'Additional Refund Information' when clicking on the 'Refund' button for an invoiced pos_order
if (this.pos.company.account_fiscal_country_id.code === "PE" && order.raw.account_move) {
const payload = await makeAwaitable(this.dialog, AddInfoPopup, {
order: destinationOrder,
});
if (payload) {
destinationOrder.l10n_pe_edi_refund_reason = payload.l10n_pe_edi_refund_reason;
}
}
await super.addAdditionalRefundInfo(...arguments);
},
});
@@ -0,0 +1,18 @@
import { AccountMoveService, accountMoveService } from "@account/services/account_move_service";
import { patch } from "@web/core/utils/patch";
patch(AccountMoveService.prototype, {
setup(env, services) {
super.setup(env, services);
this.pos = services.pos;
},
async downloadPdf(accountMoveId) {
if (this.pos.company.account_fiscal_country_id.code === "PE") {
//Invoices are not downloaded in the POS in chili. The invoice is on a receipt ticket of type electronic invoice (factura).
return;
}
super.downloadPdf(accountMoveId);
},
});
accountMoveService.dependencies = [...accountMoveService.dependencies, "pos"];
@@ -0,0 +1,13 @@
import { PosStore } from "@point_of_sale/app/services/pos_store";
import { patch } from "@web/core/utils/patch";
patch(PosStore.prototype, {
//@override
async processServerData() {
await super.processServerData();
if (this.company.account_fiscal_country_id.code === "PE") {
// load the selections to the client
this.l10n_pe_edi_refund_reason = this.data.custom["l10n_pe_edi_refund_reason"];
}
},
});
@@ -0,0 +1,35 @@
import * as Dialog from "@point_of_sale/../tests/generic_helpers/dialog_util";
import * as PaymentScreen from "@point_of_sale/../tests/pos/tours/utils/payment_screen_util";
import * as ProductScreen from "@point_of_sale/../tests/pos/tours/utils/product_screen_util";
import * as PartnerList from "@point_of_sale/../tests/pos/tours/utils/partner_list_util";
import * as ReceiptScreen from "@point_of_sale/../tests/pos/tours/utils/receipt_screen_util";
import * as TicketScreen from "@point_of_sale/../tests/pos/tours/utils/ticket_screen_util";
import * as Chrome from "@point_of_sale/../tests/pos/tours/utils/chrome_util";
import { registry } from "@web/core/registry";
registry.category("web_tour.tours").add("l10n_pe_edi_pos.RefundWithReasonTour", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
ProductScreen.clickDisplayedProduct("Desk Organizer", true, "1.0"),
ProductScreen.clickPartnerButton(),
PartnerList.searchCustomerValue("company_1_data", true),
PartnerList.clickPartner("company_1_data"),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod("Cash"),
PaymentScreen.clickValidate(),
ReceiptScreen.isShown(),
Chrome.clickOrders(),
TicketScreen.selectFilter("Active"),
TicketScreen.selectFilter("Paid"),
TicketScreen.selectOrder("0001"),
TicketScreen.confirmRefund(),
// Additional Refund Information Dialog
Dialog.confirm("Ok"),
PaymentScreen.clickPaymentMethod("Cash"),
PaymentScreen.clickValidate(),
ReceiptScreen.isShown(),
Chrome.endTour(),
].flat(),
});