19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-09 09:31:34 +01:00
parent c5006a6999
commit 80293571e7
420 changed files with 21812 additions and 44297 deletions

View file

@ -12,38 +12,15 @@ pip install odoo-bringout-oca-ocb-l10n_sa_edi_pos
## Dependencies
This addon depends on:
- l10n_sa_pos
- l10n_sa_edi
## Manifest Information
- **Name**: Saudi Arabia - E-invoicing (Simplified)
- **Version**: 0.1
- **Category**: Accounting/Localizations/EDI
- **License**: LGPL-3
- **Installable**: False
## Source
Based on [OCA/OCB](https://github.com/OCA/OCB) branch 16.0, addon `l10n_sa_edi_pos`.
- Repository: https://github.com/OCA/OCB
- Branch: 19.0
- Path: addons/l10n_sa_edi_pos
## License
This package maintains the original LGPL-3 license from the upstream Odoo project.
## Documentation
- Overview: doc/OVERVIEW.md
- Architecture: doc/ARCHITECTURE.md
- Models: doc/MODELS.md
- Controllers: doc/CONTROLLERS.md
- Wizards: doc/WIZARDS.md
- Reports: doc/REPORTS.md
- Security: doc/SECURITY.md
- Install: doc/INSTALL.md
- Usage: doc/USAGE.md
- Configuration: doc/CONFIGURATION.md
- Dependencies: doc/DEPENDENCIES.md
- Troubleshooting: doc/TROUBLESHOOTING.md
- FAQ: doc/FAQ.md
This package preserves the original LGPL-3 license.

View file

@ -1,3 +1 @@
# -*- coding: utf-8 -*-
from . import models

View file

@ -1,15 +1,14 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Saudi Arabia - E-invoicing (Simplified)',
'icon': '/l10n_sa/static/description/icon.png',
'version': '0.1',
'author': 'Odoo S.A.',
'countries': ['sa'],
'version': '0.2',
'depends': [
'l10n_sa_pos',
'l10n_sa_edi',
],
'author': 'Odoo S.A.',
'summary': """
ZATCA E-Invoicing, support for PoS
""",
@ -19,9 +18,11 @@ E-invoice implementation for Saudi Arabia; Integration with ZATCA (POS)
'category': 'Accounting/Localizations/EDI',
'license': 'LGPL-3',
'assets': {
'point_of_sale.assets': [
'l10n_sa_edi_pos/static/src/js/pos_models.js',
'l10n_sa_edi_pos/static/src/js/PaymentScreen.js',
'point_of_sale._assets_pos': [
'l10n_sa_edi_pos/static/src/**/*',
],
'web.assets_tests': [
'l10n_sa_edi_pos/static/tests/tours/**/*',
],
}
}

View file

@ -0,0 +1,134 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_sa_edi_pos
#
# Weblate <noreply-mt-weblate@weblate.org>, 2025.
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-12-30 19:09+0000\n"
"PO-Revision-Date: 2025-11-17 03:15+0000\n"
"Last-Translator: Weblate <noreply-mt-weblate@weblate.org>\n"
"Language-Team: Arabic <https://translate.odoo.com/projects/odoo-19-l10n/"
"l10n_sa_edi_pos/ar/>\n"
"Language: ar\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
"&& n%100<=10 ? 3 : n%100>=11 ? 4 : 5;\n"
"X-Generator: Weblate 5.12.2\n"
#. module: l10n_sa_edi_pos
#. odoo-javascript
#: code:addons/l10n_sa_edi_pos/static/src/app/utils/order_payment_validation.js:0
msgid "%s by going to Backend > Orders > Invoice"
msgstr "%s عن طريق الذهاب إلى الواجهة الخلفية > الطلبات > الفواتير"
#. module: l10n_sa_edi_pos
#. odoo-javascript
#: code:addons/l10n_sa_edi_pos/static/src/app/utils/order_payment_validation.js:0
msgid ""
". Upon Successful submission, you can reprint the Invoice and the Receipt."
msgstr ""
#. module: l10n_sa_edi_pos
#: model:ir.model,name:l10n_sa_edi_pos.model_res_company
msgid "Companies"
msgstr "الشركات"
#. module: l10n_sa_edi_pos
#: model:ir.model.fields,field_description:l10n_sa_edi_pos.field_account_edi_xml_ubl_21_zatca__display_name
#: model:ir.model.fields,field_description:l10n_sa_edi_pos.field_pos_config__display_name
#: model:ir.model.fields,field_description:l10n_sa_edi_pos.field_pos_order__display_name
#: model:ir.model.fields,field_description:l10n_sa_edi_pos.field_res_company__display_name
msgid "Display Name"
msgstr "اسم العرض"
#. module: l10n_sa_edi_pos
#: model:ir.model.fields,field_description:l10n_sa_edi_pos.field_pos_order__l10n_sa_invoice_edi_state
msgid "Electronic invoicing"
msgstr "الفوترة الإلكترونية "
#. module: l10n_sa_edi_pos
#. odoo-python
#: code:addons/l10n_sa_edi_pos/models/pos_config.py:0
msgid "Go to Journal configuration"
msgstr "الذهاب إلى تهيئة دفتر اليومية "
#. module: l10n_sa_edi_pos
#: model:ir.model.fields,field_description:l10n_sa_edi_pos.field_account_edi_xml_ubl_21_zatca__id
#: model:ir.model.fields,field_description:l10n_sa_edi_pos.field_pos_config__id
#: model:ir.model.fields,field_description:l10n_sa_edi_pos.field_pos_order__id
#: model:ir.model.fields,field_description:l10n_sa_edi_pos.field_res_company__id
msgid "ID"
msgstr "المُعرف"
#. module: l10n_sa_edi_pos
#: model:ir.model,name:l10n_sa_edi_pos.model_pos_config
msgid "Point of Sale Configuration"
msgstr "تهيئة نقطة البيع "
#. module: l10n_sa_edi_pos
#: model:ir.model,name:l10n_sa_edi_pos.model_pos_order
msgid "Point of Sale Orders"
msgstr "طلبات نقطة البيع "
#. module: l10n_sa_edi_pos
#. odoo-javascript
#: code:addons/l10n_sa_edi_pos/static/src/overrides/components/order_receipt/order_receipt.xml:0
msgid "THIS IS NOT A LEGAL DOCUMENT"
msgstr "هذا المستند ليس مستنداً قانونياً"
#. module: l10n_sa_edi_pos
#. odoo-javascript
#: code:addons/l10n_sa_edi_pos/static/src/app/utils/order_payment_validation.js:0
msgid ""
"The Receipt and Invoice generated here are not valid documents as there is "
msgstr ""
#. module: l10n_sa_edi_pos
#: model:ir.model.fields,help:l10n_sa_edi_pos.field_pos_order__l10n_sa_invoice_edi_state
msgid "The aggregated state of all the EDIs with web-service of this move"
msgstr ""
"تجميع كافة عمليات تبادل البيانات إلكترونياً (EDI) مع خدمة الويب لهذه الحركة "
#. module: l10n_sa_edi_pos
#. odoo-python
#: code:addons/l10n_sa_edi_pos/models/pos_config.py:0
msgid ""
"The invoice journal of the point of sale %s must be properly onboarded "
"according to ZATCA specifications.\n"
msgstr ""
"يجب أن تتم تهيئة دفتر يومية الفواتير الخاص بنقاط البيع %s بشكل صحيح وفقًا "
"لمواصفات ZATCA.\n"
#. module: l10n_sa_edi_pos
#: model:ir.model,name:l10n_sa_edi_pos.model_account_edi_xml_ubl_21_zatca
msgid "UBL 2.1 (ZATCA)"
msgstr "UBL 2.1 (ZATCA)"
#. module: l10n_sa_edi_pos
#: model:ir.model.fields,field_description:l10n_sa_edi_pos.field_pos_order__l10n_sa_invoice_qr_code_str
msgid "ZATCA QR Code"
msgstr "رمز QR الخاص بـ ZATCA "
#. module: l10n_sa_edi_pos
#. odoo-javascript
#: code:addons/l10n_sa_edi_pos/static/src/app/utils/order_payment_validation.js:0
msgid "ZATCA Validation Error"
msgstr "خطأ في التحقق من صحة ZATCA "
#. module: l10n_sa_edi_pos
#. odoo-javascript
#: code:addons/l10n_sa_edi_pos/static/src/app/utils/order_payment_validation.js:0
msgid ""
"an error in their processing. You need to resolve the errors first in %s"
msgstr ""
#. module: l10n_sa_edi_pos
#. odoo-javascript
#: code:addons/l10n_sa_edi_pos/static/src/overrides/components/order_receipt/order_receipt.xml:0
msgid "هذا المستند ليس مستنداً قانونياً"
msgstr ""

View file

@ -0,0 +1,126 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_sa_edi_pos
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 19.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-12-30 19:09+0000\n"
"PO-Revision-Date: 2025-12-30 19:09+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: l10n_sa_edi_pos
#. odoo-javascript
#: code:addons/l10n_sa_edi_pos/static/src/app/utils/order_payment_validation.js:0
msgid "%s by going to Backend > Orders > Invoice"
msgstr ""
#. module: l10n_sa_edi_pos
#. odoo-javascript
#: code:addons/l10n_sa_edi_pos/static/src/app/utils/order_payment_validation.js:0
msgid ""
". Upon Successful submission, you can reprint the Invoice and the Receipt."
msgstr ""
#. module: l10n_sa_edi_pos
#: model:ir.model,name:l10n_sa_edi_pos.model_res_company
msgid "Companies"
msgstr ""
#. module: l10n_sa_edi_pos
#: model:ir.model.fields,field_description:l10n_sa_edi_pos.field_account_edi_xml_ubl_21_zatca__display_name
#: model:ir.model.fields,field_description:l10n_sa_edi_pos.field_pos_config__display_name
#: model:ir.model.fields,field_description:l10n_sa_edi_pos.field_pos_order__display_name
#: model:ir.model.fields,field_description:l10n_sa_edi_pos.field_res_company__display_name
msgid "Display Name"
msgstr ""
#. module: l10n_sa_edi_pos
#: model:ir.model.fields,field_description:l10n_sa_edi_pos.field_pos_order__l10n_sa_invoice_edi_state
msgid "Electronic invoicing"
msgstr ""
#. module: l10n_sa_edi_pos
#. odoo-python
#: code:addons/l10n_sa_edi_pos/models/pos_config.py:0
msgid "Go to Journal configuration"
msgstr ""
#. module: l10n_sa_edi_pos
#: model:ir.model.fields,field_description:l10n_sa_edi_pos.field_account_edi_xml_ubl_21_zatca__id
#: model:ir.model.fields,field_description:l10n_sa_edi_pos.field_pos_config__id
#: model:ir.model.fields,field_description:l10n_sa_edi_pos.field_pos_order__id
#: model:ir.model.fields,field_description:l10n_sa_edi_pos.field_res_company__id
msgid "ID"
msgstr ""
#. module: l10n_sa_edi_pos
#: model:ir.model,name:l10n_sa_edi_pos.model_pos_config
msgid "Point of Sale Configuration"
msgstr ""
#. module: l10n_sa_edi_pos
#: model:ir.model,name:l10n_sa_edi_pos.model_pos_order
msgid "Point of Sale Orders"
msgstr ""
#. module: l10n_sa_edi_pos
#. odoo-javascript
#: code:addons/l10n_sa_edi_pos/static/src/overrides/components/order_receipt/order_receipt.xml:0
msgid "THIS IS NOT A LEGAL DOCUMENT"
msgstr ""
#. module: l10n_sa_edi_pos
#. odoo-javascript
#: code:addons/l10n_sa_edi_pos/static/src/app/utils/order_payment_validation.js:0
msgid ""
"The Receipt and Invoice generated here are not valid documents as there is "
msgstr ""
#. module: l10n_sa_edi_pos
#: model:ir.model.fields,help:l10n_sa_edi_pos.field_pos_order__l10n_sa_invoice_edi_state
msgid "The aggregated state of all the EDIs with web-service of this move"
msgstr ""
#. module: l10n_sa_edi_pos
#. odoo-python
#: code:addons/l10n_sa_edi_pos/models/pos_config.py:0
msgid ""
"The invoice journal of the point of sale %s must be properly onboarded "
"according to ZATCA specifications.\n"
msgstr ""
#. module: l10n_sa_edi_pos
#: model:ir.model,name:l10n_sa_edi_pos.model_account_edi_xml_ubl_21_zatca
msgid "UBL 2.1 (ZATCA)"
msgstr ""
#. module: l10n_sa_edi_pos
#: model:ir.model.fields,field_description:l10n_sa_edi_pos.field_pos_order__l10n_sa_invoice_qr_code_str
msgid "ZATCA QR Code"
msgstr ""
#. module: l10n_sa_edi_pos
#. odoo-javascript
#: code:addons/l10n_sa_edi_pos/static/src/app/utils/order_payment_validation.js:0
msgid "ZATCA Validation Error"
msgstr ""
#. module: l10n_sa_edi_pos
#. odoo-javascript
#: code:addons/l10n_sa_edi_pos/static/src/app/utils/order_payment_validation.js:0
msgid ""
"an error in their processing. You need to resolve the errors first in %s"
msgstr ""
#. module: l10n_sa_edi_pos
#. odoo-javascript
#: code:addons/l10n_sa_edi_pos/static/src/overrides/components/order_receipt/order_receipt.xml:0
msgid "هذا المستند ليس مستنداً قانونياً"
msgstr ""

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
from . import pos_config
from . import account_edi_xml_ubl_21_zatca
from . import account_move
from . import res_company
from . import pos_config
from . import pos_order

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from odoo import models
@ -10,6 +9,6 @@ class AccountEdiXmlUBL21Zatca(models.AbstractModel):
Return payment means code to be used to set the value on the XML file
"""
res = super()._l10n_sa_get_payment_means_code(invoice)
if invoice._l10n_sa_is_simplified() and invoice.sudo().pos_order_ids.payment_ids:
res = invoice.sudo().pos_order_ids.payment_ids[0].payment_method_id.type
if invoice._l10n_sa_is_simplified() and invoice.pos_order_ids.payment_ids:
res = invoice.pos_order_ids.payment_ids[0].payment_method_id.type
return res

View file

@ -1,8 +0,0 @@
from odoo import models
class AccountMove(models.Model):
_inherit = 'account.move'
def _l10n_sa_check_refund_reason(self):
return super()._l10n_sa_check_refund_reason() or (self.pos_order_ids and self.pos_order_ids[0].refunded_orders_count > 0 and self.ref)

View file

@ -1,16 +1,26 @@
from odoo import models, api, _
from odoo.exceptions import ValidationError
from odoo import models, _
from odoo.exceptions import RedirectWarning
class PosConfig(models.Model):
_inherit = 'pos.config'
@api.constrains('company_id', 'invoice_journal_id')
def _check_company_invoice_journal(self):
"""
Override to make sure POS invoice journal was probably onboarded before being used
"""
super()._check_company_invoice_journal()
def open_ui(self):
for config in self:
if config.company_id.country_id.code == 'SA' and config.invoice_journal_id and not config.invoice_journal_id._l10n_sa_ready_to_submit_einvoices():
raise ValidationError(_("The invoice journal of the point of sale %s must be properly onboarded according to ZATCA specifications.", config.name))
if (
config.company_id.country_id.code == 'SA'
and config.invoice_journal_id
and (config.invoice_journal_id.edi_format_ids.filtered(lambda f: f.code == "sa_zatca")
and not config.invoice_journal_id._l10n_sa_ready_to_submit_einvoices())
):
msg = _("The invoice journal of the point of sale %s must be properly onboarded "
"according to ZATCA specifications.\n", config.name)
action = {
"view_mode": "form",
"res_model": "account.journal",
"type": "ir.actions.act_window",
"res_id": config.invoice_journal_id.id,
"views": [[False, "form"]],
}
raise RedirectWarning(msg, action, _('Go to Journal configuration'))
return super().open_ui()

View file

@ -0,0 +1,8 @@
from odoo import fields, models
class PosOrder(models.Model):
_inherit = "pos.order"
l10n_sa_invoice_qr_code_str = fields.Char(related="account_move.l10n_sa_qr_code_str", string="ZATCA QR Code")
l10n_sa_invoice_edi_state = fields.Selection(related="account_move.edi_state", string="Electronic invoicing")

View file

@ -0,0 +1,14 @@
from odoo import models
class ResCompany(models.Model):
_inherit = 'res.company'
def _load_pos_data_fields(self, config_id):
return [
*super()._load_pos_data_fields(config_id),
'l10n_sa_edi_building_number',
'l10n_sa_edi_plot_identification',
'l10n_sa_edi_additional_identification_scheme',
'l10n_sa_edi_additional_identification_number',
]

View file

@ -0,0 +1,47 @@
import { _t } from "@web/core/l10n/translation";
import { ConfirmationDialog } from "@web/core/confirmation_dialog/confirmation_dialog";
import OrderPaymentValidation from "@point_of_sale/app/utils/order_payment_validation";
import { markup } from "@odoo/owl";
import { patch } from "@web/core/utils/patch";
patch(OrderPaymentValidation.prototype, {
setup(vals) {
super.setup(...arguments);
this.dialog = this.pos.env.services.dialog;
},
async finalizeValidation() {
const potentialValidationError = await super.finalizeValidation(...arguments);
// note: isSACompany guarantees order.is_to_invoice()
// expect for cases like deposit and settlement
// Skip if invoice is not mandatory(Ex: settlement)
// Skips entirely if journal is not onboarded or electronic invoicing is not selected
if (
this.order.isInvoiceMandatoryForSA() &&
this.order.finalized &&
!this.order.l10n_sa_invoice_qr_code_str
) {
const orderError = _t(
"%s by going to Backend > Orders > Invoice",
this.order.pos_reference
);
const href = `/odoo/customer-invoices/${this.order?.raw?.account_move}`;
const link = markup`<a target="_blank" href=${href} class="text-info fw-bolder">${_t(
"Invoice"
)}</a>`;
const errorInfo = this.order.raw.account_move ? link : orderError;
const message = _t(
`The Receipt and Invoice generated here are not valid documents as there is ` +
`an error in their processing. You need to resolve the errors first in %s` +
`. Upon Successful submission, you can reprint the Invoice and the Receipt.`,
errorInfo
);
this.dialog.add(ConfirmationDialog, {
title: _t("ZATCA Validation Error"),
body: message,
});
}
return potentialValidationError;
},
});

View file

@ -1,20 +0,0 @@
odoo.define('l10n_sa_edi_pos.PaymentScreen', function(require) {
"use strict";
const PaymentScreen = require('point_of_sale.PaymentScreen');
const Registries = require('point_of_sale.Registries');
const PosSAPaymentScreen = PaymentScreen => class extends PaymentScreen {
//@Override
toggleIsToInvoice() {
// If the company is Saudi, POS orders should always be Invoiced
if (this.currentOrder.pos.company.country && this.currentOrder.pos.company.country.code === 'SA') return false
return super.toggleIsToInvoice(...arguments);
}
};
Registries.Component.extend(PaymentScreen, PosSAPaymentScreen);
return PosSAPaymentScreen;
})

View file

@ -1,17 +0,0 @@
odoo.define("l10n_sa_edi_pos.models", function (require) {
"use strict";
const { Order } = require('point_of_sale.models');
const Registries = require('point_of_sale.Registries');
const L10nSAPosOrder = (Order) => class L10nSAPosOrder extends Order {
constructor() {
super(...arguments);
if (this.pos.company.country && this.pos.company.country.code === 'SA') {
this.set_to_invoice(true);
}
}
}
Registries.Model.extend(Order, L10nSAPosOrder);
});

View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-inherit="point_of_sale.ReceiptHeader" t-name="l10n_sa_edi_pos.ReceiptHeader" t-inherit-mode="extension">
<xpath expr="//img[hasclass('pos-receipt-qrcode')]" position="after">
<div t-if="order.notLegal and order.isSACompany() and !order.isSettlement()" class="text-center mt-3">
<p>THIS IS NOT A LEGAL DOCUMENT</p>
<p t-if="order.config_id.l10n_gcc_dual_language_receipt">هذا المستند ليس مستنداً قانونياً</p>
</div>
</xpath>
</t>
<t t-inherit="point_of_sale.OrderReceipt" t-inherit-mode="extension">
<xpath expr="//div[@name='custom_address_block']/t[@t-if='company.country_id']" position="before">
<t t-if="company.l10n_sa_edi_building_number" t-out="company.l10n_sa_edi_building_number"/>
<t t-if="company.l10n_sa_edi_plot_identification" t-out="', ' + company.l10n_sa_edi_plot_identification"/>
<t t-if="company.l10n_sa_edi_building_number or company.l10n_sa_edi_plot_identification"><br/></t>
</xpath>
<xpath expr="//div[@t-out='vatText']" position="after">
<div t-if="company.l10n_sa_edi_additional_identification_number">
<t t-if="company.l10n_sa_edi_additional_identification_scheme" t-out="company.l10n_sa_edi_additional_identification_scheme + ': '"/>
<t t-out="company.l10n_sa_edi_additional_identification_number"/>
</div>
</xpath>
</t>
</templates>

View file

@ -0,0 +1,57 @@
/** @odoo-module */
import { PosOrder } from "@point_of_sale/app/models/pos_order";
import { patch } from "@web/core/utils/patch";
import { qrCodeSrc } from "@point_of_sale/utils";
patch(PosOrder.prototype, {
setup() {
super.setup(...arguments);
if (this.isInvoiceMandatoryForSA()) {
this.to_invoice = true;
}
},
isInvoiceMandatoryForSA() {
// Zatca enforces invoice, but for settlement due, invoices are not needed
// Only applicable if enterprise:pos_settle_due module is installed
return this.isSACompany() && !this.is_settling_account;
},
isToInvoice() {
if (this.isInvoiceMandatoryForSA()) {
return true;
}
return super.isToInvoice(...arguments);
},
setToInvoice(to_invoice) {
if (this.isInvoiceMandatoryForSA()) {
this.assertEditable();
this.to_invoice = true;
} else {
super.setToInvoice(...arguments);
}
},
setPartner(partner) {
/*
The settlement dialog sets is_settling_account = true after creating the order
So making it default to false here as this is called after is_settling_account is set
is_settling_account is only applicable if enterprise:pos_settle_due module is installed
*/
super.setPartner(partner);
if (this.is_settling_account) {
this.setToInvoice(false);
}
},
get notLegal() {
return !this.l10n_sa_invoice_qr_code_str;
},
generateQrcode() {
if (!this.notLegal && this.isSACompany()) {
return qrCodeSrc(this.l10n_sa_invoice_qr_code_str);
}
return false;
},
});

View file

@ -0,0 +1,47 @@
/* global posmodel */
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 Chrome from "@point_of_sale/../tests/pos/tours/utils/chrome_util";
import { registry } from "@web/core/registry";
registry.category("web_tour.tours").add("ZATCA_invoice_not_mandatory_if_settlement", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
{
content: "Set the pos_settle_due to True and open payment screen",
trigger: "body",
run: () => {
posmodel.selectedOrder.is_settling_account = true;
posmodel.navigate("PaymentScreen", { orderUuid: posmodel.selectedOrderUuid });
},
},
PaymentScreen.clickPartnerButton(),
PaymentScreen.clickCustomer("AAA Partner"),
PaymentScreen.isInvoiceButtonUnchecked(),
].flat(),
});
registry.category("web_tour.tours").add("ZATCA_invoice_mandatory_if_not_settlement", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
{
content: "Set the pos_settle_due to False and open payment screen",
trigger: "body",
run: () => {
posmodel.selectedOrder.is_settling_account = false;
posmodel.navigate("PaymentScreen", { orderUuid: posmodel.selectedOrderUuid });
},
},
PaymentScreen.clickPartnerButton(),
PaymentScreen.clickCustomer("AAA Partner"),
PaymentScreen.isInvoiceButtonChecked(),
// Try to uncheck it and verify it remains checked
PaymentScreen.clickInvoiceButton(),
PaymentScreen.isInvoiceButtonChecked(),
].flat(),
});

View file

@ -0,0 +1,3 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import test_sa_edi_pos

View file

@ -0,0 +1,72 @@
from unittest.mock import patch
from odoo.tests import tagged
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
from odoo.addons.l10n_sa_edi.tests.common import AccountEdiTestCommon
from odoo.addons.point_of_sale.tests.test_frontend import TestPointOfSaleHttpCommon
from odoo.addons.point_of_sale.tests.test_generic_localization import (
TestGenericLocalization,
)
@tagged('post_install', '-at_install', 'post_install_l10n')
class TestGenericSAEdi(TestGenericLocalization):
@classmethod
@AccountEdiTestCommon.setup_edi_format('l10n_sa_edi.edi_sa_zatca')
@AccountTestInvoicingCommon.setup_country('sa')
def setUpClass(cls):
super().setUpClass()
cls.main_pos_config.journal_id._l10n_sa_load_edi_demo_data()
cls.company.write({
'name': 'Generic SA EDI',
'email': 'info@company.saexample.com',
'phone': '+966 51 234 5678',
'street2': 'Testomania',
'vat': '311111111111113',
'state_id': cls.env['res.country.state'].create({
'name': 'Riyadh',
'code': 'RYA',
'country_id': cls.company.country_id.id
}),
'street': 'Al Amir Mohammed Bin Abdul Aziz Street',
'city': 'المدينة المنورة',
'zip': '42317',
'l10n_sa_edi_building_number': '1234',
})
@tagged('post_install_l10n', 'post_install', '-at_install')
class TestUi(TestPointOfSaleHttpCommon):
@classmethod
@AccountEdiTestCommon.setup_country('sa')
def setUpClass(cls):
super().setUpClass()
@patch('odoo.addons.l10n_sa_edi.models.account_journal.AccountJournal._l10n_sa_ready_to_submit_einvoices',
new=lambda self: True)
def test_ZATCA_invoice_not_mandatory_if_settlement(self):
"""
Tests that the invoice is not mandatory in POS payment for ZATCA if it's a settlement.
"""
self.test_partner = self.env["res.partner"].create({"name": "AAA Partner"})
self.start_tour(
"/pos/ui?config_id=%d" % self.main_pos_config.id,
'ZATCA_invoice_not_mandatory_if_settlement',
login="pos_admin",
)
@patch('odoo.addons.l10n_sa_edi.models.account_journal.AccountJournal._l10n_sa_ready_to_submit_einvoices',
new=lambda self: True)
def test_ZATCA_invoice_mandatory_if_not_settlement(self):
"""
Tests that the invoice is mandatory in POS payment for ZATCA.
Also is by default checked.
"""
self.test_partner = self.env["res.partner"].create({"name": "AAA Partner"})
self.start_tour(
"/pos/ui?config_id=%d" % self.main_pos_config.id,
'ZATCA_invoice_mandatory_if_not_settlement',
login="pos_admin",
)

View file

@ -2,14 +2,16 @@
name = "odoo-bringout-oca-ocb-l10n_sa_edi_pos"
version = "16.0.0"
description = "Saudi Arabia - E-invoicing (Simplified) -
ZATCA E-Invoicing, support for PoS
"
"
authors = [
{ name = "Ernad Husremovic", email = "hernad@bring.out.ba" }
]
dependencies = [
"odoo-bringout-oca-ocb-l10n_sa_pos>=16.0.0",
"odoo-bringout-oca-ocb-l10n_sa_edi>=16.0.0",
"odoo-bringout-oca-ocb-l10n_sa_pos>=19.0.0",
"odoo-bringout-oca-ocb-l10n_sa_edi>=19.0.0",
"requests>=2.25.1"
]
readme = "README.md"
@ -19,7 +21,7 @@ classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Office/Business",
]