# HG changeset patch
# User szeka_wong <szeka.wong@xcg-consulting.fr>
# Date 1733317850 -3600
#      Wed Dec 04 14:10:50 2024 +0100
# Branch 18.0
# Node ID 9d0699193efd1676cb901117ee3863e2b53df46d
# Parent  2cce78dc03d08fd50ee82c986c98d95e2e79cdac
Evolve: Allow to skip update process.

diff --git a/NEWS.rst b/NEWS.rst
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -1,6 +1,11 @@
 Changelog
 =========
 
+18.0.2.0.2
+----------
+
+Evolve: Allow to skip update process.
+
 18.0.2.0.1
 ----------
 
diff --git a/__manifest__.py b/__manifest__.py
--- a/__manifest__.py
+++ b/__manifest__.py
@@ -21,7 +21,7 @@
     "name": "Converter",
     "license": "AGPL-3",
     "summary": "Convert odoo records to/from plain data structures.",
-    "version": "18.0.2.0.1",
+    "version": "18.0.2.0.2",
     "category": "Hidden",
     "author": "XCG Consulting",
     "website": "https://orbeet.io/",
diff --git a/base.py b/base.py
--- a/base.py
+++ b/base.py
@@ -111,7 +111,7 @@
         message_value: Any,
         instance: models.BaseModel,
         value_present: bool = True,
-    ) -> dict:
+    ) -> dict | SkipType:
         """From a message, returns a dict.
         Only field whose values are changed are included in the returned dict.
         :param odoo_env: odoo environment
@@ -252,6 +252,9 @@
         changes = converter.message_to_odoo(
             odoo_env, PHASE_PRECREATE, payload, instance
         )
+        if isinstance(changes, SkipType):
+            return odoo_env[model_name]
+
         instance = odoo_env[model_name].create(changes)
         changes = converter.message_to_odoo(
             odoo_env, PHASE_POSTCREATE, payload, instance
@@ -262,6 +265,9 @@
         operation is None and not instance or instance is Newinstance
     ):
         changes = converter.message_to_odoo(odoo_env, PHASE_UPDATE, payload, instance)
+        if isinstance(changes, SkipType):
+            return odoo_env[model_name]
+
         if changes:
             instance.write(changes)
     if hasattr(converter, "post_hook"):
# HG changeset patch
# User szeka_wong <szeka.wong@xcg-consulting.fr>
# Date 1733381191 -3600
#      Thu Dec 05 07:46:31 2024 +0100
# Branch 18.0
# Node ID 164d8181eccbe2cad4de41dd1f0a4636e61207ca
# Parent  9d0699193efd1676cb901117ee3863e2b53df46d
mypy

diff --git a/model.py b/model.py
--- a/model.py
+++ b/model.py
@@ -35,6 +35,7 @@
     NewinstanceType,
     PostHookConverter,
     Skip,
+    SkipType,
     build_context,
 )
 from .validate import NotInitialized, Validation, Validator
@@ -131,8 +132,8 @@
         message_value: Any,
         instance: models.BaseModel,
         value_present: bool = True,
-    ) -> dict:
-        values = OrderedDict()
+    ) -> dict | SkipType:
+        values: dict[str, Any] = OrderedDict()
 
         if self._type is not None and message_value["__type__"] != self._type:
             raise Exception(
@@ -142,21 +143,22 @@
             )
         for key in self._converters:
             value = message_value.get(key, None) if message_value else None
-            values.update(
-                self._converters[key].message_to_odoo(
-                    odoo_env,
-                    phase,
-                    value,
-                    instance,
-                    message_value and key in message_value,
-                )
+            attribute_vals = self._converters[key].message_to_odoo(
+                odoo_env,
+                phase,
+                value,
+                instance,
+                message_value and key in message_value,
             )
+            if isinstance(attribute_vals, SkipType):
+                continue
+            values.update(attribute_vals)
         if self.merge_with:
             for conv in self.merge_with:
                 value = conv.message_to_odoo(
                     odoo_env, phase, message_value, instance, value_present
                 )
-                if value is Skip:
+                if isinstance(value, SkipType):
                     continue
                 values.update(value)
 
diff --git a/switch.py b/switch.py
--- a/switch.py
+++ b/switch.py
@@ -90,7 +90,7 @@
         message_value: Any,
         instance: models.BaseModel,
         value_present: bool = True,
-    ) -> dict:
+    ) -> dict | SkipType:
         for _out_cond, in_cond, converter in self._converters:
             if in_cond is None or in_cond(message_value):
                 return converter.message_to_odoo(
# HG changeset patch
# User Balde Oury <oury.balde@xcg-consulting.fr>
# Date 1733478777 0
#      Fri Dec 06 09:52:57 2024 +0000
# Branch 18.0
# Node ID 383f632a4f838b9a8bab8f64dcdc41411dd42ebf
# Parent  164d8181eccbe2cad4de41dd1f0a4636e61207ca
Added tag 18.0.2.0.2 for changeset 164d8181eccb

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -23,3 +23,4 @@
 5a1baf89bc2866b34404f18a5ad993d232561310 18.0.1.0.0
 57ff6dfcaa1073edec1480053c03c00589107bbd 18.0.2.0.0
 11e3f9c0aeb967bddba69561086eab91dd5b1990 18.0.2.0.1
+164d8181eccbe2cad4de41dd1f0a4636e61207ca 18.0.2.0.2