mirror of
https://github.com/bringout/oca-ocb-l10n_me-africa.git
synced 2026-04-27 11:02:04 +02:00
Initial commit: L10N_Me Africa packages
This commit is contained in:
commit
c265268138
611 changed files with 75334 additions and 0 deletions
49
odoo-bringout-oca-ocb-l10n_sa_edi_pos/README.md
Normal file
49
odoo-bringout-oca-ocb-l10n_sa_edi_pos/README.md
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
# Saudi Arabia - E-invoicing (Simplified)
|
||||
|
||||
|
||||
E-invoice implementation for Saudi Arabia; Integration with ZATCA (POS)
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
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`.
|
||||
|
||||
## 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
|
||||
32
odoo-bringout-oca-ocb-l10n_sa_edi_pos/doc/ARCHITECTURE.md
Normal file
32
odoo-bringout-oca-ocb-l10n_sa_edi_pos/doc/ARCHITECTURE.md
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# Architecture
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
U[Users] -->|HTTP| V[Views and QWeb Templates]
|
||||
V --> C[Controllers]
|
||||
V --> W[Wizards – Transient Models]
|
||||
C --> M[Models and ORM]
|
||||
W --> M
|
||||
M --> R[Reports]
|
||||
DX[Data XML] --> M
|
||||
S[Security – ACLs and Groups] -. enforces .-> M
|
||||
|
||||
subgraph L10n_sa_edi_pos Module - l10n_sa_edi_pos
|
||||
direction LR
|
||||
M:::layer
|
||||
W:::layer
|
||||
C:::layer
|
||||
V:::layer
|
||||
R:::layer
|
||||
S:::layer
|
||||
DX:::layer
|
||||
end
|
||||
|
||||
classDef layer fill:#eef8ff,stroke:#6ea8fe,stroke-width:1px
|
||||
```
|
||||
|
||||
Notes
|
||||
- Views include tree/form/kanban templates and report templates.
|
||||
- Controllers provide website/portal routes when present.
|
||||
- Wizards are UI flows implemented with `models.TransientModel`.
|
||||
- Data XML loads data/demo records; Security defines groups and access.
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# Configuration
|
||||
|
||||
Refer to Odoo settings for l10n_sa_edi_pos. Configure related models, access rights, and options as needed.
|
||||
3
odoo-bringout-oca-ocb-l10n_sa_edi_pos/doc/CONTROLLERS.md
Normal file
3
odoo-bringout-oca-ocb-l10n_sa_edi_pos/doc/CONTROLLERS.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Controllers
|
||||
|
||||
This module does not define custom HTTP controllers.
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
# Dependencies
|
||||
|
||||
This addon depends on:
|
||||
|
||||
- [l10n_sa_pos](../../odoo-bringout-oca-ocb-l10n_sa_pos)
|
||||
- [l10n_sa_edi](../../odoo-bringout-oca-ocb-l10n_sa_edi)
|
||||
4
odoo-bringout-oca-ocb-l10n_sa_edi_pos/doc/FAQ.md
Normal file
4
odoo-bringout-oca-ocb-l10n_sa_edi_pos/doc/FAQ.md
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# FAQ
|
||||
|
||||
- Q: Which Odoo version? A: 16.0 (OCA/OCB packaged).
|
||||
- Q: How to enable? A: Start server with --addon l10n_sa_edi_pos or install in UI.
|
||||
7
odoo-bringout-oca-ocb-l10n_sa_edi_pos/doc/INSTALL.md
Normal file
7
odoo-bringout-oca-ocb-l10n_sa_edi_pos/doc/INSTALL.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# Install
|
||||
|
||||
```bash
|
||||
pip install odoo-bringout-oca-ocb-l10n_sa_edi_pos"
|
||||
# or
|
||||
uv pip install odoo-bringout-oca-ocb-l10n_sa_edi_pos"
|
||||
```
|
||||
14
odoo-bringout-oca-ocb-l10n_sa_edi_pos/doc/MODELS.md
Normal file
14
odoo-bringout-oca-ocb-l10n_sa_edi_pos/doc/MODELS.md
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# Models
|
||||
|
||||
Detected core models and extensions in l10n_sa_edi_pos.
|
||||
|
||||
```mermaid
|
||||
classDiagram
|
||||
class account_edi_xml_ubl_21_zatca
|
||||
class account_move
|
||||
class pos_config
|
||||
```
|
||||
|
||||
Notes
|
||||
- Classes show model technical names; fields omitted for brevity.
|
||||
- Items listed under _inherit are extensions of existing models.
|
||||
6
odoo-bringout-oca-ocb-l10n_sa_edi_pos/doc/OVERVIEW.md
Normal file
6
odoo-bringout-oca-ocb-l10n_sa_edi_pos/doc/OVERVIEW.md
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# Overview
|
||||
|
||||
Packaged Odoo addon: l10n_sa_edi_pos. Provides features documented in upstream Odoo 16 under this addon.
|
||||
|
||||
- Source: OCA/OCB 16.0, addon l10n_sa_edi_pos
|
||||
- License: LGPL-3
|
||||
3
odoo-bringout-oca-ocb-l10n_sa_edi_pos/doc/REPORTS.md
Normal file
3
odoo-bringout-oca-ocb-l10n_sa_edi_pos/doc/REPORTS.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Reports
|
||||
|
||||
This module does not define custom reports.
|
||||
8
odoo-bringout-oca-ocb-l10n_sa_edi_pos/doc/SECURITY.md
Normal file
8
odoo-bringout-oca-ocb-l10n_sa_edi_pos/doc/SECURITY.md
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# Security
|
||||
|
||||
This module does not define custom security rules or access controls beyond Odoo defaults.
|
||||
|
||||
Default Odoo security applies:
|
||||
- Base user access through standard groups
|
||||
- Model access inherited from dependencies
|
||||
- No custom row-level security rules
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
# Troubleshooting
|
||||
|
||||
- Ensure Python and Odoo environment matches repo guidance.
|
||||
- Check database connectivity and logs if startup fails.
|
||||
- Validate that dependent addons listed in DEPENDENCIES.md are installed.
|
||||
7
odoo-bringout-oca-ocb-l10n_sa_edi_pos/doc/USAGE.md
Normal file
7
odoo-bringout-oca-ocb-l10n_sa_edi_pos/doc/USAGE.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# Usage
|
||||
|
||||
Start Odoo including this addon (from repo root):
|
||||
|
||||
```bash
|
||||
python3 scripts/nix_odoo_web_server.py --db-name mydb --addon l10n_sa_edi_pos
|
||||
```
|
||||
3
odoo-bringout-oca-ocb-l10n_sa_edi_pos/doc/WIZARDS.md
Normal file
3
odoo-bringout-oca-ocb-l10n_sa_edi_pos/doc/WIZARDS.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Wizards
|
||||
|
||||
This module does not include UI wizards.
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import models
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
# -*- 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',
|
||||
'depends': [
|
||||
'l10n_sa_pos',
|
||||
'l10n_sa_edi',
|
||||
],
|
||||
'author': 'Odoo S.A.',
|
||||
'summary': """
|
||||
ZATCA E-Invoicing, support for PoS
|
||||
""",
|
||||
'description': """
|
||||
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',
|
||||
],
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from . import pos_config
|
||||
from . import account_edi_xml_ubl_21_zatca
|
||||
from . import account_move
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from odoo import models
|
||||
|
||||
|
||||
class AccountEdiXmlUBL21Zatca(models.AbstractModel):
|
||||
_inherit = "account.edi.xml.ubl_21.zatca"
|
||||
|
||||
def _l10n_sa_get_payment_means_code(self, invoice):
|
||||
"""
|
||||
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
|
||||
return res
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
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)
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
from odoo import models, api, _
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
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()
|
||||
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))
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
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;
|
||||
})
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
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);
|
||||
});
|
||||
45
odoo-bringout-oca-ocb-l10n_sa_edi_pos/pyproject.toml
Normal file
45
odoo-bringout-oca-ocb-l10n_sa_edi_pos/pyproject.toml
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
[project]
|
||||
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",
|
||||
"requests>=2.25.1"
|
||||
]
|
||||
readme = "README.md"
|
||||
requires-python = ">= 3.11"
|
||||
classifiers = [
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"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.12",
|
||||
"Topic :: Office/Business",
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
homepage = "https://github.com/bringout/0"
|
||||
repository = "https://github.com/bringout/0"
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[tool.hatch.metadata]
|
||||
allow-direct-references = true
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["l10n_sa_edi_pos"]
|
||||
|
||||
[tool.rye]
|
||||
managed = true
|
||||
dev-dependencies = [
|
||||
"pytest>=8.4.1",
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue