Added save command
This commit is contained in:
parent
f64f306368
commit
162fb1e6ce
21
odoo-rpc.py
21
odoo-rpc.py
|
@ -328,11 +328,9 @@ def lookup( model, domains ):
|
|||
# stack.append({ 'model': model, 'id': inst.id, 'file': filename, 'data': size })
|
||||
stack.append( tree )
|
||||
|
||||
# return stack
|
||||
jlog( stack )
|
||||
# return [ flatten_stack( obj ) for obj in stack ]
|
||||
return flatten_stack( stack )
|
||||
# return list(flatten( flatten_stack( stack ) ))
|
||||
return stack
|
||||
# return flatten_stack( stack )
|
||||
|
||||
def flatten_stack( data ):
|
||||
flat = []
|
||||
|
@ -350,9 +348,9 @@ def flatten_stack( data ):
|
|||
# eprint( 'is a list')
|
||||
for item in obj:
|
||||
# eprint( 'item: ', item, type(item))
|
||||
if type(item) in (str,unicode):
|
||||
# if type(item) in (str,unicode):
|
||||
# eprint( 'sub item is a str')
|
||||
flat.append( item )
|
||||
# flat.append( item )
|
||||
if type(item) == dict:
|
||||
# eprint( 'sub item is a dict')
|
||||
flatten( item )
|
||||
|
@ -473,9 +471,16 @@ def export_json( model, domains ):
|
|||
|
||||
def save( model, domains ):
|
||||
force = OPTS['force'] if 'force' in OPTS else False
|
||||
models = lookup( model, domains )
|
||||
models = flatten_stack( lookup( model, domains ) )
|
||||
unique_models = list(set(models))
|
||||
return unique_models
|
||||
jlog( unique_models )
|
||||
to_browse = {}
|
||||
for muid in unique_models:
|
||||
model, id = muid.split('/')
|
||||
to_browse[model] = [] if not model in to_browse
|
||||
to_browse[model] += id
|
||||
|
||||
return to_browse
|
||||
|
||||
|
||||
# AUTO EXEC
|
||||
|
|
Loading…
Reference in New Issue