Skip to content
Snippets Groups Projects
Commit c2d17425f1f0 authored by Vincent Hatakeyama's avatar Vincent Hatakeyama
Browse files

:ambulance: fix errors when using import_jsonrpc

parent e06a5f573fba
No related branches found
No related tags found
No related merge requests found
...@@ -12,5 +12,5 @@ ...@@ -12,5 +12,5 @@
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
__version__ = "1.0.0" __version__ = "1.0.1"
__date__ = "2020-02-17" __date__ = "2020-02-17"
...@@ -16,5 +16,5 @@ ...@@ -16,5 +16,5 @@
__date__ = "2020-02-17" __date__ = "2020-02-17"
__updated__ = "2020-02-17" __updated__ = "2020-02-26"
def import_with_jsonrpc( def import_with_jsonrpc(
...@@ -66,6 +66,6 @@ ...@@ -66,6 +66,6 @@
return value in (1, "1", "True", "true", True) return value in (1, "1", "True", "true", True)
def _convert_int(value) -> int: def _convert_int(value) -> int:
return int(value) return int(value) if value else 0
def _convert_float(value) -> float: def _convert_float(value) -> float:
...@@ -70,6 +70,6 @@ ...@@ -70,6 +70,6 @@
def _convert_float(value) -> float: def _convert_float(value) -> float:
return float(value) return float(value) if value else 0.0
def _convert_many2one(xmlid: str) -> Union[None, int]: def _convert_many2one(xmlid: str) -> Union[None, int]:
if xmlid: if xmlid:
...@@ -109,6 +109,7 @@ ...@@ -109,6 +109,7 @@
): ):
odoo_field_name = column_name[:-3] odoo_field_name = column_name[:-3]
if odoo_field_name != "id": if odoo_field_name != "id":
_logger.debug('%s: %s', model, odoo_field_name)
field = _get_imf(model, odoo_field_name) field = _get_imf(model, odoo_field_name)
ttype = field.ttype ttype = field.ttype
_logger.info( _logger.info(
...@@ -135,7 +136,7 @@ ...@@ -135,7 +136,7 @@
converter = _convert_many2many converter = _convert_many2many
elif ttype in ("integer",): elif ttype in ("integer",):
converter = _convert_int converter = _convert_int
elif ttype in ("float",): elif ttype in ("float", "monetary"):
converter = _convert_float converter = _convert_float
else: else:
_logger.warning("Unknown field type %s", ttype) _logger.warning("Unknown field type %s", ttype)
......
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