diff --git a/odoo-rpc.py b/odoo-rpc.py index d33d610..66e27d5 100755 --- a/odoo-rpc.py +++ b/odoo-rpc.py @@ -123,6 +123,9 @@ def autolog(): # Update data through a record #user.name = "Brian Jones" +def file_path( muid, format ): + return "%s/%s.%s" % ( FOLDER, muid, format ) + def json_path( model, id ): return "%s/%s.json" % ( FOLDER, Muid(model, id) ) @@ -215,10 +218,21 @@ def fields( model, domains ): stack = [] current_exports = [] +def lookup_file( muid, format ): + filename = file_path( muid, format ) + # print( field.ttype, field.relation, id, _filename ) + if not os.path.exists( filename ): + return { 'file': filename, 'exists': False } + else: + return { 'file': filename, 'exists': True } def lookup_model( muid ): eprint( "> Lookup model: %s" % (muid) ) - # _stack = [] + recursive = False + if ( 'recursive' in opts and opts['recursive'] ): # or ( 'format' in opts and 'json' in opts['format'] ): + recursive = opts['recursive'] + eprint( "> Recursive: %s" % (recursive) ) + _tree = {} # _ctree = _tree model, id = muid.split( '/' ) @@ -267,7 +281,7 @@ def lookup_model( muid ): return _tree def lookup_recs( model, domains ): - eprint( "> Lookup recursif: %s %s" % (model,domains) ) + eprint( "> Lookup many: %s %s" % (model,domains) ) if model in MODEL_IGNORE: eprint( 'IGNORED' ) return