From 12c6c64a2cf3335663e6f3a80b7677f61affe491 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 26 Feb 2010 02:03:17 +0100 Subject: [PATCH 01/34] [FIX] cleanup: removed duplicate record bzr revid: odo@openerp.com-20100226010317-v0o57e9rwbvdbzs7 --- bin/addons/base/security/base_security.xml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/bin/addons/base/security/base_security.xml b/bin/addons/base/security/base_security.xml index 6fe5731713c..c6a362edbe3 100644 --- a/bin/addons/base/security/base_security.xml +++ b/bin/addons/base/security/base_security.xml @@ -18,7 +18,7 @@ - Useability / Multi Company + Multi Companies @@ -29,10 +29,6 @@ Useability / No One - - Multi Companies - - From dad082f9991b97ad75f54e84689c074e2a578247 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 26 Feb 2010 02:03:45 +0100 Subject: [PATCH 02/34] [FIX] attempt at supporting inherited fields (through _inherits) as group_by in read_group() bzr revid: odo@openerp.com-20100226010345-mg1700e0btgf852a --- bin/osv/orm.py | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 63235e158d4..47112ddff7d 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -1836,18 +1836,22 @@ class orm(orm_template): self.pool.get('ir.model.access').check(cr, uid, self._name, 'read', context=context) if not fields: fields = self._columns.keys() - - (qu1, qu2, tables) = self._where_calc(cr, uid, domain, context=context) + + (where_clause, where_params, tables) = self._where_calc(cr, uid, domain, context=context) dom = self.pool.get('ir.rule').domain_get(cr, uid, self._name, context=context) - qu1 = qu1 + dom[0] - qu2 = qu2 + dom[1] + where_clause = where_clause + dom[0] + where_params = where_params + dom[1] for t in dom[2]: if t not in tables: tables.append(t) - if len(qu1): - qu1 = ' where '+string.join(qu1, ' and ') + + # Take care of adding join(s) if groupby is an '_inherits'ed field + tables, where_clause = self._inherits_join_calc(groupby,tables,where_clause) + + if len(where_clause): + where_clause = ' where '+string.join(where_clause, ' and ') else: - qu1 = '' + where_clause = '' limit_str = limit and ' limit %d' % limit or '' offset_str = offset and ' offset %d' % offset or '' @@ -1872,7 +1876,8 @@ class orm(orm_template): flist += ',avg('+f+') as '+f else: flist += ',sum('+f+') as '+f - cr.execute('select min(id) as id,'+flist+' from ' + self._table +qu1+' group by '+ groupby + limit_str + offset_str,qu2) + + cr.execute('select min(%s.id) as id,' % self._table + flist + ' from ' + ','.join(tables) + where_clause + ' group by '+ groupby + limit_str + offset_str, where_params) alldata = {} groupby = group_by for r in cr.dictfetchall(): @@ -1903,6 +1908,22 @@ class orm(orm_template): del d['id'] return data + def _inherits_join_calc(self, field, tables, where_clause): + """ Adds missing table select and join clause(s) for reaching + the field coming from an '_inherits' parent table. + @param tables: list of table._table names enclosed in double quotes as returned + by _where_calc() + """ + current_table = self + while field in current_table._inherit_fields and not field in current_table._columns: + parent_table = self.pool.get(current_table._inherit_fields[field][0]) + parent_table_name = parent_table._table + if '"%s"'%parent_table_name not in tables: + tables.append('"%s"'%parent_table_name) + where_clause.append('(%s.%s = %s.id)' % (current_table._table, current_table._inherits[parent_table._name], parent_table_name)) + current_table = parent_table + return (tables, where_clause) + def _parent_store_compute(self, cr): logger = netsvc.Logger() logger.notifyChannel('orm', netsvc.LOG_INFO, 'Computing parent left and right for table %s...' % (self._table, )) From f1c67940df34d4e20cebf59b97da215a289edaab Mon Sep 17 00:00:00 2001 From: Launchpad Code Hosting Date: Fri, 26 Feb 2010 04:49:22 +0000 Subject: [PATCH 03/34] Launchpad automatic translations update. bzr revid: codehost@crowberry-20100226044922-kq60kogsv1eh2c1f --- bin/addons/base/i18n/hr.po | 4 ++-- bin/addons/base/i18n/ja.po | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/addons/base/i18n/hr.po b/bin/addons/base/i18n/hr.po index be55442f89c..456d9c01496 100644 --- a/bin/addons/base/i18n/hr.po +++ b/bin/addons/base/i18n/hr.po @@ -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-02-24 13:16+0000\n" +"PO-Revision-Date: 2010-02-25 06:18+0000\n" "Last-Translator: goranc \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-02-25 04:50+0000\n" +"X-Launchpad-Export-Date: 2010-02-26 04:49+0000\n" "X-Generator: Launchpad (build Unknown)\n" "Language: hr\n" diff --git a/bin/addons/base/i18n/ja.po b/bin/addons/base/i18n/ja.po index d3c2018ed52..98297b49132 100644 --- a/bin/addons/base/i18n/ja.po +++ b/bin/addons/base/i18n/ja.po @@ -8,13 +8,13 @@ msgstr "" "Project-Id-Version: openobject-server\n" "Report-Msgid-Bugs-To: FULL NAME \n" "POT-Creation-Date: 2009-12-18 08:39+0000\n" -"PO-Revision-Date: 2010-02-24 06:13+0000\n" +"PO-Revision-Date: 2010-02-25 06:23+0000\n" "Last-Translator: OpenERP Administrators \n" "Language-Team: Japanese \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-02-25 04:50+0000\n" +"X-Launchpad-Export-Date: 2010-02-26 04:49+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: base From c74356c474e9e2b99bb2a42a56b1829af8484f17 Mon Sep 17 00:00:00 2001 From: "mra (Open ERP)" Date: Fri, 26 Feb 2010 12:30:09 +0530 Subject: [PATCH 04/34] [IMP] Add more languages in get_lang method on misc file for Load offcial Translation bzr revid: mra@tinyerp.com-20100226070009-b4b0kg12m5zubeia --- bin/tools/misc.py | 56 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/bin/tools/misc.py b/bin/tools/misc.py index cb4f58004fd..387b7c2d2a2 100644 --- a/bin/tools/misc.py +++ b/bin/tools/misc.py @@ -327,23 +327,23 @@ def html2plaintext(html, body_id=None, encoding='utf-8'): ## (c) Fry-IT, www.fry-it.com, 2007 ## ## download here: http://www.peterbe.com/plog/html2plaintext - - + + """ from an HTML text, convert the HTML to plain text. - If @body_id is provided then this is the tag where the + If @body_id is provided then this is the tag where the body (not necessarily ) starts. """ try: from BeautifulSoup import BeautifulSoup, SoupStrainer, Comment except: return html - + urls = [] if body_id is not None: strainer = SoupStrainer(id=body_id) else: strainer = SoupStrainer('body') - + soup = BeautifulSoup(html, parseOnlyThese=strainer, fromEncoding=encoding) for link in soup.findAll('a'): title = link.renderContents() @@ -351,7 +351,7 @@ def html2plaintext(html, body_id=None, encoding='utf-8'): urls.append(dict(url=url, tag=str(link), title=title)) html = soup.__str__() - + url_index = [] i = 0 for d in urls: @@ -368,11 +368,11 @@ def html2plaintext(html, body_id=None, encoding='utf-8'): html = html.replace('

','**').replace('

','**') html = html.replace('

','**').replace('

','**') html = html.replace('','/').replace('','/') - - # the only line breaks we respect is those of ending tags and + + # the only line breaks we respect is those of ending tags and # breaks - + html = html.replace('\n',' ') html = html.replace('
', '\n') html = html.replace('', '\n') @@ -381,7 +381,7 @@ def html2plaintext(html, body_id=None, encoding='utf-8'): html = html.replace(' ' * 2, ' ') - # for all other tags we failed to clean up, just remove then and + # for all other tags we failed to clean up, just remove then and # complain about them on the stderr def desperate_fixer(g): #print >>sys.stderr, "failed to clean up %s" % str(g.group()) @@ -501,8 +501,8 @@ def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=Non return True except Exception,e: netsvc.Logger().notifyChannel('email_send (maildir)', netsvc.LOG_ERROR, e) - return False - + return False + try: oldstderr = smtplib.stderr s = smtplib.SMTP() @@ -511,7 +511,7 @@ def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=Non if debug: smtplib.stderr = WriteToLogger() - s.set_debuglevel(int(bool(debug))) # 0 or 1 + s.set_debuglevel(int(bool(debug))) # 0 or 1 s.connect(smtp_server, config['smtp_port']) if ssl: s.ehlo() @@ -519,7 +519,7 @@ def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=Non s.ehlo() if config['smtp_user'] or config['smtp_password']: - s.login(config['smtp_user'], config['smtp_password']) + s.login(config['smtp_user'], config['smtp_password']) s.sendmail(email_from, flatten([email_to, email_cc, email_bcc]), msg.as_string() @@ -754,10 +754,10 @@ class cache(object): else: kwargs2 = self._unify_args(*args, **kwargs) keys_to_del = [key for key, _ in self._generate_keys(dbname, kwargs2) if key in self.cache.keys()] - + for key in keys_to_del: self.cache.pop(key) - + @classmethod def clean_caches_for_db(cls, dbname): for c in cls.__caches: @@ -906,6 +906,7 @@ def get_iso_codes(lang): def get_languages(): languages={ + 'ab_RU': u'Abkhazian (RU)', 'ar_AR': u'Arabic / الْعَرَبيّة', 'bg_BG': u'Bulgarian / български', 'bs_BS': u'Bosnian / bosanski jezik', @@ -920,29 +921,48 @@ def get_languages(): 'es_AR': u'Spanish (AR) / Español (AR)', 'es_ES': u'Spanish / Español', 'et_EE': u'Estonian / Eesti keel', + 'fa_IR': u'Persian / Iran, Islamic Republic of', 'fi_FI': u'Finland / Suomi', 'fr_BE': u'French (BE) / Français (BE)', 'fr_CH': u'French (CH) / Français (CH)', 'fr_FR': u'French / Français', + 'gl_ES': u'Galician / Spain', + 'gu_IN': u'Gujarati / India', + 'hi_IN': u'Hindi / India', 'hr_HR': u'Croatian / hrvatski jezik', 'hu_HU': u'Hungarian / Magyar', 'id_ID': u'Indonesian / Bahasa Indonesia', 'it_IT': u'Italian / Italiano', + 'iu_CA': u'Inuktitut / Canada', + 'ja_JP': u'Japanese / Japan', + 'ko_KP': u'Korean / Korea, Democratic Peoples Republic of', + 'ko_KR': u'Korean / Korea, Republic of', 'lt_LT': u'Lithuanian / Lietuvių kalba', + 'lv_LV': u'Latvian / Latvia', + 'ml_IN': u'Malayalam / India', + 'mn_MN': u'Mongolian / Mongolia', + 'nb_NO': u'Norwegian Bokmål / Norway', 'nl_NL': u'Dutch / Nederlands', 'nl_BE': u'Dutch (Belgium) / Nederlands (Belgïe)', + 'oc_FR': u'Occitan (post 1500) / France', 'pl_PL': u'Polish / Język polski', 'pt_BR': u'Portugese (BR) / português (BR)', 'pt_PT': u'Portugese / português', 'ro_RO': u'Romanian / limba română', 'ru_RU': u'Russian / русский язык', + 'si_LK': u'Sinhalese / Sri Lanka', + 'sk_SK': u'Slovak / Slovakia', 'sl_SL': u'Slovenian / slovenščina', 'sq_AL': u'Albanian / Shqipëri', + 'sr_RS': u'Serbian / Serbia', 'sv_SE': u'Swedish / svenska', + 'te_IN': u'Telugu / India', 'tr_TR': u'Turkish / Türkçe', 'vi_VN': u'Vietnam / Cộng hòa xã hội chủ nghĩa Việt Nam', 'uk_UA': u'Ukrainian / украї́нська мо́ва', + 'ur_PK': u'Urdu / Pakistan', 'zh_CN': u'Chinese (CN) / 简体中文', + 'zh_HK': u'Chinese (HK)', 'zh_TW': u'Chinese (TW) / 正體字', 'th_TH': u'Thai / ภาษาไทย', 'tlh_TLH': u'Klingon', @@ -1181,9 +1201,9 @@ def detect_ip_addr(): # RATIONALE BEHIND TIMESTAMP CALCULATIONS AND TIMEZONE MANAGEMENT: # The server side never does any timestamp calculation, always # sends them in a naive (timezone agnostic) format supposed to be -# expressed within the server timezone, and expects the clients to +# expressed within the server timezone, and expects the clients to # provide timestamps in the server timezone as well. -# It stores all timestamps in the database in naive format as well, +# It stores all timestamps in the database in naive format as well, # which also expresses the time in the server timezone. # For this reason the server makes its timezone name available via the # common/timezone_get() rpc method, which clients need to read From b007f19be7eaf954f2f372bcff8875a8d82eae30 Mon Sep 17 00:00:00 2001 From: "JMA(OpenERP)" <> Date: Fri, 26 Feb 2010 15:29:43 +0530 Subject: [PATCH 05/34] [IMP] Added AUD(Australian Dollar) Currency demo data. lp bug: https://launchpad.net/bugs/526205 fixed bzr revid: jvo@tinyerp.com-20100226095943-iun6kp42qicuuqgf --- bin/addons/base/base_data.xml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/bin/addons/base/base_data.xml b/bin/addons/base/base_data.xml index c8ad4c2b636..6873f875b69 100644 --- a/bin/addons/base/base_data.xml +++ b/bin/addons/base/base_data.xml @@ -1271,6 +1271,20 @@ + + + AUD + AUD + 0.01 + 4 + + + + 1.5266 + + + + From 0b4d4f9cf7ac8dcc354c4c725034a29b1fdeaa42 Mon Sep 17 00:00:00 2001 From: "JMA(OpenERP)" <> Date: Fri, 26 Feb 2010 18:41:09 +0530 Subject: [PATCH 06/34] [IMP] Added UAH(Ukraine Hryvnia) Currency demo data. lp bug: https://launchpad.net/bugs/516623 fixed bzr revid: jvo@tinyerp.com-20100226131109-ikjl26q66vxgb2p5 --- bin/addons/base/base_data.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bin/addons/base/base_data.xml b/bin/addons/base/base_data.xml index 6873f875b69..4f61dd1ddfc 100644 --- a/bin/addons/base/base_data.xml +++ b/bin/addons/base/base_data.xml @@ -1285,6 +1285,18 @@ + + UAH + UAH + 0.01 + 4 + + + + 10.8266 + + + From 2916ba99b38a563c1328c0051185026290b30994 Mon Sep 17 00:00:00 2001 From: Launchpad Code Hosting Date: Sat, 27 Feb 2010 04:48:39 +0000 Subject: [PATCH 07/34] Launchpad automatic translations update. bzr revid: codehost@crowberry-20100227044839-3r0i0h4i4f3xig6s --- bin/addons/base/i18n/hr.po | 4 ++-- bin/addons/base/i18n/ja.po | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/addons/base/i18n/hr.po b/bin/addons/base/i18n/hr.po index 456d9c01496..1bfa5f5dfef 100644 --- a/bin/addons/base/i18n/hr.po +++ b/bin/addons/base/i18n/hr.po @@ -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-02-25 06:18+0000\n" +"PO-Revision-Date: 2010-02-26 06:19+0000\n" "Last-Translator: goranc \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-02-26 04:49+0000\n" +"X-Launchpad-Export-Date: 2010-02-27 04:48+0000\n" "X-Generator: Launchpad (build Unknown)\n" "Language: hr\n" diff --git a/bin/addons/base/i18n/ja.po b/bin/addons/base/i18n/ja.po index 98297b49132..c70b5972913 100644 --- a/bin/addons/base/i18n/ja.po +++ b/bin/addons/base/i18n/ja.po @@ -8,13 +8,13 @@ msgstr "" "Project-Id-Version: openobject-server\n" "Report-Msgid-Bugs-To: FULL NAME \n" "POT-Creation-Date: 2009-12-18 08:39+0000\n" -"PO-Revision-Date: 2010-02-25 06:23+0000\n" +"PO-Revision-Date: 2010-02-26 06:22+0000\n" "Last-Translator: OpenERP Administrators \n" "Language-Team: Japanese \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-02-26 04:49+0000\n" +"X-Launchpad-Export-Date: 2010-02-27 04:48+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: base From d3cae5523c3e595b6a5c82b890ad8e111fccbff7 Mon Sep 17 00:00:00 2001 From: Launchpad Code Hosting Date: Sun, 28 Feb 2010 04:54:59 +0000 Subject: [PATCH 08/34] Launchpad automatic translations update. bzr revid: codehost@crowberry-20100228045459-lw4mprtq0627ixjo --- bin/addons/base/i18n/hr.po | 4 ++-- bin/addons/base/i18n/ja.po | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/addons/base/i18n/hr.po b/bin/addons/base/i18n/hr.po index 1bfa5f5dfef..40bfcfadf88 100644 --- a/bin/addons/base/i18n/hr.po +++ b/bin/addons/base/i18n/hr.po @@ -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-02-26 06:19+0000\n" +"PO-Revision-Date: 2010-02-27 06:31+0000\n" "Last-Translator: goranc \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-02-27 04:48+0000\n" +"X-Launchpad-Export-Date: 2010-02-28 04:54+0000\n" "X-Generator: Launchpad (build Unknown)\n" "Language: hr\n" diff --git a/bin/addons/base/i18n/ja.po b/bin/addons/base/i18n/ja.po index c70b5972913..8daba74a172 100644 --- a/bin/addons/base/i18n/ja.po +++ b/bin/addons/base/i18n/ja.po @@ -8,13 +8,13 @@ msgstr "" "Project-Id-Version: openobject-server\n" "Report-Msgid-Bugs-To: FULL NAME \n" "POT-Creation-Date: 2009-12-18 08:39+0000\n" -"PO-Revision-Date: 2010-02-26 06:22+0000\n" +"PO-Revision-Date: 2010-02-27 06:37+0000\n" "Last-Translator: OpenERP Administrators \n" "Language-Team: Japanese \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-02-27 04:48+0000\n" +"X-Launchpad-Export-Date: 2010-02-28 04:54+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: base From faefdc22e52775cfafe62dd89270f043f3a37350 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sun, 28 Feb 2010 09:02:14 +0100 Subject: [PATCH 09/34] merge bzr revid: fp@tinyerp.com-20100228080214-zhgkweltq2lv75xy --- bin/addons/base/base_update.xml | 2 +- bin/addons/base/res/res_user.py | 2 +- bin/osv/orm.py | 2 +- bin/tools/convert.py | 19 +------------------ 4 files changed, 4 insertions(+), 21 deletions(-) diff --git a/bin/addons/base/base_update.xml b/bin/addons/base/base_update.xml index a033724b3d3..2f20199a4d8 100644 --- a/bin/addons/base/base_update.xml +++ b/bin/addons/base/base_update.xml @@ -121,7 +121,7 @@ - + diff --git a/bin/addons/base/res/res_user.py b/bin/addons/base/res/res_user.py index eb4ca575391..ff61b9ec6fa 100644 --- a/bin/addons/base/res/res_user.py +++ b/bin/addons/base/res/res_user.py @@ -188,7 +188,7 @@ class users(osv.osv): 'rules_id': fields.many2many('ir.rule.group', 'user_rule_group_rel', 'user_id', 'rule_group_id', 'Rules'), 'company_id': fields.many2one('res.company', 'Company', required=True, help="The company this user is currently working for."), - 'company_ids':fields.many2many('res.company','res_company_users_rel','user_id','cid','Accepted Companies'), + 'company_ids':fields.many2many('res.company','res_company_users_rel','user_id','cid','Companies'), 'context_lang': fields.selection(_lang_get, 'Language', required=True, help="Sets the language for the user's user interface, when UI " "translations are available"), diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 47112ddff7d..e5ac1ba77a3 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -1901,7 +1901,7 @@ class orm(orm_template): d['__domain'] = [(groupby,'>=',alldata[d['id']][groupby] and datetime.datetime.strptime(alldata[d['id']][groupby][:7] + '-01','%Y-%m-%d').strftime('%Y-%m-%d') or False),\ (groupby,'<=',alldata[d['id']][groupby] and datetime.datetime.strptime(alldata[d['id']][groupby][:7] + '-' + str(days),'%Y-%m-%d').strftime('%Y-%m-%d') or False)] + domain elif fget[groupby]['type'] == 'many2one': - d[groupby] = d[groupby] and d[groupby][1] or '' + d[groupby] = d[groupby] and ((type(d[groupby])==type(1)) and d[groupby] or d[groupby][1]) or '' del alldata[d['id']][groupby] d.update(alldata[d['id']]) diff --git a/bin/tools/convert.py b/bin/tools/convert.py index 4314651d084..cc5b5bdc5df 100644 --- a/bin/tools/convert.py +++ b/bin/tools/convert.py @@ -18,6 +18,7 @@ # along with this program. If not, see . # ############################################################################## + import cStringIO import csv import logging @@ -62,7 +63,6 @@ def _eval_xml(self,node, pool, cr, uid, idref, context=None): f_search = node.get("search",'').encode('utf-8') f_use = node.get("use",'id').encode('ascii') f_name = node.get("name",'').encode('utf-8') - q = eval(f_search, idref) ids = pool.get(f_model).search(cr, uid, q) if f_use != 'id': @@ -190,7 +190,6 @@ class assertion_report(object): return res class xml_import(object): - @staticmethod def nodeattr2bool(node, attr, default=False): if not node.get(attr): @@ -866,19 +865,3 @@ def convert_xml_import(cr, module, xmlfile, idref=None, mode='init', noupdate=Fa obj.parse(doc.getroot()) return True -def convert_xml_export(res): - uid=1 - pool=pooler.get_pool(cr.dbname) - cr=pooler.db.cursor() - idref = {} - page = etree.Element ( 'terp' ) - doc = etree.ElementTree ( page ) - data = etree.SubElement ( page, 'data' ) - text_node = etree.SubElement ( page, 'text' ) - text_node.text = 'Some textual content.' - cr.commit() - cr.close() - - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - From 97d86127677845f5f56320735cd0093e370aef84 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sun, 28 Feb 2010 20:50:16 +0100 Subject: [PATCH 10/34] replaced tab by white spaces bzr revid: fp@tinyerp.com-20100228195016-j8cdsh6si05e5xhh --- bin/addons/base/res/partner/partner_view.xml | 84 ++++++++++---------- bin/osv/orm.py | 24 +++--- 2 files changed, 54 insertions(+), 54 deletions(-) diff --git a/bin/addons/base/res/partner/partner_view.xml b/bin/addons/base/res/partner/partner_view.xml index 73fa7fc1953..3eb53ff2aa7 100644 --- a/bin/addons/base/res/partner/partner_view.xml +++ b/bin/addons/base/res/partner/partner_view.xml @@ -94,30 +94,30 @@
- - - - - - - + + + + + + + - - + + - - - - + + + + - - + + - - + + @@ -158,15 +158,15 @@ - + - - + + - + @@ -238,8 +238,8 @@ - - + + @@ -256,11 +256,11 @@ - + - + @@ -268,27 +268,27 @@
- + - + - - - - + + + + - + - + @@ -301,14 +301,14 @@
- +
- - + + - + @@ -457,7 +457,7 @@ form
- + @@ -467,12 +467,12 @@ - + - - + + @@ -539,7 +539,7 @@ - + diff --git a/bin/osv/orm.py b/bin/osv/orm.py index e5ac1ba77a3..88058aa10c3 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -247,7 +247,7 @@ class browse_record(object): new_data[n] = self._list_class([browse_record(self._cr, self._uid, id, self._table.pool.get(f._obj), self._cache, context=self._context, list_class=self._list_class, fields_process=self._fields_process) for id in data[n]], self._context) else: new_data[n] = data[n] - self._data[data['id']].update(new_data) + self._data[data['id']].update(new_data) if not name in self._data[self._id]: #how did this happen? self.logger.notifyChannel("browse_record", netsvc.LOG_ERROR, @@ -1100,7 +1100,7 @@ class orm_template(object): if column._domain and not isinstance(column._domain, (str, unicode)): dom = column._domain dom += eval(node.get('domain','[]'), {'uid':user, 'time':time}) - context.update(eval(node.get('context','{}'))) + context.update(eval(node.get('context','{}'))) attrs['selection'] = self.pool.get(relation).name_search(cr, user, '', dom, context=context) if (node.get('required') and not int(node.get('required'))) or not column.required: attrs['selection'].append((False,'')) @@ -1836,7 +1836,7 @@ class orm(orm_template): self.pool.get('ir.model.access').check(cr, uid, self._name, 'read', context=context) if not fields: fields = self._columns.keys() - + (where_clause, where_params, tables) = self._where_calc(cr, uid, domain, context=context) dom = self.pool.get('ir.rule').domain_get(cr, uid, self._name, context=context) where_clause = where_clause + dom[0] @@ -1844,10 +1844,10 @@ class orm(orm_template): for t in dom[2]: if t not in tables: tables.append(t) - + # Take care of adding join(s) if groupby is an '_inherits'ed field - tables, where_clause = self._inherits_join_calc(groupby,tables,where_clause) - + tables, where_clause = self._inherits_join_calc(groupby,tables,where_clause) + if len(where_clause): where_clause = ' where '+string.join(where_clause, ' and ') else: @@ -1859,7 +1859,7 @@ class orm(orm_template): float_int_fields = filter(lambda x: fget[x]['type'] in ('float','integer'), fields) sum = {} - group_by = groupby + group_by = groupby if fget.get(groupby,False) and fget[groupby]['type'] in ('date','datetime'): flist = "to_char(%s,'yyyy-mm') as %s "%(groupby,groupby) groupby = "to_char(%s,'yyyy-mm')"%(groupby) @@ -1876,7 +1876,7 @@ class orm(orm_template): flist += ',avg('+f+') as '+f else: flist += ',sum('+f+') as '+f - + cr.execute('select min(%s.id) as id,' % self._table + flist + ' from ' + ','.join(tables) + where_clause + ' group by '+ groupby + limit_str + offset_str, where_params) alldata = {} groupby = group_by @@ -1909,10 +1909,10 @@ class orm(orm_template): return data def _inherits_join_calc(self, field, tables, where_clause): - """ Adds missing table select and join clause(s) for reaching + """ Adds missing table select and join clause(s) for reaching the field coming from an '_inherits' parent table. @param tables: list of table._table names enclosed in double quotes as returned - by _where_calc() + by _where_calc() """ current_table = self while field in current_table._inherit_fields and not field in current_table._columns: @@ -2053,12 +2053,12 @@ class orm(orm_template): if isinstance(f, fields.one2many): cr.execute("SELECT relname FROM pg_class WHERE relkind='r' AND relname=%s", (f._obj,)) - + if self.pool.get(f._obj): if f._fields_id not in self.pool.get(f._obj)._columns.keys(): if not self.pool.get(f._obj)._inherits or (f._fields_id not in self.pool.get(f._obj)._inherit_fields.keys()): raise except_orm('Programming Error', ("There is no reference field '%s' found for '%s'") % (f._fields_id,f._obj,)) - + if cr.fetchone(): cr.execute("SELECT count(1) as c FROM pg_class c,pg_attribute a WHERE c.relname=%s AND a.attname=%s AND c.oid=a.attrelid", (f._obj, f._fields_id)) res = cr.fetchone()[0] From b7ac17c00cb14ffbb5ca7e9266221c176a5e81cd Mon Sep 17 00:00:00 2001 From: Launchpad Code Hosting Date: Mon, 1 Mar 2010 05:00:50 +0000 Subject: [PATCH 11/34] Launchpad automatic translations update. bzr revid: codehost@crowberry-20100301050050-uo0ry58ir0y6cz6i --- bin/addons/base/i18n/hr.po | 4 ++-- bin/addons/base/i18n/ja.po | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/addons/base/i18n/hr.po b/bin/addons/base/i18n/hr.po index 40bfcfadf88..13a05cb4e67 100644 --- a/bin/addons/base/i18n/hr.po +++ b/bin/addons/base/i18n/hr.po @@ -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-02-27 06:31+0000\n" +"PO-Revision-Date: 2010-02-28 05:54+0000\n" "Last-Translator: goranc \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-02-28 04:54+0000\n" +"X-Launchpad-Export-Date: 2010-03-01 05:00+0000\n" "X-Generator: Launchpad (build Unknown)\n" "Language: hr\n" diff --git a/bin/addons/base/i18n/ja.po b/bin/addons/base/i18n/ja.po index 8daba74a172..090650b1da2 100644 --- a/bin/addons/base/i18n/ja.po +++ b/bin/addons/base/i18n/ja.po @@ -8,13 +8,13 @@ msgstr "" "Project-Id-Version: openobject-server\n" "Report-Msgid-Bugs-To: FULL NAME \n" "POT-Creation-Date: 2009-12-18 08:39+0000\n" -"PO-Revision-Date: 2010-02-27 06:37+0000\n" +"PO-Revision-Date: 2010-02-28 05:56+0000\n" "Last-Translator: OpenERP Administrators \n" "Language-Team: Japanese \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-02-28 04:54+0000\n" +"X-Launchpad-Export-Date: 2010-03-01 05:00+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: base From c95bd0a29e732edea53e77525b950356e924ceda Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Mon, 1 Mar 2010 18:19:21 +0100 Subject: [PATCH 12/34] [FIX] export the method check_connectivity bzr revid: chs@tinyerp.com-20100301171921-1nwhknyba0cmsb2e --- bin/service/web_services.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/service/web_services.py b/bin/service/web_services.py index f3325114bc2..4dfdeec1237 100644 --- a/bin/service/web_services.py +++ b/bin/service/web_services.py @@ -383,7 +383,8 @@ class common(_ObjectService): auth.logout(params[1]) logger.notifyChannel("web-service", netsvc.LOG_INFO,'Logout %s from database %s'%(login,db)) return True - elif method in ['about', 'timezone_get', 'get_server_environment', 'login_message', 'get_stats' ]: + elif method in ['about', 'timezone_get', 'get_server_environment', + 'login_message','get_stats', 'check_connectivity']: pass elif method in ['get_available_updates', 'get_migration_scripts', 'set_loglevel']: passwd = params[0] @@ -564,7 +565,8 @@ GNU Public Licence. res = "OpenERP server: %d threads\n" % threading.active_count() res += netsvc.Server.allStats() return res - def check_connectivity(self): + + def exp_check_connectivity(self): return bool(sql_db.db_connect('template1')) common() From 4e2afb88532604fbc35048e5697b634f96cce6f0 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Mon, 1 Mar 2010 19:42:04 +0100 Subject: [PATCH 13/34] [IMP] made rml2pdf independant bzr revid: fp@tinyerp.com-20100301184204-84sq3n5dqvxtpdvh --- bin/report/render/rml2pdf/utils.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/bin/report/render/rml2pdf/utils.py b/bin/report/render/rml2pdf/utils.py index 3a7dc4035ca..80912e47acb 100644 --- a/bin/report/render/rml2pdf/utils.py +++ b/bin/report/render/rml2pdf/utils.py @@ -40,18 +40,16 @@ import re import reportlab from lxml import etree import copy -import tools import locale -import netsvc import traceback, sys _regex = re.compile('\[\[(.+?)\]\]') def str2xml(s): - return s.replace('&', '&').replace('<', '<').replace('>', '>') + return (s or '').replace('&', '&').replace('<', '<').replace('>', '>') def xml2str(s): - return s.replace('&','&').replace('<','<').replace('>','>') + return (s or '').replace('&','&').replace('<','<').replace('>','>') def _child_get(node, self=None, tagname=None): for n in node: @@ -106,25 +104,24 @@ def _process_text(self, txt): sps = _regex.split(txt) while sps: # This is a simple text to translate - result += tools.ustr(self.localcontext.get('translate', lambda x:x)(sps.pop(0))) + result += unicode(self.localcontext.get('translate', lambda x:x)(sps.pop(0))) if sps: try: expr = sps.pop(0) txt = eval(expr,self.localcontext) if txt and (isinstance(txt, unicode) or isinstance(txt, str)): - txt = tools.ustr(self.localcontext.get('translate', lambda x:x)(txt)) + txt = unicode(self.localcontext.get('translate', lambda x:x)(txt)) except Exception,e: tb_s = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback)) - netsvc.Logger().notifyChannel('report', netsvc.LOG_ERROR,'report :\n%s\n%s\nexpr: %s' % (tb_s, str(e),expr.encode('utf-8'))) if type(txt)==type('') or type(txt)==type(u''): txt2 = str2xml(txt) - result += tools.ustr(txt2) + result += unicode(txt2) elif (txt is not None) and (txt is not False): - result += tools.ustr(txt) + result += unicode(txt) return result def text_get(node): - return ''.join([tools.ustr(n.text) for n in node]) + return ''.join([unicode(n.text) for n in node]) units = [ (re.compile('^(-?[0-9\.]+)\s*in$'), reportlab.lib.units.inch), From 4e2beb23aeb6479900952f5a8b7cb4836505044c Mon Sep 17 00:00:00 2001 From: Launchpad Code Hosting Date: Tue, 2 Mar 2010 04:41:14 +0000 Subject: [PATCH 14/34] Launchpad automatic translations update. bzr revid: codehost@crowberry-20100302044114-053o70datjqoofrf --- bin/addons/base/i18n/hr.po | 4 ++-- bin/addons/base/i18n/ja.po | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/addons/base/i18n/hr.po b/bin/addons/base/i18n/hr.po index 13a05cb4e67..c22c24df042 100644 --- a/bin/addons/base/i18n/hr.po +++ b/bin/addons/base/i18n/hr.po @@ -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-02-28 05:54+0000\n" +"PO-Revision-Date: 2010-03-01 06:21+0000\n" "Last-Translator: goranc \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-03-01 05:00+0000\n" +"X-Launchpad-Export-Date: 2010-03-02 04:41+0000\n" "X-Generator: Launchpad (build Unknown)\n" "Language: hr\n" diff --git a/bin/addons/base/i18n/ja.po b/bin/addons/base/i18n/ja.po index 090650b1da2..caafbdf2a71 100644 --- a/bin/addons/base/i18n/ja.po +++ b/bin/addons/base/i18n/ja.po @@ -8,13 +8,13 @@ msgstr "" "Project-Id-Version: openobject-server\n" "Report-Msgid-Bugs-To: FULL NAME \n" "POT-Creation-Date: 2009-12-18 08:39+0000\n" -"PO-Revision-Date: 2010-02-28 05:56+0000\n" +"PO-Revision-Date: 2010-03-01 06:18+0000\n" "Last-Translator: OpenERP Administrators \n" "Language-Team: Japanese \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-03-01 05:00+0000\n" +"X-Launchpad-Export-Date: 2010-03-02 04:41+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: base From f4820709b6128674d9d2d0b281dbf1e519679f3d Mon Sep 17 00:00:00 2001 From: "mra (Open ERP)" Date: Tue, 2 Mar 2010 14:21:09 +0530 Subject: [PATCH 15/34] [IMP] Translation: remove get_iso dictionary which used in get_ico_codes method to get languages bzr revid: mra@tinyerp.com-20100302085109-63xxp3mqx7wuh4zs --- bin/tools/misc.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/bin/tools/misc.py b/bin/tools/misc.py index 387b7c2d2a2..f105cd81256 100644 --- a/bin/tools/misc.py +++ b/bin/tools/misc.py @@ -883,23 +883,8 @@ if not hasattr(__builtin__, 'any'): __builtin__.any = any del any -get_iso = {'ca_ES':'ca', -'cs_CZ': 'cs', -'et_EE': 'et', -'sv_SE': 'sv', -'sq_AL': 'sq', -'uk_UA': 'uk', -'vi_VN': 'vi', -'af_ZA': 'af', -'be_BY': 'be', -'ja_JP': 'ja', -'ko_KR': 'ko' -} - def get_iso_codes(lang): - if lang in get_iso: - lang = get_iso[lang] - elif lang.find('_') != -1: + if lang.find('_') != -1: if lang.split('_')[0] == lang.split('_')[1].lower(): lang = lang.split('_')[0] return lang From e272ebf71328b82391e598824db2dffe51979e5c Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 2 Mar 2010 10:00:31 +0100 Subject: [PATCH 16/34] remove xml.* dependencies in py2exe packages list bzr revid: xmo@tinyerp.com-20100302090031-3b05optzvlycn88z --- setup.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 9c9d17989f5..d4fefa4d59e 100755 --- a/setup.py +++ b/setup.py @@ -171,10 +171,10 @@ options = { "optimize": 2, "dist_dir": 'dist', "packages": ["lxml", "lxml.builder", "lxml._elementpath", "lxml.etree", - "lxml.objectify", "decimal", "xml", "xml.dom", "xml.xpath", - "encodings","dateutil","wizard","pychart","PIL", - "pyparsing", "pydot","asyncore","asynchat", "reportlab", - "vobject", "HTMLParser", "select"], + "lxml.objectify", "decimal", "xml", "encodings", + "dateutil", "wizard", "pychart", "PIL", "pyparsing", + "pydot", "asyncore","asynchat", "reportlab", "vobject", + "HTMLParser", "select"], "excludes" : ["Tkconstants","Tkinter","tcl"], } } From c66be1d7f983826108aa8b84b832e50eb1068f5c Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 2 Mar 2010 10:18:04 +0100 Subject: [PATCH 17/34] [IMP] change version number bzr revid: chs@tinyerp.com-20100302091804-1uk3nf2ir69u1x7e --- bin/release.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/release.py b/bin/release.py index 95801d58da1..f5fde69f1a9 100644 --- a/bin/release.py +++ b/bin/release.py @@ -21,8 +21,8 @@ ############################################################################## name = 'openerp-server' -version = '5.0.7' -major_version = '5.0' +version = '5.2dev' +major_version = '5.2' description = 'OpenERP Server' long_desc = '''\ OpenERP is a complete ERP and CRM. The main features are accounting (analytic From ea5cf5989f6649a672f55b133c23c893edb645c0 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 2 Mar 2010 10:33:14 +0100 Subject: [PATCH 18/34] [imp] add PendingDeprecationWarning to netsvc.Logger API bzr revid: xmo@tinyerp.com-20100302093314-xos9vi0le2f249id --- bin/netsvc.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bin/netsvc.py b/bin/netsvc.py index 49d68c8479e..a708ba5d97d 100644 --- a/bin/netsvc.py +++ b/bin/netsvc.py @@ -36,6 +36,7 @@ import threading import time import xmlrpclib import release +import warnings class Service(object): """ Base class for *Local* services @@ -211,8 +212,14 @@ def init_logger(): class Logger(object): + def __init__(self): + warnings.warn("The netsvc.Logger API shouldn't be used anymore, please " + "use the standard `logging.getLogger` API instead") + super(Logger, self).__init__() def notifyChannel(self, name, level, msg): + warnings.warn("notifyChannel API shouldn't be used anymore, please use " + "the standard `logging` module instead") from service.web_services import common log = logging.getLogger(tools.ustr(name)) From 0c67a510d777b7a4ecbfdc3aaf940619b82643b0 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 2 Mar 2010 10:36:10 +0100 Subject: [PATCH 19/34] [imp] Add level names for debug2 and debug_rpc in logging bzr revid: xmo@tinyerp.com-20100302093610-f1pzzx1ck7e2i6jl --- bin/netsvc.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/netsvc.py b/bin/netsvc.py index a708ba5d97d..4a48f540f30 100644 --- a/bin/netsvc.py +++ b/bin/netsvc.py @@ -138,7 +138,9 @@ LOG_CRITICAL = 'critical' # add new log level below DEBUG logging.DEBUG2 = logging.DEBUG - 1 +logging.addLevelName(logging.DEBUG2, 'DEBUG2') logging.DEBUG_RPC = logging.DEBUG2 - 1 +logging.addLevelName(logging.DEBUG_RPC, 'DEBUG_RPC') def init_logger(): import os From a7d00eb5f34893d06e9c1e8e5b3b3b6656be79a6 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 2 Mar 2010 10:46:48 +0100 Subject: [PATCH 20/34] [imp] remove mostly unused DEBUG2 logging level bzr revid: xmo@tinyerp.com-20100302094648-gztszaux31oyfptv --- bin/netsvc.py | 11 +---------- bin/sql_db.py | 2 +- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/bin/netsvc.py b/bin/netsvc.py index 4a48f540f30..4e3608fa7cf 100644 --- a/bin/netsvc.py +++ b/bin/netsvc.py @@ -130,16 +130,12 @@ class ExportService(object): LOG_NOTSET = 'notset' LOG_DEBUG_RPC = 'debug_rpc' LOG_DEBUG = 'debug' -LOG_DEBUG2 = 'debug2' LOG_INFO = 'info' LOG_WARNING = 'warn' LOG_ERROR = 'error' LOG_CRITICAL = 'critical' -# add new log level below DEBUG -logging.DEBUG2 = logging.DEBUG - 1 -logging.addLevelName(logging.DEBUG2, 'DEBUG2') -logging.DEBUG_RPC = logging.DEBUG2 - 1 +logging.DEBUG_RPC = logging.DEBUG - 2 logging.addLevelName(logging.DEBUG_RPC, 'DEBUG_RPC') def init_logger(): @@ -200,7 +196,6 @@ def init_logger(): mapping = { 'DEBUG_RPC': ('blue', 'white'), - 'DEBUG2': ('green', 'white'), 'DEBUG': ('blue', 'default'), 'INFO': ('green', 'default'), 'WARNING': ('yellow', 'default'), @@ -226,10 +221,6 @@ class Logger(object): log = logging.getLogger(tools.ustr(name)) - if level == LOG_DEBUG2 and not hasattr(log, level): - fct = lambda msg, *args, **kwargs: log.log(logging.DEBUG2, msg, *args, **kwargs) - setattr(log, LOG_DEBUG2, fct) - if level == LOG_DEBUG_RPC and not hasattr(log, level): fct = lambda msg, *args, **kwargs: log.log(logging.DEBUG_RPC, msg, *args, **kwargs) setattr(log, LOG_DEBUG_RPC, fct) diff --git a/bin/sql_db.py b/bin/sql_db.py index 2cc71408f5c..35492cdceda 100644 --- a/bin/sql_db.py +++ b/bin/sql_db.py @@ -61,7 +61,7 @@ re_from = re.compile('.* from "?([a-zA-Z_0-9]+)"? .*$'); re_into = re.compile('.* into "?([a-zA-Z_0-9]+)"? .*$'); -def log(msg, lvl=netsvc.LOG_DEBUG2): +def log(msg, lvl=netsvc.LOG_DEBUG): logger = netsvc.Logger() logger.notifyChannel('sql', lvl, msg) From 9150c0695ffbf7f76809f2811c27aaeb7177e087 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 2 Mar 2010 10:58:09 +0100 Subject: [PATCH 21/34] [fix] specify PendingDeprecationWarning, not default UserWarning bzr revid: xmo@tinyerp.com-20100302095809-v2tdjb22ogok3y73 --- bin/netsvc.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/netsvc.py b/bin/netsvc.py index 4e3608fa7cf..9f4cd0c8e39 100644 --- a/bin/netsvc.py +++ b/bin/netsvc.py @@ -211,12 +211,14 @@ def init_logger(): class Logger(object): def __init__(self): warnings.warn("The netsvc.Logger API shouldn't be used anymore, please " - "use the standard `logging.getLogger` API instead") + "use the standard `logging.getLogger` API instead", + PendingDeprecationWarning, stacklevel=2) super(Logger, self).__init__() def notifyChannel(self, name, level, msg): warnings.warn("notifyChannel API shouldn't be used anymore, please use " - "the standard `logging` module instead") + "the standard `logging` module instead", + PendingDeprecationWarning, stacklevel=2) from service.web_services import common log = logging.getLogger(tools.ustr(name)) From f8ef7598b6aee48b69aa27875f33c2bd8278272f Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 2 Mar 2010 10:58:40 +0100 Subject: [PATCH 22/34] [imp] remove crappy log() function from db_sql, migrate to logging's Logger bzr revid: xmo@tinyerp.com-20100302095840-bavk87douskr01af --- bin/sql_db.py | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/bin/sql_db.py b/bin/sql_db.py index 35492cdceda..9c6fd1c27a4 100644 --- a/bin/sql_db.py +++ b/bin/sql_db.py @@ -21,6 +21,7 @@ __all__ = ['db_connect', 'close_db'] +import logging import netsvc from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT, ISOLATION_LEVEL_READ_COMMITTED, ISOLATION_LEVEL_SERIALIZABLE from psycopg2.psycopg1 import cursor as psycopg1cursor @@ -60,15 +61,11 @@ import re re_from = re.compile('.* from "?([a-zA-Z_0-9]+)"? .*$'); re_into = re.compile('.* into "?([a-zA-Z_0-9]+)"? .*$'); - -def log(msg, lvl=netsvc.LOG_DEBUG): - logger = netsvc.Logger() - logger.notifyChannel('sql', lvl, msg) - sql_counter = 0 class Cursor(object): IN_MAX = 1000 + __logger = logging.getLogger('db.cursor') def check(f): @wraps(f) @@ -102,15 +99,16 @@ class Cursor(object): # pool, preventing some operation on the database like dropping it. # This can also lead to a server overload. msg = "Cursor not closed explicitly\n" \ - "Cursor was created at %s:%s" % self.__caller - log(msg, netsvc.LOG_WARNING) + "Cursor was created at %s:%s" + self.__logger.warn(msg, *self.__caller) self.close() @check def execute(self, query, params=None): if '%d' in query or '%f' in query: - log(query, netsvc.LOG_WARNING) - log("SQL queries cannot contain %d or %f anymore. Use only %s", netsvc.LOG_WARNING) + self.__logger.warn(query) + self.__logger.warn("SQL queries cannot contain %d or %f anymore. " + "Use only %s") if params: query = query.replace('%d', '%s').replace('%f', '%s') @@ -124,16 +122,15 @@ class Cursor(object): logger= netsvc.Logger() logger.notifyChannel('sql_db', netsvc.LOG_ERROR, "Programming error: %s, in query %s" % (pe, query)) raise - except Exception, e: - log("bad query: %s" % self._obj.query) - log(e) + except Exception: + self.__logger.exception("bad query: %s", self._obj.query) raise if self.sql_log: delay = mdt.now() - now delay = delay.seconds * 1E6 + delay.microseconds - log("query: %s" % self._obj.query) + self.__logger.debug("query: %s", self._obj.query) self.sql_log_count+=1 res_from = re_from.match(query.lower()) if res_from: @@ -158,14 +155,16 @@ class Cursor(object): if sqllogs[type]: sqllogitems = sqllogs[type].items() sqllogitems.sort(key=lambda k: k[1][1]) - log("SQL LOG %s:" % (type,)) + self.__logger.debug("SQL LOG %s:", type) for r in sqllogitems: delay = timedelta(microseconds=r[1][1]) - log("table: %s: %s/%s" %(r[0], str(delay), r[1][0])) + self.__logger.debug("table: %s: %s/%s", + r[0], delay, r[1][0]) sum+= r[1][1] sqllogs[type].clear() sum = timedelta(microseconds=sum) - log("SUM %s:%s/%d [%d]" % (type, str(sum), self.sql_log_count, sql_counter)) + self.__logger.debug("SUM %s:%s/%d [%d]", + type, sum, self.sql_log_count, sql_counter) sqllogs[type].clear() process('from') process('into') From 56e1e6cd2a8f82c2b78c7a99f10eabe6305e75ec Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 2 Mar 2010 11:52:46 +0100 Subject: [PATCH 23/34] [fix] remove print spam bzr revid: xmo@tinyerp.com-20100302105246-slpkqkx65it1r7qr --- bin/service/security.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/bin/service/security.py b/bin/service/security.py index a1ae4fab311..c74ed2c7aba 100644 --- a/bin/service/security.py +++ b/bin/service/security.py @@ -30,12 +30,9 @@ class ExceptionNoTb(Exception): self.args = (msg, '') def login(db, login, password): - print 'login' pool = pooler.get_pool(db) user_obj = pool.get('res.users') - res = user_obj.login(db, login, password) - print 'login end' - return res + return user_obj.login(db, login, password) def check_super(passwd): if passwd == tools.config['admin_passwd']: From 7a29deab31a111f42abf08ea20306f93fecaa041 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 2 Mar 2010 13:28:01 +0100 Subject: [PATCH 24/34] [fix] remove pyxml/python-xml Ubuntu hacks from openerp-server.py, had forgotten that bzr revid: xmo@tinyerp.com-20100302122801-2aetv6si7nxymz7e --- bin/openerp-server.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/bin/openerp-server.py b/bin/openerp-server.py index ea3a9c046bb..15f7ac670fa 100755 --- a/bin/openerp-server.py +++ b/bin/openerp-server.py @@ -37,17 +37,6 @@ import sys import os import signal import pwd -#---------------------------------------------------------- -# ubuntu 8.04 has obsoleted `pyxml` package and installs here. -# the path needs to be updated before any `import xml` -# TODO: remove PyXML dependencies, use lxml instead. -#---------------------------------------------------------- -_oldxml1 = '/usr/lib/python%s/site-packages/oldxml' % sys.version[:3] -_oldxml2 = '/usr/lib/python%s/dist-packages/oldxml' % sys.version[:3] -if os.path.exists(_oldxml1): - sys.path.insert(0,_oldxml1) -elif os.path.exists(_oldxml2): - sys.path.insert(0,_oldxml2) import release __author__ = release.author From 766edc36f821af56be2941b9585b6854185c595b Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 2 Mar 2010 14:12:57 +0100 Subject: [PATCH 25/34] [fix] remove mentions of python-xml, libxml2 and libxslt from doc/INSTALL; bump python dep from 2.4-2.5 to >2.5 < 3.O bzr revid: xmo@tinyerp.com-20100302131257-nomnqff50z5p643x --- doc/INSTALL | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/doc/INSTALL b/doc/INSTALL index 97684d6b3fd..47a75694d46 100644 --- a/doc/INSTALL +++ b/doc/INSTALL @@ -8,11 +8,9 @@ Required dependencies: You need the following software installed: - * Python 2.4 or 2.5 + * Python 2.5 or 2.6 * Postgresql 8.2 or above * Psycopg2 python module - * libxml2 and python bindings - * libxslt and python bindings * Reportlab pdf generation library for python * lxml python module * pytz python module @@ -29,7 +27,7 @@ for generating reports using non .jpg images, you need: For Debian-based distributions, the required packages can be installed with the following command: - #> apt-get install -y postgresql graphviz python-psycopg2 python-xml python-lxml python-libxml2 python-libxslt1 python-tz python-imaging + #> apt-get install -y postgresql graphviz python-psycopg2 python-lxml python-tz python-imaging For Fedora if they are not installed, install: @@ -37,8 +35,6 @@ python and postgresql uses yum or you can recover required packages on fedora web site in "core" or "extra" repository : postgresql-python -libxml2-python -libxslt-python python-lxml python-imaging python-psycopg2 From c40e6c6d2de6d29f8cd0f93eae12df177591af89 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Tue, 2 Mar 2010 14:51:53 +0100 Subject: [PATCH 26/34] [IMP] removed groups uos and multi-company by default bzr revid: fp@tinyerp.com-20100302135153-g1dyzh2fib02gc8p --- bin/addons/base/security/base_security.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/addons/base/security/base_security.xml b/bin/addons/base/security/base_security.xml index c6a362edbe3..ca1f33aa23e 100644 --- a/bin/addons/base/security/base_security.xml +++ b/bin/addons/base/security/base_security.xml @@ -17,7 +17,7 @@ Employee - + Multi Companies From 9ded20ae70329312b4d672e9b64e3f0fe8a8cd11 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Tue, 2 Mar 2010 22:47:39 +0100 Subject: [PATCH 27/34] [IMP] removed this month bzr revid: fp@tinyerp.com-20100302214739-uwq4kgmh01a7xoxi --- bin/osv/orm.py | 6 +----- bin/report/render/rml2pdf/trml2pdf.py | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 88058aa10c3..c0caf70087c 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -1893,11 +1893,7 @@ class orm(orm_template): dt = datetime.datetime.strptime(alldata[d['id']][groupby][:7],'%Y-%m') days = calendar.monthrange(dt.year, dt.month)[1] - if d[groupby][:7] == today.strftime('%Y-%m'): - d[groupby] = 'This Month' - else: - d[groupby] = datetime.datetime.strptime(d[groupby][:10],'%Y-%m-%d').strftime('%B %Y') - + d[groupby] = datetime.datetime.strptime(d[groupby][:10],'%Y-%m-%d').strftime('%B %Y') d['__domain'] = [(groupby,'>=',alldata[d['id']][groupby] and datetime.datetime.strptime(alldata[d['id']][groupby][:7] + '-01','%Y-%m-%d').strftime('%Y-%m-%d') or False),\ (groupby,'<=',alldata[d['id']][groupby] and datetime.datetime.strptime(alldata[d['id']][groupby][:7] + '-' + str(days),'%Y-%m-%d').strftime('%Y-%m-%d') or False)] + domain elif fget[groupby]['type'] == 'many2one': diff --git a/bin/report/render/rml2pdf/trml2pdf.py b/bin/report/render/rml2pdf/trml2pdf.py index 920d89a8479..0574f563c90 100644 --- a/bin/report/render/rml2pdf/trml2pdf.py +++ b/bin/report/render/rml2pdf/trml2pdf.py @@ -135,7 +135,7 @@ class _rml_styles(object,): sys.stderr.write('Warning: style not found, %s - setting default!\n' % (node.get('style'),) ) if not style: styles = reportlab.lib.styles.getSampleStyleSheet() - style = copy.deepcopy(styles['Normal']) + style = styles['Normal'] style.__dict__.update(self._para_style_update(node)) return style From 6e9eb61f4b6bd20e36ef5518cd31c36b29ba1819 Mon Sep 17 00:00:00 2001 From: Launchpad Code Hosting Date: Wed, 3 Mar 2010 04:45:26 +0000 Subject: [PATCH 28/34] Launchpad automatic translations update. bzr revid: codehost@crowberry-20100303044526-63unudi33yfbgk77 --- bin/addons/base/i18n/hr.po | 4 ++-- bin/addons/base/i18n/ja.po | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/addons/base/i18n/hr.po b/bin/addons/base/i18n/hr.po index c22c24df042..75bfd4a7916 100644 --- a/bin/addons/base/i18n/hr.po +++ b/bin/addons/base/i18n/hr.po @@ -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-03-01 06:21+0000\n" +"PO-Revision-Date: 2010-03-02 05:28+0000\n" "Last-Translator: goranc \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-03-02 04:41+0000\n" +"X-Launchpad-Export-Date: 2010-03-03 04:45+0000\n" "X-Generator: Launchpad (build Unknown)\n" "Language: hr\n" diff --git a/bin/addons/base/i18n/ja.po b/bin/addons/base/i18n/ja.po index caafbdf2a71..f9da453aeab 100644 --- a/bin/addons/base/i18n/ja.po +++ b/bin/addons/base/i18n/ja.po @@ -8,13 +8,13 @@ msgstr "" "Project-Id-Version: openobject-server\n" "Report-Msgid-Bugs-To: FULL NAME \n" "POT-Creation-Date: 2009-12-18 08:39+0000\n" -"PO-Revision-Date: 2010-03-01 06:18+0000\n" +"PO-Revision-Date: 2010-03-02 05:31+0000\n" "Last-Translator: OpenERP Administrators \n" "Language-Team: Japanese \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-03-02 04:41+0000\n" +"X-Launchpad-Export-Date: 2010-03-03 04:45+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: base From 9f48e575b5db423254d6fe2ee93fa131a3830644 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Wed, 3 Mar 2010 08:03:22 +0100 Subject: [PATCH 29/34] [IMP] taks view bzr revid: fp@tinyerp.com-20100303070322-5283l3zzfnp2pc7i --- addons/project/project_view.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index 72e12a81aa7..427c266f3d5 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -413,6 +413,7 @@ + From 566b334c5996ed714a538904f01d57094740ef18 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Wed, 3 Mar 2010 08:04:23 +0100 Subject: [PATCH 30/34] [IMP] taks view bzr revid: fp@tinyerp.com-20100303070423-o1gjnzt5tfj94nxo --- addons/project/project_view.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index 427c266f3d5..b05f0c8642a 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -413,8 +413,8 @@ - - + + From bca733707d0ea11c8c6b57dbde69b062e2c35ee3 Mon Sep 17 00:00:00 2001 From: "HDA (OpenERP)" Date: Wed, 3 Mar 2010 12:51:09 +0530 Subject: [PATCH 31/34] added noupdate=1 if csv is in init_xml bzr revid: hda@tinyerp.com-20100303072109-qoi1h70ohfsjq96h --- bin/addons/__init__.py | 5 ++++- bin/osv/fields.py | 2 -- bin/tools/convert.py | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/addons/__init__.py b/bin/addons/__init__.py index b147db854ef..2910b9fe7c1 100644 --- a/bin/addons/__init__.py +++ b/bin/addons/__init__.py @@ -634,7 +634,10 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, **kwargs): name, ext = os.path.splitext(filename) fp = tools.file_open(opj(m, filename)) if ext == '.csv': - tools.convert_csv_import(cr, m, os.path.basename(filename), fp.read(), idref, mode=mode) + noupdate=False + if kind == 'init': + noupdate=True + tools.convert_csv_import(cr, m, os.path.basename(filename), fp.read(), idref, mode=mode, noupdate=noupdate) elif ext == '.sql': queries = fp.read().split(';') for query in queries: diff --git a/bin/osv/fields.py b/bin/osv/fields.py index 3d47cfb08f5..4398c896a5a 100644 --- a/bin/osv/fields.py +++ b/bin/osv/fields.py @@ -778,7 +778,6 @@ class related(function): res[data.id] = t_data.id else: res[data.id] = t_data - if self._type=='many2one': ids = filter(None, res.values()) if ids: @@ -790,7 +789,6 @@ class related(function): for r in res: if res[r]: res[r] = [x.id for x in res[r]] - return res def __init__(self, *arg, **args): diff --git a/bin/tools/convert.py b/bin/tools/convert.py index 4314651d084..d4f3d86b9ae 100644 --- a/bin/tools/convert.py +++ b/bin/tools/convert.py @@ -838,7 +838,7 @@ def convert_csv_import(cr, module, fname, csvcontent, idref=None, mode='init', except: logger = netsvc.Logger() logger.notifyChannel("init", netsvc.LOG_ERROR, "Cannot import the line: %s" % line) - pool.get(model).import_data(cr, uid, fields, datas,mode, module,noupdate,filename=fname_partial) + pool.get(model).import_data(cr, uid, fields, datas,mode, module, noupdate, filename=fname_partial) if config.get('import_partial'): data = pickle.load(file(config.get('import_partial'))) data[fname_partial] = 0 From 831d650de19cd7e43e742fa1bdefd1b36223dfe9 Mon Sep 17 00:00:00 2001 From: "Rvo (Open ERP)" Date: Wed, 3 Mar 2010 12:55:40 +0530 Subject: [PATCH 32/34] [ADD]:added missing resource _demo.xml bzr revid: rvo@tinyerp.co.in-20100303072540-8gqqgt4yvpgyd2re --- addons/resource/resource_demo.xml | 83 +++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 addons/resource/resource_demo.xml diff --git a/addons/resource/resource_demo.xml b/addons/resource/resource_demo.xml new file mode 100644 index 00000000000..b70728ea9ad --- /dev/null +++ b/addons/resource/resource_demo.xml @@ -0,0 +1,83 @@ + + + + + + + + 38 Hours/Week + + + + Monday morning + 0 + 08 + 12 + + + + Monday evening + 0 + 13 + 18 + + + + Tuesday morning + 1 + 08 + 12 + + + + Tuesday evening + 1 + 13 + 18 + + + + Wednesday morning + 2 + 08 + 12 + + + + Wednesday evening + 2 + 13 + 18 + + + + Thursday morning + 3 + 08 + 12 + + + + Thursday evening + 13 + 18 + 3 + + + + Friday morning + 4 + 08 + 12 + + + + Friday evening + 4 + 13 + 18 + + + + + From 350baa314cdadc1ba4c88fb972a876dea678c6bc Mon Sep 17 00:00:00 2001 From: "HDA (OpenERP)" Date: Wed, 3 Mar 2010 13:23:14 +0530 Subject: [PATCH 33/34] Small fix by adding calendar_id field bzr revid: hda@tinyerp.com-20100303075314-adehvgccvpmxowbg --- addons/project_long_term/project.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/project_long_term/project.py b/addons/project_long_term/project.py index 94e82b593eb..709efe893e9 100644 --- a/addons/project_long_term/project.py +++ b/addons/project_long_term/project.py @@ -259,8 +259,8 @@ class project(osv.osv): _inherit = "project.project" _columns = { - 'phase_ids': fields.one2many('project.phase', 'project_id', "Project Phases") - + 'phase_ids': fields.one2many('project.phase', 'project_id', "Project Phases"), + 'resource_calendar_id': fields.many2one('resource.calendar', 'Working Time', help="Timetable working hours to adjust the gantt diagram report"), } project() From 55a89995e14a6a5d15b5c4c50a09a16e914503c4 Mon Sep 17 00:00:00 2001 From: "HDA (OpenERP)" Date: Wed, 3 Mar 2010 14:17:22 +0530 Subject: [PATCH 34/34] fix by type casting occupation rate in project bzr revid: hda@tinyerp.com-20100303084722-32s4j728lhk7337j --- addons/project_long_term/project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project_long_term/project.py b/addons/project_long_term/project.py index 709efe893e9..9b41b3a726f 100644 --- a/addons/project_long_term/project.py +++ b/addons/project_long_term/project.py @@ -290,7 +290,7 @@ class task(osv.osv): hrs = planned / (float(occupation_rate) * resource_obj.time_efficiency) calendar_id = resource_obj.calendar_id.id else: - hrs = float(planned / occupation_rate) + hrs = float(planned / float(occupation_rate)) calendar_id = project_pool.browse(cr, uid, project).resource_calendar_id .id work_times = resource_calendar.interval_get(cr, uid, calendar_id or False, dt_start, hrs or 0.0, resource_id or False) result['date_end'] = work_times[-1][1].strftime('%Y-%m-%d %H:%M:%S')