-
-
-
-
- ir.ui.menu.search
- ir.ui.menu
-
-
-
-
-
-
-
-
-
- Menu Items
- ir.ui.menu
- form
-
- {'ir.ui.menu.full_list':True}
-
- Manage and customize the items available and displayed in your OpenERP system menu. You can delete an item by clicking on the box at the beginning of each line and then delete it through the button that appeared. Items can be assigned to specific groups in order to make them accessible to some users within the system.
-
-
-
-
-
-
- ir.cron.tree
- ir.cron
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ir.cron.form
- ir.cron
-
-
-
-
-
-
- ir.actions.todo
- ir.actions.todo.select
-
-
-
-
-
-
-
-
-
-
- Configuration Wizards
- ir.actions.todo
-
- form
- The configuration wizards are used to help you configure a new instance of OpenERP. They are launched during the installation of new modules, but you can choose to restart some wizards manually from this menu.
-
-
-
-
-
- AutoVacuum osv_memory objects
- 30
- minutes
- -1
- True
-
- osv_memory.autovacuum
- power_on
- ()
-
-
-
-
- ir.mail.server.form
- ir.mail_server
-
-
+
+
+
+
+ ir.actions.todo
+ ir.actions.todo.select
+
+
+
+
+
+
+
+
+
+
+ Configuration Wizards
+ ir.actions.todo
+
+ form
+ The configuration wizards are used to help you configure a new instance of OpenERP. They are launched during the installation of new modules, but you can choose to restart some wizards manually from this menu.
+
+
+
+
+
+
+
diff --git a/openerp/addons/base/ir/ir_attachment_view.xml b/openerp/addons/base/ir/ir_attachment_view.xml
new file mode 100644
index 00000000000..4a65dd0ad0a
--- /dev/null
+++ b/openerp/addons/base/ir/ir_attachment_view.xml
@@ -0,0 +1,95 @@
+
+
+
+
+
+ ir.attachment
+
+
+
+
+
+ ir.mail_server
+
+
+
+
+
+
+
+
+
+
+
+ ir.mail_server
+
+
+
+
+
+
+
+
+ Outgoing Mail Servers
+ ir.mail_server
+ form
+ tree,form
+
+
+
+
+
+
diff --git a/openerp/addons/base/ir/ir_model.py b/openerp/addons/base/ir/ir_model.py
index 633db6de6a3..e477f2f09a5 100644
--- a/openerp/addons/base/ir/ir_model.py
+++ b/openerp/addons/base/ir/ir_model.py
@@ -24,8 +24,11 @@ import re
import time
import types
-from openerp.osv import fields,osv
+import openerp
+from openerp import SUPERUSER_ID
from openerp import netsvc, pooler, tools
+from openerp.osv import fields,osv
+from openerp.osv.orm import Model
from openerp.tools.safe_eval import safe_eval as eval
from openerp.tools import config
from openerp.tools.translate import _
@@ -58,7 +61,6 @@ def _in_modules(self, cr, uid, ids, field_name, arg, context=None):
result[k] = ', '.join(sorted(installed_modules & set(xml_id.split('.')[0] for xml_id in v)))
return result
-
class ir_model(osv.osv):
_name = 'ir.model'
_description = "Models"
@@ -204,7 +206,6 @@ class ir_model(osv.osv):
else:
x_name = a._columns.keys()[0]
x_custom_model._rec_name = x_name
-ir_model()
class ir_model_fields(osv.osv):
_name = 'ir.model.fields'
@@ -462,7 +463,128 @@ class ir_model_fields(osv.osv):
obj._auto_init(cr, ctx)
return res
-ir_model_fields()
+class ir_model_constraint(Model):
+ """
+ This model tracks PostgreSQL foreign keys and constraints used by OpenERP
+ models.
+ """
+ _name = 'ir.model.constraint'
+ _columns = {
+ 'name': fields.char('Constraint', required=True, size=128, select=1,
+ help="PostgreSQL constraint or foreign key name."),
+ 'model': fields.many2one('ir.model', string='Model',
+ required=True, select=1),
+ 'module': fields.many2one('ir.module.module', string='Module',
+ required=True, select=1),
+ 'type': fields.char('Constraint Type', required=True, size=1, select=1,
+ help="Type of the constraint: `f` for a foreign key, "
+ "`u` for other constraints."),
+ 'date_update': fields.datetime('Update Date'),
+ 'date_init': fields.datetime('Initialization Date')
+ }
+
+ _sql_constraints = [
+ ('module_name_uniq', 'unique(name, module)',
+ 'Constraints with the same name are unique per module.'),
+ ]
+
+ def _module_data_uninstall(self, cr, uid, ids, context=None):
+ """
+ Delete PostgreSQL foreign keys and constraints tracked by this model.
+ """
+
+ if uid != SUPERUSER_ID and not self.pool.get('ir.model.access').check_groups(cr, uid, "base.group_system"):
+ raise except_orm(_('Permission Denied'), (_('Administrator access is required to uninstall a module')))
+
+ context = dict(context or {})
+
+ ids_set = set(ids)
+ ids.sort()
+ ids.reverse()
+ for data in self.browse(cr, uid, ids, context):
+ model = data.model.model
+ model_obj = self.pool.get(model)
+ name = openerp.tools.ustr(data.name)
+ typ = data.type
+
+ # double-check we are really going to delete all the owners of this schema element
+ cr.execute("""SELECT id from ir_model_constraint where name=%s""", (data.name,))
+ external_ids = [x[0] for x in cr.fetchall()]
+ if (set(external_ids)-ids_set):
+ # as installed modules have defined this element we must not delete it!
+ continue
+
+ if typ == 'f':
+ # test if FK exists on this table (it could be on a related m2m table, in which case we ignore it)
+ cr.execute("""SELECT 1 from pg_constraint cs JOIN pg_class cl ON (cs.conrelid = cl.oid)
+ WHERE cs.contype=%s and cs.conname=%s and cl.relname=%s""", ('f', name, model_obj._table))
+ if cr.fetchone():
+ cr.execute('ALTER TABLE "%s" DROP CONSTRAINT "%s"' % (model_obj._table, name),)
+ _logger.info('Dropped FK CONSTRAINT %s@%s', name, model)
+
+ if typ == 'u':
+ # test if constraint exists
+ cr.execute("""SELECT 1 from pg_constraint cs JOIN pg_class cl ON (cs.conrelid = cl.oid)
+ WHERE cs.contype=%s and cs.conname=%s and cl.relname=%s""", ('u', name, model_obj._table))
+ if cr.fetchone():
+ cr.execute('ALTER TABLE "%s" DROP CONSTRAINT "%s"' % (model_obj._table, name),)
+ _logger.info('Dropped CONSTRAINT %s@%s', name, model)
+
+ self.unlink(cr, uid, ids, context)
+
+class ir_model_relation(Model):
+ """
+ This model tracks PostgreSQL tables used to implement OpenERP many2many
+ relations.
+ """
+ _name = 'ir.model.relation'
+ _columns = {
+ 'name': fields.char('Relation Name', required=True, size=128, select=1,
+ help="PostgreSQL table name implementing a many2many relation."),
+ 'model': fields.many2one('ir.model', string='Model',
+ required=True, select=1),
+ 'module': fields.many2one('ir.module.module', string='Module',
+ required=True, select=1),
+ 'date_update': fields.datetime('Update Date'),
+ 'date_init': fields.datetime('Initialization Date')
+ }
+
+ def _module_data_uninstall(self, cr, uid, ids, context=None):
+ """
+ Delete PostgreSQL many2many relations tracked by this model.
+ """
+
+ if uid != SUPERUSER_ID and not self.pool.get('ir.model.access').check_groups(cr, uid, "base.group_system"):
+ raise except_orm(_('Permission Denied'), (_('Administrator access is required to uninstall a module')))
+
+ ids_set = set(ids)
+ to_drop_table = []
+ ids.sort()
+ ids.reverse()
+ for data in self.browse(cr, uid, ids, context):
+ model = data.model
+ model_obj = self.pool.get(model)
+ name = openerp.tools.ustr(data.name)
+
+ # double-check we are really going to delete all the owners of this schema element
+ cr.execute("""SELECT id from ir_model_relation where name = %s""", (data.name,))
+ external_ids = [x[0] for x in cr.fetchall()]
+ if (set(external_ids)-ids_set):
+ # as installed modules have defined this element we must not delete it!
+ continue
+
+ cr.execute("SELECT 1 FROM information_schema.tables WHERE table_name=%s", (name,))
+ if cr.fetchone() and not name in to_drop_table:
+ to_drop_table.append(name)
+
+ self.unlink(cr, uid, ids, context)
+
+ # drop m2m relation tables
+ for table in to_drop_table:
+ cr.execute('DROP TABLE %s CASCADE'% (table),)
+ _logger.info('Dropped table %s', table)
+
+ cr.commit()
class ir_model_access(osv.osv):
_name = 'ir.model.access'
@@ -643,8 +765,6 @@ class ir_model_access(osv.osv):
res = super(ir_model_access, self).unlink(cr, uid, *args, **argv)
return res
-ir_model_access()
-
class ir_model_data(osv.osv):
"""Holds external identifier keys for records in the database.
This has two main uses:
@@ -978,5 +1098,4 @@ class ir_model_data(osv.osv):
_logger.info('Deleting %s@%s', res_id, model)
self.pool.get(model).unlink(cr, uid, [res_id])
-
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/openerp/addons/base/ir/ir_model_constraint.py b/openerp/addons/base/ir/ir_model_constraint.py
deleted file mode 100644
index a3099339131..00000000000
--- a/openerp/addons/base/ir/ir_model_constraint.py
+++ /dev/null
@@ -1,77 +0,0 @@
-import logging
-
-import openerp
-from openerp import SUPERUSER_ID
-from openerp.osv import fields
-from openerp.osv.orm import Model
-
-_logger = logging.getLogger(__name__)
-
-class ir_model_constraint(Model):
- """
- This model tracks PostgreSQL foreign keys and constraints used by OpenERP
- models.
- """
- _name = 'ir.model.constraint'
- _columns = {
- 'name': fields.char('Constraint', required=True, size=128, select=1,
- help="PostgreSQL constraint or foreign key name."),
- 'model': fields.many2one('ir.model', string='Model',
- required=True, select=1),
- 'module': fields.many2one('ir.module.module', string='Module',
- required=True, select=1),
- 'type': fields.char('Constraint Type', required=True, size=1, select=1,
- help="Type of the constraint: `f` for a foreign key, "
- "`u` for other constraints."),
- 'date_update': fields.datetime('Update Date'),
- 'date_init': fields.datetime('Initialization Date')
- }
-
- _sql_constraints = [
- ('module_name_uniq', 'unique(name, module)',
- 'Constraints with the same name are unique per module.'),
- ]
-
- def _module_data_uninstall(self, cr, uid, ids, context=None):
- """
- Delete PostgreSQL foreign keys and constraints tracked by this model.
- """
-
- if uid != SUPERUSER_ID and not self.pool.get('ir.model.access').check_groups(cr, uid, "base.group_system"):
- raise except_orm(_('Permission Denied'), (_('Administrator access is required to uninstall a module')))
-
- context = dict(context or {})
-
- ids_set = set(ids)
- ids.sort()
- ids.reverse()
- for data in self.browse(cr, uid, ids, context):
- model = data.model.model
- model_obj = self.pool.get(model)
- name = openerp.tools.ustr(data.name)
- typ = data.type
-
- # double-check we are really going to delete all the owners of this schema element
- cr.execute("""SELECT id from ir_model_constraint where name=%s""", (data.name,))
- external_ids = [x[0] for x in cr.fetchall()]
- if (set(external_ids)-ids_set):
- # as installed modules have defined this element we must not delete it!
- continue
-
- if typ == 'f':
- # test if FK exists on this table (it could be on a related m2m table, in which case we ignore it)
- cr.execute("""SELECT 1 from pg_constraint cs JOIN pg_class cl ON (cs.conrelid = cl.oid)
- WHERE cs.contype=%s and cs.conname=%s and cl.relname=%s""", ('f', name, model_obj._table))
- if cr.fetchone():
- cr.execute('ALTER TABLE "%s" DROP CONSTRAINT "%s"' % (model_obj._table, name),)
- _logger.info('Dropped FK CONSTRAINT %s@%s', name, model)
-
- if typ == 'u':
- # test if constraint exists
- cr.execute("""SELECT 1 from pg_constraint cs JOIN pg_class cl ON (cs.conrelid = cl.oid)
- WHERE cs.contype=%s and cs.conname=%s and cl.relname=%s""", ('u', name, model_obj._table))
- if cr.fetchone():
- cr.execute('ALTER TABLE "%s" DROP CONSTRAINT "%s"' % (model_obj._table, name),)
- _logger.info('Dropped CONSTRAINT %s@%s', name, model)
-
- 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
deleted file mode 100644
index fc6dae2ca52..00000000000
--- a/openerp/addons/base/ir/ir_model_relation.py
+++ /dev/null
@@ -1,62 +0,0 @@
-import logging
-
-import openerp
-from openerp import SUPERUSER_ID
-from openerp.osv import fields
-from openerp.osv.orm import Model
-
-_logger = logging.getLogger(__name__)
-
-class ir_model_relation(Model):
- """
- This model tracks PostgreSQL tables used to implement OpenERP many2many
- relations.
- """
- _name = 'ir.model.relation'
- _columns = {
- 'name': fields.char('Relation Name', required=True, size=128, select=1,
- help="PostgreSQL table name implementing a many2many relation."),
- 'model': fields.many2one('ir.model', string='Model',
- required=True, select=1),
- 'module': fields.many2one('ir.module.module', string='Module',
- required=True, select=1),
- 'date_update': fields.datetime('Update Date'),
- 'date_init': fields.datetime('Initialization Date')
- }
-
- def _module_data_uninstall(self, cr, uid, ids, context=None):
- """
- Delete PostgreSQL many2many relations tracked by this model.
- """
-
- if uid != SUPERUSER_ID and not self.pool.get('ir.model.access').check_groups(cr, uid, "base.group_system"):
- raise except_orm(_('Permission Denied'), (_('Administrator access is required to uninstall a module')))
-
- ids_set = set(ids)
- to_drop_table = []
- ids.sort()
- ids.reverse()
- for data in self.browse(cr, uid, ids, context):
- model = data.model
- model_obj = self.pool.get(model)
- name = openerp.tools.ustr(data.name)
-
- # double-check we are really going to delete all the owners of this schema element
- cr.execute("""SELECT id from ir_model_relation where name = %s""", (data.name,))
- external_ids = [x[0] for x in cr.fetchall()]
- if (set(external_ids)-ids_set):
- # as installed modules have defined this element we must not delete it!
- continue
-
- cr.execute("SELECT 1 FROM information_schema.tables WHERE table_name=%s", (name,))
- if cr.fetchone() and not name in to_drop_table:
- to_drop_table.append(name)
-
- self.unlink(cr, uid, ids, context)
-
- # drop m2m relation tables
- for table in to_drop_table:
- cr.execute('DROP TABLE %s CASCADE'% (table),)
- _logger.info('Dropped table %s', table)
-
- cr.commit()
diff --git a/openerp/addons/base/ir/ir_model_view.xml b/openerp/addons/base/ir/ir_model_view.xml
new file mode 100644
index 00000000000..01ff918662f
--- /dev/null
+++ b/openerp/addons/base/ir/ir_model_view.xml
@@ -0,0 +1,416 @@
+
+
+
+
+
+ ir.model
+
+
+
+
+
+ ir.ui.menu
+
+
+
+
+
+
+
+
+
+ ir.ui.menu.search
+ ir.ui.menu
+
+
+
+
+
+
+
+
+ Menu Items
+ ir.ui.menu
+ form
+
+ {'ir.ui.menu.full_list':True}
+
+ Manage and customize the items available and displayed in your OpenERP system menu. You can delete an item by clicking on the box at the beginning of each line and then delete it through the button that appeared. Items can be assigned to specific groups in order to make them accessible to some users within the system.
+
+
+
+
+
diff --git a/openerp/addons/base/ir/ir_ui_view.py b/openerp/addons/base/ir/ir_ui_view.py
index 9208297cf84..868f634783c 100644
--- a/openerp/addons/base/ir/ir_ui_view.py
+++ b/openerp/addons/base/ir/ir_ui_view.py
@@ -44,7 +44,6 @@ class view_custom(osv.osv):
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'ir_ui_view_custom_user_id_ref_id\'')
if not cr.fetchone():
cr.execute('CREATE INDEX ir_ui_view_custom_user_id_ref_id ON ir_ui_view_custom (user_id, ref_id)')
-view_custom()
class view(osv.osv):
_name = 'ir.ui.view'
@@ -60,7 +59,7 @@ class view(osv.osv):
return result
_columns = {
- 'name': fields.char('View Name',size=64, required=True),
+ 'name': fields.char('View Name', required=True),
'model': fields.char('Object', size=64, required=True, select=True),
'priority': fields.integer('Sequence', required=True),
'type': fields.function(_type_field, type='selection', selection=[
@@ -88,11 +87,17 @@ class view(osv.osv):
_order = "priority,name"
# Holds the RNG schema
- _relaxng_validator = None
+ _relaxng_validator = None
def create(self, cr, uid, values, context=None):
if 'type' in values:
_logger.warning("Setting the `type` field is deprecated in the `ir.ui.view` model.")
+ if not values.get('name'):
+ if values.get('inherit_id'):
+ inferred_type = self.browse(cr, uid, values['inherit_id'], context).type
+ else:
+ inferred_type = etree.fromstring(values['arch'].encode('utf8')).tag
+ values['name'] = "%s %s" % (values['model'], inferred_type)
return super(osv.osv, self).create(cr, uid, values, context)
def _relaxng(self):
@@ -106,8 +111,7 @@ class view(osv.osv):
finally:
frng.close()
return self._relaxng_validator
-
-
+
def _check_render_view(self, cr, uid, view, context=None):
"""Verify that the given view's hierarchy is valid for rendering, along with all the changes applied by
its inherited views, by rendering it using ``fields_view_get()``.
@@ -267,7 +271,6 @@ class view(osv.osv):
'label' : labels,
'blank_nodes': blank_nodes,
'node_parent_field': _Model_Field,}
-view()
class view_sc(osv.osv):
_name = 'ir.ui.view_sc'
@@ -304,7 +307,5 @@ class view_sc(osv.osv):
('shortcut_unique', 'unique(res_id, resource, user_id)', 'Shortcut for this menu already exists!'),
]
-view_sc()
-
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/openerp/addons/base/ir/ir_ui_view_view.xml b/openerp/addons/base/ir/ir_ui_view_view.xml
new file mode 100644
index 00000000000..59dfdd72b3f
--- /dev/null
+++ b/openerp/addons/base/ir/ir_ui_view_view.xml
@@ -0,0 +1,144 @@
+
+
+
+
+
+ ir.ui.view
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ir.ui.view
+
+
+
+
+
+
+
+
+
+
+
+
+ ir.ui.view
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Views
+ ir.actions.act_window
+ ir.ui.view
+
+ Views allows you to personalize each view of OpenERP. You can add new fields, move fields, rename them or delete the ones that you do not need.
+
+
+
+
+
+ ir.ui.view.custom
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ir.ui.view.custom
+
+
+
+
+
+
+
+
+ ir.ui.view.custom
+
+
+
+
+
+
+
+
+ Customized Views
+ ir.actions.act_window
+ ir.ui.view.custom
+ Customized views are used when users reorganize the content of their dashboard views (via web client)
+
+
+
+
+
+ ir.ui.view_sc
+
+