Added save command
This commit is contained in:
parent
d82268bd90
commit
387671e8ad
16
remote.py
16
remote.py
|
@ -413,18 +413,20 @@ def save( model, domains, recurse = False, force = False ):
|
||||||
print('loading %s %s' % (len(to_browse[mod]), 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] ):
|
list = odoo.env[mod].browse( to_browse[mod] )
|
||||||
|
except:
|
||||||
|
eprint('Model %s not found' % (mod) )
|
||||||
|
continue
|
||||||
|
|
||||||
|
if list:
|
||||||
|
for inst in list:
|
||||||
filename = json_path( mod, inst.id )
|
filename = json_path( mod, inst.id )
|
||||||
print( inst.id, inst.name, ' > ', filename )
|
print( inst.id, inst.name, ' > ', filename )
|
||||||
# Write pretty print JSON data to file
|
# Write pretty print JSON data to file
|
||||||
with open( filename, "w") as write_file:
|
with open( filename, "w") as write_file:
|
||||||
json.dump(data, write_file, indent=4)
|
json.dump(inst.read()[0], write_file, indent=4)
|
||||||
print( "%s written" % (filename) )
|
print( "%s written" % (filename) )
|
||||||
|
|
||||||
except:
|
|
||||||
eprint('Model %s not found' % (mod) )
|
|
||||||
continue
|
|
||||||
# list = odoo.env[mod].browse( to_browse[mod] )
|
|
||||||
return to_browse
|
return to_browse
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue