Accepting request 927821 from Application:ERP:GNUHealth:3.8

- Update_changed_fields.diff added to force update of XML files

OBS-URL: https://build.opensuse.org/request/show/927821
OBS-URL: https://build.opensuse.org/package/show/Application:ERP:GNUHealth:Factory/trytond?expand=0&rev=131
This commit is contained in:
Axel Braun 2021-10-27 16:18:24 +00:00 committed by Git OBS Bridge
parent 825458738f
commit e8dafbec28
3 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,47 @@
diff --git a/trytond/convert.py b/trytond/convert.py
index c1dde99f19ae579d3d84d0e9f75272ea857f86f1..b57f1c710aefb7579d4edd9d07baad30df23ba8b 100644
--- a/trytond/convert.py
+++ b/trytond/convert.py
@@ -9,6 +9,8 @@ import re
from collections import defaultdict
from decimal import Decimal
+from trytond.config import config
+
from . import __version__
from .tools import grouped_slice
from .transaction import Transaction
@@ -19,6 +21,9 @@ logger = logging.getLogger(__name__)
CDATA_START = re.compile('^\s*\<\!\[cdata\[', re.IGNORECASE)
CDATA_END = re.compile('\]\]\>\s*$', re.IGNORECASE)
+_update_changed_fields = config.getboolean('optional',
+ 'update_changed_fields', default=True)
+
class DummyTagHandler:
"""Dubhandler implementing empty methods. Will be used when whe
@@ -668,11 +673,18 @@ class TrytondXmlHandler(sax.handler.ContentHandler):
# if they are not false in a boolean context (ie None,
# False, {} or [])
if db_field != expected_value and (db_field or expected_value):
- logger.warning(
- "Field %s of %s@%s not updated (id: %s), because "
- "it has changed since the last update",
- key, record.id, model, fs_id)
- continue
+ if _update_changed_fields:
+ logger.warning(
+ "Field %s of %s@%s (id: %s) "
+ "has changed since the last update\n"
+ "It will be nevertheless updated",
+ key, record.id, model, fs_id)
+ else:
+ logger.warning(
+ "Field %s of %s@%s not updated (id: %s), because "
+ "it has changed since the last update",
+ key, record.id, model, fs_id)
+ continue
# so, the field in the fs and in the db are different,
# and no user changed the value in the db:

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Oct 27 16:15:35 UTC 2021 - Axel Braun <axel.braun@gmx.de>
- Update_changed_fields.diff added to force update of XML files
-------------------------------------------------------------------
Tue Jul 27 14:04:30 UTC 2021 - Axel Braun <axel.braun@gmx.de>

View File

@ -37,6 +37,7 @@ Source20: %{name}.service
Patch0: fix_werkzeug.patch
Patch1: revert_werkzeug_setup.patch
Patch2: fix_werkzeug_2.x.patch
Patch3: Update_changed_fields.diff
BuildRequires: fdupes
BuildRequires: python3-Werkzeug
BuildRequires: python3-bcrypt
@ -84,6 +85,7 @@ cp %{SOURCE1} .
cp %{SOURCE2} .
%patch0 -p1
%patch1 -p1
%patch3 -p1
#Werkzeug2 is not compatible with Werkzeug 1.x, so we need a conditional patch
echo 0%{?suse_version}