Browse Source

[MIG] partner_vat_unique: Migration to 13.0

14.0
Manuel Calero 4 years ago
committed by newtratip
parent
commit
4ca2deebb7
  1. 21
      partner_vat_unique/README.rst
  2. 5
      partner_vat_unique/__manifest__.py
  3. 6
      partner_vat_unique/i18n/es.po
  4. 14
      partner_vat_unique/models/res_partner.py
  5. 5
      partner_vat_unique/readme/CONTRIBUTORS.rst
  6. 2
      partner_vat_unique/readme/ROADMAP.rst
  7. 44
      partner_vat_unique/static/description/index.html
  8. 2
      partner_vat_unique/tests/test_vat_unique.py

21
partner_vat_unique/README.rst

@ -14,13 +14,13 @@ Partner VAT Unique
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpartner--contact-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpartner--contact-lightgray.png?logo=github
:target: https://github.com/OCA/partner-contact/tree/12.0/partner_vat_unique
:target: https://github.com/OCA/partner-contact/tree/13.0/partner_vat_unique
:alt: OCA/partner-contact :alt: OCA/partner-contact
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/partner-contact-12-0/partner-contact-12-0-partner_vat_unique
:target: https://translation.odoo-community.org/projects/partner-contact-13-0/partner-contact-13-0-partner_vat_unique
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/134/12.0
:target: https://runbot.odoo-community.org/runbot/134/13.0
:alt: Try me on Runbot :alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@ -39,13 +39,19 @@ Installation
Will not check previous VAT duplicates, so it is recomended make sure there Will not check previous VAT duplicates, so it is recomended make sure there
isn't any duplicated VAT before installation. isn't any duplicated VAT before installation.
Known issues / Roadmap
======================
* Creation of the partner from XML-RPC.
* Partner creation by importing a CSV file, in those cases you miss the notice.
Bug Tracker Bug Tracker
=========== ===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/partner-contact/issues>`_. Bugs are tracked on `GitHub Issues <https://github.com/OCA/partner-contact/issues>`_.
In case of trouble, please check there if your issue has already been reported. 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 If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/partner-contact/issues/new?body=module:%20partner_vat_unique%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/partner-contact/issues/new?body=module:%20partner_vat_unique%0Aversion:%2013.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. Do not contact contributors directly about support or help with technical issues.
@ -61,10 +67,13 @@ Contributors
~~~~~~~~~~~~ ~~~~~~~~~~~~
* Ismael Calvo <ismael.calvo@es.gt.com> * Ismael Calvo <ismael.calvo@es.gt.com>
* Vicent Cubells <vicent.cubells@tecnativa.com>
* Michael Michot <michotm@gmail.com> * Michael Michot <michotm@gmail.com>
* Koen Loodts <koen.loodts@dynapps.be> * Koen Loodts <koen.loodts@dynapps.be>
* `Tecnativa <https://www.tecnativa.com>`__:
* Vicent Cubells <vicent.cubells@tecnativa.com>
* Manuel Calero - Tecnativa
Maintainers Maintainers
~~~~~~~~~~~ ~~~~~~~~~~~
@ -78,6 +87,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
This module is part of the `OCA/partner-contact <https://github.com/OCA/partner-contact/tree/12.0/partner_vat_unique>`_ project on GitHub.
This module is part of the `OCA/partner-contact <https://github.com/OCA/partner-contact/tree/13.0/partner_vat_unique>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

5
partner_vat_unique/__manifest__.py

@ -1,9 +1,10 @@
# Copyright 2017 Grant Thornton Spain - Ismael Calvo <ismael.calvo@es.gt.com> # Copyright 2017 Grant Thornton Spain - Ismael Calvo <ismael.calvo@es.gt.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# Copyright 2020 Manuel Calero - Tecnativa
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{ {
"name": "Partner VAT Unique", "name": "Partner VAT Unique",
"summary": "Module to make the VAT number unique for customers and suppliers.", "summary": "Module to make the VAT number unique for customers and suppliers.",
"version": "12.0.1.0.1",
"version": "13.0.1.0.0",
"category": "Customer Relationship Management", "category": "Customer Relationship Management",
"website": "https://github.com/OCA/partner-contact", "website": "https://github.com/OCA/partner-contact",
"author": "Grant Thornton S.L.P, Odoo Community Association (OCA)", "author": "Grant Thornton S.L.P, Odoo Community Association (OCA)",

6
partner_vat_unique/i18n/es.po

@ -20,13 +20,13 @@ msgstr ""
#. module: partner_vat_unique #. module: partner_vat_unique
#: model:ir.model,name:partner_vat_unique.model_res_partner #: model:ir.model,name:partner_vat_unique.model_res_partner
msgid "Contact" msgid "Contact"
msgstr ""
msgstr "Contacto"
#. module: partner_vat_unique #. module: partner_vat_unique
#: model:ir.model.fields,field_description:partner_vat_unique.field_res_partner__vat #: model:ir.model.fields,field_description:partner_vat_unique.field_res_partner__vat
#: model:ir.model.fields,field_description:partner_vat_unique.field_res_users__vat #: model:ir.model.fields,field_description:partner_vat_unique.field_res_users__vat
msgid "Tax ID" msgid "Tax ID"
msgstr ""
msgstr "Tax"
#. module: partner_vat_unique #. module: partner_vat_unique
#: model:ir.model.fields,help:partner_vat_unique.field_res_partner__vat #: model:ir.model.fields,help:partner_vat_unique.field_res_partner__vat
@ -35,6 +35,8 @@ msgid ""
"The Tax Identification Number. Complete it if the contact is subjected to " "The Tax Identification Number. Complete it if the contact is subjected to "
"government taxes. Used in some legal statements." "government taxes. Used in some legal statements."
msgstr "" msgstr ""
"Complete el número de identificación fiscal si el contacto está sujeto "
"a impuestos gubernamentales. Utilizado en algunas declaraciones legales"
#. module: partner_vat_unique #. module: partner_vat_unique
#: code:addons/partner_vat_unique/models/res_partner.py:29 #: code:addons/partner_vat_unique/models/res_partner.py:29

14
partner_vat_unique/models/res_partner.py

@ -1,5 +1,6 @@
# Copyright 2017 Grant Thornton Spain - Ismael Calvo <ismael.calvo@es.gt.com> # Copyright 2017 Grant Thornton Spain - Ismael Calvo <ismael.calvo@es.gt.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# Copyright 2020 Manuel Calero - Tecnativa
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import _, api, fields, models from odoo import _, api, fields, models
from odoo.exceptions import ValidationError from odoo.exceptions import ValidationError
@ -21,14 +22,7 @@ class ResPartner(models.Model):
) )
if test_condition: if test_condition:
continue continue
results = self.env["res.partner"].search_count(
[
("parent_id", "=", False),
("vat", "=", record.vat),
("id", "!=", record.id),
]
)
if results:
if record.same_vat_partner_id:
raise ValidationError( raise ValidationError(
_("The VAT %s already exists in another " "partner.") % record.vat
_("The VAT %s already exists in another partner.") % record.vat
) )

5
partner_vat_unique/readme/CONTRIBUTORS.rst

@ -1,4 +1,7 @@
* Ismael Calvo <ismael.calvo@es.gt.com> * Ismael Calvo <ismael.calvo@es.gt.com>
* Vicent Cubells <vicent.cubells@tecnativa.com>
* Michael Michot <michotm@gmail.com> * Michael Michot <michotm@gmail.com>
* Koen Loodts <koen.loodts@dynapps.be> * Koen Loodts <koen.loodts@dynapps.be>
* `Tecnativa <https://www.tecnativa.com>`__:
* Vicent Cubells <vicent.cubells@tecnativa.com>
* Manuel Calero - Tecnativa

2
partner_vat_unique/readme/ROADMAP.rst

@ -0,0 +1,2 @@
* Creation of the partner from XML-RPC.
* Partner creation by importing a CSV file, in those cases you miss the notice.

44
partner_vat_unique/static/description/index.html

@ -367,18 +367,19 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/partner-contact/tree/12.0/partner_vat_unique"><img alt="OCA/partner-contact" src="https://img.shields.io/badge/github-OCA%2Fpartner--contact-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/partner-contact-12-0/partner-contact-12-0-partner_vat_unique"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/134/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/partner-contact/tree/13.0/partner_vat_unique"><img alt="OCA/partner-contact" src="https://img.shields.io/badge/github-OCA%2Fpartner--contact-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/partner-contact-13-0/partner-contact-13-0-partner_vat_unique"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/134/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>Module to make the VAT number unique for customers and suppliers. Will not <p>Module to make the VAT number unique for customers and suppliers. Will not
consider empty VATs as duplicated.</p> consider empty VATs as duplicated.</p>
<p><strong>Table of contents</strong></p> <p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents"> <div class="contents local topic" id="contents">
<ul class="simple"> <ul class="simple">
<li><a class="reference internal" href="#installation" id="id1">Installation</a></li> <li><a class="reference internal" href="#installation" id="id1">Installation</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id4">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li>
<li><a class="reference internal" href="#known-issues-roadmap" id="id2">Known issues / Roadmap</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id3">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id4">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id5">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id6">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
@ -388,39 +389,54 @@ consider empty VATs as duplicated.</p>
<p>Will not check previous VAT duplicates, so it is recomended make sure there <p>Will not check previous VAT duplicates, so it is recomended make sure there
isn’t any duplicated VAT before installation.</p> isn’t any duplicated VAT before installation.</p>
</div> </div>
<div class="section" id="known-issues-roadmap">
<h1><a class="toc-backref" href="#id2">Known issues / Roadmap</a></h1>
<ul class="simple">
<li>Creation of the partner from XML-RPC.</li>
<li>Partner creation by importing a CSV file, in those cases you miss the notice.</li>
</ul>
</div>
<div class="section" id="bug-tracker"> <div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
<h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/partner-contact/issues">GitHub Issues</a>. <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/partner-contact/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported. 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 If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/partner-contact/issues/new?body=module:%20partner_vat_unique%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/partner-contact/issues/new?body=module:%20partner_vat_unique%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
<h1><a class="toc-backref" href="#id3">Credits</a></h1>
<h1><a class="toc-backref" href="#id4">Credits</a></h1>
<div class="section" id="authors"> <div class="section" id="authors">
<h2><a class="toc-backref" href="#id4">Authors</a></h2>
<h2><a class="toc-backref" href="#id5">Authors</a></h2>
<ul class="simple"> <ul class="simple">
<li>Grant Thornton S.L.P</li> <li>Grant Thornton S.L.P</li>
</ul> </ul>
</div> </div>
<div class="section" id="contributors"> <div class="section" id="contributors">
<h2><a class="toc-backref" href="#id5">Contributors</a></h2>
<h2><a class="toc-backref" href="#id6">Contributors</a></h2>
<ul class="simple"> <ul class="simple">
<li>Ismael Calvo &lt;<a class="reference external" href="mailto:ismael.calvo&#64;es.gt.com">ismael.calvo&#64;es.gt.com</a>&gt;</li> <li>Ismael Calvo &lt;<a class="reference external" href="mailto:ismael.calvo&#64;es.gt.com">ismael.calvo&#64;es.gt.com</a>&gt;</li>
<li>Vicent Cubells &lt;<a class="reference external" href="mailto:vicent.cubells&#64;tecnativa.com">vicent.cubells&#64;tecnativa.com</a>&gt;</li>
<li>Michael Michot &lt;<a class="reference external" href="mailto:michotm&#64;gmail.com">michotm&#64;gmail.com</a>&gt;</li> <li>Michael Michot &lt;<a class="reference external" href="mailto:michotm&#64;gmail.com">michotm&#64;gmail.com</a>&gt;</li>
<li>Koen Loodts &lt;<a class="reference external" href="mailto:koen.loodts&#64;dynapps.be">koen.loodts&#64;dynapps.be</a>&gt;</li> <li>Koen Loodts &lt;<a class="reference external" href="mailto:koen.loodts&#64;dynapps.be">koen.loodts&#64;dynapps.be</a>&gt;</li>
<li><dl class="first docutils">
<dt><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:</dt>
<dd><ul class="first last">
<li>Vicent Cubells &lt;<a class="reference external" href="mailto:vicent.cubells&#64;tecnativa.com">vicent.cubells&#64;tecnativa.com</a>&gt;</li>
<li>Manuel Calero - Tecnativa</li>
</ul>
</dd>
</dl>
</li>
</ul> </ul>
</div> </div>
<div class="section" id="maintainers"> <div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
<h2><a class="toc-backref" href="#id7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p> <p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a> <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/partner-contact/tree/12.0/partner_vat_unique">OCA/partner-contact</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/partner-contact/tree/13.0/partner_vat_unique">OCA/partner-contact</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div> </div>
</div> </div>

2
partner_vat_unique/tests/test_vat_unique.py

@ -1,5 +1,5 @@
# Copyright 2017 Grant Thornton Spain - Ismael Calvo <ismael.calvo@es.gt.com> # Copyright 2017 Grant Thornton Spain - Ismael Calvo <ismael.calvo@es.gt.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo.exceptions import ValidationError from odoo.exceptions import ValidationError
from odoo.tests.common import SavepointCase from odoo.tests.common import SavepointCase

Loading…
Cancel
Save