diff --git a/bin/addons/base/ir/ir.xml b/bin/addons/base/ir/ir.xml index 855b7a3ffce..e598fd9cc54 100644 --- a/bin/addons/base/ir/ir.xml +++ b/bin/addons/base/ir/ir.xml @@ -261,6 +261,8 @@
+ + @@ -901,7 +903,7 @@ ir.translation tree - + diff --git a/bin/addons/base/res/partner/partner.py b/bin/addons/base/res/partner/partner.py index e0c312762d5..3d74c0f6b92 100644 --- a/bin/addons/base/res/partner/partner.py +++ b/bin/addons/base/res/partner/partner.py @@ -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): diff --git a/bin/addons/base/rng/view.rng b/bin/addons/base/rng/view.rng index 2f3c07b60bc..6255c9f7650 100644 --- a/bin/addons/base/rng/view.rng +++ b/bin/addons/base/rng/view.rng @@ -37,6 +37,7 @@ + diff --git a/bin/addons/gen_graph.sh b/bin/addons/gen_graph.sh new file mode 100755 index 00000000000..a56780d1d49 --- /dev/null +++ b/bin/addons/gen_graph.sh @@ -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 + diff --git a/bin/osv/expression.py b/bin/osv/expression.py index 3d18463e1ef..34b222a11d5 100644 --- a/bin/osv/expression.py +++ b/bin/osv/expression.py @@ -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): diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 6507d270370..61b379f5311 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -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() diff --git a/bin/report/report_sxw.py b/bin/report/report_sxw.py index 208418436d9..314c41e05cf 100644 --- a/bin/report/report_sxw.py +++ b/bin/report/report_sxw.py @@ -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: diff --git a/bin/service/web_services.py b/bin/service/web_services.py index ab13bae4451..11bf8c8c88c 100644 --- a/bin/service/web_services.py +++ b/bin/service/web_services.py @@ -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