Skip to content
Snippets Groups Projects
Commit 164d8181eccb authored by szeka.wong's avatar szeka.wong
Browse files

mypy

parent 9d0699193efd
No related branches found
No related tags found
1 merge request!54skip-update-process
......@@ -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,12 +143,10 @@
)
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,
)
......@@ -153,6 +152,9 @@
)
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
)
......@@ -154,9 +156,9 @@
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)
......
......@@ -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(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment