Browse Source

[12.0][MIG] partner_address_version: Migration to 12.0

14.0
kevinkhao 5 years ago
committed by Kevin Khao
parent
commit
2ea0e7eaf7
  1. 21
      partner_address_version/README.rst
  2. 1
      partner_address_version/__init__.py
  3. 3
      partner_address_version/__manifest__.py
  4. 3
      partner_address_version/models/res_partner.py
  5. 1
      partner_address_version/readme/CONTRIBUTORS.rst
  6. 10
      partner_address_version/readme/DESCRIPTION.rst
  7. 17
      partner_address_version/static/description/index.html
  8. 5
      partner_address_version/tests/test_address_version.py

21
partner_address_version/README.rst

@ -14,23 +14,25 @@ Partner Address Version
: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/10.0/partner_address_version
:target: https://github.com/OCA/partner-contact/tree/12.0/partner_address_version
: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-10-0/partner-contact-10-0-partner_address_version
:target: https://translation.odoo-community.org/projects/partner-contact-12-0/partner-contact-12-0-partner_address_version
: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/10.0
:target: https://runbot.odoo-community.org/runbot/134/12.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
This module allows to manage versions for partner addresses.
This module allows you to manage versions for partner addresses.
You can define a list of versionned fields, for instance address, country, ...
Those fields cannot be changed once an address is versionned.
A list of fields are defined for versioning. These are immutable once set, and force the user to create a new partner
if they want to change one of these fields.
This can be useful to know where a sale order has been delivered even after several changes on the partner addresses.
This forces historical consistency. For example, the moment you confirm a
sale order, you might want to lock the address of that sale order instead of having it
change everytime that partner is modified (see e.g sale_partner_version).
**Table of contents**
@ -43,7 +45,7 @@ Bug Tracker
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.
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_address_version%0Aversion:%2010.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_address_version%0Aversion:%2012.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.
@ -59,6 +61,7 @@ Contributors
~~~~~~~~~~~~
* Benoît Guillot <benoit.guillot@akretion.com>
* Kevin Khao <kevin.khao@akretion.com>
Maintainers
~~~~~~~~~~~
@ -73,6 +76,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 <https://github.com/OCA/partner-contact/tree/10.0/partner_address_version>`_ project on GitHub.
This module is part of the `OCA/partner-contact <https://github.com/OCA/partner-contact/tree/12.0/partner_address_version>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

1
partner_address_version/__init__.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Akretion - Benoît Guillot
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

3
partner_address_version/__manifest__.py

@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Akretion - Benoît Guillot
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Partner Address Version",
"version": "10.0.1.0.0",
"version": "12.0.1.0.0",
"author": "Akretion, " "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/partner-contact",
"category": "CRM",

3
partner_address_version/models/res_partner.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Akretion - Benoît Guillot
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
@ -55,7 +54,7 @@ class ResPartner(models.Model):
version[field] = parent_id
elif self[field]:
version[field] = self[field]
version_hash = hashlib.md5(str(version)).hexdigest()
version_hash = hashlib.md5(str(version).encode("utf-8")).hexdigest()
return version_hash
@api.multi

1
partner_address_version/readme/CONTRIBUTORS.rst

@ -1 +1,2 @@
* Benoît Guillot <benoit.guillot@akretion.com>
* Kevin Khao <kevin.khao@akretion.com>

10
partner_address_version/readme/DESCRIPTION.rst

@ -1,6 +1,8 @@
This module allows to manage versions for partner addresses.
This module allows you to manage versions for partner addresses.
You can define a list of versionned fields, for instance address, country, ...
Those fields cannot be changed once an address is versionned.
A list of fields are defined for versioning. These are immutable once set, and force the user to create a new partner
if they want to change one of these fields.
This can be useful to know where a sale order has been delivered even after several changes on the partner addresses.
This forces historical consistency. For example, the moment you confirm a
sale order, you might want to lock the address of that sale order instead of having it
change everytime that partner is modified (see e.g sale_partner_version).

17
partner_address_version/static/description/index.html

@ -367,11 +367,13 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! 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/10.0/partner_address_version"><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-10-0/partner-contact-10-0-partner_address_version"><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/10.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module allows to manage versions for partner addresses.</p>
<p>You can define a list of versionned fields, for instance address, country, …
Those fields cannot be changed once an address is versionned.</p>
<p>This can be useful to know where a sale order has been delivered even after several changes on the partner addresses.</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/12.0/partner_address_version"><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_address_version"><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>This module allows you to manage versions for partner addresses.</p>
<p>A list of fields are defined for versioning. These are immutable once set, and force the user to create a new partner
if they want to change one of these fields.</p>
<p>This forces historical consistency. For example, the moment you confirm a
sale order, you might want to lock the address of that sale order instead of having it
change everytime that partner is modified (see e.g sale_partner_version).</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
@ -389,7 +391,7 @@ Those fields cannot be changed once an address is versionned.</p>
<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.
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_address_version%0Aversion:%2010.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_address_version%0Aversion:%2012.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>
</div>
<div class="section" id="credits">
@ -404,6 +406,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<h2><a class="toc-backref" href="#id4">Contributors</a></h2>
<ul class="simple">
<li>Benoît Guillot &lt;<a class="reference external" href="mailto:benoit.guillot&#64;akretion.com">benoit.guillot&#64;akretion.com</a>&gt;</li>
<li>Kevin Khao &lt;<a class="reference external" href="mailto:kevin.khao&#64;akretion.com">kevin.khao&#64;akretion.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
@ -413,7 +416,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/partner-contact/tree/10.0/partner_address_version">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/12.0/partner_address_version">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>
</div>
</div>

5
partner_address_version/tests/test_address_version.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Akretion - Benoît Guillot
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
@ -30,7 +29,9 @@ class TestAddressVersion(SavepointCase):
cls.partner_vals.update({"parent_id": cls.partner.id})
def test_hash(self):
test_hash = hashlib.md5(str(self.partner_vals)).hexdigest()
test_hash = hashlib.md5(
str(self.partner_vals).encode("utf-8")
).hexdigest()
self.assertEqual(test_hash, self.partner.get_version_hash())
def test_create_version_partner(self):

Loading…
Cancel
Save