Skip to content

Commit

Permalink
Merge PR #2615 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Jun 6, 2023
2 parents 5b36240 + bb5ee01 commit 5928e95
Show file tree
Hide file tree
Showing 31 changed files with 2,259 additions and 0 deletions.
144 changes: 144 additions & 0 deletions l10n_es_pos/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
=================================================
Punto de venta adaptado a la legislación española
=================================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--spain-lightgray.png?logo=github
:target: https://github.com/OCA/l10n-spain/tree/15.0/l10n_es_pos
:alt: OCA/l10n-spain
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/l10n-spain-15-0/l10n-spain-15-0-l10n_es_pos
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/189/15.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

* Adapta el terminal punto de venta a la legislación Española (no se permite la
emisión de tiquets, todo deben ser facturas o facturas simplificadas con
numeración)
* Adapta el ticket de venta a la factura simplificada, añadiendo una secuencia
correlativa y el NIF del emisor.
* Incluye los datos del cliente (nombre, NIF y dirección) si hay uno asignado.
* Chequea que no se realice una factura simplificada con valor
superior a 3.000 euros (la cantidad es configurable por TPV).

**Table of contents**

.. contents::
:local:

Installation
============

Antes de instalar el módulo, podemos definir el relleno y el prefijo automático
en *Configuración > Parámetros del sistema*:

- `l10n_es_pos.simplified_invoice_sequence.padding` (o 4 cifras por defecto)
- `l10n_es_pos.simplified_invoice_sequence.prefix` (nombre del TPV más este
valor)

Al instalarse el módulo, se define una secuencia para factura simplificada por
cada TPV existente.

Configuration
=============

Para activar la factura simplificada en un TPV, iremos a
*Punto de Venta > Configuración > Punto de Venta* y escogeremos uno de la
lista. En la sección *Facturación y recibos* activaremos la opción
*Secuencia de Factura Simplificada*. Podemos configurar el límite a partir del
cual no se considera factura simplificada, que por defecto es 3.000,00 €.

Si entramos en la configuración del TPV en modo debug, podremos también
configurar la sequencia asociada al TPV.

`Ver enlace de la AEAT <https://www.agenciatributaria.es/AEAT.internet/Inicio/_Segmentos_/Empresas_y_profesionales/Empresas/IVA/Obligaciones_de_facturacion/Tipos_de_factura.shtml>`_

Known issues / Roadmap
======================

* No se comprueba el límite en operaciones separadas para un mismo cliente, algo
que Hacienda proscribe.
* El soporte para usuarios concurrentes sobre una misma sesión es limitado y solo es
fiable si ambos puestos están online. En el caso de que cualquiera de ellos estuviese
offline, se correría el riesgo de solapar la secuencia de factura simplificada. Se
recomienda que en estos casos se añada mejor una configuración de punto de venta
adicional.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-spain/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/l10n-spain/issues/new?body=module:%20l10n_es_pos%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Tecnativa
* Aselcis Consulting
* Acysos S.L.

Contributors
~~~~~~~~~~~~

* `Antiun <https://www.antiun.com>`_:

* Endika Iglesias <[email protected]>

* `Aselcis <https://www.aselcis.com>`_:

* David Gómez <[email protected]>
* Miguel Paraíso <[email protected]>

* `Acysos <https://www.acysos.com>`_:

* Ignacio Ibeas <[email protected]>

* `Tecnativa <https://www.tecnativa.com>`_:

* David Vidal
* Pedro M. Baeza
* Antonio Espinosa
* Rafael Blasco
* Carlos Roca
* João Marques

* `Sygel <https://www.sygel.es>`_:

* Manuel Regidor

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/l10n-spain <https://github.com/OCA/l10n-spain/tree/15.0/l10n_es_pos>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
5 changes: 5 additions & 0 deletions l10n_es_pos/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
from .hooks import post_init_hook, uninstall_hook
from . import wizard
27 changes: 27 additions & 0 deletions l10n_es_pos/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Punto de venta adaptado a la legislación española",
"category": "Sales/Point Of Sale",
"author": "Tecnativa, "
"Aselcis Consulting, "
"Acysos S.L., "
"Odoo Community Association (OCA)",
"website": "https://github.com/OCA/l10n-spain",
"license": "AGPL-3",
"version": "16.0.1.0.0",
"depends": ["point_of_sale"],
"data": ["views/pos_views.xml", "views/res_config_settings_views.xml"],
"assets": {
"point_of_sale.assets": [
"l10n_es_pos/static/src/xml/pos.xml",
"l10n_es_pos/static/src/xml/Screens/OrderManagementScreen/TicketScreen.xml",
"l10n_es_pos/static/src/js/PaymentScreen.js",
"l10n_es_pos/static/src/js/models.js",
"l10n_es_pos/static/src/js/Screens/TicketScreen/TicketScreen.js",
],
},
"installable": True,
"post_init_hook": "post_init_hook",
"uninstall_hook": "uninstall_hook",
}
52 changes: 52 additions & 0 deletions l10n_es_pos/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Copyright 2018 David Vidal <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import SUPERUSER_ID, api


def post_init_hook(cr, registry, vals=None):
"""For brand new installations"""
env = api.Environment(cr, SUPERUSER_ID, {})
IrSequence = env["ir.sequence"]
pos_config = env["pos.config"].search(
[("l10n_es_simplified_invoice_sequence_id", "=", False)]
)
pos_name_dupes = {}
vals = {} if vals is None else vals
for pos in pos_config:
pos_name_dupes.setdefault(pos.name, -1)
pos_name_dupes[pos.name] += 1
pos_vals = vals.get(pos, {})
pos_name = (
pos.name
if not pos_name_dupes[pos.name]
else "%s_%d" % (pos.name, pos_name_dupes[pos.name])
)
if not pos_vals.get("prefix"):
pos_vals["prefix"] = initial_prefix = "{}{}".format(
pos_name, pos._get_default_prefix()
)
ith = 0
while IrSequence.search_count([("prefix", "=", pos_vals["prefix"])]):
ith += 1
pos_vals["prefix"] = "{}_{}".format(initial_prefix, ith)
pos.l10n_es_simplified_invoice_sequence_id = IrSequence.create(
{
"name": (
pos.with_context(lang=env.user.lang)._get_l10n_es_sequence_name()
% pos_name
),
"prefix": pos_vals.get(
"prefix", "{}{}".format(pos_name, pos._get_default_prefix())
),
"padding": pos_vals.get("padding", pos._get_default_padding()),
"implementation": pos_vals.get("implementation", "standard"),
"code": "pos.config.simplified_invoice",
"company_id": pos_vals.get("company_id", pos.company_id.id),
}
)


def uninstall_hook(cr, registry):
env = api.Environment(cr, SUPERUSER_ID, {})
env["ir.sequence"].search([("code", "=", "pos.config.simplified_invoice")]).unlink()
Loading

0 comments on commit 5928e95

Please sign in to comment.