solved import zip problem (ref:nch)

bzr revid: hda@tinyerp.com-20081110051226-ovyliknq3w8mmxr6
This commit is contained in:
hda@tinyerp.com
2008-11-10 10:42:26 +05:30
2 changed files with 16 additions and 6 deletions
+6 -6
View File
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
@@ -176,7 +176,7 @@ def create_graph(module_list, force=None):
continue
terp_file = get_module_resource(module, '__terp__.py')
if not terp_file: continue
if os.path.isfile(terp_file) or zipfile.is_zipfile(mod_path):
if os.path.isfile(terp_file) or zipfile.is_zipfile(mod_path+'.zip'):
try:
info = eval(tools.file_open(terp_file).read())
except:
@@ -206,7 +206,7 @@ def create_graph(module_list, force=None):
later.add(package)
packages.append((package, deps, datas))
packages.pop(0)
for package in later:
logger.notifyChannel('init', netsvc.LOG_ERROR, 'addon:%s:Unmet dependency' % package)
@@ -236,7 +236,7 @@ def load_module_graph(cr, graph, status=None, **kwargs):
sys.stdout.flush()
pool = pooler.get_pool(cr.dbname)
modules = pool.instanciate(m, cr)
cr.execute('select id from ir_module_module where name=%s', (m,))
mid = int(cr.rowcount and cr.fetchone()[0] or 0)
@@ -277,7 +277,7 @@ def load_module_graph(cr, graph, status=None, **kwargs):
cr.execute("update ir_module_module set state='installed' where state in ('to upgrade', 'to install') and id=%d", (mid,))
cr.commit()
# Update translations for all installed languages
modobj = pool.get('ir.module.module')
if modobj:
@@ -289,7 +289,7 @@ def load_module_graph(cr, graph, status=None, **kwargs):
cr.execute("""select model,name from ir_model where id not in (select model_id from ir_model_access)""")
for (model,name) in cr.fetchall():
logger.notifyChannel('init', netsvc.LOG_WARNING, 'addon:object %s (%s) has no access rules!' % (model,name))
pool = pooler.get_pool(cr.dbname)
cr.execute('select * from ir_model where state=%s', ('manual',))
for model in cr.dictfetchall():
+10
View File
@@ -73,6 +73,16 @@ class view(osv.osv):
(_check_xml, 'Invalid XML for View Architecture!', ['arch'])
]
def create(self, cr, uid, vals, context={}):
if 'inherit_id' in vals:
obj=self.browse(cr,uid,vals['inherit_id'])
if not obj.model==vals['model']:
raise Exception("Inherited view model [%s] and \
\n\n base view model [%s] do not match \
\n\n It should be same as base view model " \
%(vals['model'],obj.model))
return super(view,self).create(cr, uid, vals, context={})
def read(self, cr, uid, ids, fields=None, context={}, load='_classic_read'):
if not isinstance(ids, (list, tuple)):