bzr revid: fp@tinyerp.com-49d32e536413943e883fad5d36b1eaec36a04021
This commit is contained in:
Fabien Pinckaers 2008-05-27 05:38:42 +00:00
parent 548d8bd91e
commit b37bfd9bc3
3 changed files with 8 additions and 0 deletions

View File

@ -59,6 +59,8 @@ import fields
import ir
import tools
from tools.config import config
prof = 0
ID_MAX = 1000
@ -851,6 +853,8 @@ class orm(object):
context2=context.copy()
context2['lang']=lang
self.write(cr, uid, [id], translate[lang], context2)
if config.get('commit_mode', False):
cr.commit()
except Exception, e:
logger.notifyChannel("import",netsvc.LOG_ERROR, e)
cr.rollback()

View File

@ -57,6 +57,7 @@ class configmanager(object):
'addons_path': None,
'root_path': None,
'debug_mode': False,
'commit_mode': False,
'pidfile': None,
'logfile': None,
'secure': False,
@ -110,6 +111,7 @@ class configmanager(object):
group.add_option("--db_host", dest="db_host", help="specify the database host")
group.add_option("--db_port", dest="db_port", help="specify the database port")
group.add_option("--db_maxconn", dest="db_maxconn", default='64', help="specify the the maximum number of physical connections to posgresql")
group.add_option("-C", "--commit-mode", dest="commit_mode", action="store_true", help="Several commit during one file importation. Use this for big data importation.", default=False)
parser.add_option_group(group)
group = optparse.OptionGroup(parser, "Internationalisation options",

View File

@ -573,6 +573,8 @@ class xml_import(object):
id = self.pool.get('ir.model.data')._update(cr, self.uid, rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode )
if rec_id:
self.idref[rec_id] = int(id)
if config.get('commit_mode', False):
cr.commit()
return rec_model, id
def id_get(self, cr, model, id_str):