From 02c74cd7bbbd60670372be430e0644c7f068237c Mon Sep 17 00:00:00 2001 From: Denis Roussel Date: Mon, 8 Aug 2016 09:58:31 +0200 Subject: [PATCH 1/4] Add module to manage GLN partner identification number --- partner_identification_gln/README.rst | 61 ++++++++++++++ partner_identification_gln/__init__.py | 2 + partner_identification_gln/__openerp__.py | 23 ++++++ .../data/partner_identification_gln.xml | 15 ++++ partner_identification_gln/models/__init__.py | 5 ++ partner_identification_gln/models/partner.py | 65 +++++++++++++++ .../static/description/icon.svg | 79 +++++++++++++++++++ partner_identification_gln/tests/__init__.py | 5 ++ partner_identification_gln/tests/test_gln.py | 70 ++++++++++++++++ 9 files changed, 325 insertions(+) create mode 100644 partner_identification_gln/README.rst create mode 100644 partner_identification_gln/__init__.py create mode 100644 partner_identification_gln/__openerp__.py create mode 100644 partner_identification_gln/data/partner_identification_gln.xml create mode 100644 partner_identification_gln/models/__init__.py create mode 100644 partner_identification_gln/models/partner.py create mode 100644 partner_identification_gln/static/description/icon.svg create mode 100644 partner_identification_gln/tests/__init__.py create mode 100644 partner_identification_gln/tests/test_gln.py diff --git a/partner_identification_gln/README.rst b/partner_identification_gln/README.rst new file mode 100644 index 000000000..e59a31c8e --- /dev/null +++ b/partner_identification_gln/README.rst @@ -0,0 +1,61 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +========================== +Partner Identification Gln +========================== + +This addon extends "Partner Identification Numbers" to provide a number category for GLN registration + +see: http://www.gs1.org/1/glnrules/en/ + +Installation +============ + +This module depends on 'stdnum' python module + + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/repo/github-com-oca-partner-contact-134 + +.. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt +.. branch is "8.0" for example + + +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. + +Credits +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Denis Roussel + +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_identification_gln/__init__.py b/partner_identification_gln/__init__.py new file mode 100644 index 000000000..a9e337226 --- /dev/null +++ b/partner_identification_gln/__init__.py @@ -0,0 +1,2 @@ + +from . import models diff --git a/partner_identification_gln/__openerp__.py b/partner_identification_gln/__openerp__.py new file mode 100644 index 000000000..305ef2bb8 --- /dev/null +++ b/partner_identification_gln/__openerp__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Copyright 2016 Acsone S.A. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + 'name': 'Partner Identification Gln', + 'summary': """ + This addon extends "Partner Identification Numbers" + to provide a number category for GLN registration""", + 'version': '8.0.1.0.0', + 'license': 'AGPL-3', + 'author': 'Acsone S.A.,Odoo Community Association (OCA)', + 'website': 'https://www.acsone.eu', + 'external_dependencies': { + 'python': ['stdnum' + ], + }, + 'depends': ['partner_identification' + ], + 'data': ['data/partner_identification_gln.xml' + ], + 'installable': True, +} diff --git a/partner_identification_gln/data/partner_identification_gln.xml b/partner_identification_gln/data/partner_identification_gln.xml new file mode 100644 index 000000000..a0649dd1b --- /dev/null +++ b/partner_identification_gln/data/partner_identification_gln.xml @@ -0,0 +1,15 @@ + + + + + GLN Identification Number + gln_id_number + + + + GCP Identification Number + gcp_id_number + + + + \ No newline at end of file diff --git a/partner_identification_gln/models/__init__.py b/partner_identification_gln/models/__init__.py new file mode 100644 index 000000000..4f649425e --- /dev/null +++ b/partner_identification_gln/models/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# Copyright 2016 Acsone S.A. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import partner diff --git a/partner_identification_gln/models/partner.py b/partner_identification_gln/models/partner.py new file mode 100644 index 000000000..f04a835d9 --- /dev/null +++ b/partner_identification_gln/models/partner.py @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -*- +# © 2016 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +import logging +from openerp import api, models +_logger = logging.getLogger(__name__) + +try: + from stdnum import ean + from stdnum.exceptions import InvalidChecksum +except ImportError: + _logger.debug('Cannot `import external dependency python stdnum package`.') + + +class ResPartnerIdCategory(models.Model): + _inherit = 'res.partner.id_category' + + def _search_duplicate(self, category_id, id_number, force_active=False): + domain = [('category_id', '=', category_id), + ('name', '=', id_number.name), + ('name', '!=', False), + ('id', '!=', id_number.id)] + + if force_active: + domain.append(('partner_id.active', '=', True)) + num_obj = self.env['res.partner.id_number'] + return num_obj.search(domain) + + @api.multi + def validate_res_partner_gln(self, id_number): + self.ensure_one() + if not id_number: + return False + + try: + ean.validate(id_number.name) + except InvalidChecksum: + return True + + cat = self.env.ref('partner_identification_gln.' + 'partner_identification_gln_number_category').id + duplicate_gln = self._search_duplicate(cat, id_number, True) + + if duplicate_gln: + return True + + return False + + @api.multi + def validate_res_partner_gcp(self, id_number): + self.ensure_one() + if not id_number: + return False + + if len(id_number.name) < 1 or len(id_number.name) > 12: + return True + + cat = self.env.ref('partner_identification_gln.' + 'partner_identification_gcp_number_category').id + duplicate_gln = self._search_duplicate(cat, id_number) + + if duplicate_gln: + return True + + return False diff --git a/partner_identification_gln/static/description/icon.svg b/partner_identification_gln/static/description/icon.svg new file mode 100644 index 000000000..a7a26d093 --- /dev/null +++ b/partner_identification_gln/static/description/icon.svg @@ -0,0 +1,79 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/partner_identification_gln/tests/__init__.py b/partner_identification_gln/tests/__init__.py new file mode 100644 index 000000000..a064df9b0 --- /dev/null +++ b/partner_identification_gln/tests/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# Copyright 2016 Acsone S.A. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import test_gln diff --git a/partner_identification_gln/tests/test_gln.py b/partner_identification_gln/tests/test_gln.py new file mode 100644 index 000000000..50f7459e3 --- /dev/null +++ b/partner_identification_gln/tests/test_gln.py @@ -0,0 +1,70 @@ +# -*- coding: utf-8 -*- +# Copyright 2016 Acsone S.A. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from openerp.exceptions import ValidationError +from openerp.tests.common import TransactionCase + + +class TestGLN(TransactionCase): + def setUp(self): + super(TestGLN, self).setUp() + self.partner = self.env['res.partner'].create({'name': 'TestGLN'}) + self.partner2 = self.env['res.partner'].create({'name': 'TestGLN2'}) + pc = self.env.ref('partner_identification_gln.' + 'partner_identification_gln_number_category') + self.partner_id_category = pc + + pc_gcp = self.env.ref('partner_identification_gln.' + 'partner_identification_gcp_number_category') + self.partner_id_gcp_category = pc_gcp + + def test_gln(self): + # Good GLN + vals = {'name': '5450534001717', + 'category_id': self.partner_id_category.id + } + self.partner.write({'id_numbers': [(0, 0, vals)]}) + id_number = self.partner.id_numbers[0] + + self.assertEqual(id_number.name, '5450534001717') + + # Duplicate GLN + vals = {'name': '5450534001717', + 'category_id': self.partner_id_category.id + } + + with self.assertRaises(ValidationError): + self.partner2.write({'id_numbers': [(0, 0, vals)]}) + + # Bad GLN + vals = {'name': '5450534001716', + 'category_id': self.partner_id_category.id + } + with self.assertRaises(ValidationError): + self.partner.write({'id_numbers': [(0, 0, vals)]}) + + def test_gcp(self): + # Good GLN + vals = {'name': '545053', + 'category_id': self.partner_id_gcp_category.id + } + self.partner.write({'id_numbers': [(0, 0, vals)]}) + id_number = self.partner.id_numbers[0] + + self.assertEqual(id_number.name, '545053') + + # Duplicate GLN + vals = {'name': '545053', + 'category_id': self.partner_id_gcp_category.id + } + + with self.assertRaises(ValidationError): + self.partner2.write({'id_numbers': [(0, 0, vals)]}) + + # Bad GLN + vals = {'name': '5450534001716', + 'category_id': self.partner_id_gcp_category.id + } + with self.assertRaises(ValidationError): + self.partner.write({'id_numbers': [(0, 0, vals)]}) From b900ac2819fa98ef0e57ca8940d1c183b0bbf9f6 Mon Sep 17 00:00:00 2001 From: OCA Transbot Date: Sat, 3 Jun 2017 06:35:35 +0200 Subject: [PATCH 2/4] OCA Transbot updated translations from Transifex --- partner_identification_gln/i18n/sl.po | 29 +++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 partner_identification_gln/i18n/sl.po diff --git a/partner_identification_gln/i18n/sl.po b/partner_identification_gln/i18n/sl.po new file mode 100644 index 000000000..7d951d030 --- /dev/null +++ b/partner_identification_gln/i18n/sl.po @@ -0,0 +1,29 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * partner_identification_gln +# +# Translators: +# Matjaž Mozetič , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-01 03:23+0000\n" +"PO-Revision-Date: 2017-06-01 03:23+0000\n" +"Last-Translator: Matjaž Mozetič , 2017\n" +"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: sl\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_identification_gln +#: model:res.partner.id_category,name:partner_identification_gln.partner_identification_gcp_number_category +msgid "GCP Identification Number" +msgstr "GCP identifikacijska številka" + +#. module: partner_identification_gln +#: model:res.partner.id_category,name:partner_identification_gln.partner_identification_gln_number_category +msgid "GLN Identification Number" +msgstr "GLN identifikacijska številka" From e3483be0f062f942be6d0b7c30a4a6cb728dc60c Mon Sep 17 00:00:00 2001 From: gilles Date: Thu, 6 Jul 2017 18:07:43 +0200 Subject: [PATCH 3/4] [MIG] Partner Identification Gln v10 --- partner_identification_gln/README.rst | 5 +-- partner_identification_gln/__init__.py | 3 ++ .../{__openerp__.py => __manifest__.py} | 6 +-- .../data/partner_identification_gln.xml | 28 ++++++------ partner_identification_gln/models/__init__.py | 4 +- partner_identification_gln/models/partner.py | 7 ++- partner_identification_gln/tests/__init__.py | 4 +- partner_identification_gln/tests/test_gln.py | 43 ++++++++++++------- 8 files changed, 57 insertions(+), 43 deletions(-) rename partner_identification_gln/{__openerp__.py => __manifest__.py} (78%) diff --git a/partner_identification_gln/README.rst b/partner_identification_gln/README.rst index e59a31c8e..de1d7da25 100644 --- a/partner_identification_gln/README.rst +++ b/partner_identification_gln/README.rst @@ -20,10 +20,6 @@ This module depends on 'stdnum' python module :alt: Try me on Runbot :target: https://runbot.odoo-community.org/runbot/repo/github-com-oca-partner-contact-134 -.. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt -.. branch is "8.0" for example - - Bug Tracker =========== @@ -44,6 +40,7 @@ Contributors ------------ * Denis Roussel +* Meyomesse Gilles Maintainer ---------- diff --git a/partner_identification_gln/__init__.py b/partner_identification_gln/__init__.py index a9e337226..9e7304ea3 100644 --- a/partner_identification_gln/__init__.py +++ b/partner_identification_gln/__init__.py @@ -1,2 +1,5 @@ +# -*- coding: utf-8 -*- +# Copyright 2016-2017 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import models diff --git a/partner_identification_gln/__openerp__.py b/partner_identification_gln/__manifest__.py similarity index 78% rename from partner_identification_gln/__openerp__.py rename to partner_identification_gln/__manifest__.py index 305ef2bb8..ced0818dc 100644 --- a/partner_identification_gln/__openerp__.py +++ b/partner_identification_gln/__manifest__.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- -# Copyright 2016 Acsone S.A. -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +# Copyright 2016-2017 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { 'name': 'Partner Identification Gln', 'summary': """ This addon extends "Partner Identification Numbers" to provide a number category for GLN registration""", - 'version': '8.0.1.0.0', + 'version': '10.0.1.0.0', 'license': 'AGPL-3', 'author': 'Acsone S.A.,Odoo Community Association (OCA)', 'website': 'https://www.acsone.eu', diff --git a/partner_identification_gln/data/partner_identification_gln.xml b/partner_identification_gln/data/partner_identification_gln.xml index a0649dd1b..e047a1ce7 100644 --- a/partner_identification_gln/data/partner_identification_gln.xml +++ b/partner_identification_gln/data/partner_identification_gln.xml @@ -1,15 +1,15 @@ - - - - GLN Identification Number - gln_id_number - - - - GCP Identification Number - gcp_id_number - - - - \ No newline at end of file + + + + GLN Identification Number + gln_id_number + + + + GCP Identification Number + gcp_id_number + + + \ No newline at end of file diff --git a/partner_identification_gln/models/__init__.py b/partner_identification_gln/models/__init__.py index 4f649425e..de83392e6 100644 --- a/partner_identification_gln/models/__init__.py +++ b/partner_identification_gln/models/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2016 Acsone S.A. -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +# Copyright 2016-2017 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import partner diff --git a/partner_identification_gln/models/partner.py b/partner_identification_gln/models/partner.py index f04a835d9..9ea5f45e2 100644 --- a/partner_identification_gln/models/partner.py +++ b/partner_identification_gln/models/partner.py @@ -1,8 +1,11 @@ # -*- coding: utf-8 -*- -# © 2016 ACSONE SA/NV () +# Copyright 2016-2017 ACSONE SA/NV () # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + import logging -from openerp import api, models + +from odoo import api, models + _logger = logging.getLogger(__name__) try: diff --git a/partner_identification_gln/tests/__init__.py b/partner_identification_gln/tests/__init__.py index a064df9b0..56bc9598b 100644 --- a/partner_identification_gln/tests/__init__.py +++ b/partner_identification_gln/tests/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2016 Acsone S.A. -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +# Copyright 2016-2017 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import test_gln diff --git a/partner_identification_gln/tests/test_gln.py b/partner_identification_gln/tests/test_gln.py index 50f7459e3..9560ba6df 100644 --- a/partner_identification_gln/tests/test_gln.py +++ b/partner_identification_gln/tests/test_gln.py @@ -2,35 +2,37 @@ # Copyright 2016 Acsone S.A. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp.exceptions import ValidationError -from openerp.tests.common import TransactionCase +from odoo.exceptions import ValidationError +from odoo.tests.common import SavepointCase -class TestGLN(TransactionCase): - def setUp(self): - super(TestGLN, self).setUp() - self.partner = self.env['res.partner'].create({'name': 'TestGLN'}) - self.partner2 = self.env['res.partner'].create({'name': 'TestGLN2'}) - pc = self.env.ref('partner_identification_gln.' - 'partner_identification_gln_number_category') - self.partner_id_category = pc +class TestGLN(SavepointCase): - pc_gcp = self.env.ref('partner_identification_gln.' - 'partner_identification_gcp_number_category') - self.partner_id_gcp_category = pc_gcp + def setUp(cls): + super(TestGLN, cls).setUp() + cls.partner = cls.env['res.partner'].create({'name': 'TestGLN'}) + cls.partner2 = cls.env['res.partner'].create({'name': 'TestGLN2'}) + pc = cls.env.ref('partner_identification_gln.' + 'partner_identification_gln_number_category') + cls.partner_id_category = pc + + pc_gcp = cls.env.ref('partner_identification_gln.' + 'partner_identification_gcp_number_category') + cls.partner_id_gcp_category = pc_gcp def test_gln(self): # Good GLN - vals = {'name': '5450534001717', + vals = {'name': '5450534005852', 'category_id': self.partner_id_category.id } + self.partner.write({'id_numbers': [(0, 0, vals)]}) id_number = self.partner.id_numbers[0] - self.assertEqual(id_number.name, '5450534001717') + self.assertEqual(id_number.name, '5450534005852') # Duplicate GLN - vals = {'name': '5450534001717', + vals = {'name': '5450534005852', 'category_id': self.partner_id_category.id } @@ -44,6 +46,10 @@ class TestGLN(TransactionCase): with self.assertRaises(ValidationError): self.partner.write({'id_numbers': [(0, 0, vals)]}) + def test_gln_with_no_number(self): + self.assertFalse( + self.partner_id_category.validate_res_partner_gln(id_number=None)) + def test_gcp(self): # Good GLN vals = {'name': '545053', @@ -68,3 +74,8 @@ class TestGLN(TransactionCase): } with self.assertRaises(ValidationError): self.partner.write({'id_numbers': [(0, 0, vals)]}) + + def test_gcp_with_no_number(self): + self.assertFalse( + self.partner_id_gcp_category.validate_res_partner_gln( + id_number=None)) From 7bb312b89f2e1c24ba61c19c5fab45c990a17ca8 Mon Sep 17 00:00:00 2001 From: BT-aestebanez Date: Wed, 11 Sep 2019 14:55:53 +0200 Subject: [PATCH 4/4] [MIG] partner_identification_gln: Migration to 12.0 --- partner_identification_gln/README.rst | 1 + partner_identification_gln/__init__.py | 3 --- partner_identification_gln/__manifest__.py | 20 ++++++++++--------- .../data/partner_identification_gln.xml | 6 +++--- partner_identification_gln/i18n/sl.po | 18 +++++++++-------- partner_identification_gln/models/__init__.py | 5 +---- ...{partner.py => res_partner_id_category.py} | 5 ++--- partner_identification_gln/tests/__init__.py | 3 --- partner_identification_gln/tests/test_gln.py | 1 - 9 files changed, 28 insertions(+), 34 deletions(-) rename partner_identification_gln/models/{partner.py => res_partner_id_category.py} (94%) diff --git a/partner_identification_gln/README.rst b/partner_identification_gln/README.rst index de1d7da25..dbeb69323 100644 --- a/partner_identification_gln/README.rst +++ b/partner_identification_gln/README.rst @@ -39,6 +39,7 @@ Images Contributors ------------ +* Alvaro Estebanez * Denis Roussel * Meyomesse Gilles diff --git a/partner_identification_gln/__init__.py b/partner_identification_gln/__init__.py index 9e7304ea3..a9e337226 100644 --- a/partner_identification_gln/__init__.py +++ b/partner_identification_gln/__init__.py @@ -1,5 +1,2 @@ -# -*- coding: utf-8 -*- -# Copyright 2016-2017 ACSONE SA/NV () -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import models diff --git a/partner_identification_gln/__manifest__.py b/partner_identification_gln/__manifest__.py index ced0818dc..62482104e 100644 --- a/partner_identification_gln/__manifest__.py +++ b/partner_identification_gln/__manifest__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2016-2017 ACSONE SA/NV () # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). @@ -7,17 +6,20 @@ 'summary': """ This addon extends "Partner Identification Numbers" to provide a number category for GLN registration""", - 'version': '10.0.1.0.0', + 'version': '12.0.1.0.0', 'license': 'AGPL-3', 'author': 'Acsone S.A.,Odoo Community Association (OCA)', - 'website': 'https://www.acsone.eu', + 'website': 'https://github.com/OCA/partner-contact', 'external_dependencies': { - 'python': ['stdnum' - ], + 'python': [ + 'stdnum', + ], }, - 'depends': ['partner_identification' - ], - 'data': ['data/partner_identification_gln.xml' - ], + 'depends': [ + 'partner_identification', + ], + 'data': [ + 'data/partner_identification_gln.xml', + ], 'installable': True, } diff --git a/partner_identification_gln/data/partner_identification_gln.xml b/partner_identification_gln/data/partner_identification_gln.xml index e047a1ce7..132d539d4 100644 --- a/partner_identification_gln/data/partner_identification_gln.xml +++ b/partner_identification_gln/data/partner_identification_gln.xml @@ -2,14 +2,14 @@ - + GLN Identification Number gln_id_number - + GCP Identification Number gcp_id_number - \ No newline at end of file + diff --git a/partner_identification_gln/i18n/sl.po b/partner_identification_gln/i18n/sl.po index 7d951d030..b54d605c5 100644 --- a/partner_identification_gln/i18n/sl.po +++ b/partner_identification_gln/i18n/sl.po @@ -1,21 +1,18 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * partner_identification_gln -# -# Translators: -# Matjaž Mozetič , 2017 +# * partner_identification_gln +# msgid "" msgstr "" -"Project-Id-Version: Odoo Server 8.0\n" +"Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-06-01 03:23+0000\n" -"PO-Revision-Date: 2017-06-01 03:23+0000\n" +"POT-Creation-Date: 2019-09-11 11:05+0000\n" +"PO-Revision-Date: 2019-09-11 11:05+0000\n" "Last-Translator: Matjaž Mozetič , 2017\n" "Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: sl\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_identification_gln @@ -27,3 +24,8 @@ msgstr "GCP identifikacijska številka" #: model:res.partner.id_category,name:partner_identification_gln.partner_identification_gln_number_category msgid "GLN Identification Number" msgstr "GLN identifikacijska številka" + +#. module: partner_identification_gln +#: model:ir.model,name:partner_identification_gln.model_res_partner_id_category +msgid "Partner ID Category" +msgstr "Partnerjeve ID kategorije" diff --git a/partner_identification_gln/models/__init__.py b/partner_identification_gln/models/__init__.py index de83392e6..045a6d0d9 100644 --- a/partner_identification_gln/models/__init__.py +++ b/partner_identification_gln/models/__init__.py @@ -1,5 +1,2 @@ -# -*- coding: utf-8 -*- -# Copyright 2016-2017 ACSONE SA/NV () -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from . import partner +from . import res_partner_id_category diff --git a/partner_identification_gln/models/partner.py b/partner_identification_gln/models/res_partner_id_category.py similarity index 94% rename from partner_identification_gln/models/partner.py rename to partner_identification_gln/models/res_partner_id_category.py index 9ea5f45e2..63a7d4151 100644 --- a/partner_identification_gln/models/partner.py +++ b/partner_identification_gln/models/res_partner_id_category.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2016-2017 ACSONE SA/NV () # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). @@ -18,6 +17,7 @@ except ImportError: class ResPartnerIdCategory(models.Model): _inherit = 'res.partner.id_category' + @api.model def _search_duplicate(self, category_id, id_number, force_active=False): domain = [('category_id', '=', category_id), ('name', '=', id_number.name), @@ -26,8 +26,7 @@ class ResPartnerIdCategory(models.Model): if force_active: domain.append(('partner_id.active', '=', True)) - num_obj = self.env['res.partner.id_number'] - return num_obj.search(domain) + return self.env['res.partner.id_number'].search(domain) @api.multi def validate_res_partner_gln(self, id_number): diff --git a/partner_identification_gln/tests/__init__.py b/partner_identification_gln/tests/__init__.py index 56bc9598b..a7f8eb649 100644 --- a/partner_identification_gln/tests/__init__.py +++ b/partner_identification_gln/tests/__init__.py @@ -1,5 +1,2 @@ -# -*- coding: utf-8 -*- -# Copyright 2016-2017 ACSONE SA/NV () -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import test_gln diff --git a/partner_identification_gln/tests/test_gln.py b/partner_identification_gln/tests/test_gln.py index 9560ba6df..94b631afe 100644 --- a/partner_identification_gln/tests/test_gln.py +++ b/partner_identification_gln/tests/test_gln.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2016 Acsone S.A. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).