commit
ae0649df5f
|
@ -96,14 +96,17 @@ def preload_registry(dbname):
|
|||
|
||||
def run_test_file(dbname, test_file):
|
||||
""" Preload a registry, possibly run a test file, and start the cron."""
|
||||
db, pool = openerp.pooler.get_db_and_pool(dbname, update_module=config['init'] or config['update'], pooljobs=False)
|
||||
try:
|
||||
db, pool = openerp.pooler.get_db_and_pool(dbname, update_module=config['init'] or config['update'], pooljobs=False)
|
||||
cr = db.cursor()
|
||||
logger = logging.getLogger('server')
|
||||
logger.info('loading test file %s', test_file)
|
||||
openerp.tools.convert_yaml_import(cr, 'base', file(test_file), {}, 'test', True)
|
||||
cr.rollback()
|
||||
cr.close()
|
||||
except Exception:
|
||||
logging.exception('Failed to initialize database `%s` and run test file `%s`.', dbname, test_file)
|
||||
|
||||
cr = db.cursor()
|
||||
logger = logging.getLogger('server')
|
||||
logger.info('loading test file %s', test_file)
|
||||
openerp.tools.convert_yaml_import(cr, 'base', file(test_file), {}, 'test', True)
|
||||
cr.rollback()
|
||||
cr.close()
|
||||
|
||||
def export_translation():
|
||||
config = openerp.tools.config
|
||||
|
@ -235,11 +238,14 @@ if __name__ == "__main__":
|
|||
sys.exit(0)
|
||||
|
||||
for m in openerp.conf.server_wide_modules:
|
||||
__import__(m)
|
||||
# Call any post_load hook.
|
||||
info = openerp.modules.module.load_information_from_description_file(m)
|
||||
if info['post_load']:
|
||||
getattr(sys.modules[m], info['post_load'])()
|
||||
try:
|
||||
__import__(m)
|
||||
# Call any post_load hook.
|
||||
info = openerp.modules.module.load_information_from_description_file(m)
|
||||
if info['post_load']:
|
||||
getattr(sys.modules[m], info['post_load'])()
|
||||
except Exception:
|
||||
logging.exception('Failed to load server-wide module `%s`', m)
|
||||
|
||||
setup_pid_file()
|
||||
logger = logging.getLogger('server')
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -700,7 +700,7 @@ class users_view(osv.osv):
|
|||
self._process_values_groups(cr, uid, values, context)
|
||||
return super(users_view, self).write(cr, uid, ids, values, context)
|
||||
|
||||
def read(self, cr, uid, ids, fields, context=None, load='_classic_read'):
|
||||
def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'):
|
||||
if not fields:
|
||||
group_fields, fields = [], self.fields_get(cr, uid, context).keys()
|
||||
else:
|
||||
|
|
|
@ -1041,17 +1041,6 @@ class orm_template(object):
|
|||
"""
|
||||
Import given data in given module
|
||||
|
||||
:param cr: database cursor
|
||||
:param uid: current user id
|
||||
:param fields: list of fields
|
||||
:param data: data to import
|
||||
:param mode: 'init' or 'update' for record creation
|
||||
:param current_module: module name
|
||||
:param noupdate: flag for record creation
|
||||
:param context: context arguments, like lang, time zone,
|
||||
:param filename: optional file to store partial import state for recovery
|
||||
:rtype: tuple
|
||||
|
||||
This method is used when importing data via client menu.
|
||||
|
||||
Example of fields to import for a sale.order::
|
||||
|
@ -1064,6 +1053,22 @@ class orm_template(object):
|
|||
order_line/price_unit,
|
||||
order_line/product_uom_qty,
|
||||
order_line/product_uom/id (=xml_id)
|
||||
|
||||
This method returns a 4-tuple with the following structure:
|
||||
|
||||
* The first item is a return code, it returns either ``-1`` in case o
|
||||
|
||||
:param cr: database cursor
|
||||
:param uid: current user id
|
||||
:param fields: list of fields
|
||||
:param data: data to import
|
||||
:param mode: 'init' or 'update' for record creation
|
||||
:param current_module: module name
|
||||
:param noupdate: flag for record creation
|
||||
:param context: context arguments, like lang, time zone,
|
||||
:param filename: optional file to store partial import state for recovery
|
||||
:returns: 4-tuple of a return code, an errored resource, an error message and ???
|
||||
:rtype: (int, dict|0, str|0, ''|0)
|
||||
"""
|
||||
if not context:
|
||||
context = {}
|
||||
|
|
Loading…
Reference in New Issue