remote.py as module
This commit is contained in:
parent
1db6a5e3e0
commit
2ff9186798
20
remote.py
20
remote.py
|
@ -1,7 +1,15 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Usage:
|
||||
# ./odoo-export.py <MODEL> <METHOD> [<param> [<param> [<param>]]]
|
||||
## Usage:
|
||||
## ./remote.py <MODEL> <METHOD> [<param> [<param> [<param>]]] [+<opt>] [+<opt=value>]
|
||||
## Where <opt> are:
|
||||
## json Renders json data.
|
||||
## tsv Renders tsv data.
|
||||
## csv Renders csv data.
|
||||
## xml Soon WIP Renders xml data.
|
||||
## recurse Execute the <METHOD> recursively.
|
||||
## recurse=L Execute the <METHOD> recursively, limiting
|
||||
## to model names in L being a list with comma and no spaces.
|
||||
|
||||
|
||||
from __future__ import print_function
|
||||
|
@ -11,10 +19,10 @@ import odoorpc # pip install odoorpc
|
|||
#from typing import Iterable # > py38
|
||||
# from collections import Iterable # < py38
|
||||
|
||||
from config import *
|
||||
from utils import *
|
||||
from renderers import render, tsv
|
||||
|
||||
from config import *
|
||||
|
||||
|
||||
|
||||
|
@ -394,9 +402,9 @@ def export_json( model, domains ):
|
|||
else:
|
||||
print('Already exists %s' % (_filename) )
|
||||
|
||||
def save( model, domains ):
|
||||
def save( model, domains, recurse = False ):
|
||||
force = OPTS['force'] if 'force' in OPTS else False
|
||||
models = flatten_stack( lookup( model, domains ) )
|
||||
models = flatten_stack( lookup( model, domains, recurse=recurse ) )
|
||||
unique_models = uniq( models )
|
||||
jlog( unique_models )
|
||||
to_browse = groupby_model( unique_models )
|
||||
|
@ -482,7 +490,7 @@ if __name__ == "__main__":
|
|||
#for inst in Field.browse( ids ):
|
||||
# render_tsv( 'ir.model.fields', inst )
|
||||
|
||||
if 'lookup' in METHOD:
|
||||
if 'lookup' in METHOD or 'save' in METHOD:
|
||||
recurse = False
|
||||
if ( 'recurse' in OPTS and OPTS['recurse'] ):
|
||||
recurse = OPTS['recurse']
|
||||
|
|
Loading…
Reference in New Issue