merging from the trunk

bzr revid: mga@tinyerp.com-20081216102643-cmvyrwi73k9bbwun
This commit is contained in:
Mantavya Gajjar
2008-12-16 15:56:43 +05:30
7 changed files with 41 additions and 25 deletions
+1 -1
View File
@@ -19,7 +19,7 @@
<field name="view_id" ref="view_menu"/>
<field name="res_model">ir.ui.menu</field>
<field name="view_type">tree</field>
<field eval="'[(\'parent_id\',\'=\',False)]'" name="domain"/>
<field name="domain">[('parent_id', '=', False)]</field>
</record>
<record id="lang_en" model="res.lang">
+16 -3
View File
@@ -324,12 +324,25 @@
</record>
<menuitem action="ir_action_window" id="menu_ir_action_window" parent="base.next_id_6"/>
<record id="act_wizard_view" model="ir.ui.view">
<record id="act_wizard_view_tree" model="ir.ui.view">
<field name="name">ir.actions.wizard.tree</field>
<field name="model">ir.actions.wizard</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Wizard">
<field name="name" select="1"/>
<field name="wiz_name" select="1"/>
<field name="multi"/>
</tree>
</field>
</record>
<record id="act_wizard_view" model="ir.ui.view">
<field name="name">ir.actions.wizard</field>
<field name="model">ir.actions.wizard</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Wizard">
<form string="Wizards">
<field name="name" select="1"/>
<field name="type" select="1"/>
<field name="wiz_name" select="1"/>
@@ -340,7 +353,7 @@
</record>
<record id="ir_action_wizard" model="ir.actions.act_window">
<field name="name">Wizard</field>
<field name="name">Wizards</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">ir.actions.wizard</field>
<field name="view_type">form</field>
+16 -16
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$
#
@@ -55,7 +55,7 @@ class ir_model(osv.osv):
if model.state=='manual':
if not model.model.startswith('x_'):
return False
if not re.match('^[a-z_A-Z0-9]+$',model.model):
if not re.match('^[a-z_A-Z0-9.]+$',model.model):
return False
return True
@@ -233,7 +233,7 @@ class ir_model_fields(osv.osv):
# MAY BE ADD A ALTER TABLE DROP ?
#
return super(ir_model_fields, self).unlink(cr, user, ids, context)
def write(self, cr, uid, ids, vals, context=None):
res = False
if 'relation_id' in vals:
@@ -242,29 +242,29 @@ class ir_model_fields(osv.osv):
if 'relation_field_id' in vals:
field_data = self.pool.get('ir.model.fields').browse(cr, uid, vals['relation_field_id'])
vals['relation'] = field_data.name
res = super(ir_model_fields, self).write(cr, uid, ids, vals, context)
return res
def create(self, cr, user, vals, context=None):
if 'relation_id' in vals:
model_data = self.pool.get('ir.model').browse(cr,user,vals['relation_id'])
model_data = self.pool.get('ir.model').browse(cr, user, vals['relation_id'])
vals['relation']=model_data.model
if 'relation_field_id' in vals:
field_data = self.pool.get('ir.model.fields').browse(cr, uid, vals['relation_field_id'])
field_data = self.pool.get('ir.model.fields').browse(cr, user, vals['relation_field_id'])
vals['relation_field'] = field_data.name
if 'model_id' in vals:
model_data=self.pool.get('ir.model').browse(cr,user,vals['model_id'])
vals['model']=model_data.model
model_data = self.pool.get('ir.model').browse(cr, user, vals['model_id'])
vals['model'] = model_data.model
if context and context.get('manual',False):
vals['state']='manual'
vals['state'] = 'manual'
res = super(ir_model_fields,self).create(cr, user, vals, context)
if vals.get('state','base')=='manual':
if vals.get('state','base') == 'manual':
if not vals['name'].startswith('x_'):
raise except_orm(_('Error'), _("Custom fields must have a name that starts with 'x_' !"))
if self.pool.get(vals['model']):
self.pool.get(vals['model']).__init__(self.pool, cr)
self.pool.get(vals['model'])._auto_init(cr,{})
self.pool.get(vals['model'])._auto_init(cr, {})
return res
ir_model_fields()
@@ -298,7 +298,7 @@ class ir_model_access(osv.osv):
model_name = model.name
else:
model_name = model
if isinstance(group_ids, (int, long)):
group_ids = [group_ids]
for group_id in group_ids:
@@ -324,7 +324,7 @@ class ir_model_access(osv.osv):
def check(self, cr, uid, model, mode='read', raise_exception=True):
if uid==1:
# User root have all accesses
# User root have all accesses
# TODO: exclude xml-rpc requests
return True
@@ -335,7 +335,7 @@ class ir_model_access(osv.osv):
model_name = model.name
else:
model_name = model
# We check if a specific rule exists
cr.execute('SELECT MAX(CASE WHEN perm_' + mode + ' THEN 1 ELSE 0 END) '
' FROM ir_model_access a '
@@ -394,7 +394,7 @@ class ir_model_access(osv.osv):
res = super(ir_model_access, self).write(cr, uid, *args, **argv)
self.check() # clear the cache of check function
return res
def create(self, cr, uid, *args, **argv):
res = super(ir_model_access, self).create(cr, uid, *args, **argv)
self.check()
+1 -1
View File
@@ -255,7 +255,7 @@ class res_partner(osv.osv):
ref = res and res[0]['ref'] or '0'
try:
nextref = int(ref)+1
except e:
except:
raise osv.except_osv(_('Warning'), _("Couldn't generate the next id because some partners have an alphabetic id !"))
# update the current partner
+3
View File
@@ -602,6 +602,9 @@ class function(_column):
if store:
self._classic_read = True
self._classic_write = True
if type=='binary':
self._symbol_get=lambda x:x and str(x)
if type == 'float':
self._symbol_c = float._symbol_c
self._symbol_f = float._symbol_f
+1 -1
View File
@@ -613,7 +613,7 @@ class report_sxw(report_rml):
else:
ir_menu_report_obj = pool.get('ir.ui.menu')
report_menu_ids = ir_menu_report_obj.search(cr, uid,
[('id', '=', ids)], context=context)
[('id', 'in', ids)], context=context)
if report_menu_ids:
report_name = ir_menu_report_obj.browse(cr, uid, report_menu_ids[0],
context=context)
+3 -3
View File
@@ -213,15 +213,15 @@ class PoolManager(object):
logger = netsvc.Logger()
try:
logger.notifyChannel('dbpool', netsvc.LOG_INFO, 'Connecting to %s' % (db_name,))
PoolManager._pools[db_name] = ConnectionPool(ThreadedConnectionPool(0, PoolManager.maxconn, PoolManager.dsn(db_name)), db_name)
PoolManager._pools[db_name] = ConnectionPool(ThreadedConnectionPool(1, PoolManager.maxconn, PoolManager.dsn(db_name)), db_name)
except Exception, e:
logger.notifyChannel('dbpool', netsvc.LOG_CRITICAL, 'Unable to connect to %s: %r' % (db_name, e))
logger.notifyChannel('dbpool', netsvc.LOG_CRITICAL, 'Unable to connect to %s: %s' % (db_name, e.message))
raise
return PoolManager._pools[db_name]
get = staticmethod(get)
def close(db_name):
if db_name is PoolManager._pools:
if db_name in PoolManager._pools:
logger.notifyChannel('dbpool', netsvc.LOG_INFO, 'Closing all connections to %s' % (db_name,))
PoolManager._pools[db_name].closeall()
del PoolManager._pools[db_name]