Add module in model
Remove some size=None
This commit is contained in:
1 parent
d9cd24b699
commit
443a352d27
4 files changed
+30
-19
No files matched your search
@@ -7,6 +7,7 @@ CREATE TABLE ir_model (
|
||||
model varchar NOT NULL,
|
||||
name varchar,
|
||||
info text,
|
||||
module varchar,
|
||||
primary key(id)
|
||||
);
|
||||
|
||||
|
||||
+19
-13
@@ -9,14 +9,20 @@ class Model(OSV):
|
||||
"Model"
|
||||
_name = 'ir.model'
|
||||
_description = __doc__
|
||||
name = fields.Char('Model name', size=None, translate=True)
|
||||
model = fields.Char('Object name', size=None, required=True)
|
||||
name = fields.Char('Model name', translate=True)
|
||||
model = fields.Char('Object name', required=True)
|
||||
info = fields.Text('Information')
|
||||
module = fields.Char('Module',
|
||||
help="Module in which this model is defined")
|
||||
fields = fields.One2Many('ir.model.field', 'model', 'Fields',
|
||||
required=True)
|
||||
|
||||
def default_name(self, cursor, user, context=None):
|
||||
return 'No Name'
|
||||
def __init__(self):
|
||||
super(Model, self).__init__()
|
||||
self._sql_constraints += [
|
||||
('name_uniq', 'UNIQUE(name)',
|
||||
'The name of model must be unique!'),
|
||||
]
|
||||
|
||||
Model()
|
||||
|
||||
@@ -24,19 +30,19 @@ class ModelField(OSV):
|
||||
"Model field"
|
||||
_name = 'ir.model.field'
|
||||
_description = __doc__
|
||||
name = fields.Char('Name', size=None, required=True)
|
||||
relation = fields.Char('Model Relation', size=None)
|
||||
name = fields.Char('Name', required=True)
|
||||
relation = fields.Char('Model Relation')
|
||||
model = fields.Many2One('ir.model', 'Model', required=True,
|
||||
select=True, ondelete='cascade')
|
||||
field_description = fields.Char('Field Description', size=None,
|
||||
field_description = fields.Char('Field Description',
|
||||
translate=True)
|
||||
ttype = fields.Char('Field Type', size=None)
|
||||
ttype = fields.Char('Field Type')
|
||||
groups = fields.Many2Many('res.group', 'ir_model_field_group_rel',
|
||||
'field_id', 'group_id', 'Groups')
|
||||
group_name = fields.Char('Group Name', size=None)
|
||||
group_name = fields.Char('Group Name')
|
||||
view_load = fields.Boolean('View Auto-Load')
|
||||
help = fields.Text('Help', translate=True)
|
||||
module = fields.Char('Module', size=None,
|
||||
module = fields.Char('Module',
|
||||
help="Module in which this field is defined")
|
||||
|
||||
def __init__(self):
|
||||
@@ -160,9 +166,9 @@ class ModelData(OSV):
|
||||
_name = 'ir.model.data'
|
||||
_description = __doc__
|
||||
fs_id = fields.Char('Identifier on File System', required=True,
|
||||
size=None, help="The id of the record as known on the file system.")
|
||||
model = fields.Char('Model', required=True, size=None)
|
||||
module = fields.Char('Module', required=True, size=None)
|
||||
help="The id of the record as known on the file system.")
|
||||
model = fields.Char('Model', required=True)
|
||||
module = fields.Char('Module', required=True)
|
||||
db_id = fields.Integer('Resource ID',
|
||||
help="The id of the record in the database.")
|
||||
date_update = fields.DateTime('Update Date')
|
||||
|
||||
@@ -7,14 +7,16 @@
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<![CDATA[
|
||||
<form string="Model Description">
|
||||
<form string="Model Description" col="6">
|
||||
<label name="name"/>
|
||||
<field name="name"/>
|
||||
<label name="model"/>
|
||||
<field name="model"/>
|
||||
<separator name="info" colspan="4"/>
|
||||
<field name="info" colspan="4"/>
|
||||
<field name="fields" colspan="4" readonly="1">
|
||||
<label name="module"/>
|
||||
<field name="module"/>
|
||||
<separator name="info" colspan="6"/>
|
||||
<field name="info" colspan="6"/>
|
||||
<field name="fields" colspan="6" readonly="1">
|
||||
<form string="Fields Description">
|
||||
<label name="name"/>
|
||||
<field name="name"/>
|
||||
@@ -42,6 +44,7 @@
|
||||
<field name="name" select="1"/>
|
||||
<field name="model" select="1"/>
|
||||
<field name="info" select="1"/>
|
||||
<field name="module" select="1"/>
|
||||
</tree>
|
||||
]]>
|
||||
</field>
|
||||
|
||||
+3
-2
@@ -258,8 +258,9 @@ class ORM(object):
|
||||
# reference model in order to have a description
|
||||
# of its fonctionnality in custom_report
|
||||
cursor.execute("INSERT INTO ir_model " \
|
||||
"(model, name, info) VALUES (%s, %s, %s)",
|
||||
(self._name, self._description, self.__doc__))
|
||||
"(model, name, info, module) VALUES (%s, %s, %s, %s)",
|
||||
(self._name, self._description, self.__doc__,
|
||||
module_name))
|
||||
cursor.execute("SELECT id FROM ir_model WHERE model = %s",
|
||||
(self._name,))
|
||||
(model_id,) = cursor.fetchone()
|
||||
|
||||
Reference in new issue
Block a user