diff --git a/pms_l10n_es_SII/README.rst b/pms_l10n_es_SII/README.rst new file mode 100644 index 000000000..7c8d78033 --- /dev/null +++ b/pms_l10n_es_SII/README.rst @@ -0,0 +1,81 @@ +============================== +Payment Acquirer Multiproperty +============================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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%2Fpms-lightgray.png?logo=github + :target: https://github.com/OCA/pms/tree/14.0/payment_acquirer_multi_pms_properties + :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 + :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 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Set the pms property in the payment acquirer to filter on website payments + +**Table of contents** + +.. contents:: + :local: + +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. + +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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Commit [Sun] + +Contributors +~~~~~~~~~~~~ + +* `Commit [Sun] `: + + * Dario Lodeiros + +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/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..0650744f6 --- /dev/null +++ b/pms_l10n_es_SII/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/pms_l10n_es_SII/__manifest__.py b/pms_l10n_es_SII/__manifest__.py new file mode 100644 index 000000000..a5ec4c2f2 --- /dev/null +++ b/pms_l10n_es_SII/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2009-2020 Noviat. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "PMS AEAT SII Integration", + "author": "Commit [Sun], Odoo Community Association (OCA)", + "website": "https://github.com/OCA/pms", + "category": "Generic Modules/Property Management System", + "version": "14.0.1.0.2", + "license": "AGPL-3", + "depends": [ + "pms", + "l10n_es_aeat_sii_oca", + ], + "data": ["data/pms_data.xml", "views/res_partner_id_category.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..7d567f9f0 --- /dev/null +++ b/pms_l10n_es_SII/data/pms_data.xml @@ -0,0 +1,37 @@ + + + + + + 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 new file mode 100644 index 000000000..0fc6ce7a6 --- /dev/null +++ b/pms_l10n_es_SII/models/__init__.py @@ -0,0 +1,2 @@ +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 new file mode 100644 index 000000000..13d62208b --- /dev/null +++ b/pms_l10n_es_SII/models/res_partner.py @@ -0,0 +1,69 @@ +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 new file mode 100644 index 000000000..5e062de05 --- /dev/null +++ b/pms_l10n_es_SII/models/res_partner_id_category.py @@ -0,0 +1,26 @@ +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/CONTRIBUTORS.rst b/pms_l10n_es_SII/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..f94c25c48 --- /dev/null +++ b/pms_l10n_es_SII/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* `Commit [Sun] `: + + * Dario Lodeiros diff --git a/pms_l10n_es_SII/readme/DESCRIPTION.rst b/pms_l10n_es_SII/readme/DESCRIPTION.rst new file mode 100644 index 000000000..1f50e77a1 --- /dev/null +++ b/pms_l10n_es_SII/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +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 new file mode 100644 index 000000000..f529c8da2 --- /dev/null +++ b/pms_l10n_es_SII/readme/USAGE.rst @@ -0,0 +1,2 @@ +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/static/description/icon.png b/pms_l10n_es_SII/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/pms_l10n_es_SII/static/description/icon.png differ diff --git a/pms_l10n_es_SII/static/description/index.html b/pms_l10n_es_SII/static/description/index.html new file mode 100644 index 000000000..fa8c42020 --- /dev/null +++ b/pms_l10n_es_SII/static/description/index.html @@ -0,0 +1,428 @@ + + + + + + +Payment Acquirer Multiproperty + + + +
+

Payment Acquirer Multiproperty

+ + +

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

+

Table of contents

+ +
+

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.

+
+
+

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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Commit [Sun]
  • +
+
+
+

Contributors

+
    +
  • Commit [Sun] <https://www.commitsun.com>:
      +
    • Dario Lodeiros
    • +
    +
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

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

+
+
+
+ + diff --git a/pms_l10n_es_SII/views/res_partner_id_category.xml b/pms_l10n_es_SII/views/res_partner_id_category.xml new file mode 100644 index 000000000..8a8ca1e8c --- /dev/null +++ b/pms_l10n_es_SII/views/res_partner_id_category.xml @@ -0,0 +1,15 @@ + + + + res.partner.id_category + + + + + + + + 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..3a392a36a --- /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 new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/pms_l10n_es_SII/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)