forked from pool/trytond
da3d9f9658
version bump OBS-URL: https://build.opensuse.org/request/show/959950 OBS-URL: https://build.opensuse.org/package/show/Application:ERP:GNUHealth:Factory/trytond?expand=0&rev=136
47 lines
2.0 KiB
Diff
47 lines
2.0 KiB
Diff
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 trytond import __version__
|
|
from trytond.pyson import PYSONEncoder, CONTEXT
|
|
from trytond.tools import grouped_slice
|
|
@@ -19,6 +19,8 @@
|
|
CDATA_START = re.compile(r'^\s*\<\!\[cdata\[', re.IGNORECASE)
|
|
CDATA_END = re.compile(r'\]\]\>\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
|
|
@@ -666,11 +671,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:
|