From 748345c0b253cd0ff650a21fe4dace160b80e374 Mon Sep 17 00:00:00 2001
From: Ronald Portier
Date: Fri, 21 Aug 2020 12:09:22 +0200
Subject: [PATCH] [FIX] base_external_system. Solve test error.
Testing fingerprint, with ignore_finger_print set to False, caused an error, because it would first set
ignore_fingerprint to False, then validate, never getting to actually setting the fingerprint, causing the
following stacktrace:
Traceback (most recent call last):
File "/home/travis/build/OCA/server-backend/base_external_system/tests/test_external_system.py", line 28, in test_check_fingerprint_allowed
self.record.write({"ignore_fingerprint": False, "fingerprint": "Data"})
File "/home/travis/odoo-13.0/odoo/models.py", line 3573, in write
fields[0].determine_inverse(real_recs)
File "/home/travis/odoo-13.0/odoo/fields.py", line 1122, in determine_inverse
self.inverse(records)
File "/home/travis/odoo-13.0/odoo/fields.py", line 594, in _inverse_related
target[field.name] = record_value[record]
File "/home/travis/odoo-13.0/odoo/models.py", line 5629, in __setitem__
return self._fields[key].__set__(self, value)
File "/home/travis/odoo-13.0/odoo/fields.py", line 1087, in __set__
records.write({self.name: write_value})
File "/home/travis/odoo-13.0/odoo/models.py", line 3568, in write
real_recs._validate_fields(set(vals) - set(inverse_fields))
File "/home/travis/odoo-13.0/odoo/models.py", line 1176, in _validate_fields
check(self)
---
base_external_system/README.rst | 11 ++---
.../i18n/base_external_system.pot | 41 ++++++++++++-------
.../static/description/index.html | 7 ++--
.../tests/test_external_system.py | 5 ++-
4 files changed, 41 insertions(+), 23 deletions(-)
diff --git a/base_external_system/README.rst b/base_external_system/README.rst
index 6874e904..8e8271b8 100644
--- a/base_external_system/README.rst
+++ b/base_external_system/README.rst
@@ -14,13 +14,13 @@ Base External System
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--backend-lightgray.png?logo=github
- :target: https://github.com/OCA/server-backend/tree/12.0/base_external_system
+ :target: https://github.com/OCA/server-backend/tree/13.0/base_external_system
:alt: OCA/server-backend
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/server-backend-12-0/server-backend-12-0-base_external_system
+ :target: https://translation.odoo-community.org/projects/server-backend-13-0/server-backend-13-0-base_external_system
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/253/12.0
+ :target: https://runbot.odoo-community.org/runbot/253/13.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -85,7 +85,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.
@@ -102,6 +102,7 @@ Contributors
* Dave Lasley
* Alexandre Díaz
+* Ronald Portier
Maintainers
~~~~~~~~~~~
@@ -116,6 +117,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/server-backend `_ project on GitHub.
+This module is part of the `OCA/server-backend `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/base_external_system/i18n/base_external_system.pot b/base_external_system/i18n/base_external_system.pot
index 774c41d3..905e061f 100644
--- a/base_external_system/i18n/base_external_system.pot
+++ b/base_external_system/i18n/base_external_system.pot
@@ -1,12 +1,12 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
-# * base_external_system
+# * base_external_system
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 12.0\n"
+"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
-"Last-Translator: <>\n"
+"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -28,7 +28,7 @@ msgid "Companies"
msgstr ""
#. module: base_external_system
-#: sql_constraint:external.system:0
+#: model:ir.model.constraint,message:base_external_system.constraint_external_system_name_uniq
msgid "Connection name must be unique."
msgstr ""
@@ -85,7 +85,7 @@ msgid "Fingerprint"
msgstr ""
#. module: base_external_system
-#: code:addons/base_external_system/models/external_system.py:90
+#: code:addons/base_external_system/models/external_system.py:0
#, python-format
msgid "Fingerprint cannot be empty when Ignore Fingerprint is not checked."
msgstr ""
@@ -204,7 +204,9 @@ msgstr ""
#: model:ir.model.fields,help:base_external_system.field_external_system__ignore_fingerprint
#: model:ir.model.fields,help:base_external_system.field_external_system_adapter__ignore_fingerprint
#: model:ir.model.fields,help:base_external_system.field_external_system_os__ignore_fingerprint
-msgid "Set this to `True` in order to ignore an invalid/unknown fingerprint from the system."
+msgid ""
+"Set this to `True` in order to ignore an invalid/unknown fingerprint from "
+"the system."
msgstr ""
#. module: base_external_system
@@ -226,7 +228,7 @@ msgid "Test Connection"
msgstr ""
#. module: base_external_system
-#: code:addons/base_external_system/models/external_system_adapter.py:70
+#: code:addons/base_external_system/models/external_system_adapter.py:0
#, python-format
msgid "The connection was a success."
msgstr ""
@@ -249,28 +251,36 @@ msgstr ""
#: model:ir.model.fields,help:base_external_system.field_external_system__fingerprint
#: model:ir.model.fields,help:base_external_system.field_external_system_adapter__fingerprint
#: model:ir.model.fields,help:base_external_system.field_external_system_os__fingerprint
-msgid "This is the fingerprint that is advertised by this system in order to validate its identity."
+msgid ""
+"This is the fingerprint that is advertised by this system in order to "
+"validate its identity."
msgstr ""
#. module: base_external_system
#: model:ir.model.fields,help:base_external_system.field_external_system__interface
#: model:ir.model.fields,help:base_external_system.field_external_system_adapter__interface
#: model:ir.model.fields,help:base_external_system.field_external_system_os__interface
-msgid "This is the interface that this system represents. It is created automatically upon creation of the external system."
+msgid ""
+"This is the interface that this system represents. It is created "
+"automatically upon creation of the external system."
msgstr ""
#. module: base_external_system
#: model:ir.model.fields,help:base_external_system.field_external_system__password
#: model:ir.model.fields,help:base_external_system.field_external_system_adapter__password
#: model:ir.model.fields,help:base_external_system.field_external_system_os__password
-msgid "This is the password that is used for authenticating to this system, if applicable."
+msgid ""
+"This is the password that is used for authenticating to this system, if "
+"applicable."
msgstr ""
#. module: base_external_system
#: model:ir.model.fields,help:base_external_system.field_external_system__private_key_password
#: model:ir.model.fields,help:base_external_system.field_external_system_adapter__private_key_password
#: model:ir.model.fields,help:base_external_system.field_external_system_os__private_key_password
-msgid "This is the password to unlock the private key that was provided for this sytem."
+msgid ""
+"This is the password to unlock the private key that was provided for this "
+"sytem."
msgstr ""
#. module: base_external_system
@@ -284,14 +294,18 @@ msgstr ""
#: model:ir.model.fields,help:base_external_system.field_external_system__private_key
#: model:ir.model.fields,help:base_external_system.field_external_system_adapter__private_key
#: model:ir.model.fields,help:base_external_system.field_external_system_os__private_key
-msgid "This is the private key that is used for authenticating to this system, if applicable."
+msgid ""
+"This is the private key that is used for authenticating to this system, if "
+"applicable."
msgstr ""
#. module: base_external_system
#: model:ir.model.fields,help:base_external_system.field_external_system__username
#: model:ir.model.fields,help:base_external_system.field_external_system_adapter__username
#: model:ir.model.fields,help:base_external_system.field_external_system_os__username
-msgid "This is the username that is used for authenticating to this system, if applicable."
+msgid ""
+"This is the username that is used for authenticating to this system, if "
+"applicable."
msgstr ""
#. module: base_external_system
@@ -301,4 +315,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:base_external_system.external_system_view_search
msgid "Username"
msgstr ""
-
diff --git a/base_external_system/static/description/index.html b/base_external_system/static/description/index.html
index 4bada30a..ba65825f 100644
--- a/base_external_system/static/description/index.html
+++ b/base_external_system/static/description/index.html
@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-

+

This module provides an interface/adapter mechanism for the definition of remote
systems.
Note that this module stores everything in plain text. In the interest of security,
@@ -431,7 +431,7 @@ to be defined if the connection destroys itself.
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.
@@ -447,6 +447,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
@@ -456,7 +457,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/server-backend project on GitHub.
+
This module is part of the OCA/server-backend project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/base_external_system/tests/test_external_system.py b/base_external_system/tests/test_external_system.py
index 20dee9be..ab264728 100644
--- a/base_external_system/tests/test_external_system.py
+++ b/base_external_system/tests/test_external_system.py
@@ -25,7 +25,10 @@ class TestExternalSystem(Common):
def test_check_fingerprint_allowed(self):
"""It should not raise a validation error if there is a fingerprint."""
- self.record.write({"ignore_fingerprint": False, "fingerprint": "Data"})
+ # In Odoo 13.0, due to the way inverse records (models inherited from)
+ # are handled, setting both fields at the same time causes an error.
+ self.record.write({"fingerprint": "Data"})
+ self.record.write({"ignore_fingerprint": False})
self.assertTrue(True)
def test_client(self):