diff --git a/openerp/addons/base/__openerp__.py b/openerp/addons/base/__openerp__.py index 5b65bff4bd7..3fdb8c6448d 100644 --- a/openerp/addons/base/__openerp__.py +++ b/openerp/addons/base/__openerp__.py @@ -25,20 +25,21 @@ 'name': 'Base', 'version': '1.3', 'category': 'Hidden', - 'description': """The kernel of OpenERP, needed for all installation.""", + 'description': """ +The kernel of OpenERP, needed for all installation. +=================================================== +""", 'author': 'OpenERP SA', 'maintainer': 'OpenERP SA', 'website': 'http://www.openerp.com', 'depends': [], - 'init_xml': [ + 'data': [ 'base_data.xml', 'security/base_security.xml', 'base_menu.xml', 'res/res_security.xml', 'res/res_config.xml', - 'data/res.country.state.csv' - ], - 'update_xml': [ + 'data/res.country.state.csv', 'ir/wizard/wizard_menu_view.xml', 'ir/ir.xml', 'ir/ir_filters.xml', @@ -77,7 +78,7 @@ 'res/res_widget_data.xml', 'publisher_warranty/publisher_warranty_data.xml', ], - 'demo_xml': [ + 'demo': [ 'base_demo.xml', 'res/res_partner_demo.xml', 'res/res_partner_demo.yml', diff --git a/openerp/addons/base/ir/ir_model.py b/openerp/addons/base/ir/ir_model.py index e777b390aa8..46ab8841deb 100644 --- a/openerp/addons/base/ir/ir_model.py +++ b/openerp/addons/base/ir/ir_model.py @@ -183,7 +183,6 @@ class ir_model(osv.osv): res = super(ir_model,self).create(cr, user, vals, context) if vals.get('state','base')=='manual': self.instanciate(cr, user, vals['model'], context) - self.pool.get(vals['model']).__init__(self.pool, cr) ctx = dict(context, field_name=vals['name'], field_state='manual', @@ -198,7 +197,9 @@ class ir_model(osv.osv): x_custom_model._name = model x_custom_model._module = False a = x_custom_model.create_instance(self.pool, cr) - if (not a._columns) or ('x_name' in a._columns.keys()): + if not a._columns: + x_name = 'id' + elif 'x_name' in a._columns.keys(): x_name = 'x_name' else: x_name = a._columns.keys()[0] @@ -931,6 +932,9 @@ class ir_model_data(osv.osv): ir_model_relation = self.pool.get('ir.model.relation') relation_ids = ir_model_relation.search(cr, uid, [('module', 'in', modules_to_remove)]) + ir_module_module = self.pool.get('ir.module.module') + modules_to_remove_ids = ir_module_module.search(cr, uid, [('name', 'in', modules_to_remove)]) + relation_ids = ir_model_relation.search(cr, uid, [('module', 'in', modules_to_remove_ids)]) ir_model_relation._module_data_uninstall(cr, uid, relation_ids, context) unlink_if_refcount((model, res_id) for model, res_id in to_unlink diff --git a/openerp/addons/base/ir/ir_model_constraint.py b/openerp/addons/base/ir/ir_model_constraint.py index 4a69bc2f0a7..a3099339131 100644 --- a/openerp/addons/base/ir/ir_model_constraint.py +++ b/openerp/addons/base/ir/ir_model_constraint.py @@ -45,7 +45,6 @@ class ir_model_constraint(Model): ids_set = set(ids) ids.sort() ids.reverse() - to_unlink = [] for data in self.browse(cr, uid, ids, context): model = data.model.model model_obj = self.pool.get(model) @@ -75,5 +74,4 @@ class ir_model_constraint(Model): cr.execute('ALTER TABLE "%s" DROP CONSTRAINT "%s"' % (model_obj._table, name),) _logger.info('Dropped CONSTRAINT %s@%s', name, model) - to_unlink.append(data.id) - self.unlink(cr, uid, to_unlink, context) + self.unlink(cr, uid, ids, context) diff --git a/openerp/addons/base/ir/ir_model_relation.py b/openerp/addons/base/ir/ir_model_relation.py index eede6eae44f..fc6dae2ca52 100644 --- a/openerp/addons/base/ir/ir_model_relation.py +++ b/openerp/addons/base/ir/ir_model_relation.py @@ -36,7 +36,6 @@ class ir_model_relation(Model): to_drop_table = [] ids.sort() ids.reverse() - to_unlink = [] for data in self.browse(cr, uid, ids, context): model = data.model model_obj = self.pool.get(model) @@ -53,9 +52,7 @@ class ir_model_relation(Model): if cr.fetchone() and not name in to_drop_table: to_drop_table.append(name) - to_unlink.append(data.id) - - self.unlink(cr, uid, to_unlink, context) + self.unlink(cr, uid, ids, context) # drop m2m relation tables for table in to_drop_table: diff --git a/openerp/addons/base/module/module.py b/openerp/addons/base/module/module.py index 5751ed678eb..617a31dae66 100644 --- a/openerp/addons/base/module/module.py +++ b/openerp/addons/base/module/module.py @@ -18,12 +18,14 @@ # along with this program. If not, see . # ############################################################################## + +import base64 +from docutils.core import publish_string import imp import logging import re import urllib import zipimport -import base64 from openerp import modules, pooler, release, tools, addons from openerp.tools.parse_version import parse_version @@ -94,6 +96,14 @@ class module(osv.osv): 'module %s', name, exc_info=True) return info + def _get_desc(self, cr, uid, ids, field_name=None, arg=None, context=None): + res = dict.fromkeys(ids, '') + for module in self.browse(cr, uid, ids, context=context): + overrides = dict(embed_stylesheet=False, doctitle_xform=False, output_encoding='unicode') + output = publish_string(source=module.description, writer_name='html', settings_overrides=overrides) + res[module.id] = output + return res + def _get_latest_version(self, cr, uid, ids, field_name=None, arg=None, context=None): res = dict.fromkeys(ids, '') for m in self.browse(cr, uid, ids): @@ -183,6 +193,7 @@ class module(osv.osv): 'shortdesc': fields.char('Module Name', size=64, readonly=True, translate=True), 'summary': fields.char('Summary', size=64, readonly=True, translate=True), 'description': fields.text("Description", readonly=True, translate=True), + 'description_html': fields.function(_get_desc, string='Description HTML', type='html', method=True, readonly=True), 'author': fields.char("Author", size=128, readonly=True), 'maintainer': fields.char('Maintainer', size=128, readonly=True), 'contributors': fields.text('Contributors', readonly=True), @@ -222,7 +233,7 @@ class module(osv.osv): ('AGPL-3', 'Affero GPL-3'), ('Other OSI approved licence', 'Other OSI Approved Licence'), ('Other proprietary', 'Other Proprietary') - ], string='License', readonly=True), + ], string='License', readonly=True), 'menus_by_module': fields.function(_get_views, string='Menus', type='text', multi="meta", store=True), 'reports_by_module': fields.function(_get_views, string='Reports', type='text', multi="meta", store=True), 'views_by_module': fields.function(_get_views, string='Views', type='text', multi="meta", store=True), @@ -371,7 +382,8 @@ class module(osv.osv): ir_model_data = self.pool.get('ir.model.data') ir_model_constraint = self.pool.get('ir.model.constraint') modules_to_remove = [m.name for m in self.browse(cr, uid, ids, context)] - constraint_ids = ir_model_constraint.search(cr, uid, [('module', 'in', modules_to_remove)]) + modules_to_remove_ids = [m.id for m in self.browse(cr, uid, ids, context)] + constraint_ids = ir_model_constraint.search(cr, uid, [('module', 'in', modules_to_remove_ids)]) ir_model_constraint._module_data_uninstall(cr, uid, constraint_ids, context) ir_model_data._module_data_uninstall(cr, uid, modules_to_remove, context) self.write(cr, uid, ids, {'state': 'uninstalled'}) diff --git a/openerp/addons/base/module/module_view.xml b/openerp/addons/base/module/module_view.xml index 19f9dbdaa44..27eccf020b2 100644 --- a/openerp/addons/base/module/module_view.xml +++ b/openerp/addons/base/module/module_view.xml @@ -38,7 +38,7 @@ ir.module.module - @@ -133,7 +133,7 @@ - + diff --git a/openerp/addons/base/res/res_config.xml b/openerp/addons/base/res/res_config.xml index bdfd6ab329c..342aeaa6e0f 100644 --- a/openerp/addons/base/res/res_config.xml +++ b/openerp/addons/base/res/res_config.xml @@ -1,6 +1,7 @@ + res.config.view.base res.config diff --git a/openerp/addons/base/res/res_security.xml b/openerp/addons/base/res/res_security.xml index f02abd90985..c7d2a77f846 100644 --- a/openerp/addons/base/res/res_security.xml +++ b/openerp/addons/base/res/res_security.xml @@ -1,42 +1,37 @@ - + - - Partner Manager - + + Partner Manager + - - - - - - - - - + + + + + + + + + - + + + company rule + + + + [('id','child_of',[user.company_id.id])] + - + + + user rule + + + [('company_ids','child_of',[user.company_id.id])] + - - - - company rule - - - - [('id','child_of',[user.company_id.id])] - - - - - user rule - - - [('company_ids','child_of',[user.company_id.id])] - - - + diff --git a/openerp/addons/base/security/base_security.xml b/openerp/addons/base/security/base_security.xml index cd0b7e999b3..8eb832ea618 100644 --- a/openerp/addons/base/security/base_security.xml +++ b/openerp/addons/base/security/base_security.xml @@ -1,54 +1,51 @@ - - - - - Access Rights - - - Configuration - - - - - - Employee - - - - - Multi Companies - - - - Multi Currencies - - - - Technical Features - - - - User - - - Manager - - - - - - - - - - + + + Access Rights + + + Configuration + + + + + + Employee + + + + + Multi Companies + + + + Multi Currencies + + + + Technical Features + + + + User + + + Manager + + + + + + + + res.widget.user rule @@ -58,8 +55,11 @@ res.partner company - + ['|','|',('company_id.child_ids','child_of',[user.company_id.id]),('company_id','child_of',[user.company_id.id]),('company_id','=',False)] diff --git a/openerp/import_xml.rng b/openerp/import_xml.rng index bf5a9e1800e..5dd789c6e95 100644 --- a/openerp/import_xml.rng +++ b/openerp/import_xml.rng @@ -185,7 +185,6 @@ - diff --git a/openerp/tools/convert.py b/openerp/tools/convert.py index 36f560ba62c..be8465055ee 100644 --- a/openerp/tools/convert.py +++ b/openerp/tools/convert.py @@ -591,7 +591,11 @@ form: module.record_id""" % (xml_id,) if rec.get('action'): a_action = rec.get('action','').encode('utf8') - a_type = rec.get('type','').encode('utf8') or 'act_window' + + # determine the type of action + a_type, a_id = self.model_id_get(cr, a_action) + a_type = a_type.split('.')[-1] # keep only type part + icons = { "act_window": 'STOCK_NEW', "report.xml": 'STOCK_PASTE', @@ -601,8 +605,8 @@ form: module.record_id""" % (xml_id,) "server": 'STOCK_EXECUTE', } values['icon'] = icons.get(a_type,'STOCK_NEW') + if a_type=='act_window': - a_id = self.id_get(cr, a_action) cr.execute('select view_type,view_mode,name,view_id,target from ir_act_window where id=%s', (int(a_id),)) rrres = cr.fetchone() assert rrres, "No window action defined for this id %s !\n" \ @@ -627,9 +631,8 @@ form: module.record_id""" % (xml_id,) values['icon'] = 'STOCK_EXECUTE' if not values.get('name', False): values['name'] = action_name - + elif a_type in ['wizard', 'url', 'client', 'server'] and not values.get('name'): - a_id = self.id_get(cr, a_action) a_table = 'ir_act_%s' % a_type cr.execute('select name from %s where id=%%s' % a_table, (int(a_id),)) resw = cr.fetchone() @@ -667,9 +670,6 @@ form: module.record_id""" % (xml_id,) self.idref[rec_id] = int(pid) if rec.get('action') and pid: - a_action = rec.get('action').encode('utf8') - a_type = rec.get('type','').encode('utf8') or 'act_window' - a_id = self.id_get(cr, a_action) action = "ir.actions.%s,%d" % (a_type, a_id) self.pool.get('ir.model.data').ir_set(cr, self.uid, 'action', 'tree_but_open', 'Menuitem', [('ir.ui.menu', int(pid))], action, True, True, xml_id=rec_id) return ('ir.ui.menu', pid) diff --git a/setup.py b/setup.py index 6e1adadde82..5925a0484ba 100755 --- a/setup.py +++ b/setup.py @@ -96,6 +96,7 @@ setuptools.setup( # our tree.) http://download.gna.org/pychart/ # TODO 'pychart', 'babel', + 'docutils', 'feedparser', 'gdata', 'lxml',