[MERGE] Merged main trunk server branch

bzr revid: jvo@tinyerp.com-20100514160602-0nnir766yoyr57i2
bzr revid: jvo@tinyerp.com-20100517053403-e8nxmhjir01v87rz
This commit is contained in:
Jay (Open ERP) 2010-05-17 11:04:03 +05:30
commit 40215c023a
10 changed files with 112 additions and 64 deletions

View File

@ -87,6 +87,7 @@
<label colspan="4" string="Please note that you will have to logout and relog if you change your password."/>
<field name="context_lang" completion="1" readonly="0"/>
<field name="context_tz" completion="1" readonly="0" colspan="4"/>
<field name="view" colspan="4" readonly="0" />
<newline/>
<field colspan="4" name="signature" readonly="0"/>
</page>

View File

@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.4\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-12-18 08:39+0000\n"
"PO-Revision-Date: 2010-04-21 04:53+0000\n"
"Last-Translator: OpenERP Administrators <Unknown>\n"
"PO-Revision-Date: 2010-05-15 14:19+0000\n"
"Last-Translator: Boris <boris.t.ivanov@gmail.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-04-22 03:42+0000\n"
"X-Launchpad-Export-Date: 2010-05-17 05:00+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: base
@ -83,7 +83,7 @@ msgstr "Създадени изгледи"
#. module: base
#: view:workflow.activity:0
msgid "Outgoing transitions"
msgstr "Изходящи промени"
msgstr "Изходящи преходи"
#. module: base
#: selection:ir.report.custom,frequency:0
@ -1754,7 +1754,7 @@ msgstr "XSL"
#: code:addons/base/module/module.py:0
#, python-format
msgid "Can not upgrade module '%s'. It is not installed."
msgstr "Не може да бъде обновен модул '%s'. Той не е инсталиран."
msgstr "Модул '%s' не може да бъде обновен. Той не е инсталиран."
#. module: base
#: model:res.country,name:base.cu
@ -2039,7 +2039,7 @@ msgstr "Извличане на език"
#. module: base
#: selection:maintenance.contract.wizard,state:0
msgid "Unvalidated"
msgstr "Непроверен"
msgstr "Невалидирано"
#. module: base
#: model:ir.ui.menu,name:base.next_id_9
@ -2066,7 +2066,7 @@ msgstr "Също така може да вмъкнете \".po\" файлове.
#: code:addons/base/maintenance/maintenance.py:0
#, python-format
msgid "Unable to find a valid contract"
msgstr "Не може да се намери валиден договор"
msgstr "Не е намер валиден договор"
#. module: base
#: code:addons/base/ir/ir_actions.py:0
@ -5002,7 +5002,7 @@ msgstr "Python код"
#: code:addons/base/module/wizard/wizard_module_import.py:0
#, python-format
msgid "Can not create the module file: %s !"
msgstr "Модулния файл: %s, не можеда да бъде създаден !"
msgstr "Модулния файл: %s, не можеда да бъде създаден !"
#. module: base
#: model:ir.module.module,description:base.module_meta_information
@ -5028,7 +5028,7 @@ msgstr "Откажи"
#: code:addons/base/ir/ir_actions.py:0
#, python-format
msgid "Please specify server option --smtp-from !"
msgstr "Моля укажете опцията на сървъра --smtp-from !"
msgstr "Моля укажете опция на сървъра --smtp-from !"
#. module: base
#: selection:wizard.module.lang.export,format:0
@ -6225,7 +6225,7 @@ msgstr "Извличане на файл с превод"
#. module: base
#: field:ir.ui.view_sc,user_id:0
msgid "User Ref."
msgstr "Справка за потребител"
msgstr "Потребителска справка"
#. module: base
#: model:ir.ui.menu,name:base.menu_base_config
@ -6812,7 +6812,7 @@ msgstr "RML съдържание"
#. module: base
#: view:workflow.activity:0
msgid "Incoming transitions"
msgstr "Входящи промени"
msgstr "Входящи преходи"
#. module: base
#: model:res.country,name:base.cn
@ -7277,7 +7277,7 @@ msgstr "Оригинал"
#. module: base
#: help:res.partner.address,partner_id:0
msgid "Keep empty for a private address, not related to partner."
msgstr "Оставете празно за личен адрес несвързан с партньора"
msgstr "Оставете празно за личен адрес нямащ отношение към партньора."
#. module: base
#: model:res.country,name:base.vu
@ -7296,8 +7296,8 @@ msgid ""
"Save this document to a .tgz file. This archive containt UTF-8 %s files and "
"may be uploaded to launchpad."
msgstr ""
"Запази документа като .tgz файл. Този архив съдържа %s UTF-8 файлове и може "
"да бъде качен в launchpad."
"Запазете документа като .tgz файл. Този архив съдържа %s UTF-8 файлове и "
"може да бъде качен в launchpad."
#. module: base
#: wizard_button:module.upgrade,end,config:0
@ -7728,7 +7728,7 @@ msgid ""
"invoice, then `object.invoice_address_id.mobile` is the field which gives "
"the correct mobile number"
msgstr ""
"Оказва полетата които ще се използват за доставяне на мобилен номер, напр., "
"Указва полетата които ще се използват за доставяне на мобилен номер, напр., "
"когато изберете фактура, тогава 'object.invoice_address_id.mobile' е полето "
"което дава правилния мобилен номер"
@ -8080,7 +8080,7 @@ msgstr "полски / Język polski"
#. module: base
#: field:ir.exports,name:0
msgid "Export Name"
msgstr "Име на извлечането"
msgstr "Име на изнасянето"
#. module: base
#: help:res.partner.address,type:0

View File

@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.4\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-12-18 08:39+0000\n"
"PO-Revision-Date: 2010-05-13 04:54+0000\n"
"PO-Revision-Date: 2010-05-17 04:48+0000\n"
"Last-Translator: goranc <goranc@gmail.com>\n"
"Language-Team: openerp-translators\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-05-14 04:54+0000\n"
"X-Launchpad-Export-Date: 2010-05-17 05:00+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
"Language: hr\n"

View File

@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.4\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-12-18 08:39+0000\n"
"PO-Revision-Date: 2010-05-13 09:24+0000\n"
"Last-Translator: Carlo - didotech.com <Unknown>\n"
"PO-Revision-Date: 2010-05-16 16:24+0000\n"
"Last-Translator: eLBati - albatos.com <lorenzo.battistini@albatos.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-05-14 04:54+0000\n"
"X-Launchpad-Export-Date: 2010-05-17 05:00+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: base
@ -901,7 +901,7 @@ msgstr "Relazione"
#. module: base
#: field:ir.model.access,perm_read:0
msgid "Read Access"
msgstr "Accesso di Lettura"
msgstr "Accesso in lettura"
#. module: base
#: model:ir.model,name:base.model_ir_exports
@ -3875,7 +3875,7 @@ msgstr "Esegui Conteggio"
#. module: base
#: field:ir.model.access,perm_create:0
msgid "Create Access"
msgstr "Crea Accesso"
msgstr "Accesso in creazione"
#. module: base
#: field:res.partner.address,state_id:0
@ -5506,7 +5506,7 @@ msgstr "Sig.rina"
#. module: base
#: field:ir.model.access,perm_write:0
msgid "Write Access"
msgstr "Accesso Scrittura"
msgstr "Accesso in scrittura"
#. module: base
#: field:res.bank,city:0
@ -7411,7 +7411,7 @@ msgstr ">"
#. module: base
#: field:ir.model.access,perm_unlink:0
msgid "Delete Permission"
msgstr "Cancella Autorizzazione"
msgstr "Permesso di cancellazione"
#. module: base
#: model:ir.model,name:base.model_multi_company_default

View File

@ -8,13 +8,13 @@ msgstr ""
"Project-Id-Version: openobject-server\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2009-12-18 08:39+0000\n"
"PO-Revision-Date: 2010-05-13 04:56+0000\n"
"PO-Revision-Date: 2010-05-17 04:47+0000\n"
"Last-Translator: Harry (Open ERP) <hmo@tinyerp.com>\n"
"Language-Team: Japanese <ja@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-05-14 04:54+0000\n"
"X-Launchpad-Export-Date: 2010-05-17 05:00+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: base

View File

@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.0\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-12-18 08:39+0000\n"
"PO-Revision-Date: 2010-05-13 04:57+0000\n"
"PO-Revision-Date: 2010-05-17 04:45+0000\n"
"Last-Translator: Anders Wallenquist <anders.wallenquist@vertel.se>\n"
"Language-Team: <>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-05-14 04:54+0000\n"
"X-Launchpad-Export-Date: 2010-05-17 05:00+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: base

View File

@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.0\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-12-18 08:39+0000\n"
"PO-Revision-Date: 2010-05-13 04:57+0000\n"
"PO-Revision-Date: 2010-05-17 04:49+0000\n"
"Last-Translator: Fabien (Open ERP) <fp@tinyerp.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-05-14 04:54+0000\n"
"X-Launchpad-Export-Date: 2010-05-17 05:01+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: base

View File

@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.4\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-12-18 08:39+0000\n"
"PO-Revision-Date: 2010-05-13 04:57+0000\n"
"PO-Revision-Date: 2010-05-17 04:47+0000\n"
"Last-Translator: OpenERP Administrators <Unknown>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-05-14 04:55+0000\n"
"X-Launchpad-Export-Date: 2010-05-17 05:01+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: base

View File

@ -167,6 +167,39 @@ class users(osv.osv):
body=self.get_welcome_mail_body(
cr, uid, context=context) % user)
def update_user_group(self, cr, uid, ids, name, value, arg, context):
""" update User groups according to the interface.
@param name: Name of the field
@param arg: User defined argument
@param value: new value returned
@return: True/False
"""
if not value: return False
if not isinstance(ids, list):
ids = [ids]
group_obj = self.pool.get('res.groups')
extended_group = group_obj.search(cr,uid,[('name','ilike','Extended')])[0]
user_groups = self.read(cr, uid, ids, ['groups_id'])[0]['groups_id']
if value == 'simple':
cr.execute(""" delete from res_groups_users_rel where gid=%s and uid=ANY(%s)""",(extended_group, ids))
else:
self.write(cr, uid, ids,{'groups_id':[(6, 0, list(set([extended_group] + user_groups)))]})
return True
def _set_interface(self, cr, uid, ids, name, args, context=None):
""" Sets interface for the User.
@param field_name: Name of the field
@param arg: User defined argument
@return: Dictionary of values
"""
group_obj = self.pool.get('res.groups')
extended_group = group_obj.search(cr,uid,[('name','ilike','Extended')])[0]
user_groups = self.read(cr, uid, ids, ['groups_id'])[0]['groups_id']
if extended_group not in user_groups:
return {ids[0]:'simple'}
else:
return {ids[0]:'extended'}
_columns = {
'name': fields.char('Name', size=64, required=True, select=True,
help="The new user's real name, used for searching"
@ -195,7 +228,11 @@ class users(osv.osv):
'context_tz': fields.selection(_tz_get, 'Timezone', size=64,
help="The user's timezone, used to perform timezone conversions "
"between the server and the client."),
'view': fields.function(_set_interface, method=True, type='selection', fnct_inv=update_user_group,
selection=[('simple','Simplified'),('extended','Extended')],
string='Interface', help="Choose between the simplified interface and the extended one"),
}
def read(self,cr, uid, ids, fields=None, context=None, load='_classic_read'):
def override_password(o):
if 'password' in o and ( 'id' not in o or o['id'] != uid ):
@ -463,15 +500,10 @@ class res_config_view(osv.osv_memory):
}
def execute(self, cr, uid, ids, context=None):
res=self.read(cr,uid,ids)[0]
users_obj = self.pool.get('res.users')
group_obj=self.pool.get('res.groups')
if 'view' in res and res['view'] and res['view']=='extended':
group_ids=group_obj.search(cr,uid,[('name','ilike','Extended')])
if group_ids and len(group_ids):
users_obj.write(cr, uid, [uid],{
'groups_id':[(4,group_ids[0])]
}, context=context)
res = self.read(cr, uid, ids)[0]
self.pool.get('res.users').write(cr, uid, [uid],
{'view':res['view']}, context=context)
res_config_view()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -100,7 +100,7 @@ class Cursor(object):
msg = "Cursor not closed explicitly\n" \
"Cursor was created at %s:%s"
self.__logger.warn(msg, *self.__caller)
self.close()
self._close(True)
@check
def execute(self, query, params=None):
@ -118,7 +118,7 @@ class Cursor(object):
params = params or None
res = self._obj.execute(query, params)
except psycopg2.ProgrammingError, pe:
self.__logger.error("Programming error: %s, in query %s" % (pe, query))
self.__logger.error("Programming error: %s, in query %s", pe, query)
raise
except Exception:
self.__logger.exception("bad query: %s", self._obj.query)
@ -177,6 +177,9 @@ class Cursor(object):
@check
def close(self):
return self._close(False)
def _close(self, leak=False):
if not self._obj:
return
@ -194,8 +197,12 @@ class Cursor(object):
# part because browse records keep a reference to the cursor.
del self._obj
self.__closed = True
keep_in_pool = self.dbname not in ('template1', 'template0', 'postgres')
self._pool.give_back(self._cnx, keep_in_pool=keep_in_pool)
if leak:
self._cnx.leaked = True
else:
keep_in_pool = self.dbname not in ('template1', 'template0', 'postgres')
self._pool.give_back(self._cnx, keep_in_pool=keep_in_pool)
@check
def autocommit(self, on):
@ -215,6 +222,9 @@ class Cursor(object):
return getattr(self._obj, name)
class PsycoConnection(psycopg2.extensions.connection):
pass
class ConnectionPool(object):
__logger = logging.getLogger('db.connection_pool')
@ -240,59 +250,64 @@ class ConnectionPool(object):
count = len(self._connections)
return "ConnectionPool(used=%d/count=%d/max=%d)" % (used, count, self._maxconn)
def _debug(self, msg):
self.__logger.debug(repr(self))
self.__logger.debug(msg)
def _debug(self, msg, *args):
msg = '%r ' + msg
self.__logger.debug(msg, self, *args)
@locked
def borrow(self, dsn):
self._debug('Borrow connection to %s' % (dsn,))
self._debug('Borrow connection to %r', dsn)
# free leaked connections
for i, (cnx, _) in tools.reverse_enumerate(self._connections):
if getattr(cnx, 'leaked', False):
delattr(cnx, 'leaked')
self._connections.pop(i)
self._connections.append((cnx, False))
self._debug('Free leaked connection to %r', cnx.dsn)
result = None
for i, (cnx, used) in enumerate(self._connections):
if not used and dsn_are_equals(cnx.dsn, dsn):
self._debug('Existing connection found at index %d' % i)
self._connections.pop(i)
self._connections.append((cnx, True))
self._debug('Existing connection found at index %d', i)
result = cnx
break
if result:
return result
return cnx
if len(self._connections) >= self._maxconn:
# try to remove the oldest connection not used
for i, (cnx, used) in enumerate(self._connections):
if not used:
self._debug('Removing old connection at index %d: %s' % (i, cnx.dsn))
self._connections.pop(i)
self._debug('Removing old connection at index %d: %r', i, cnx.dsn)
break
else:
# note: this code is called only if the for loop has completed (no break)
raise PoolError('The Connection Pool Is Full')
self._debug('Create new connection')
result = psycopg2.connect(dsn=dsn)
result = psycopg2.connect(dsn=dsn, connection_factory=PsycoConnection)
self._connections.append((result, True))
self._debug('Create new connection')
return result
@locked
def give_back(self, connection, keep_in_pool=True):
self._debug('Give back connection to %s' % (connection.dsn,))
self._debug('Give back connection to %r', connection.dsn)
for i, (cnx, used) in enumerate(self._connections):
if cnx is connection:
self._connections.pop(i)
if keep_in_pool:
self._connections.append((cnx, False))
self._debug('Put connection to %s in pool' % (cnx.dsn,))
self._debug('Put connection to %r in pool', cnx.dsn)
else:
self._debug('Forgot connection to %r', cnx.dsn)
break
else:
raise PoolError('This connection does not below to the pool')
@locked
def close_all(self, dsn):
self._debug('Close all connections to %s' % (dsn,))
self._debug('Close all connections to %r', dsn)
for i, (cnx, used) in tools.reverse_enumerate(self._connections):
if dsn_are_equals(cnx.dsn, dsn):
cnx.close()
@ -308,7 +323,7 @@ class Connection(object):
def cursor(self, serialized=False):
cursor_type = serialized and 'serialized ' or ''
self.__logger.debug('create %scursor to "%s"' % (cursor_type, self.dbname,))
self.__logger.debug('create %scursor to %r', cursor_type, self.dbname)
return Cursor(self._pool, self.dbname, serialized=serialized)
def serialized_cursor(self):