bzr revid: olt@tinyerp.com-20090119085806-mj80r29qoswby3xo
This commit is contained in:
Olivier Laurent 2009-01-19 09:58:06 +01:00
commit e0e1fe6b2b
8 changed files with 107 additions and 19 deletions

View File

@ -261,6 +261,8 @@
<form string="Report xml">
<field name="name" select="1"/>
<field name="type" select="1"/>
<field name="model" select="1"/>
<newline/>
<field name="report_name" select="1"/>
<field name="report_xsl"/>
<field name="report_xml"/>
@ -901,7 +903,7 @@
<field name="model">ir.translation</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree editable="bottom" string="Translations">
<tree string="Translations">
<field name="src"/>
<field name="value"/>
<field name="name"/>

View File

@ -328,6 +328,10 @@ class res_partner_address(osv.osv):
ids += self.search(cr, user, [('name',operator,name)] + args, limit=limit, context=context)
ids += self.search(cr, user, [('partner_id',operator,name)] + args, limit=limit, context=context)
return self.name_get(cr, user, ids, context=context)
def get_city(self, cr, uid, id):
return self.browse(cr, uid, id).city
res_partner_address()
class res_partner_bank_type(osv.osv):

View File

@ -37,6 +37,7 @@
<rng:optional><rng:attribute name="position"/></rng:optional>
<rng:optional><rng:attribute name="link"/></rng:optional>
<rng:optional><rng:attribute name="type"/></rng:optional>
<rng:optional><rng:attribute name="on_write"/></rng:optional>
<rng:zeroOrMore>
<rng:choice>
<rng:ref name="field"/>

32
bin/addons/gen_graph.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
##############################################################################
#
# Copyright (c) 2004-2009 TINY SPRL. (http://tiny.be)
#
# $Id$
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contact a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
./module_graph.py $@ | dot -Tpng -o > module_graph.png

View File

@ -34,7 +34,7 @@ class expression(object):
"""
def _is_operator(self, element):
return isinstance(element, str) \
return (isinstance(element, str) or isinstance(element, unicode)) \
and element in ['&', '|', '!']
def _is_leaf(self, element, internal=False):

View File

@ -296,6 +296,7 @@ class orm_template(object):
_rec_name = 'name'
_parent_name = 'parent_id'
_parent_store = False
_parent_order = False
_date_name = 'date'
_order = 'id'
_sequence = None
@ -1365,6 +1366,8 @@ class orm(orm_template):
where = self._parent_name+'='+str(root)
if not root:
where = self._parent_name+' IS NULL'
if self._parent_order:
where += ' order by '+self._parent_order
cr.execute('SELECT id FROM '+self._table+' WHERE '+where)
pos2 = pos + 1
childs = cr.fetchall()

View File

@ -155,7 +155,7 @@ class _format(object):
if os.name == 'nt':
locale.setlocale(locale.LC_ALL, _LOCALE2WIN32.get(lang, lang) + '.' + encoding)
else:
locale.setlocale(locale.LC_ALL, lang + '.' + encoding)
locale.setlocale(locale.LC_ALL,str( lang + '.' + encoding))
except Exception:
netsvc.Logger().notifyChannel('report', netsvc.LOG_WARNING,
'report %s: unable to set locale "%s"' % (self.name,
@ -337,31 +337,78 @@ class rml_parse(object):
if not value:
return ''
pool_lang=self.pool.get('res.lang')
lc, encoding = locale.getdefaultlocale()
if not encoding:
encoding = 'UTF-8'
if encoding == 'utf':
encoding = 'UTF-8'
if encoding == 'cp1252':
encoding= '1252'
lang = self.localcontext.get('lang', 'en_US') or 'en_US'
lang_obj = pool_lang.browse(self.cr,self.uid,pool_lang.search(self.cr,self.uid,[('code','=',lang)])[0])
try:
if os.name == 'nt':
locale.setlocale(locale.LC_ALL, _LOCALE2WIN32.get(lang, lang) + '.' + encoding)
else:
locale.setlocale(locale.LC_ALL, str(lang + '.' + encoding))
except Exception:
netsvc.Logger().notifyChannel('report', netsvc.LOG_WARNING,
'report %s: unable to set locale "%s"' % (self.name,
self.localcontext.get('lang', 'en_US') or 'en_US'))
lang, encoding = locale.getdefaultlocale()
if date or date_time:
date_format = lang_obj.date_format
if date_time:
date_format = lang_obj.date_format + " " + lang_obj.time_format
if not isinstance(value, time.struct_time):
# assume string, parse it
if len(str(value)) == 10:
# length of date like 2001-01-01 is ten
# assume format '%Y-%m-%d'
date = mx.DateTime.strptime(str(value),DT_FORMAT)
date = time.strptime(value, DT_FORMAT)
locale.setlocale(locale.LC_ALL, str(lang + '.' + encoding))
return time.strftime(locale.nl_langinfo(locale.D_FMT).replace('%y', '%Y'),date)
else:
# assume format '%Y-%m-%d %H:%M:%S'
value = str(value)[:19]
date = mx.DateTime.strptime(str(value),DHM_FORMAT)
else:
date = mx.DateTime.DateTime(*(value.timetuple()[:6]))
return date.strftime(date_format)
return lang_obj.format('%.' + str(digits) + 'f', value, grouping=grouping, monetary=monetary)
date = time.strptime(value, DHM_FORMAT)
date_f = time.strftime(locale.nl_langinfo(locale.D_FMT).replace('%y', '%Y'),date)
time_f = time.strftime(locale.nl_langinfo(locale.T_FMT),date)
res = date_f + " " + time_f
locale.setlocale(locale.LC_ALL, str(lang + '.' + encoding))
return res
return date
return locale.format('%.' + str(digits) + 'f', value, grouping=grouping, monetary=monetary)
# def formatLang(self, value, digits=2, date=False,date_time=False, grouping=True, monetary=False, currency=None):
# if not value:
# return ''
#
# pool_lang=self.pool.get('res.lang')
# lang = self.localcontext.get('lang', 'en_US') or 'en_US'
# lang_obj = pool_lang.browse(self.cr,self.uid,pool_lang.search(self.cr,self.uid,[('code','=',lang)])[0])
#
# if date or date_time:
# date_format = lang_obj.date_format
# if date_time:
# date_format = lang_obj.date_format + " " + lang_obj.time_format
#
# if not isinstance(value, time.struct_time):
# # assume string, parse it
# if len(str(value)) == 10:
# # length of date like 2001-01-01 is ten
# # assume format '%Y-%m-%d'
# date = mx.DateTime.strptime(str(value),DT_FORMAT)
# else:
# # assume format '%Y-%m-%d %H:%M:%S'
# value = str(value)[:19]
# date = mx.DateTime.strptime(str(value),DHM_FORMAT)
# else:
# date = mx.DateTime.DateTime(*(value.timetuple()[:6]))
#
# return date.strftime(date_format)
#
# return lang_obj.format('%.' + str(digits) + 'f', value, grouping=grouping, monetary=monetary)
# def formatLang(self, value, digit=2, date=False):
# if not value:

View File

@ -249,7 +249,6 @@ class db(netsvc.Service):
cr = db.cursor()
try:
try:
cr = db.cursor()
db_user = tools.config["db_user"]
if not db_user and os.name == 'posix':
import pwd