diff --git a/base_partner_sequence/README.rst b/base_partner_sequence/README.rst index b36e30e88..bc79298bb 100644 --- a/base_partner_sequence/README.rst +++ b/base_partner_sequence/README.rst @@ -14,13 +14,13 @@ Add a sequence on customers' code :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |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/base_partner_sequence + :target: https://github.com/OCA/partner-contact/tree/13.0/base_partner_sequence :alt: OCA/partner-contact .. |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-base_partner_sequence + :target: https://translation.odoo-community.org/projects/partner-contact-13-0/partner-contact-13-0-base_partner_sequence :alt: Translate me on Weblate .. |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 |badge1| |badge2| |badge3| |badge4| |badge5| @@ -48,7 +48,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. @@ -77,6 +77,7 @@ Contributors * Akim Juillerat * Cas Vissers * Quentin Groulard +* Kevin Khao Maintainers ~~~~~~~~~~~ @@ -91,6 +92,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/partner-contact `_ project on GitHub. +This module is part of the `OCA/partner-contact `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/base_partner_sequence/__init__.py b/base_partner_sequence/__init__.py index cfc40a3ea..43b53da2b 100644 --- a/base_partner_sequence/__init__.py +++ b/base_partner_sequence/__init__.py @@ -1,4 +1,4 @@ -# 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 . import models from . import tests diff --git a/base_partner_sequence/__manifest__.py b/base_partner_sequence/__manifest__.py index 4a65e8aae..a3cce5e6e 100644 --- a/base_partner_sequence/__manifest__.py +++ b/base_partner_sequence/__manifest__.py @@ -1,8 +1,8 @@ -# Copyright 2004-2009 Tiny SPRL (). -# Copyright 2013 initOS GmbH & Co. KG (). +# Copyright 2004-2009 Tiny SPRL (). +# Copyright 2013 initOS GmbH & Co. KG (). # Copyright 2016 Tecnativa - Vicent Cubells -# Copyright 2016 Camptocamp - Akim Juillerat (). -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# Copyright 2016 Camptocamp - Akim Juillerat (). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "author": ( "Tiny/initOS GmbH & Co. KG," @@ -12,7 +12,7 @@ "Odoo Community Association (OCA)" ), "name": "Add a sequence on customers' code", - "version": "12.0.1.0.0", + "version": "13.0.1.0.0", "development_status": "Production/Stable", "category": "Generic Modules/Base", "website": "https://github.com/OCA/partner-contact", diff --git a/base_partner_sequence/data/partner_sequence.xml b/base_partner_sequence/data/partner_sequence.xml index 77e3f7674..45c6b5cbc 100644 --- a/base_partner_sequence/data/partner_sequence.xml +++ b/base_partner_sequence/data/partner_sequence.xml @@ -1,6 +1,6 @@ - + Partner code res.partner P/ diff --git a/base_partner_sequence/models/__init__.py b/base_partner_sequence/models/__init__.py index 35c698ed9..7c9f3e048 100644 --- a/base_partner_sequence/models/__init__.py +++ b/base_partner_sequence/models/__init__.py @@ -1,3 +1,3 @@ -# 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 . import partner diff --git a/base_partner_sequence/models/partner.py b/base_partner_sequence/models/partner.py index 4249258b9..c4a631cd8 100644 --- a/base_partner_sequence/models/partner.py +++ b/base_partner_sequence/models/partner.py @@ -1,8 +1,8 @@ -# Copyright 2004-2009 Tiny SPRL (). -# Copyright 2013 initOS GmbH & Co. KG (). +# Copyright 2004-2009 Tiny SPRL (). +# Copyright 2013 initOS GmbH & Co. KG (). # Copyright 2016 Tecnativa - Vicent Cubells -# Copyright 2016 Camptocamp - Akim Juillerat (). -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# Copyright 2016 Camptocamp - Akim Juillerat (). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import _, api, exceptions, models @@ -12,38 +12,34 @@ class ResPartner(models.Model): _inherit = "res.partner" - @api.multi def _get_next_ref(self, vals=None): return self.env["ir.sequence"].next_by_code("res.partner") @api.model def create(self, vals): - if not vals.get("ref") and self._needsRef(vals=vals): + if not vals.get("ref") and self._needs_ref(vals=vals): vals["ref"] = self._get_next_ref(vals=vals) return super(ResPartner, self).create(vals) - @api.multi def copy(self, default=None): default = default or {} - if self._needsRef(): + if self._needs_ref(): default["ref"] = self._get_next_ref() - return super(ResPartner, self).copy(default) + return super(ResPartner, self).copy(default=default) - @api.multi def write(self, vals): for partner in self: partner_vals = vals.copy() if ( not partner_vals.get("ref") - and partner._needsRef(partner_vals) + and partner._needs_ref(vals=partner_vals) and not partner.ref ): partner_vals["ref"] = partner._get_next_ref(vals=partner_vals) super(ResPartner, partner).write(partner_vals) return True - @api.multi - def _needsRef(self, vals=None): + def _needs_ref(self, vals=None): """ Checks whether a sequence value should be assigned to a partner's 'ref' diff --git a/base_partner_sequence/readme/CONTRIBUTORS.rst b/base_partner_sequence/readme/CONTRIBUTORS.rst index 5733f64db..4d8c53a1c 100644 --- a/base_partner_sequence/readme/CONTRIBUTORS.rst +++ b/base_partner_sequence/readme/CONTRIBUTORS.rst @@ -9,3 +9,4 @@ * Akim Juillerat * Cas Vissers * Quentin Groulard +* Kevin Khao diff --git a/base_partner_sequence/static/description/index.html b/base_partner_sequence/static/description/index.html index a0bfdd8b7..8d36d6083 100644 --- a/base_partner_sequence/static/description/index.html +++ b/base_partner_sequence/static/description/index.html @@ -367,7 +367,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Production/Stable License: AGPL-3 OCA/partner-contact Translate me on Weblate Try me on Runbot

+

Production/Stable License: AGPL-3 OCA/partner-contact Translate me on Weblate Try me on Runbot

This module adds the possibility to define a sequence for the partner’s reference. This reference is then set as default when you create a new partner, using the defined sequence.

@@ -394,7 +394,7 @@ invoice addresses.

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.

@@ -422,6 +422,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
  • Akim Juillerat <akim.juillerat@camptocamp.com>
  • Cas Vissers <c.vissers@brahoo.nl>
  • Quentin Groulard <quentin.groulard@acsone.eu>
  • +
  • Kevin Khao <kevinkhao@gmail.com>
  • @@ -431,7 +432,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/partner-contact project on GitHub.

    +

    This module is part of the OCA/partner-contact project on GitHub.

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

    diff --git a/base_partner_sequence/tests/__init__.py b/base_partner_sequence/tests/__init__.py index 0cc5181d2..768a6b300 100644 --- a/base_partner_sequence/tests/__init__.py +++ b/base_partner_sequence/tests/__init__.py @@ -1,3 +1,3 @@ -# 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 . import test_base_partner_sequence diff --git a/base_partner_sequence/tests/test_base_partner_sequence.py b/base_partner_sequence/tests/test_base_partner_sequence.py index 0a1bcfc42..e54e542e0 100644 --- a/base_partner_sequence/tests/test_base_partner_sequence.py +++ b/base_partner_sequence/tests/test_base_partner_sequence.py @@ -1,6 +1,6 @@ -# Copyright 2015 ACSONE SA/NV (). +# Copyright 2015 ACSONE SA/NV (). # Copyright 2016 Tecnativa - Vicent Cubells -# 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). import odoo.tests.common as common @@ -20,7 +20,7 @@ class TestBasePartnerSequence(common.TransactionCase): copy = self.partner.copy() self.assertTrue( - copy.ref, "A partner with ref created by copy " "has a ref by default." + copy.ref, "A partner with ref created by copy has a ref by default." ) def test_ref_sequence_on_contact(self): @@ -33,13 +33,11 @@ class TestBasePartnerSequence(common.TransactionCase): } ) self.assertEqual( - self.partner.ref, - contact.ref, - "All it's ok as sequence doesn't " "increase.", + self.partner.ref, contact.ref, "All it's ok as sequence doesn't increase." ) def test_unique_ref_on_write(self): - """Assert that create and write gives a different refs if we """ + """Assert that on create or on write, a different ref is assigned""" vals = [ {"name": "test1", "email": "test@test.com"}, {"name": "test2", "email": "test@test.com"},