Added save command
This commit is contained in:
parent
f3a7ab8ac4
commit
d82268bd90
10
remote.py
10
remote.py
|
@ -410,11 +410,17 @@ def save( model, domains, recurse = False, force = False ):
|
||||||
to_browse = groupby_model( unique_models )
|
to_browse = groupby_model( unique_models )
|
||||||
|
|
||||||
for mod in to_browse.keys():
|
for mod in to_browse.keys():
|
||||||
print('loading %s %s' % (to_browse[mod].length, mod) )
|
print('loading %s %s' % (len(to_browse[mod]), mod) )
|
||||||
if mod in odoo.env:
|
if mod in odoo.env:
|
||||||
try:
|
try:
|
||||||
for inst in odoo.env[mod].browse( to_browse[mod] ):
|
for inst in odoo.env[mod].browse( to_browse[mod] ):
|
||||||
print( inst.id, inst.name )
|
filename = json_path( mod, inst.id )
|
||||||
|
print( inst.id, inst.name, ' > ', filename )
|
||||||
|
# Write pretty print JSON data to file
|
||||||
|
with open( filename, "w") as write_file:
|
||||||
|
json.dump(data, write_file, indent=4)
|
||||||
|
print( "%s written" % (filename) )
|
||||||
|
|
||||||
except:
|
except:
|
||||||
eprint('Model %s not found' % (mod) )
|
eprint('Model %s not found' % (mod) )
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue