[IMP] base_module_doc_rst, base_module_record, base_report_creator: cleanup imports and default values
bzr revid: rco@openerp.com-20120209091117-mal31ct6nkmh6tyq
This commit is contained in:
parent
e18bbfaf1d
commit
d672ded286
|
@ -21,7 +21,8 @@
|
|||
import time, os
|
||||
import pydot
|
||||
|
||||
import report,pooler,tools
|
||||
import report
|
||||
import tools
|
||||
|
||||
class report_graph(report.interface.report_int):
|
||||
def __init__(self, name, table):
|
||||
|
@ -29,11 +30,10 @@ class report_graph(report.interface.report_int):
|
|||
self.table = table
|
||||
|
||||
def get_proximity_graph(self, cr, uid, module_id, context=None):
|
||||
pool_obj = pooler.get_pool(cr.dbname)
|
||||
module_obj = pool_obj.get('ir.module.module')
|
||||
module_obj = self.pool.get('ir.module.module')
|
||||
nodes = [('base','unknown')]
|
||||
edges = []
|
||||
def get_dpend_module(module_id):
|
||||
def get_depend_module(module_id):
|
||||
module_record = module_obj.browse(cr, uid, module_id, context=context)
|
||||
if module_record.name not in nodes:
|
||||
# Add new field ir.module.module object in server side. field name = module_type/
|
||||
|
@ -46,8 +46,8 @@ class report_graph(report.interface.report_int):
|
|||
continue
|
||||
id = module_obj.browse(cr, uid, module_obj.search(cr, uid, [('name', '=' ,depen.name)]), context=context)
|
||||
if id:
|
||||
get_dpend_module(id[0].id)
|
||||
get_dpend_module(module_id)
|
||||
get_depend_module(id[0].id)
|
||||
get_depend_module(module_id)
|
||||
graph = pydot.Dot(graph_type='digraph',fontsize='10', label="\\nProximity Graph. \\n\\nGray Color-Official Modules, Red Color-Extra Addons Modules, Blue Color-Community Modules, Purple Color-Unknow Modules"
|
||||
, center='1')
|
||||
for node in nodes:
|
||||
|
|
|
@ -18,17 +18,14 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
import wizard
|
||||
|
||||
from osv import osv
|
||||
from osv import fields
|
||||
import pooler
|
||||
from tools.translate import _
|
||||
|
||||
class create_graph(osv.osv_memory):
|
||||
_name = "create.relation.graph"
|
||||
|
||||
def get_graph(self, cr, uid, datas, context=None):
|
||||
mod_obj = pooler.get_pool(cr.dbname).get('ir.module.module')
|
||||
mod_obj = self.pool.get('ir.module.module')
|
||||
modules = mod_obj.browse(cr, uid, context['active_ids'], context=context)
|
||||
for module in modules:
|
||||
module_data = mod_obj.get_relation_graph(cr, uid, module.name, context=context)
|
||||
|
|
|
@ -18,18 +18,15 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
from os.path import join
|
||||
|
||||
from osv import osv, fields
|
||||
import netsvc
|
||||
|
||||
import base64
|
||||
import tempfile
|
||||
import tarfile
|
||||
import httplib
|
||||
|
||||
import netsvc
|
||||
import wizard
|
||||
import pooler
|
||||
import os
|
||||
import tools
|
||||
from osv import osv,fields
|
||||
|
||||
class RstDoc(object):
|
||||
def __init__(self, module, objects):
|
||||
|
@ -308,13 +305,12 @@ class RstDoc(object):
|
|||
class wizard_tech_guide_rst(osv.osv_memory):
|
||||
_name = "tech.guide.rst"
|
||||
_columns = {
|
||||
'rst_file': fields.binary('File',required = True, readonly = True),
|
||||
'name': fields.char("Filename", size=64, required=True, readonly = True),
|
||||
}
|
||||
'rst_file': fields.binary('File',required = True, readonly = True),
|
||||
'name': fields.char("Filename", size=64, required=True, readonly = True),
|
||||
}
|
||||
|
||||
def _generate(self, cr, uid, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
module_model = pool.get('ir.module.module')
|
||||
module_model = self.pool.get('ir.module.module')
|
||||
module_ids = context['active_ids']
|
||||
|
||||
module_index = []
|
||||
|
@ -389,8 +385,7 @@ class wizard_tech_guide_rst(osv.osv_memory):
|
|||
return base64.encodestring(out)
|
||||
|
||||
def _get_views(self, cr, uid, module_id, context=None):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
module_module_obj = pool.get('ir.module.module')
|
||||
module_module_obj = self.pool.get('ir.module.module')
|
||||
res = {}
|
||||
model_data_obj = pool.get('ir.model.data')
|
||||
view_obj = pool.get('ir.ui.view')
|
||||
|
@ -455,17 +450,15 @@ class wizard_tech_guide_rst(osv.osv_memory):
|
|||
return res
|
||||
|
||||
def _object_find(self, cr, uid, module):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
ids2 = pool.get('ir.model.data').search(cr, uid, [('module', '=', module.name), ('model', '=', 'ir.model')])
|
||||
ir_model_data = self.pool.get('ir.model.data')
|
||||
ids2 = ir_model_data.search(cr, uid, [('module', '=', module.name), ('model', '=', 'ir.model')])
|
||||
ids = []
|
||||
for mod in pool.get('ir.model.data').browse(cr, uid, ids2):
|
||||
for mod in ir_model_data.browse(cr, uid, ids2):
|
||||
ids.append(mod.res_id)
|
||||
modobj = pool.get('ir.model')
|
||||
return modobj.browse(cr, uid, ids)
|
||||
return self.pool.get('ir.model').browse(cr, uid, ids)
|
||||
|
||||
def _fields_find(self, cr, uid, obj):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
modobj = pool.get(obj)
|
||||
modobj = self.pool.get(obj)
|
||||
if modobj:
|
||||
res = modobj.fields_get(cr, uid).items()
|
||||
return res
|
||||
|
|
|
@ -20,12 +20,12 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
|
||||
from osv import osv, fields
|
||||
import tools
|
||||
from tools.translate import _
|
||||
|
||||
import time
|
||||
|
||||
class base_module_data(osv.osv_memory):
|
||||
_name = 'base.module.data'
|
||||
_description = "Base Module Data"
|
||||
|
|
|
@ -19,43 +19,33 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
|
||||
import base_module_save
|
||||
from osv import osv, fields
|
||||
import tools
|
||||
from tools.translate import _
|
||||
import base_module_save
|
||||
|
||||
import time
|
||||
|
||||
class base_module_record(osv.osv_memory):
|
||||
_name = 'base.module.record'
|
||||
_description = "Base Module Record"
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
mod = self.pool.get('ir.model')
|
||||
res = super(base_module_record, self).default_get(cr, uid, fields, context=context)
|
||||
|
||||
list=('ir.ui.view', 'ir.ui.menu', 'ir.model', 'ir.model.fields', 'ir.model.access', \
|
||||
'res.partner', 'res.partner.address', 'res.partner.category', 'workflow', \
|
||||
'workflow.activity', 'workflow.transition', 'ir.actions.server', 'ir.server.object.lines')
|
||||
if 'objects' in fields:
|
||||
res.update({'objects': mod.search(cr, uid, [('model', 'in', list)])})
|
||||
cr.execute('select max(create_date) from ir_model_data')
|
||||
c=(cr.fetchone())[0].split('.')[0]
|
||||
c = time.strptime(c, "%Y-%m-%d %H:%M:%S")
|
||||
sec=c.tm_sec!=59 and c.tm_sec + 1
|
||||
c=(c[0],c[1],c[2],c[3],c[4],sec,c[6],c[7],c[8])
|
||||
if 'check_date' in fields:
|
||||
res.update({'check_date': time.strftime("%Y-%m-%d %H:%M:%S", c)})
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'check_date': fields.datetime('Record from Date', required=True),
|
||||
'objects': fields.many2many('ir.model', 'base_module_record_object_rel', 'objects', 'model_id', 'Objects'),
|
||||
'filter_cond': fields.selection([('created', 'Created'), ('modified', 'Modified'), ('created_modified', 'Created & Modified')], 'Records only', required=True),
|
||||
'info_yaml': fields.boolean('YAML'),
|
||||
}
|
||||
|
||||
def _get_default_objects(self, cr, uid, context=None):
|
||||
names = ('ir.ui.view', 'ir.ui.menu', 'ir.model', 'ir.model.fields', 'ir.model.access',
|
||||
'res.partner', 'res.partner.address', 'res.partner.category', 'workflow',
|
||||
'workflow.activity', 'workflow.transition', 'ir.actions.server', 'ir.server.object.lines')
|
||||
return self.pool.get('ir.model').search(cr, uid, [('model', 'in', names)])
|
||||
|
||||
_defaults = {
|
||||
'check_date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'objects': _get_default_objects,
|
||||
'filter_cond': 'created',
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue