Initial commit: L10N_Europe packages

This commit is contained in:
Ernad Husremovic 2025-08-29 15:20:52 +02:00
commit 9803722600
2377 changed files with 380711 additions and 0 deletions

View file

@ -0,0 +1,45 @@
# l10n_be_pos_sale
Odoo addon: l10n_be_pos_sale
## Installation
```bash
pip install odoo-bringout-oca-ocb-l10n_be_pos_sale
```
## Dependencies
This addon depends on:
- pos_sale
- l10n_be
## Manifest Information
- **Name**: l10n_be_pos_sale
- **Version**: 1.0
- **Category**: Hidden
- **License**: LGPL-3
- **Installable**: False
## Source
Based on [OCA/OCB](https://github.com/OCA/OCB) branch 16.0, addon `l10n_be_pos_sale`.
## 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
- Install: doc/INSTALL.md
- Usage: doc/USAGE.md
- Configuration: doc/CONFIGURATION.md
- Dependencies: doc/DEPENDENCIES.md
- Troubleshooting: doc/TROUBLESHOOTING.md
- FAQ: doc/FAQ.md

View 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_be_pos_sale Module - l10n_be_pos_sale
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.

View file

@ -0,0 +1,3 @@
# Configuration
Refer to Odoo settings for l10n_be_pos_sale. Configure related models, access rights, and options as needed.

View file

@ -0,0 +1,3 @@
# Controllers
This module does not define custom HTTP controllers.

View file

@ -0,0 +1,6 @@
# Dependencies
This addon depends on:
- [pos_sale](../../odoo-bringout-oca-ocb-pos_sale)
- [l10n_be](../../odoo-bringout-oca-ocb-l10n_be)

View 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_be_pos_sale or install in UI.

View file

@ -0,0 +1,7 @@
# Install
```bash
pip install odoo-bringout-oca-ocb-l10n_be_pos_sale"
# or
uv pip install odoo-bringout-oca-ocb-l10n_be_pos_sale"
```

View file

@ -0,0 +1,12 @@
# Models
Detected core models and extensions in l10n_be_pos_sale.
```mermaid
classDiagram
class pos_session
```
Notes
- Classes show model technical names; fields omitted for brevity.
- Items listed under _inherit are extensions of existing models.

View file

@ -0,0 +1,6 @@
# Overview
Packaged Odoo addon: l10n_be_pos_sale. Provides features documented in upstream Odoo 16 under this addon.
- Source: OCA/OCB 16.0, addon l10n_be_pos_sale
- License: LGPL-3

View file

@ -0,0 +1,3 @@
# Reports
This module does not define custom reports.

View 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

View file

@ -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.

View 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_be_pos_sale
```

View file

@ -0,0 +1,3 @@
# Wizards
This module does not include UI wizards.

View file

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

View file

@ -0,0 +1,21 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'l10n_be_pos_sale',
'version': '1.0',
'category': 'Hidden',
'sequence': 6,
'summary': 'Link module between pos_sale and l10n_be',
'depends': ['pos_sale', 'l10n_be'],
'auto_install': True,
'assets': {
'point_of_sale.assets': [
'l10n_be_pos_sale/static/src/js/**/*',
],
'web.assets_tests': [
'l10n_be_pos_sale/static/tests/**/*',
],
},
'license': 'LGPL-3',
}

View file

@ -0,0 +1,33 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_be_pos_sale
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-10-30 09:20+0000\n"
"PO-Revision-Date: 2023-10-30 09:20+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_be_pos_sale
#. odoo-javascript
#: code:addons/l10n_be_pos_sale/static/src/js/PaymentScreen.js:0
#, python-format
msgid ""
"If you do not invoice imported orders containing intra-community taxes you "
"will encounter issues in your accounting. Especially in the EC Sales List "
"report"
msgstr ""
#. module: l10n_be_pos_sale
#. odoo-javascript
#: code:addons/l10n_be_pos_sale/static/src/js/PaymentScreen.js:0
#, python-format
msgid "This order needs to be invoiced"
msgstr ""

View file

@ -0,0 +1 @@
from . import pos_session

View file

@ -0,0 +1,13 @@
from odoo import models
class PosSession(models.Model):
_inherit = 'pos.session'
def _pos_data_process(self, loaded_data):
res = super()._pos_data_process(loaded_data)
if self.company_id.country_code == 'BE':
intracom_fpos = self.env.ref(f"l10n_be.{self.env.company.id}_fiscal_position_template_3", False)
if intracom_fpos:
loaded_data['intracom_tax_ids'] = intracom_fpos.tax_ids.tax_dest_id.ids
return res

View file

@ -0,0 +1,31 @@
/** @odoo-module **/
import PaymentScreen from 'point_of_sale.PaymentScreen';
import Registries from 'point_of_sale.Registries';
export const PoSSaleBePaymentScreen = (PaymentScreen) =>
class extends PaymentScreen {
toggleIsToInvoice() {
const orderLines = this.currentOrder.get_orderlines();
const has_origin_order = orderLines.some((line) => line.sale_order_origin_id);
const has_intracom_taxes = orderLines.some((line) =>
line.tax_ids && this.env.pos.intracom_tax_ids && line.tax_ids.some((tax) => this.env.pos.intracom_tax_ids.includes(tax))
);
if (
this.currentOrder.is_to_invoice() &&
this.env.pos.company.country.code === "BE" &&
has_origin_order &&
has_intracom_taxes
) {
this.showPopup('ErrorPopup', {
title: this.env._t('This order needs to be invoiced'),
body: this.env._t('If you do not invoice imported orders containing intra-community taxes you will encounter issues in your accounting. Especially in the EC Sales List report'),
});
}
else{
super.toggleIsToInvoice();
}
}
};
Registries.Component.extend(PaymentScreen, PoSSaleBePaymentScreen);

View file

@ -0,0 +1,29 @@
/** @odoo-module **/
import ProductScreen from 'point_of_sale.ProductScreen';
import Registries from 'point_of_sale.Registries';
export const PoSSaleBeProductScreen = (ProductScreen) =>
class extends ProductScreen {
async _onClickPay() {
const orderLines = this.currentOrder.get_orderlines();
const has_origin_order = orderLines.some(line => line.sale_order_origin_id);
const has_intracom_taxes = orderLines.some(
(line) =>
line.tax_ids &&
this.env.pos.intracom_tax_ids &&
line.tax_ids.some((tax) => this.env.pos.intracom_tax_ids.includes(tax))
);
if (
this.env.pos.company.country &&
this.env.pos.company.country.code === "BE" &&
has_origin_order &&
has_intracom_taxes
) {
this.currentOrder.to_invoice = true;
}
return super._onClickPay(...arguments);
}
};
Registries.Component.extend(ProductScreen, PoSSaleBeProductScreen);

View file

@ -0,0 +1,17 @@
odoo.define("l10n_be_pos_sale.models", function (require) {
"use strict";
var { PosGlobalState } = require("point_of_sale.models");
const Registries = require("point_of_sale.Registries");
const PoSSaleBeGlobalState = (PosGlobalState) =>
class PoSSaleBeGlobalState extends PosGlobalState {
async _processData(loadedData) {
await super._processData(...arguments);
if (this.company.country && this.company.country.code == "BE") {
this.intracom_tax_ids = loadedData["intracom_tax_ids"];
}
}
};
Registries.Model.extend(PosGlobalState, PoSSaleBeGlobalState);
});

View file

@ -0,0 +1,35 @@
odoo.define('l10n_be_pos_sale.tour', function (require) {
'use strict';
const { ErrorPopup } = require('point_of_sale.tour.ErrorPopupTourMethods');
const { PaymentScreen } = require('point_of_sale.tour.PaymentScreenTourMethods');
const { ProductScreen } = require('pos_sale.tour.ProductScreenTourMethods');
const { ReceiptScreen } = require('pos_sale.tour.ReceiptScreenTourMethods');
const { getSteps, startSteps } = require('point_of_sale.tour.utils');
const Tour = require('web_tour.tour');
// signal to start generating steps
// when finished, steps can be taken from getSteps
startSteps();
ProductScreen.do.confirmOpeningPopup();
ProductScreen.do.clickQuotationButton();
ProductScreen.do.selectNthOrder(2);
ProductScreen.do.clickPayButton();
PaymentScreen.check.isInvoiceButtonChecked();
PaymentScreen.do.clickInvoiceButton();
PaymentScreen.check.isInvoiceButtonChecked();
ErrorPopup.do.clickConfirm();
PaymentScreen.do.clickPaymentMethod("Cash");
PaymentScreen.do.clickValidate();
ReceiptScreen.do.clickNextOrder();
ProductScreen.do.clickQuotationButton();
ProductScreen.do.selectFirstOrder();
ProductScreen.do.clickPayButton();
PaymentScreen.check.isInvoiceButtonNotChecked();
PaymentScreen.do.clickInvoiceButton();
PaymentScreen.check.isInvoiceButtonChecked();
Tour.register('PosSettleOrderIsInvoice', { test: true, url: '/pos/ui' }, getSteps());
});

View file

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

View file

@ -0,0 +1,74 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import odoo
from odoo.addons.point_of_sale.tests.test_frontend import TestPointOfSaleHttpCommon
from odoo.addons.l10n_be_pos_sale.models.pos_session import PosSession
from odoo import Command
@odoo.tests.tagged('post_install_l10n', 'post_install', '-at_install')
class TestPoSSaleL10NBe(TestPointOfSaleHttpCommon):
@classmethod
def setUpClass(cls, chart_template_ref='l10n_be.l10nbe_chart_template'):
super().setUpClass(chart_template_ref=chart_template_ref)
def test_settle_order_is_invoice(self):
intracom_fpos = self.env.ref(f"l10n_be.{self.env.company.id}_fiscal_position_template_3", False)
intracom_tax = self.env['account.tax'].create({
'name': 'test_intracom_taxes_computation_0_1',
'amount_type': 'percent',
'amount': 21,
'invoice_repartition_line_ids': [
(0, 0, {'repartition_type': 'base', 'factor_percent': 100.0}),
(0, 0, {'repartition_type': 'tax', 'factor_percent': 100.0}),
(0, 0, {'repartition_type': 'tax', 'factor_percent': -100.0}),
],
'refund_repartition_line_ids': [
(0, 0, {'repartition_type': 'base', 'factor_percent': 100.0}),
(0, 0, {'repartition_type': 'tax', 'factor_percent': 100.0}),
(0, 0, {'repartition_type': 'tax', 'factor_percent': -100.0}),
],
})
intracom_fpos.tax_ids.tax_dest_id = intracom_tax
#Change company country to Belgium
self.env.user.company_id.country_id = self.env.ref('base.be')
self.product_a = self.env['product.product'].create({
'name': 'Product A',
'type': 'product',
'list_price': 10,
'taxes_id': False,
'available_in_pos': True,
})
sale_order = self.env['sale.order'].create({
'partner_id': self.partner_a.id,
'order_line': [Command.create({
'product_id': self.product_a.id,
'product_uom_qty': 10,
'product_uom': self.product_a.uom_id.id,
'price_unit': 10,
'tax_id': intracom_tax,
})],
})
sale_order.action_confirm()
sale_order2 = self.env['sale.order'].create({
'partner_id': self.partner_a.id,
'order_line': [Command.create({
'product_id': self.product_a.id,
'product_uom_qty': 20,
'product_uom': self.product_a.uom_id.id,
'price_unit': 20,
'tax_id': False,
})],
})
sale_order2.action_confirm()
self.main_pos_config.open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'PosSettleOrderIsInvoice', login="accountman")

View file

@ -0,0 +1,43 @@
[project]
name = "odoo-bringout-oca-ocb-l10n_be_pos_sale"
version = "16.0.0"
description = "l10n_be_pos_sale - Link module between pos_sale and l10n_be"
authors = [
{ name = "Ernad Husremovic", email = "hernad@bring.out.ba" }
]
dependencies = [
"odoo-bringout-oca-ocb-pos_sale>=16.0.0",
"odoo-bringout-oca-ocb-l10n_be>=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_be_pos_sale"]
[tool.rye]
managed = true
dev-dependencies = [
"pytest>=8.4.1",
]