diff --git a/partner_create_by_vat/README.rst b/partner_create_by_vat/README.rst deleted file mode 100644 index 97e525668..000000000 --- a/partner_create_by_vat/README.rst +++ /dev/null @@ -1,71 +0,0 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :alt: License: AGPL-3 - -============================================== -Automatic partner creation based on VAT number -============================================== - -This module allows you to create the partners (companies) based on their VAT number. -Name and address of the partner will automatically be completed via VIES Webservice. - -VIES Service (based on stdnum python) -http://ec.europa.eu/taxation_customs/vies/vieshome.do - -Installation -============ - -To install this module, you need to: - -#. Clone the branch 8.0 of the repository https://github.com/OCA/partner-contact -#. Add the path to this repository in your configuration (addons-path) -#. Update the module list -#. Search for "Partner Create by VAT" in your addons -#. install the module - -Usage -===== - -On the partner's form view you will have a button in the header, called -"Get Vies Data", available only on companies (is_company field set to True). -Clicking the button will fetch data, when available, from the VIES Webservice, for most of -the EU countries. - -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/134/8.0 - -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 -`here `_. - -Credits -======= - -Images ------- - -* Odoo Community Association: `Icon `_. - -Contributors ------------- - -* Fekete Mihai - -Maintainer ----------- - -.. image:: https://odoo-community.org/logo.png - :alt: Odoo Community Association - :target: https://odoo-community.org - -This module is maintained by the OCA. - -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. - -To contribute to this module, please visit https://odoo-community.org. diff --git a/partner_create_by_vat/__init__.py b/partner_create_by_vat/__init__.py deleted file mode 100644 index 8986aaf4e..000000000 --- a/partner_create_by_vat/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# -*- coding: utf-8 -*- -# © 2015 Forest and Biomass Services Romania -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from . import models diff --git a/partner_create_by_vat/__openerp__.py b/partner_create_by_vat/__openerp__.py deleted file mode 100644 index c49a1a061..000000000 --- a/partner_create_by_vat/__openerp__.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -# © 2015 Forest and Biomass Services Romania -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -{ - 'name': 'Automatic partner creation based on VAT number', - 'summary': 'Using VIES webservice, name and address information will ' - 'be fetched and added to the partner.', - 'version': '8.0.1.0.0', - 'category': 'Customer Relationship Management', - 'author': 'Forest and Biomass Services Romania, ' - 'Odoo Community Association (OCA)', - 'website': 'https://www.forbiom.eu', - 'license': 'AGPL-3', - 'application': False, - 'installable': True, - 'external_dependencies': { - 'python': ['stdnum', 'suds'], - }, - 'depends': ['base_vat'], - 'data': ['views/res_partner_view.xml'], - 'images': ['static/description/icon.png', - 'static/description/customer.png', - 'static/description/customer1.png'], - 'auto_install': False, -} diff --git a/partner_create_by_vat/i18n/de.po b/partner_create_by_vat/i18n/de.po deleted file mode 100644 index de3262880..000000000 --- a/partner_create_by_vat/i18n/de.po +++ /dev/null @@ -1,36 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * partner_create_by_vat -# -# Translators: -# Rudolf Schnapka , 2017 -msgid "" -msgstr "" -"Project-Id-Version: partner-contact (8.0)\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-02-21 16:57+0000\n" -"PO-Revision-Date: 2017-02-24 20:44+0000\n" -"Last-Translator: Rudolf Schnapka \n" -"Language-Team: German (http://www.transifex.com/oca/OCA-partner-contact-8-0/" -"language/de/)\n" -"Language: de\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#. module: partner_create_by_vat -#: view:res.partner:partner_create_by_vat.view_partner_create_by_vat -msgid "Get Vies Data" -msgstr "Hole MIAS-Daten" - -#. module: partner_create_by_vat -#: model:ir.model,name:partner_create_by_vat.model_res_partner -msgid "Partner" -msgstr "Partner" - -#. module: partner_create_by_vat -#: code:addons/partner_create_by_vat/models/res_partner.py:29 -#, python-format -msgid "The partner is not listed on Vies Webservice." -msgstr "Der Partner ist nicht im MIAS-Webdienst eingetragen." diff --git a/partner_create_by_vat/i18n/es.po b/partner_create_by_vat/i18n/es.po deleted file mode 100644 index fa99566c8..000000000 --- a/partner_create_by_vat/i18n/es.po +++ /dev/null @@ -1,36 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * partner_create_by_vat -# -# Translators: -# Oihane Crucelaegui , 2016 -msgid "" -msgstr "" -"Project-Id-Version: partner-contact (8.0)\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-07-03 07:56+0000\n" -"PO-Revision-Date: 2016-07-04 07:42+0000\n" -"Last-Translator: Oihane Crucelaegui \n" -"Language-Team: Spanish (http://www.transifex.com/oca/OCA-partner-contact-8-0/" -"language/es/)\n" -"Language: es\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#. module: partner_create_by_vat -#: view:res.partner:partner_create_by_vat.view_partner_create_by_vat -msgid "Get Vies Data" -msgstr "" - -#. module: partner_create_by_vat -#: model:ir.model,name:partner_create_by_vat.model_res_partner -msgid "Partner" -msgstr "Empresa" - -#. module: partner_create_by_vat -#: code:addons/partner_create_by_vat/models/res_partner.py:29 -#, python-format -msgid "The partner is not listed on Vies Webservice." -msgstr "" diff --git a/partner_create_by_vat/i18n/eu.po b/partner_create_by_vat/i18n/eu.po deleted file mode 100644 index b491da9aa..000000000 --- a/partner_create_by_vat/i18n/eu.po +++ /dev/null @@ -1,36 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * partner_create_by_vat -# -# Translators: -# Esther Martín Menéndez , 2017 -msgid "" -msgstr "" -"Project-Id-Version: partner-contact (8.0)\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-02-21 16:57+0000\n" -"PO-Revision-Date: 2017-02-23 15:55+0000\n" -"Last-Translator: Esther Martín Menéndez \n" -"Language-Team: Basque (http://www.transifex.com/oca/OCA-partner-contact-8-0/" -"language/eu/)\n" -"Language: eu\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#. module: partner_create_by_vat -#: view:res.partner:partner_create_by_vat.view_partner_create_by_vat -msgid "Get Vies Data" -msgstr "" - -#. module: partner_create_by_vat -#: model:ir.model,name:partner_create_by_vat.model_res_partner -msgid "Partner" -msgstr "Kidea" - -#. module: partner_create_by_vat -#: code:addons/partner_create_by_vat/models/res_partner.py:29 -#, python-format -msgid "The partner is not listed on Vies Webservice." -msgstr "" diff --git a/partner_create_by_vat/i18n/partner_create_by_vat.pot b/partner_create_by_vat/i18n/partner_create_by_vat.pot deleted file mode 100644 index e8594090b..000000000 --- a/partner_create_by_vat/i18n/partner_create_by_vat.pot +++ /dev/null @@ -1,31 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * partner_create_by_vat -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 8.0\n" -"Report-Msgid-Bugs-To: \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: partner_create_by_vat -#: view:res.partner:partner_create_by_vat.view_partner_create_by_vat -msgid "Get Vies Data" -msgstr "" - -#. module: partner_create_by_vat -#: model:ir.model,name:partner_create_by_vat.model_res_partner -msgid "Partner" -msgstr "" - -#. module: partner_create_by_vat -#: code:addons/partner_create_by_vat/models/res_partner.py:29 -#, python-format -msgid "The partner is not listed on Vies Webservice." -msgstr "" - diff --git a/partner_create_by_vat/i18n/ro.po b/partner_create_by_vat/i18n/ro.po deleted file mode 100644 index d497a1af6..000000000 --- a/partner_create_by_vat/i18n/ro.po +++ /dev/null @@ -1,36 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * partner_create_by_vat -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: partner-contact (8.0)\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-05-07 07:18+0000\n" -"PO-Revision-Date: 2016-05-06 15:15+0000\n" -"Last-Translator: OCA Transbot \n" -"Language-Team: Romanian (http://www.transifex.com/oca/OCA-partner-" -"contact-8-0/language/ro/)\n" -"Language: ro\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?" -"2:1));\n" - -#. module: partner_create_by_vat -#: view:res.partner:partner_create_by_vat.view_partner_create_by_vat -msgid "Get Vies Data" -msgstr "" - -#. module: partner_create_by_vat -#: model:ir.model,name:partner_create_by_vat.model_res_partner -msgid "Partner" -msgstr "Partener" - -#. module: partner_create_by_vat -#: code:addons/partner_create_by_vat/models/res_partner.py:29 -#, python-format -msgid "The partner is not listed on Vies Webservice." -msgstr "Partenerul nu este listat pe site-ul Vies." diff --git a/partner_create_by_vat/i18n/sl.po b/partner_create_by_vat/i18n/sl.po deleted file mode 100644 index 43c88f738..000000000 --- a/partner_create_by_vat/i18n/sl.po +++ /dev/null @@ -1,37 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * partner_create_by_vat -# -# Translators: -# Matjaž Mozetič , 2016 -msgid "" -msgstr "" -"Project-Id-Version: partner-contact (8.0)\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-05-07 07:18+0000\n" -"PO-Revision-Date: 2016-05-07 07:16+0000\n" -"Last-Translator: Matjaž Mozetič \n" -"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-partner-" -"contact-8-0/language/sl/)\n" -"Language: sl\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n" -"%100==4 ? 2 : 3);\n" - -#. module: partner_create_by_vat -#: view:res.partner:partner_create_by_vat.view_partner_create_by_vat -msgid "Get Vies Data" -msgstr "Pridobi podatke VIES" - -#. module: partner_create_by_vat -#: model:ir.model,name:partner_create_by_vat.model_res_partner -msgid "Partner" -msgstr "Partner" - -#. module: partner_create_by_vat -#: code:addons/partner_create_by_vat/models/res_partner.py:29 -#, python-format -msgid "The partner is not listed on Vies Webservice." -msgstr "Partnerja ni na seznamu spletne storitve VIES." diff --git a/partner_create_by_vat/models/__init__.py b/partner_create_by_vat/models/__init__.py deleted file mode 100644 index 9fd77dd8e..000000000 --- a/partner_create_by_vat/models/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# -*- coding: utf-8 -*- -# © 2015 Forest and Biomass Services Romania -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from . import res_partner diff --git a/partner_create_by_vat/models/res_partner.py b/partner_create_by_vat/models/res_partner.py deleted file mode 100644 index 9ffe17e5a..000000000 --- a/partner_create_by_vat/models/res_partner.py +++ /dev/null @@ -1,62 +0,0 @@ -# -*- coding: utf-8 -*- -# © 2015 Forest and Biomass Services Romania -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -import logging - -from openerp import api, models, _ -from openerp.exceptions import ValidationError - -_logger = logging.getLogger(__name__) - -try: - from stdnum.eu.vat import check_vies -except ImportError: - _logger.debug("Cannot import check_vies method from python stdnum.") - - -class ResPartner(models.Model): - _inherit = "res.partner" - - @api.model - def _get_vies_data(self, vat): - res = {} - vat = vat.strip().upper() - vat_country, vat_number = self._split_vat(vat) - result = check_vies(vat) - # Raise error if partner is not listed on Vies - if result.name is None: - raise ValidationError(_("The partner is not listed on Vies " - "Webservice.")) - res['vat'] = vat - res['vat_subjected'] = result.valid - # Update partner name if listed on VIES - if result.name != '---': - res['name'] = result.name.upper() - # Update partner address if listed on VIES - if result.address != '---': - res['street'] = \ - result.address.replace('\n', ' ').replace('\r', '').title() - # Get country by country code - country = self.env['res.country'].search( - [('code', 'ilike', vat_country)]) - if country: - res['country_id'] = country[0].id - return res - - @api.multi - def vat_change(self, value): - res = super(ResPartner, self).vat_change(value) - # Update fields with the values available in the upper method - # Skip required name error - with self.env.do_in_onchange(): - if value: - result = self._get_vies_data(value) - res['value'].update(result) - return res - - @api.one - def get_vies_data_from_vat(self): - if self.vat: - res = self._get_vies_data(self.vat) - self.update(res) diff --git a/partner_create_by_vat/static/description/customer.png b/partner_create_by_vat/static/description/customer.png deleted file mode 100644 index 8a1fdcd27..000000000 Binary files a/partner_create_by_vat/static/description/customer.png and /dev/null differ diff --git a/partner_create_by_vat/static/description/customer1.png b/partner_create_by_vat/static/description/customer1.png deleted file mode 100644 index 785cd6bbb..000000000 Binary files a/partner_create_by_vat/static/description/customer1.png and /dev/null differ diff --git a/partner_create_by_vat/static/description/icon.png b/partner_create_by_vat/static/description/icon.png deleted file mode 100755 index 8db138641..000000000 Binary files a/partner_create_by_vat/static/description/icon.png and /dev/null differ diff --git a/partner_create_by_vat/tests/__init__.py b/partner_create_by_vat/tests/__init__.py deleted file mode 100644 index a4cb1837c..000000000 --- a/partner_create_by_vat/tests/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# -*- coding: utf-8 -*- -# © 2015 Forest and Biomass Services Romania -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from . import test_partner_create_by_vat diff --git a/partner_create_by_vat/tests/test_partner_create_by_vat.py b/partner_create_by_vat/tests/test_partner_create_by_vat.py deleted file mode 100644 index 177ee956e..000000000 --- a/partner_create_by_vat/tests/test_partner_create_by_vat.py +++ /dev/null @@ -1,72 +0,0 @@ -# -*- coding: utf-8 -*- -# © 2015 Forest and Biomass Services Romania -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -import mock -from openerp.tests.common import TransactionCase -from openerp.exceptions import ValidationError - -mock_vies = 'openerp.addons.partner_create_by_vat.' \ - 'models.res_partner.check_vies' - - -class TestPartnerCreatebyVAT(TransactionCase): - - def setUp(self): - super(TestPartnerCreatebyVAT, self).setUp() - self.partner_model = self.env['res.partner'] - self.sample_1 = { - 'valid': True, - 'name': u'SA ODOO', - 'address': u'Chaussée De Namur 40 1367 Ramillies', - } - - def test_create_from_vat1(self): - # Create an partner from VAT number field - self.partner1_id = self.partner_model.create({'name': '1', - 'vat': 'be0477472701', - 'is_company': True}) - - with mock.patch(mock_vies) as mock_func: - mock_func.return_value = type('obj', (object,), self.sample_1) - # Push the button to fetch partner's data - self.partner1_id.get_vies_data_from_vat() - - # Check if the datas fetch correspond with the datas from VIES. - self.assertEqual( - unicode(self.partner1_id.name), self.sample_1['name']) - self.assertEqual( - unicode(self.partner1_id.street), self.sample_1['address']) - self.assertEqual(self.partner1_id.country_id.name, 'Belgium') - self.assertEqual(self.partner1_id.vat, 'BE0477472701') - self.assertEqual(self.partner1_id.vat_subjected, True) - - def test_vat_change1(self): - # Create an partner from VAT number field - self.partner11_id = self.partner_model.create({'name': '1', - 'is_company': True}) - - with self.env.do_in_onchange(): - with mock.patch(mock_vies) as mock_func: - mock_func.return_value = type('obj', (object,), self.sample_1) - res = self.partner11_id.vat_change('be0477472701') - self.partner11_id.update(res['value']) - - # Check if the datas fetch correspond with the datas from VIES. - self.assertEqual( - unicode(self.partner11_id.name), self.sample_1['name']) - self.assertEqual( - unicode(self.partner11_id.street), self.sample_1['address']) - self.assertEqual(self.partner11_id.country_id.name, 'Belgium') - self.assertEqual(self.partner11_id.vat, 'BE0477472701') - self.assertEqual(self.partner11_id.vat_subjected, True) - - def test_create_from_vat2(self): - # Create an partner from VAT number field - self.partner2_id = self.partner_model.create({'name': '1', - 'vat': 'ro4400972', - 'is_company': True}) - - # Check VAT number not listed on VIES - with self.assertRaises(ValidationError): - self.partner2_id.get_vies_data_from_vat() diff --git a/partner_create_by_vat/views/res_partner_view.xml b/partner_create_by_vat/views/res_partner_view.xml deleted file mode 100644 index a3353e03a..000000000 --- a/partner_create_by_vat/views/res_partner_view.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - res.partner.create.by.vat - res.partner - - - -