Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Odoo scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
XCG
Odoo scripts
Commits
c2d17425f1f0
Commit
c2d17425f1f0
authored
5 years ago
by
Vincent Hatakeyama
Browse files
Options
Downloads
Patches
Plain Diff
fix errors when using import_jsonrpc
parent
e06a5f573fba
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
odoo_scripts/import_jsonrpc.py
+6
-5
6 additions, 5 deletions
odoo_scripts/import_jsonrpc.py
with
6 additions
and
5 deletions
odoo_scripts/import_jsonrpc.py
+
6
−
5
View file @
c2d17425
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment