From 2ff91867986827efc196ea8d6a47e2829451b145 Mon Sep 17 00:00:00 2001 From: DiG Date: Tue, 18 Jan 2022 00:37:13 +0100 Subject: [PATCH] remote.py as module --- remote.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/remote.py b/remote.py index ea38fcc..5330736 100644 --- a/remote.py +++ b/remote.py @@ -1,7 +1,15 @@ #!/usr/bin/env python -# Usage: -# ./odoo-export.py [ [ []]] +## Usage: +## ./remote.py [ [ []]] [+] [+] +## Where are: +## json Renders json data. +## tsv Renders tsv data. +## csv Renders csv data. +## xml Soon WIP Renders xml data. +## recurse Execute the recursively. +## recurse=L Execute the 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']