From 23ceffa577800d0814cce8a5d14b8c0cad0a2e20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dar=C3=ADo=20Lodeiros?= Date: Thu, 29 Sep 2022 20:06:16 +0200 Subject: [PATCH] [ADD]l10n_es_SII: Add README --- pms/tests/test_pms_folio_invoice.py | 4 +- pms/tests/test_pms_reservation.py | 12 ++- pms_l10n_es/__manifest__.py | 2 + pms_l10n_es/data/pms_data.xml | 31 ++++++++ pms_l10n_es/models/res_partner.py | 2 +- pms_l10n_es_SII/__init__.py | 1 - pms_l10n_es_SII/data/pms_data.xml | 37 ---------- pms_l10n_es_SII/models/__init__.py | 2 - pms_l10n_es_SII/models/res_partner.py | 69 ------------------ .../models/res_partner_id_category.py | 26 ------- pms_l10n_es_SII/readme/DESCRIPTION.rst | 1 - pms_l10n_es_SII/readme/USAGE.rst | 2 - .../views/res_partner_id_category.xml | 15 ---- .../README.rst | 19 +++-- pms_l10n_es_sii/__init__.py | 1 + .../__manifest__.py | 4 +- pms_l10n_es_sii/data/pms_data.xml | 9 +++ .../readme/CONTRIBUTORS.rst | 0 pms_l10n_es_sii/readme/DESCRIPTION.rst | 1 + pms_l10n_es_sii/readme/USAGE.rst | 1 + .../static/description/icon.png | Bin .../static/description/index.html | 19 +++-- .../odoo/addons/pms_l10n_es_SII | 1 - .../odoo/addons/pms_l10n_es_sii | 1 + .../setup.py | 0 25 files changed, 77 insertions(+), 183 deletions(-) delete mode 100644 pms_l10n_es_SII/__init__.py delete mode 100644 pms_l10n_es_SII/data/pms_data.xml delete mode 100644 pms_l10n_es_SII/models/__init__.py delete mode 100644 pms_l10n_es_SII/models/res_partner.py delete mode 100644 pms_l10n_es_SII/models/res_partner_id_category.py delete mode 100644 pms_l10n_es_SII/readme/DESCRIPTION.rst delete mode 100644 pms_l10n_es_SII/readme/USAGE.rst delete mode 100644 pms_l10n_es_SII/views/res_partner_id_category.xml rename {pms_l10n_es_SII => pms_l10n_es_sii}/README.rst (75%) create mode 100644 pms_l10n_es_sii/__init__.py rename {pms_l10n_es_SII => pms_l10n_es_sii}/__manifest__.py (83%) create mode 100644 pms_l10n_es_sii/data/pms_data.xml rename {pms_l10n_es_SII => pms_l10n_es_sii}/readme/CONTRIBUTORS.rst (100%) create mode 100644 pms_l10n_es_sii/readme/DESCRIPTION.rst create mode 100644 pms_l10n_es_sii/readme/USAGE.rst rename {pms_l10n_es_SII => pms_l10n_es_sii}/static/description/icon.png (100%) rename {pms_l10n_es_SII => pms_l10n_es_sii}/static/description/index.html (87%) delete mode 120000 setup/pms_l10n_es_SII/odoo/addons/pms_l10n_es_SII create mode 120000 setup/pms_l10n_es_sii/odoo/addons/pms_l10n_es_sii rename setup/{pms_l10n_es_SII => pms_l10n_es_sii}/setup.py (100%) diff --git a/pms/tests/test_pms_folio_invoice.py b/pms/tests/test_pms_folio_invoice.py index bed69c713..db89f3809 100644 --- a/pms/tests/test_pms_folio_invoice.py +++ b/pms/tests/test_pms_folio_invoice.py @@ -76,7 +76,7 @@ class TestPmsFolioInvoice(TestPms): self.partner_id = self.env["res.partner"].create( { "name": "Miguel", - "vat": "ES123456789", + "vat": "45224522J", "country_id": self.env.ref("base.es").id, "city": "Madrid", "zip": "28013", @@ -755,7 +755,7 @@ class TestPmsFolioInvoice(TestPms): self.partner_id2 = self.env["res.partner"].create( { "name": "Sara", - "vat": "ES123456787", + "vat": "54235544A", "country_id": self.env.ref("base.es").id, "city": "Madrid", "zip": "28013", diff --git a/pms/tests/test_pms_reservation.py b/pms/tests/test_pms_reservation.py index 6f9348c50..a9c007f17 100644 --- a/pms/tests/test_pms_reservation.py +++ b/pms/tests/test_pms_reservation.py @@ -2989,10 +2989,14 @@ class TestPmsReservations(TestPms): # ACTION reservation.action_cancel() reservation.flush() - expected_price = ( - self.service.price_total - + self.board_service.price_total * reservation.adults - ) - reservation.services_discount + expected_price = round( + ( + self.service.price_total + + self.board_service.price_total * reservation.adults + ) + - reservation.services_discount, + 2, + ) # ASSERT self.assertEqual( diff --git a/pms_l10n_es/__manifest__.py b/pms_l10n_es/__manifest__.py index f57c7fd50..d4b26a641 100644 --- a/pms_l10n_es/__manifest__.py +++ b/pms_l10n_es/__manifest__.py @@ -18,6 +18,8 @@ "partner_contact_nationality", "base_iso3166", "queue_job", + "l10n_es_aeat", + "l10n_es_aeat_partner_identification", ], "external_dependencies": { "python": [ diff --git a/pms_l10n_es/data/pms_data.xml b/pms_l10n_es/data/pms_data.xml index f4ef78992..8fa12b8ef 100644 --- a/pms_l10n_es/data/pms_data.xml +++ b/pms_l10n_es/data/pms_data.xml @@ -42,5 +42,36 @@ else: + + + + + 02 + + + 05 + + + 05 + + + 03 + + + 06 + + + 06 + + diff --git a/pms_l10n_es/models/res_partner.py b/pms_l10n_es/models/res_partner.py index fd88333a3..01de54e21 100644 --- a/pms_l10n_es/models/res_partner.py +++ b/pms_l10n_es/models/res_partner.py @@ -41,7 +41,7 @@ class ResPartner(models.Model): not self.vat or not self.country_id or not self.city - or not (self.street and self.street2) + or not (self.street or self.street2) ): return False return True diff --git a/pms_l10n_es_SII/__init__.py b/pms_l10n_es_SII/__init__.py deleted file mode 100644 index 0650744f6..000000000 --- a/pms_l10n_es_SII/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import models diff --git a/pms_l10n_es_SII/data/pms_data.xml b/pms_l10n_es_SII/data/pms_data.xml deleted file mode 100644 index 7d567f9f0..000000000 --- a/pms_l10n_es_SII/data/pms_data.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - True - - - - 02 - - - 05 - - - 05 - - - 03 - - - 06 - - - 06 - - - diff --git a/pms_l10n_es_SII/models/__init__.py b/pms_l10n_es_SII/models/__init__.py deleted file mode 100644 index 0fc6ce7a6..000000000 --- a/pms_l10n_es_SII/models/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from . import res_partner_id_category -from . import res_partner diff --git a/pms_l10n_es_SII/models/res_partner.py b/pms_l10n_es_SII/models/res_partner.py deleted file mode 100644 index 13d62208b..000000000 --- a/pms_l10n_es_SII/models/res_partner.py +++ /dev/null @@ -1,69 +0,0 @@ -from odoo import api, fields, models - - -class ResPartner(models.Model): - _inherit = "res.partner" - - vat = fields.Char( - readonly=False, - store=True, - compute="_compute_vat", - ) - aeat_identification_type = fields.Selection( - readonly=False, - store=True, - compute="_compute_aeat_identification_type", - ) - aeat_identification = fields.Char( - readonly=False, - store=True, - compute="_compute_aeat_identification", - ) - - @api.depends( - "id_numbers", - "id_numbers.category_id", - "id_numbers.category_id.aeat_identification_type", - ) - def _compute_aeat_identification_type(self): - if hasattr(super(), "_compute_aeat_identification_type"): - super()._compute_aeat_identification_type() - for record in self: - # Passport ("03"), Residential cert. ("04") and Another document ("05") - # are setted in aeat identificacion type. - # NIF/VAT ("02") are setted in partner vat field compute - document = record.id_numbers.filtered( - lambda i: i.category_id.aeat_identification_type in ["03", "05", "06"] - ) - if document and not record.vat: - record.aeat_identification_type = document[ - 0 - ].category_id.aeat_identification_type - elif not record.aeat_identification_type or record.vat: - record.aeat_identification_type = False - - @api.depends("id_numbers", "id_numbers.name") - def _compute_aeat_identification(self): - if hasattr(super(), "_compute_aeat_identification"): - super()._compute_aeat_identification() - for record in self: - document = record.id_numbers.filtered( - lambda i: i.category_id.aeat_identification_type in ["03", "05", "06"] - ) - if document: - record.aeat_identification = document[0].name - elif not record.aeat_identification: - record.aeat_identification = False - - @api.depends("id_numbers", "id_numbers.name") - def _compute_vat(self): - if hasattr(super(), "_compute_vat"): - super()._compute_vat() - for record in self: - vat = record.id_numbers.filtered( - lambda i: i.category_id.aeat_identification_type == "02" - ) - if vat: - record.vat = vat[0].name - elif not record.vat: - record.vat = False diff --git a/pms_l10n_es_SII/models/res_partner_id_category.py b/pms_l10n_es_SII/models/res_partner_id_category.py deleted file mode 100644 index 5e062de05..000000000 --- a/pms_l10n_es_SII/models/res_partner_id_category.py +++ /dev/null @@ -1,26 +0,0 @@ -from odoo import fields, models - - -class ResPartnerIdCategory(models.Model): - _inherit = "res.partner.id_category" - - aeat_identification_type = fields.Selection( - string="AEAT Identification type equivalent", - help=( - "Used to specify an identification type to send to SII. Normally for " - "sending national and export invoices to SII where the customer country " - "is not Spain, it would calculate an identification type of 04 if the VAT " - "field is filled and 06 if it was not. This field is to specify " - "types of 03 through 05, in the event that the customer doesn't identify " - "with a foreign VAT and instead with their passport " - "or residential certificate. If there is no value it will work as before." - ), - selection=[ - ("02", "NIF - VAT"), - ("03", "Passport"), - ("04", "Official document from the original country"), - ("05", "Residential certificate"), - ("06", "Another document"), - ("07", "Not registered on census"), - ], - ) diff --git a/pms_l10n_es_SII/readme/DESCRIPTION.rst b/pms_l10n_es_SII/readme/DESCRIPTION.rst deleted file mode 100644 index 1f50e77a1..000000000 --- a/pms_l10n_es_SII/readme/DESCRIPTION.rst +++ /dev/null @@ -1 +0,0 @@ -Set automatically SII fields from Checkin document Partners diff --git a/pms_l10n_es_SII/readme/USAGE.rst b/pms_l10n_es_SII/readme/USAGE.rst deleted file mode 100644 index f529c8da2..000000000 --- a/pms_l10n_es_SII/readme/USAGE.rst +++ /dev/null @@ -1,2 +0,0 @@ -When you create a new checkin document, this is copied to aeat identification type -Set the various client like a anonimous AEAT diff --git a/pms_l10n_es_SII/views/res_partner_id_category.xml b/pms_l10n_es_SII/views/res_partner_id_category.xml deleted file mode 100644 index 8a8ca1e8c..000000000 --- a/pms_l10n_es_SII/views/res_partner_id_category.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - res.partner.id_category - - - - - - - - diff --git a/pms_l10n_es_SII/README.rst b/pms_l10n_es_sii/README.rst similarity index 75% rename from pms_l10n_es_SII/README.rst rename to pms_l10n_es_sii/README.rst index 7c8d78033..8e4335fb1 100644 --- a/pms_l10n_es_SII/README.rst +++ b/pms_l10n_es_sii/README.rst @@ -1,6 +1,6 @@ -============================== -Payment Acquirer Multiproperty -============================== +======================== +PMS AEAT SII Integration +======================== .. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! @@ -14,10 +14,10 @@ Payment Acquirer Multiproperty :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpms-lightgray.png?logo=github - :target: https://github.com/OCA/pms/tree/14.0/payment_acquirer_multi_pms_properties + :target: https://github.com/OCA/pms/tree/14.0/pms_l10n_es_sii :alt: OCA/pms .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/pms-14-0/pms-14-0-payment_acquirer_multi_pms_properties + :target: https://translation.odoo-community.org/projects/pms-14-0/pms-14-0-pms_l10n_es_sii :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png :target: https://runbot.odoo-community.org/runbot/293/14.0 @@ -25,7 +25,7 @@ Payment Acquirer Multiproperty |badge1| |badge2| |badge3| |badge4| |badge5| -Set the pms property in the payment acquirer to filter on website payments +Set the pms various contact like anonymous SII aeat **Table of contents** @@ -35,8 +35,7 @@ Set the pms property in the payment acquirer to filter on website payments Usage ===== -Sets one or more properties in the payment acquirer so that payment method is only available for documents of those properties. -If you leave it blank, it will be available to everyone. +Nothing to do Bug Tracker =========== @@ -44,7 +43,7 @@ Bug Tracker Bugs are tracked on `GitHub 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -76,6 +75,6 @@ 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/pms `_ project on GitHub. +This module is part of the `OCA/pms `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/pms_l10n_es_sii/__init__.py b/pms_l10n_es_sii/__init__.py new file mode 100644 index 000000000..572cd5184 --- /dev/null +++ b/pms_l10n_es_sii/__init__.py @@ -0,0 +1 @@ +# License AGPL-3 - See https://www.gnu.org/licenses/agpl-3.0.html diff --git a/pms_l10n_es_SII/__manifest__.py b/pms_l10n_es_sii/__manifest__.py similarity index 83% rename from pms_l10n_es_SII/__manifest__.py rename to pms_l10n_es_sii/__manifest__.py index a5ec4c2f2..abf9a9522 100644 --- a/pms_l10n_es_SII/__manifest__.py +++ b/pms_l10n_es_sii/__manifest__.py @@ -9,9 +9,9 @@ "version": "14.0.1.0.2", "license": "AGPL-3", "depends": [ - "pms", "l10n_es_aeat_sii_oca", + "l10n_es_aeat_partner_identification", ], - "data": ["data/pms_data.xml", "views/res_partner_id_category.xml"], + "data": ["data/pms_data.xml"], "installable": True, } diff --git a/pms_l10n_es_sii/data/pms_data.xml b/pms_l10n_es_sii/data/pms_data.xml new file mode 100644 index 000000000..7b97f59cf --- /dev/null +++ b/pms_l10n_es_sii/data/pms_data.xml @@ -0,0 +1,9 @@ + + + + + + True + + + diff --git a/pms_l10n_es_SII/readme/CONTRIBUTORS.rst b/pms_l10n_es_sii/readme/CONTRIBUTORS.rst similarity index 100% rename from pms_l10n_es_SII/readme/CONTRIBUTORS.rst rename to pms_l10n_es_sii/readme/CONTRIBUTORS.rst diff --git a/pms_l10n_es_sii/readme/DESCRIPTION.rst b/pms_l10n_es_sii/readme/DESCRIPTION.rst new file mode 100644 index 000000000..6386051ec --- /dev/null +++ b/pms_l10n_es_sii/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Set the pms various contact like anonymous SII aeat diff --git a/pms_l10n_es_sii/readme/USAGE.rst b/pms_l10n_es_sii/readme/USAGE.rst new file mode 100644 index 000000000..b1534b160 --- /dev/null +++ b/pms_l10n_es_sii/readme/USAGE.rst @@ -0,0 +1 @@ +Nothing to do diff --git a/pms_l10n_es_SII/static/description/icon.png b/pms_l10n_es_sii/static/description/icon.png similarity index 100% rename from pms_l10n_es_SII/static/description/icon.png rename to pms_l10n_es_sii/static/description/icon.png diff --git a/pms_l10n_es_SII/static/description/index.html b/pms_l10n_es_sii/static/description/index.html similarity index 87% rename from pms_l10n_es_SII/static/description/index.html rename to pms_l10n_es_sii/static/description/index.html index fa8c42020..e5f94aef5 100644 --- a/pms_l10n_es_SII/static/description/index.html +++ b/pms_l10n_es_sii/static/description/index.html @@ -3,8 +3,8 @@ - -Payment Acquirer Multiproperty + +PMS AEAT SII Integration -
-

Payment Acquirer Multiproperty

+
+

PMS AEAT SII Integration

-

Beta License: AGPL-3 OCA/pms Translate me on Weblate Try me on Runbot

-

Set the pms property in the payment acquirer to filter on website payments

+

Beta License: AGPL-3 OCA/pms Translate me on Weblate Try me on Runbot

+

Set the pms various contact like anonymous SII aeat

Table of contents

    @@ -384,15 +384,14 @@ ul.auto-toc {

Usage

-

Sets one or more properties in the payment acquirer so that payment method is only available for documents of those properties. -If you leave it blank, it will be available to everyone.

+

Nothing to do

Bug Tracker

Bugs are tracked on GitHub 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.

+feedback.

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

@@ -419,7 +418,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

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/pms project on GitHub.

+

This module is part of the OCA/pms project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/setup/pms_l10n_es_SII/odoo/addons/pms_l10n_es_SII b/setup/pms_l10n_es_SII/odoo/addons/pms_l10n_es_SII deleted file mode 120000 index 3a392a36a..000000000 --- a/setup/pms_l10n_es_SII/odoo/addons/pms_l10n_es_SII +++ /dev/null @@ -1 +0,0 @@ -../../../../pms_l10n_es_SII \ No newline at end of file diff --git a/setup/pms_l10n_es_sii/odoo/addons/pms_l10n_es_sii b/setup/pms_l10n_es_sii/odoo/addons/pms_l10n_es_sii new file mode 120000 index 000000000..c501209e4 --- /dev/null +++ b/setup/pms_l10n_es_sii/odoo/addons/pms_l10n_es_sii @@ -0,0 +1 @@ +../../../../pms_l10n_es_sii \ No newline at end of file diff --git a/setup/pms_l10n_es_SII/setup.py b/setup/pms_l10n_es_sii/setup.py similarity index 100% rename from setup/pms_l10n_es_SII/setup.py rename to setup/pms_l10n_es_sii/setup.py