From f71e08d649da98cb433c3939282e6a930f5626e8 Mon Sep 17 00:00:00 2001 From: Christophe Chauvet Date: Fri, 21 Nov 2008 08:04:14 +0100 Subject: [PATCH 01/36] [base] * Complete Syleam Address bzr revid: christophe.chauvet@syleam.fr-20081121070414-0ztw45l6q4pnd2on --- bin/addons/base/res/partner/partner_demo.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/bin/addons/base/res/partner/partner_demo.xml b/bin/addons/base/res/partner/partner_demo.xml index ae583ace947..78113610f0a 100644 --- a/bin/addons/base/res/partner/partner_demo.xml +++ b/bin/addons/base/res/partner/partner_demo.xml @@ -81,6 +81,7 @@ 1 + http://www.syleam.fr Syleam @@ -271,6 +272,18 @@ default + + Alencon + Sebastien LANGE + 61000 + M. + contact@syleam.fr + 1 place de l'Église + +33 (0) 2 33 31 22 10 + + default + + Liege Karine Lesbrouffe From fa09719fbf89e38b3a70be0360584fc0fbfe99d2 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Fri, 21 Nov 2008 17:57:08 +0100 Subject: [PATCH 02/36] [FIX] Add the HTMLParser bzr revid: stephane@tinyerp.com-20081121165708-qrk3kcj42dv1czwc --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d171398a870..129df517e59 100755 --- a/setup.py +++ b/setup.py @@ -164,7 +164,7 @@ options = { "packages": ["lxml", "lxml.builder", "lxml._elementpath", "lxml.etree", "lxml.objectify", "decimal", "xml", "xml.dom", "xml.xpath", "encodings","mx.DateTime","wizard","pychart","PIL", "pyparsing", - "pydot","asyncore","asynchat", "reportlab", "vobject"], + "pydot","asyncore","asynchat", "reportlab", "vobject", "HTMLParser"], "excludes" : ["Tkconstants","Tkinter","tcl"], } } From 9fcea67fabafd515dbeb9aef4171c553f6edd801 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Fri, 21 Nov 2008 19:12:24 +0100 Subject: [PATCH 03/36] improve bzr revid: fp@tinyerp.com-20081121181224-ms1h2p3nip6w93kx --- bin/osv/fields.py | 1 + bin/osv/orm.py | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/osv/fields.py b/bin/osv/fields.py index dd46d7654fb..9bd2875bcb7 100644 --- a/bin/osv/fields.py +++ b/bin/osv/fields.py @@ -429,6 +429,7 @@ class one2many(_column): for act in values: if act[0] == 0: act[2][self._fields_id] = id + print 'CREATE', self._obj, act[2], context obj.create(cr, user, act[2], context=context) elif act[0] == 1: obj.write(cr, user, [act[1]], act[2], context=context) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 0acfba66299..75aa1146243 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -116,7 +116,7 @@ class browse_record(object): ''' if not context: context = {} - assert id, _('Wrong ID for the browse record, got %s, expected an integer.') % str(id) + assert id and type(id)==type(1), _('Wrong ID for the browse record, got %s, expected an integer.') % str(id) self._list_class = list_class or browse_record_list self._cr = cr self._uid = uid @@ -128,9 +128,12 @@ class browse_record(object): cache.setdefault(table._name, {}) self._data = cache[table._name] + if not id in self._data: self._data[id] = {'id': id} + self._cache = cache + pass def __getitem__(self, name): if name == 'id': @@ -183,7 +186,7 @@ class browse_record(object): if data[n]: obj = self._table.pool.get(f._obj) compids = False - if not f._classic_write: + if type(data[n]) in (type([]),type( (1,) )): ids2 = data[n][0] else: ids2 = data[n] From 44ac88b020ac317e2b4e220ea5b6017d3d3b9bea Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Fri, 21 Nov 2008 20:50:42 +0100 Subject: [PATCH 04/36] [IMP] Add some languages [REF] Sort languages to display to the client [REF] Show the translated languages bzr revid: stephane@tinyerp.com-20081121195042-2hafq729icvylffy --- bin/tools/misc.py | 50 +++++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/bin/tools/misc.py b/bin/tools/misc.py index 934bdd7a236..dcf9c8a498d 100644 --- a/bin/tools/misc.py +++ b/bin/tools/misc.py @@ -642,24 +642,34 @@ def to_xml(s): def get_languages(): languages={ - 'zh_CN': 'Chinese (CN)', - 'zh_TW': 'Chinese (TW)', - 'cs_CZ': 'Czech', - 'de_DE': 'Deutsch', - 'es_AR': 'Español (Argentina)', - 'es_ES': 'Español (España)', - 'fr_FR': 'Français', - 'fr_CH': 'Français (Suisse)', - 'en_EN': 'English (default)', - 'hu_HU': 'Hungarian', - 'it_IT': 'Italiano', - 'pt_BR': 'Portugese (Brasil)', - 'pt_PT': 'Portugese (Portugal)', - 'nl_NL': 'Nederlands', - 'ro_RO': 'Romanian', - 'ru_RU': 'Russian', - 'sv_SE': 'Swedish', - 'ca_ES': 'Català', + 'bg_BG': u'Bulgarian / български', + 'ca_ES': u'Catalan / Català', + 'cs_CZ': u'Czech / Čeština', + 'de_DE': u'German / Deutsch', + 'en_CA': u'English (Canada)', + 'en_EN': u'English (default)', + 'en_GB': u'English (United Kingdom)', + 'en_US': u'English (Unites States)', + 'es_AR': u'Spanish (Argentina) / Español (República Argentina)', + 'es_ES': u'Spanish / Español', + 'et_ET': u'Estonian / Eesti keel', + 'fr_BE': u'French (Belgium) / Français (Belgique)', + 'fr_CH': u'French (Switzerland) / Français (Suisse)', + 'fr_FR': u'French / Français', + 'hr_HR': u'Croatian / hrvatski jezik', + 'hu_HU': u'Hungarian / Magyar', + 'it_IT': u'Italian / Italiano', + 'lt_LT': u'Lithuanian / Lietuvių kalba', + 'nl_NL': u'Dutch / Nederlands', + 'pt_BR': u'Portugese (Federative Republic of Brazil) / português (República Federativa do Brasil)', + 'pt_PT': u'Portugese / português', + 'ro_RO': u'Romanian / limba română', + 'ru_RU': u'Russian / русский язык', + 'sl_SL': u'Slovenian / slovenščina', + 'sv_SE': u'Swedish / svenska', + 'uk_UK': u'Ukrainian / украї́нська мо́ва', + 'zh_CN': u'Chinese (Simplified) / 简体中文' , + 'zh_TW': u'Chinese (Traditional) / 正體字', } return languages @@ -667,7 +677,9 @@ def scan_languages(): import glob file_list = [os.path.splitext(os.path.basename(f))[0] for f in glob.glob(os.path.join(config['root_path'],'addons', 'base', 'i18n', '*.po'))] lang_dict = get_languages() - return [(lang, lang_dict.get(lang, lang)) for lang in file_list] + ret = [(lang, lang_dict.get(lang, lang)) for lang in file_list] + ret.sort(key=lambda k:k[1]) + return ret def get_user_companies(cr, user): From 5898eb5cf10f82dbd07f89a54874fb14834fe4c2 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Fri, 21 Nov 2008 21:02:39 +0100 Subject: [PATCH 05/36] [IMP] remove print bzr revid: christophe@tinyerp.com-20081121200239-uf1aiehhuy3eta0i --- bin/osv/fields.py | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/osv/fields.py b/bin/osv/fields.py index 9bd2875bcb7..dd46d7654fb 100644 --- a/bin/osv/fields.py +++ b/bin/osv/fields.py @@ -429,7 +429,6 @@ class one2many(_column): for act in values: if act[0] == 0: act[2][self._fields_id] = id - print 'CREATE', self._obj, act[2], context obj.create(cr, user, act[2], context=context) elif act[0] == 1: obj.write(cr, user, [act[1]], act[2], context=context) From 7b58ad4b4410d940368d89775e75ccec89e6b52b Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Fri, 21 Nov 2008 21:13:05 +0100 Subject: [PATCH 06/36] [IMP] Add a shortcut to the Modules menu item for the root user bzr revid: stephane@tinyerp.com-20081121201305-ep000zyynfmmfywf --- bin/addons/base/__terp__.py | 2 +- bin/addons/base/module/module_data.xml | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/addons/base/__terp__.py b/bin/addons/base/__terp__.py index f3497ebe010..d1bd53f8252 100644 --- a/bin/addons/base/__terp__.py +++ b/bin/addons/base/__terp__.py @@ -43,9 +43,9 @@ "ir/wizard/wizard_menu_view.xml", "ir/ir.xml", "ir/workflow/workflow_view.xml", - "module/module_data.xml", "module/module_wizard.xml", "module/module_view.xml", + "module/module_data.xml", "module/module_report.xml", "res/res_request_view.xml", "res/res_lang_view.xml", diff --git a/bin/addons/base/module/module_data.xml b/bin/addons/base/module/module_data.xml index 0bf5c5aa85d..6176b229e13 100644 --- a/bin/addons/base/module/module_data.xml +++ b/bin/addons/base/module/module_data.xml @@ -7,5 +7,12 @@ + + + Modules + ir.ui.menu + + + From c4668b61755cd6a0c1db32a08b38c73e66bdefd3 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Fri, 21 Nov 2008 22:47:11 +0100 Subject: [PATCH 07/36] [FIX] Use unicode, because there is a warning when the system tries to compare two strings for the language bzr revid: stephane@tinyerp.com-20081121214711-r806zio10y45gogb --- bin/addons/base/ir/ir_translation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/addons/base/ir/ir_translation.py b/bin/addons/base/ir/ir_translation.py index dac4a550e45..c7eb75211fe 100644 --- a/bin/addons/base/ir/ir_translation.py +++ b/bin/addons/base/ir/ir_translation.py @@ -48,7 +48,7 @@ class ir_translation(osv.osv, Cacheable): lang_ids = lang_obj.search(cr, uid, [('translatable', '=', True)], context=context) langs = lang_obj.browse(cr, uid, lang_ids, context=context) - res = [(lang.code, lang.name) for lang in langs] + res = [(lang.code, unicode(lang.name,'utf-8')) for lang in langs] for lang_dict in tools.scan_languages(): if lang_dict not in res: res.append(lang_dict) From e2ef2a178296dc178880b96a2e6bdf62e0f3f819 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Fri, 21 Nov 2008 23:09:37 +0100 Subject: [PATCH 08/36] [FIX] allow long to be used as id in browse_record bzr revid: christophe@tinyerp.com-20081121220937-psm6o20p3yqkq98i --- bin/osv/orm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 75aa1146243..2da4b812a98 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -116,7 +116,7 @@ class browse_record(object): ''' if not context: context = {} - assert id and type(id)==type(1), _('Wrong ID for the browse record, got %s, expected an integer.') % str(id) + assert id and isinstance(id, (int, long,)), _('Wrong ID for the browse record, got %r, expected an integer.') % (id,) self._list_class = list_class or browse_record_list self._cr = cr self._uid = uid From f67d6fe2616ad753d31d2fa44884b31e1960287e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Sat, 22 Nov 2008 00:30:28 +0100 Subject: [PATCH 09/36] fix for bug https://bugs.launchpad.net/openobject-addons/+bug/300834 bzr revid: rvalyi@gmail.com-20081121233028-otxgi1q1ji7gi9qb --- addons/sale/report/order.rml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/sale/report/order.rml b/addons/sale/report/order.rml index 30ce25b4952..26f3e8a2cd8 100644 --- a/addons/sale/report/order.rml +++ b/addons/sale/report/order.rml @@ -149,7 +149,7 @@ - Invoice address :[[ o.partner_id.property_payment_term.name ]] + Invoice address : [[ o.partner_invoice_id.street ]][[ o.partner_invoice_id.street2 and (', %s' % o.partner_invoice_id.street2 or '') ]] [[ o.partner_invoice_id.zip or '' ]][[ o.partner_invoice_id.city or '' ]][[ o.partner_invoice_id.country_id and (', %s' % (o.partner_invoice_id.country_id and o.partner_invoice_id.country_id.name or '')) ]] @@ -213,7 +213,7 @@ [[ o.user_id.name ]] - [[ o.partner_id and o.partner_id.property_payment_term and o.partner_id.property_payment_term['name'] or '' ]] + [[ o.payment_term.name ]] From 0c75507f55a74363e6faab3c0bf32283a5ff95e3 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sat, 22 Nov 2008 00:52:29 +0100 Subject: [PATCH 10/36] Modifs bzr revid: fp@tinyerp.com-20081121235229-bchbrwj13vgry0v0 --- addons/audittrail/audittrail.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/addons/audittrail/audittrail.py b/addons/audittrail/audittrail.py index 0eda4f8c3fe..c0c6bb9b4c8 100644 --- a/addons/audittrail/audittrail.py +++ b/addons/audittrail/audittrail.py @@ -219,6 +219,7 @@ def log_fct( db, uid, passwd, object, method, fct_src , *args ): lines.append(line) create_log_line(cr,uid,id,model_object,lines) cr.commit() + cr.close() return res_id if method in ('write'): @@ -247,6 +248,7 @@ def log_fct( db, uid, passwd, object, method, fct_src , *args ): lines.append(line) cr.commit() create_log_line(cr,uid,id,model_object,lines) + cr.close() return res if method in ('read'): @@ -273,6 +275,7 @@ def log_fct( db, uid, passwd, object, method, fct_src , *args ): lines.append(line) cr.commit() create_log_line(cr,uid,id,model_object,lines) + cr.close() return res if method in ('unlink'): @@ -296,7 +299,9 @@ def log_fct( db, uid, passwd, object, method, fct_src , *args ): cr.commit() create_log_line(cr,uid,id,model_object,lines) res =fct_src( db, uid, passwd, object, method, *args) + cr.close() return res + cr.close() def tmp_fct(fct_src): def execute( db, uid, passwd, object, method, *args): @@ -331,11 +336,12 @@ def tmp_fct(fct_src): return log_fct(db, uid, passwd, object, method, fct_src , *args) return fct_src( db, uid, passwd, object, method, *args) cr.commit() - return my_fct( db, uid, passwd, object, method, *args) + res = my_fct( db, uid, passwd, object, method, *args) cr.close() + return res return execute obj = netsvc._service['object'] obj.execute = tmp_fct(obj.execute) obj.exportMethod(obj.execute) -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: From 5350c071906795e8cf1f1d1beb79a493c6375b4a Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sat, 22 Nov 2008 00:54:44 +0100 Subject: [PATCH 11/36] document/document.py bzr revid: fp@tinyerp.com-20081121235444-em4fmubyrnf6g6fx --- addons/wiki/security/ir.model.access.csv | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 addons/wiki/security/ir.model.access.csv diff --git a/addons/wiki/security/ir.model.access.csv b/addons/wiki/security/ir.model.access.csv new file mode 100644 index 00000000000..09ea7a5589c --- /dev/null +++ b/addons/wiki/security/ir.model.access.csv @@ -0,0 +1,4 @@ +"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" +"wiki_wiki","wiki.wiki","model_wiki_wiki","base.group_user",1,1,1,1 +"wiki_groups","wiki.groups","model_wiki_groups","base.group_user",1,1,1,1 +"wiki_wiki_history","wiki.wiki.history","model_wiki_wiki_history","base.group_user",1,1,1,1 From 82dda1fb71a945fc5d65ce8958f5379d4ab1c067 Mon Sep 17 00:00:00 2001 From: Christophe Chauvet Date: Sat, 22 Nov 2008 01:05:33 +0100 Subject: [PATCH 12/36] [base] * Add improvement into sequence variable * new variable available ** %(y)s : Year without century (ex 08) ** %(doy)s : day of the year ** %(woy)s : week of the year ** %(weekday)s : day of the week (ex 0 -> Monday) ** %(h24)s : Hour [00->24] ** %(h12)s : Hour [00->12] ** %(min)s : Minutes ** %(sec)s : secondes bzr revid: christophe.chauvet@syleam.fr-20081122000533-mlbpqulfrnxylove --- bin/addons/base/ir/ir.xml | 23 ++++++++++++++++++++--- bin/addons/base/ir/ir_sequence.py | 14 +++++++++++++- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/bin/addons/base/ir/ir.xml b/bin/addons/base/ir/ir.xml index cab66157303..3b86cecb91e 100644 --- a/bin/addons/base/ir/ir.xml +++ b/bin/addons/base/ir/ir.xml @@ -70,9 +70,26 @@ - diff --git a/bin/addons/base/ir/ir_sequence.py b/bin/addons/base/ir/ir_sequence.py index 9a1fb16c2d7..7c160fe98da 100644 --- a/bin/addons/base/ir/ir_sequence.py +++ b/bin/addons/base/ir/ir_sequence.py @@ -55,7 +55,19 @@ class ir_sequence(osv.osv): } def _process(self, s): - return (s or '') % {'year':time.strftime('%Y'), 'month': time.strftime('%m'), 'day':time.strftime('%d')} + return (s or '') % { + 'year':time.strftime('%Y'), + 'month': time.strftime('%m'), + 'day':time.strftime('%d'), + 'y': time.strftime('%y'), + 'doy': time.strftime('%j'), + 'woy': time.strftime('%W'), + 'weekday': time.strftime('%w'), + 'h24': time.strftime('%H'), + 'h12': time.strftime('%I'), + 'min': time.strftime('%M'), + 'sec': time.strftime('%S'), + } def get_id(self, cr, uid, sequence_id, test='id=%d'): cr.execute('select id,number_next,number_increment,prefix,suffix,padding from ir_sequence where '+test+' and active=True FOR UPDATE', (sequence_id,)) From b67fcb51ed90679d5acbbad82b988b78d315b644 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sat, 22 Nov 2008 01:09:35 +0100 Subject: [PATCH 13/36] improve bzr revid: fp@tinyerp.com-20081122000935-p245m22qxykckmv3 --- bin/addons/base/ir/ir_actions.py | 22 ++--- .../module/wizard/wizard_module_upgrade.py | 94 +++++++++++++++++++ bin/tools/misc.py | 18 ++-- 3 files changed, 114 insertions(+), 20 deletions(-) diff --git a/bin/addons/base/ir/ir_actions.py b/bin/addons/base/ir/ir_actions.py index 8e601589f60..c520291fba2 100644 --- a/bin/addons/base/ir/ir_actions.py +++ b/bin/addons/base/ir/ir_actions.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2008 Tiny SPRL (). All Rights Reserved # $Id$ # @@ -588,26 +588,26 @@ act_window_close() # - if start_type='auto', it will be start on auto starting from start date, and stop on stop date # - if start_type="manual", it will start and stop on manually class ir_actions_todo(osv.osv): - _name = 'ir.actions.todo' + _name = 'ir.actions.todo' _columns={ 'name':fields.char('Name',size=64,required=True, select=True), 'note':fields.text('Text'), - 'start_date': fields.datetime('Start Date'), - 'end_date': fields.datetime('End Date'), + 'start_date': fields.datetime('Start Date'), + 'end_date': fields.datetime('End Date'), 'action_id':fields.many2one('ir.actions.act_window', 'Action', select=True,required=True, ondelete='cascade'), 'sequence':fields.integer('Sequence'), - 'active': fields.boolean('Active'), - 'type':fields.selection([('configure', 'Configure'),('service', 'Service'),('other','Other')], string='Type', required=True), - 'start_on':fields.selection([('at_once', 'At Once'),('auto', 'Auto'),('manual','Manual')], string='Start On'), - 'groups_id': fields.many2many('res.groups', 'res_groups_act_todo_rel', 'act_todo_id', 'group_id', 'Groups'), - 'users_id': fields.many2many('res.users', 'res_users_act_todo_rel', 'act_todo_id', 'user_id', 'Users'), + 'active': fields.boolean('Active'), + 'type':fields.selection([('configure', 'Configure'),('service', 'Service'),('other','Other')], string='Type', required=True), + 'start_on':fields.selection([('at_once', 'At Once'),('auto', 'Auto'),('manual','Manual')], string='Start On'), + 'groups_id': fields.many2many('res.groups', 'res_groups_act_todo_rel', 'act_todo_id', 'group_id', 'Groups'), + 'users_id': fields.many2many('res.users', 'res_users_act_todo_rel', 'act_todo_id', 'user_id', 'Users'), 'state':fields.selection([('open', 'Not Started'),('done', 'Done'),('skip','Skipped'),('cancel','Cancel')], string='State', required=True) } _defaults={ 'state': lambda *a: 'open', 'sequence': lambda *a: 10, - 'active':lambda *a:True, - 'type':lambda *a:'configure' + 'active':lambda *a:True, + 'type':lambda *a:'configure' } _order="sequence" ir_actions_todo() diff --git a/bin/addons/base/module/wizard/wizard_module_upgrade.py b/bin/addons/base/module/wizard/wizard_module_upgrade.py index 64db951bdf3..782457c00fd 100644 --- a/bin/addons/base/module/wizard/wizard_module_upgrade.py +++ b/bin/addons/base/module/wizard/wizard_module_upgrade.py @@ -146,5 +146,99 @@ class wizard_info_get(wizard.interface): wizard_info_get('module.upgrade') +class wizard_info_get_simple(wizard.interface): + def _get_install(self, cr, uid, data, context): + pool=pooler.get_pool(cr.dbname) + mod_obj = pool.get('ir.module.module') + ids = mod_obj.search(cr, uid, [ + ('state', 'in', ['to upgrade', 'to remove', 'to install'])]) + res = mod_obj.read(cr, uid, ids, ['name','state'], context) + url = mod_obj.download(cr, uid, ids, download=False, context=context) + return {'module_info': '\n'.join(map(lambda x: x['name']+' : '+x['state'], res)), + 'module_download': '\n'.join(url)} + + def _check_upgrade_module(self,cr,uid,data,context): + db, pool = pooler.get_db_and_pool(cr.dbname) + cr = db.cursor() + mod_obj = pool.get('ir.module.module') + ids = mod_obj.search(cr, uid, [ + ('state', 'in', ['to upgrade', 'to remove', 'to install'])]) + if ids and len(ids): + return 'next' + else: + return 'end' + + def _upgrade_module(self, cr, uid, data, context): + db, pool = pooler.get_db_and_pool(cr.dbname) + cr = db.cursor() + mod_obj = pool.get('ir.module.module') + ids = mod_obj.search(cr, uid, [('state', 'in', ['to upgrade', 'to remove', 'to install'])]) + unmet_packages = [] + mod_dep_obj = pool.get('ir.module.module.dependency') + for mod in mod_obj.browse(cr, uid, ids): + depends_mod_ids = mod_dep_obj.search(cr, uid, [('module_id', '=', mod.id)]) + for dep_mod in mod_dep_obj.browse(cr, uid, depends_mod_ids): + if dep_mod.state in ('unknown','uninstalled'): + unmet_packages.append(dep_mod.name) + if len(unmet_packages): + raise wizard.except_wizard('Unmet dependency !', 'Following modules are uninstalled or unknown. \n\n'+'\n'.join(unmet_packages)) + mod_obj.download(cr, uid, ids, context=context) + cr.commit() + db, pool = pooler.restart_pool(cr.dbname, update_module=True) + return {} + + def _config(self, cr, uid, data, context=None): + return { + 'view_type': 'form', + "view_mode": 'form', + 'res_model': 'ir.actions.configuration.wizard', + 'type': 'ir.actions.act_window', + 'target':'new', + } + + states = { + 'init': { + 'actions': [], + 'result' : {'type': 'choice', 'next_state': _check_upgrade_module } + }, + 'next': { + 'actions': [_get_install], + 'result': {'type':'form', 'arch':view_form, 'fields': view_field, + 'state':[ + ('end', 'Cancel', 'gtk-cancel'), + ('start', 'Start Upgrade', 'gtk-ok', True) + ] + } + }, + 'start': { + 'actions': [_upgrade_module], + 'result': {'type':'form', 'arch':view_form_end, 'fields': {}, + 'state':[ + ('end', 'Close', 'gtk-close', True), + ('config', 'Start configuration', 'gtk-ok', True) + ] + } + }, + 'end': { + 'actions': [], + 'result': {'type':'form', 'arch':view_form_end, 'fields': {}, + 'state':[ + ('end', 'Close', 'gtk-close', True), + ('config', 'Start configuration', 'gtk-ok', True) + ] + } + }, + 'config':{ + 'result': { + 'type': 'action', + 'action': _config, + 'state': 'end', + }, + } + } +wizard_info_get_simple('module.upgrade.simple') + + + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/bin/tools/misc.py b/bin/tools/misc.py index dcf9c8a498d..fc89a4522e0 100644 --- a/bin/tools/misc.py +++ b/bin/tools/misc.py @@ -646,30 +646,30 @@ def get_languages(): 'ca_ES': u'Catalan / Català', 'cs_CZ': u'Czech / Čeština', 'de_DE': u'German / Deutsch', - 'en_CA': u'English (Canada)', + 'en_CA': u'English (CA)', 'en_EN': u'English (default)', - 'en_GB': u'English (United Kingdom)', - 'en_US': u'English (Unites States)', - 'es_AR': u'Spanish (Argentina) / Español (República Argentina)', + 'en_GB': u'English (UK)', + 'en_US': u'English (US)', + 'es_AR': u'Spanish (AR) / Español (AR)', 'es_ES': u'Spanish / Español', 'et_ET': u'Estonian / Eesti keel', - 'fr_BE': u'French (Belgium) / Français (Belgique)', - 'fr_CH': u'French (Switzerland) / Français (Suisse)', + 'fr_BE': u'French (BE) / Français (BE)', + 'fr_CH': u'French (CH) / Français (CH)', 'fr_FR': u'French / Français', 'hr_HR': u'Croatian / hrvatski jezik', 'hu_HU': u'Hungarian / Magyar', 'it_IT': u'Italian / Italiano', 'lt_LT': u'Lithuanian / Lietuvių kalba', 'nl_NL': u'Dutch / Nederlands', - 'pt_BR': u'Portugese (Federative Republic of Brazil) / português (República Federativa do Brasil)', + '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 / русский язык', 'sl_SL': u'Slovenian / slovenščina', 'sv_SE': u'Swedish / svenska', 'uk_UK': u'Ukrainian / украї́нська мо́ва', - 'zh_CN': u'Chinese (Simplified) / 简体中文' , - 'zh_TW': u'Chinese (Traditional) / 正體字', + 'zh_CN': u'Chinese (CN) / 简体中文' , + 'zh_TW': u'Chinese (TW) / 正體字', } return languages From a76122fa34a10de44b0d2facfb2f1e5a6f049c9d Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Sat, 22 Nov 2008 01:14:01 +0100 Subject: [PATCH 14/36] [FIX] put audittrail method in autocommit bzr revid: christophe@tinyerp.com-20081122001401-axf7gw1zy566ttod --- addons/audittrail/audittrail.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/audittrail/audittrail.py b/addons/audittrail/audittrail.py index c0c6bb9b4c8..09fc74507fe 100644 --- a/addons/audittrail/audittrail.py +++ b/addons/audittrail/audittrail.py @@ -307,6 +307,7 @@ def tmp_fct(fct_src): def execute( db, uid, passwd, object, method, *args): pool = pooler.get_pool(db) cr = pooler.get_db(db).cursor() + cr.autocommit(True) obj=pool.get(object) logged_uids = [] object_name=obj._name @@ -335,8 +336,7 @@ def tmp_fct(fct_src): if getattr(thisrule, 'log_'+field): return log_fct(db, uid, passwd, object, method, fct_src , *args) return fct_src( db, uid, passwd, object, method, *args) - cr.commit() - res = my_fct( db, uid, passwd, object, method, *args) + res = my_fct( db, uid, passwd, object, method, *args) cr.close() return res return execute @@ -344,4 +344,6 @@ def tmp_fct(fct_src): obj = netsvc._service['object'] obj.execute = tmp_fct(obj.execute) obj.exportMethod(obj.execute) + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + From 67ca84598f4db922bc38f23e9b7031e452ee3b9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Sat, 22 Nov 2008 03:29:43 +0100 Subject: [PATCH 15/36] fix for traceability bug https://bugs.launchpad.net/openobject-addons/+bug/300651 and translated code to English terms bzr revid: rvalyi@gmail.com-20081122022943-gs1g66us0uftrh07 --- addons/stock/stock_view.xml | 16 ++++++++-------- addons/stock/wizard/stock_traceability.py | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index 4967fe23c77..805e49b7509 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -271,26 +271,26 @@ + name="stock.traceability.lot.upstream" + string="Upstream traceability"/> + name="stock.traceability.lot.downstream" + string="Downstream traceability"/> + name="stock.traceability.upstream" + string="Upstream traceability"/> + name="stock.traceability.downstream" + string="Downstream traceability"/> Downstream traceability diff --git a/addons/stock/wizard/stock_traceability.py b/addons/stock/wizard/stock_traceability.py index bab1be53a49..7baee9674e8 100644 --- a/addons/stock/wizard/stock_traceability.py +++ b/addons/stock/wizard/stock_traceability.py @@ -52,7 +52,7 @@ class wiz_journal(wizard.interface): 'result': {'type': 'action', 'action': action_traceability(), 'state':'end'} } } -wiz_journal('stock.traceability.aval') +wiz_journal('stock.traceability.downstream') class wiz_journal2(wizard.interface): states = { @@ -61,7 +61,7 @@ class wiz_journal2(wizard.interface): 'result': {'type': 'action', 'action': action_traceability('move_history_ids2'), 'state':'end'} } } -wiz_journal2('stock.traceability.amont') +wiz_journal2('stock.traceability.upstream') class wiz_journal3(wizard.interface): states = { @@ -70,7 +70,7 @@ class wiz_journal3(wizard.interface): 'result': {'type': 'action', 'action': action_traceability(field='prodlot_id'), 'state':'end'} } } -wiz_journal3('stock.traceability.lot.amont') +wiz_journal3('stock.traceability.lot.upstream') class wiz_journal4(wizard.interface): states = { @@ -79,7 +79,7 @@ class wiz_journal4(wizard.interface): 'result': {'type': 'action', 'action': action_traceability('move_history_ids2', 'prodlot_id'), 'state':'end'} } } -wiz_journal4('stock.traceability.lot.aval') +wiz_journal4('stock.traceability.lot.downstream') # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: From 0baea7eed3bb604cd3f3c9a8030f9a3827bdf645 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sat, 22 Nov 2008 16:45:01 +0100 Subject: [PATCH 16/36] bugfixes bzr revid: fp@tinyerp.com-20081122154501-zqe7gi1kwcj9qxhc --- .../wizard/base_module_publish.py | 2 ++ .../wizard/base_module_publish_all.py | 8 +++++ addons/document/document.py | 32 +++++++++++++------ addons/document_ics/document_demo.xml | 2 +- addons/event/event_demo.xml | 25 --------------- 5 files changed, 33 insertions(+), 36 deletions(-) diff --git a/addons/base_module_publish/wizard/base_module_publish.py b/addons/base_module_publish/wizard/base_module_publish.py index a2e36b60147..8743945c34d 100644 --- a/addons/base_module_publish/wizard/base_module_publish.py +++ b/addons/base_module_publish/wizard/base_module_publish.py @@ -264,8 +264,10 @@ def _upload(self, cr, uid, datas, context): 'auto_password': datas['form']['password'] } name = mod.name + print 'ICI' a = urllib.urlopen('http://www.openerp.com/mtree_interface.php?module=%s' % (name,)) aa = a.read() + print aa if aa[0]<>'0': updata['link_id']=aa.split('\n')[0] updata['option'] = 'mtree' diff --git a/addons/base_module_publish/wizard/base_module_publish_all.py b/addons/base_module_publish/wizard/base_module_publish_all.py index 6816262534b..fc2e85a153c 100644 --- a/addons/base_module_publish/wizard/base_module_publish_all.py +++ b/addons/base_module_publish/wizard/base_module_publish_all.py @@ -101,6 +101,9 @@ def _upload(self, cr, uid, datas, context): ], [('module', res['module_filename'], res['module_file']) ]) + print '-'*50 + print result + print '-'*50 if result[0] == "1": raise wizard.except_wizard('Error', 'Login failed!') elif result[0] == "0": @@ -126,13 +129,18 @@ def _upload(self, cr, uid, datas, context): 'auto_login': datas['form']['login'], 'auto_password': datas['form']['password'] } + print updata a = urlopen('http://www.openerp.com/mtree_interface.php?module=%s' % (mod.name,)) aa = a.read() + print '='*40 + print aa if aa[0]<>'0': updata['link_id']=aa.split('\n')[0] updata['cat_id']=aa.split('\n')[1] updata['option'] = 'mtree' result = post_multipart('www.openerp.com', '/index.php', updata.items(), []) + print '.'*50 + print result return {'update': '\n'.join(log[0]), 'already': '\n'.join(log[1]), 'error': '\n'.join(log[2])} diff --git a/addons/document/document.py b/addons/document/document.py index 01ab5e96beb..a1bb5324a40 100644 --- a/addons/document/document.py +++ b/addons/document/document.py @@ -33,6 +33,17 @@ from content_index import content_index import netsvc import StringIO +import random +import string + + +def random_name(): + random.seed() + d = [random.choice(string.letters) for x in xrange(10) ] + name = "".join(d) + return name + + # Unsupported WebDAV Commands: # label # search @@ -374,6 +385,8 @@ class document_directory(osv.osv): document_directory() +print '1' + class document_directory_node(osv.osv): _inherit = 'process.node' _columns = { @@ -381,6 +394,8 @@ class document_directory_node(osv.osv): } document_directory_node() +print '2' + class document_directory_content_type(osv.osv): _name = 'document.directory.content.type' _description = 'Directory Content Type' @@ -393,6 +408,7 @@ class document_directory_content_type(osv.osv): 'active': lambda *args: 1 } document_directory_content_type() +print '3' class document_directory_content(osv.osv): _name = 'document.directory.content' @@ -426,6 +442,7 @@ class document_directory_content(osv.osv): s.name = node return s document_directory_content() +print '4' class ir_action_report_xml(osv.osv): _name="ir.actions.report.xml" @@ -462,16 +479,7 @@ class ir_action_report_xml(osv.osv): ir_action_report_xml() - -import random -import string - - -def random_name(): - random.seed() - d = [random.choice(string.letters) for x in xrange(10) ] - name = "".join(d) - return name +print '5' def create_directory(path): @@ -662,6 +670,8 @@ class document_file(osv.osv): return super(document_file, self).unlink(cr, uid, ids, context) document_file() +print '5' + class document_configuration_wizard(osv.osv_memory): _name='document.configuration.wizard' _rec_name = 'Auto Directory configuration' @@ -759,3 +769,5 @@ class document_configuration_wizard(osv.osv_memory): 'target':'new', } document_configuration_wizard() + +print '6' diff --git a/addons/document_ics/document_demo.xml b/addons/document_ics/document_demo.xml index 72b1e60f0f8..eb939cfd515 100644 --- a/addons/document_ics/document_demo.xml +++ b/addons/document_ics/document_demo.xml @@ -18,7 +18,7 @@ .ics - + diff --git a/addons/event/event_demo.xml b/addons/event/event_demo.xml index 94be31ea93d..ad25a1dbfc1 100644 --- a/addons/event/event_demo.xml +++ b/addons/event/event_demo.xml @@ -115,30 +115,5 @@ Thanks for registrering. The conference will begin at 2 PM and will be given by Mister Pinckaers. - - - Registration for "Conference on Environment" - - - 15.50 - Ticket for Conference - - - Registration for "Opera of Verdi" - - - Ticket for Opera - 24.00 - 5 - - - Registration for "Concert of Bon Jovi" - - - Ticket for Concert - 68.00 - 2 - - From deb42d1d3b22592c099491295d040048d016d404 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sat, 22 Nov 2008 16:48:29 +0100 Subject: [PATCH 17/36] improved_loading bzr revid: fp@tinyerp.com-20081122154829-ef0cdnj87uc6kd9i --- bin/addons/__init__.py | 53 +++++++++++++++++++++++++++--------------- bin/openerp-server.py | 1 - 2 files changed, 34 insertions(+), 20 deletions(-) diff --git a/bin/addons/__init__.py b/bin/addons/__init__.py index a5115deccc5..d552572f39c 100644 --- a/bin/addons/__init__.py +++ b/bin/addons/__init__.py @@ -45,6 +45,9 @@ sys.path.insert(1, _ad) if ad != _ad: sys.path.insert(1, ad) +# Modules already loaded +loaded = [] + class Graph(dict): def addNode(self, name, deps): @@ -224,6 +227,36 @@ def init_module_objects(cr, module_name, obj_list): obj._auto_init(cr, {'module': module_name}) cr.commit() +# +# Register module named m, if not already registered +# +def register_class(m): + global loaded + logger.notifyChannel('init', netsvc.LOG_INFO, 'addon:%s:registering classes' % m) + sys.stdout.flush() + if m in loaded: + return + loaded.append(m) + mod_path = get_module_path(m) + if not os.path.isfile(mod_path+'.zip'): + imp.load_module(m, *imp.find_module(m)) + else: + import zipimport + try: + zimp = zipimport.zipimporter(mod_path+'.zip') + zimp.load_module(m) + except zipimport.ZipImportError: + logger.notifyChannel('init', netsvc.LOG_ERROR, 'Couldn\'t find module %s' % m) + +def register_classes(): + return + module_list = get_modules() + for package in create_graph(module_list): + m = package.name + register_class(m) + logger.notifyChannel('init', netsvc.LOG_INFO, 'addon:%s:registering classes' % m) + sys.stdout.flush() + def load_module_graph(cr, graph, status=None, **kwargs): # **kwargs is passed directly to convert_xml_import if not status: @@ -235,6 +268,7 @@ def load_module_graph(cr, graph, status=None, **kwargs): for package in graph: status['progress'] = (float(statusi)+0.1)/len(graph) m = package.name + register_class(m) logger.notifyChannel('init', netsvc.LOG_INFO, 'addon:%s' % m) sys.stdout.flush() pool = pooler.get_pool(cr.dbname) @@ -301,25 +335,6 @@ def load_module_graph(cr, graph, status=None, **kwargs): pool.get('ir.model.data')._process_end(cr, 1, package_todo) cr.commit() -def register_classes(): - module_list = get_modules() - for package in create_graph(module_list): - m = package.name - logger.notifyChannel('init', netsvc.LOG_INFO, 'addon:%s:registering classes' % m) - sys.stdout.flush() - - mod_path = get_module_path(m) - if not os.path.isfile(mod_path+'.zip'): - # XXX must restrict to only addons paths - imp.load_module(m, *imp.find_module(m)) - else: - import zipimport - try: - zimp = zipimport.zipimporter(mod_path+'.zip') - zimp.load_module(m) - except zipimport.ZipImportError: - logger.notifyChannel('init', netsvc.LOG_ERROR, 'Couldn\'t find module %s' % m) - def load_modules(db, force_demo=False, status=None, update_module=False): if not status: status={} diff --git a/bin/openerp-server.py b/bin/openerp-server.py index 49c60c83214..54e9f5de724 100755 --- a/bin/openerp-server.py +++ b/bin/openerp-server.py @@ -129,7 +129,6 @@ import osv, workflow, report, service #---------------------------------------------------------- import addons -addons.register_classes() if tools.config['init'] or tools.config['update']: pooler.get_db_and_pool(tools.config['db_name'], update_module=True) From 51151bfddc75619265125f89e701d31f4b050ccc Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sat, 22 Nov 2008 16:49:45 +0100 Subject: [PATCH 18/36] improved_start bzr revid: fp@tinyerp.com-20081122154945-e3wtmtqvqavokjil --- bin/openerp-server.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/bin/openerp-server.py b/bin/openerp-server.py index 54e9f5de724..432d277fe26 100755 --- a/bin/openerp-server.py +++ b/bin/openerp-server.py @@ -81,8 +81,6 @@ dispatcher.monitor(signal.SIGINT) #--------------------------------------------------------------- # connect to the database and initialize it with base if needed #--------------------------------------------------------------- -logger.notifyChannel("init", netsvc.LOG_INFO, 'connecting to database') - import psycopg import pooler From aea71594cc644602af1949dff1e25685d3e8b466 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sat, 22 Nov 2008 16:50:49 +0100 Subject: [PATCH 19/36] modifs bzr revid: fp@tinyerp.com-20081122155049-q5x2vw38lwbe8wlt --- addons/document/document.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/addons/document/document.py b/addons/document/document.py index a1bb5324a40..942eefb2682 100644 --- a/addons/document/document.py +++ b/addons/document/document.py @@ -385,8 +385,6 @@ class document_directory(osv.osv): document_directory() -print '1' - class document_directory_node(osv.osv): _inherit = 'process.node' _columns = { @@ -394,8 +392,6 @@ class document_directory_node(osv.osv): } document_directory_node() -print '2' - class document_directory_content_type(osv.osv): _name = 'document.directory.content.type' _description = 'Directory Content Type' @@ -408,7 +404,6 @@ class document_directory_content_type(osv.osv): 'active': lambda *args: 1 } document_directory_content_type() -print '3' class document_directory_content(osv.osv): _name = 'document.directory.content' @@ -442,7 +437,6 @@ class document_directory_content(osv.osv): s.name = node return s document_directory_content() -print '4' class ir_action_report_xml(osv.osv): _name="ir.actions.report.xml" @@ -479,9 +473,6 @@ class ir_action_report_xml(osv.osv): ir_action_report_xml() -print '5' - - def create_directory(path): dir_name = random_name() path = os.path.join(path,dir_name) @@ -670,8 +661,6 @@ class document_file(osv.osv): return super(document_file, self).unlink(cr, uid, ids, context) document_file() -print '5' - class document_configuration_wizard(osv.osv_memory): _name='document.configuration.wizard' _rec_name = 'Auto Directory configuration' @@ -769,5 +758,3 @@ class document_configuration_wizard(osv.osv_memory): 'target':'new', } document_configuration_wizard() - -print '6' From 188f781333e96ef3a29793c86f9b5226f6d6709f Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sat, 22 Nov 2008 16:52:07 +0100 Subject: [PATCH 20/36] better_message bzr revid: fp@tinyerp.com-20081122155207-hksen8yj33r0nrxs --- bin/openerp-server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/openerp-server.py b/bin/openerp-server.py index 432d277fe26..11a5b32705c 100755 --- a/bin/openerp-server.py +++ b/bin/openerp-server.py @@ -200,7 +200,7 @@ if tools.config['netrpc']: netinterface = tools.config["netinterface"] tinySocket = netsvc.TinySocketServerThread(netinterface, netport, False) - logger.notifyChannel("web-services", netsvc.LOG_INFO, "starting netrpc service, port "+str(netport)) + logger.notifyChannel("web-services", netsvc.LOG_INFO, "starting NET-RPC service, port "+str(netport)) def handler(signum, frame): From f10c8fcc665d79a2d7ec895ca4b28314db493e63 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sat, 22 Nov 2008 17:14:18 +0100 Subject: [PATCH 21/36] modifs bzr revid: fp@tinyerp.com-20081122161418-8w20acsz5km2gwod --- bin/addons/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/addons/__init__.py b/bin/addons/__init__.py index d552572f39c..afd92ee26f8 100644 --- a/bin/addons/__init__.py +++ b/bin/addons/__init__.py @@ -232,10 +232,10 @@ def init_module_objects(cr, module_name, obj_list): # def register_class(m): global loaded - logger.notifyChannel('init', netsvc.LOG_INFO, 'addon:%s:registering classes' % m) - sys.stdout.flush() if m in loaded: return + logger.notifyChannel('init', netsvc.LOG_INFO, 'addon:%s:registering classes' % m) + sys.stdout.flush() loaded.append(m) mod_path = get_module_path(m) if not os.path.isfile(mod_path+'.zip'): From 6bf016f9ee25381ac333c0eb1429fcf06b2ac769 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sat, 22 Nov 2008 17:14:53 +0100 Subject: [PATCH 22/36] modifs bzr revid: fp@tinyerp.com-20081122161453-eep2h8wen1dtdlf6 --- addons/sale/sale_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index f7871d0d234..4090262a5b7 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -348,7 +348,7 @@ - + From b31839425eeb602c7aabd9c9c8651b0925689317 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sat, 22 Nov 2008 20:01:52 +0100 Subject: [PATCH 23/36] bugfixes bzr revid: fp@tinyerp.com-20081122190152-4a0mrq5pvbq7h6ot --- addons/mrp_operations/mrp_operations.py | 1 + addons/mrp_operations/mrp_operations_view.xml | 33 +++++++++++++++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/addons/mrp_operations/mrp_operations.py b/addons/mrp_operations/mrp_operations.py index 20f73243638..e5b89de3e10 100755 --- a/addons/mrp_operations/mrp_operations.py +++ b/addons/mrp_operations/mrp_operations.py @@ -44,6 +44,7 @@ class mrp_production_workcenter_line(osv.osv): _description = 'Production workcenters used' _columns = { 'state': fields.selection([('draft','Draft'),('startworking', 'In Progress'),('pause','Pause'),('cancel','Canceled'),('done','Finished')],'Status', readonly=True), + 'date_planned': fields.related('production_id', 'date_planned', string='Date Planned'), 'date_start': fields.datetime('Start Date'), 'date_finnished': fields.datetime('End Date'), 'delay': fields.char('Delay',size=128,help="This is delay between operation start and stop in this workcenter",readonly=True), diff --git a/addons/mrp_operations/mrp_operations_view.xml b/addons/mrp_operations/mrp_operations_view.xml index 528fa936a29..2b1b55c36f4 100755 --- a/addons/mrp_operations/mrp_operations_view.xml +++ b/addons/mrp_operations/mrp_operations_view.xml @@ -42,6 +42,33 @@ + + mrp.production.workcenter.line.calendar + mrp.production.workcenter.line + calendar + + + + + + + + + + + mrp.production.workcenter.line.gantt + mrp.production.workcenter.line + gantt + + + + + + + + + + @@ -49,7 +76,7 @@ ir.actions.act_window mrp.production.workcenter.line form - tree,form + tree,form,gantt,calendar,graph [('id','=',active_id)] @@ -60,7 +87,7 @@ ir.actions.act_window mrp.production.workcenter.line form - tree,form,graph + tree,form,graph,calendar,gantt @@ -70,7 +97,7 @@ ir.actions.act_window mrp.production.workcenter.line form - tree,form,graph + tree,form,graph,gantt,calendar [('state','=','confirm')] From 7c6cea37cbb93e2ade32eceadc995a4cf7ad1655 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sat, 22 Nov 2008 20:02:42 +0100 Subject: [PATCH 24/36] improved_field bzr revid: fp@tinyerp.com-20081122190242-k0klxlqf3860oo1m --- addons/mrp/mrp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index b6e421fe1c3..f023436172f 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -685,8 +685,8 @@ class mrp_production_workcenter_line(osv.osv): _columns = { 'name': fields.char('Name', size=64, required=True), 'workcenter_id': fields.many2one('mrp.workcenter', 'Workcenter', required=True), - 'cycle': fields.float('Nbr of cycle'), - 'hour': fields.float('Nbr of hour'), + 'cycle': fields.float('Nbr of cycle', digits=(16,2)), + 'hour': fields.float('Nbr of hour', digits=(16,2)), 'sequence': fields.integer('Sequence', required=True), 'production_id': fields.many2one('mrp.production', 'Production Order', select=True), } From cbbe020e76bab24be95a346ba2386080e863e34b Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sat, 22 Nov 2008 20:04:53 +0100 Subject: [PATCH 25/36] removed_print_statement bzr revid: fp@tinyerp.com-20081122190453-m7jrpvws5e1s7of7 --- addons/base_module_publish/wizard/base_module_publish.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/addons/base_module_publish/wizard/base_module_publish.py b/addons/base_module_publish/wizard/base_module_publish.py index 8743945c34d..a2e36b60147 100644 --- a/addons/base_module_publish/wizard/base_module_publish.py +++ b/addons/base_module_publish/wizard/base_module_publish.py @@ -264,10 +264,8 @@ def _upload(self, cr, uid, datas, context): 'auto_password': datas['form']['password'] } name = mod.name - print 'ICI' a = urllib.urlopen('http://www.openerp.com/mtree_interface.php?module=%s' % (name,)) aa = a.read() - print aa if aa[0]<>'0': updata['link_id']=aa.split('\n')[0] updata['option'] = 'mtree' From b2d2fe75a335b9650ec4f9040571c0375a6a7a36 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sun, 23 Nov 2008 11:18:15 +0100 Subject: [PATCH 26/36] improvement bzr revid: fp@tinyerp.com-20081123101815-zhn4lbvg7liabz3x --- addons/project/project.py | 72 +++++++++++---------------------- addons/project/project_view.xml | 1 + 2 files changed, 24 insertions(+), 49 deletions(-) diff --git a/addons/project/project.py b/addons/project/project.py index d99109007bf..27789b56d5a 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -31,46 +31,6 @@ class project(osv.osv): _name = "project.project" _description = "Project" - def _calc_effective(self, cr, uid, ids, name, args, context): - ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) - res_sum = {} - if ids2: - cr.execute('SELECT t.project_id, COALESCE(SUM(w.hours),0) \ - FROM project_task t \ - LEFT JOIN project_task_work w \ - ON (w.task_id = t.id) \ - WHERE t.project_id in (' + ','.join([str(x) for x in ids2]) + ') \ - AND active \ - GROUP BY project_id') - for project_id, sum in cr.fetchall(): - res_sum[project_id] = sum - res={} - for id in ids: - ids3 = self.search(cr, uid, [('parent_id', 'child_of', [id])]) - res.setdefault(id, 0.0) - for idx in ids3: - res[id] += res_sum.get(idx, 0.0) - return res - - def _calc_planned(self, cr, uid, ids, name, args, context): - ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) - res_sum = {} - if ids2: - cr.execute('SELECT project_id, COALESCE(SUM(total_hours),0) \ - FROM project_task \ - WHERE project_id IN (' + ','.join([str(x) for x in ids2]) + ') \ - AND active \ - GROUP BY project_id') - for project_id, sum in cr.fetchall(): - res_sum[project_id] = sum - res = {} - for id in ids: - ids3 = self.search(cr, uid, [('parent_id', 'child_of', [id])]) - res.setdefault(id, 0.0) - for idx in ids3: - res[id] += res_sum.get(idx, 0.0) - return res - def check_recursion(self, cursor, user, ids, parent=None): return super(project, self).check_recursion(cursor, user, ids, parent=parent) @@ -83,22 +43,35 @@ class project(osv.osv): pricelist = self.pool.get('res.partner').browse(cr, uid, part).property_product_pricelist.id return {'value':{'contact_id': addr['contact'], 'pricelist_id': pricelist}} - def _progress_rate(self, cr, uid, ids, name, arg, context=None): + def _progress_rate(self, cr, uid, ids, names, arg, context=None): res = {}.fromkeys(ids, 0.0) if not ids: return res + ids2 = self.search(cr, uid, [('parent_id','child_of',ids)]) cr.execute('''SELECT - project_id, sum(progress*total_hours), sum(total_hours) + project_id, sum(planned_hours), sum(total_hours), sum(effective_hours) FROM project_task WHERE - project_id in ('''+','.join(map(str,ids))+''') AND + project_id in ('''+','.join(map(str,ids2))+''') AND state<>'cancelled' GROUP BY project_id''') - for id,prog,tot in cr.fetchall(): - if tot: - res[id] = prog / tot + progress = dict(map(lambda x: (x[0], (x[1],x[2],x[3])), cr.fetchall())) + for project in self.browse(cr, uid, ids, context=context): + s = [0.0,0.0,0.0] + tocompute = [project] + while tocompute: + p = tocompute.pop() + tocompute += p.child_id + for i in range(3): + s[i] += progress.get(p.id, (0.0,0.0,0.0))[i] + res[project.id] = { + 'planned_hours': s[0], + 'effective_hours': s[2], + 'total_hours': s[1], + 'progress_rate': s[1] and (100.0 * s[2] / s[1]) or 0.0 + } return res def unlink(self, cr, uid, ids, *args, **kwargs): @@ -117,9 +90,10 @@ class project(osv.osv): 'tasks': fields.one2many('project.task', 'project_id', "Project tasks"), 'parent_id': fields.many2one('project.project', 'Parent Project'), 'child_id': fields.one2many('project.project', 'parent_id', 'Subproject'), - 'planned_hours': fields.function(_calc_planned, method=True, string='Planned hours', help="Sum of planned hours of all tasks related to this project."), - 'effective_hours': fields.function(_calc_effective, method=True, string='Hours spent', help="Sum of spent hours of all tasks related to this project."), - 'progress_rate': fields.function(_progress_rate, method=True, string='Progress', type='float', help="Percent of tasks closed according to the total of tasks todo."), + 'planned_hours': fields.function(_progress_rate, multi="progress", method=True, string='Planned Time', help="Sum of planned hours of all tasks related to this project."), + 'effective_hours': fields.function(_progress_rate, multi="progress", method=True, string='Time Spent', help="Sum of spent hours of all tasks related to this project."), + 'total_hours': fields.function(_progress_rate, multi="progress", method=True, string='Total Time', help="Sum of total hours of all tasks related to this project."), + 'progress_rate': fields.function(_progress_rate, multi="progress", method=True, string='Progress', type='float', help="Percent of tasks closed according to the total of tasks todo."), 'date_start': fields.date('Starting Date'), 'date_end': fields.date('Expected End'), 'partner_id': fields.many2one('res.partner', 'Partner'), diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index c30aa71069b..10e8d067968 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -84,6 +84,7 @@ + From 21a9b9e064bcf30bbdb3392728e7abcf4dafbc76 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sun, 23 Nov 2008 12:07:17 +0100 Subject: [PATCH 27/36] bugfix_301049 bzr revid: fp@tinyerp.com-20081123110717-c7odqp2ri7du65s0 --- bin/osv/fields.py | 4 +++- bin/tools/translate.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/osv/fields.py b/bin/osv/fields.py index dd46d7654fb..07f72e5b859 100644 --- a/bin/osv/fields.py +++ b/bin/osv/fields.py @@ -678,7 +678,8 @@ class related(function): where += " %s.%s %s '%s' and" % (obj_child._table, self._arg[i], context[0][1], context[0][2]) if field_detail[1] in ['integer', 'long', 'float','integer_big']: where += " %s.%s %s '%d' and" % (obj_child._table, self._arg[i], context[0][1], context[0][2]) - query += where.rstrip('and') + if len(where)>10: + query += where.rstrip('and') cr.execute(query) ids = [] for id in cr.fetchall(): @@ -718,6 +719,7 @@ class related(function): # TODO: call field_get on the object, not in the DB def _field_get(self, cr, uid, obj, model_name, prop): + print model_name, prop fields = obj.pool.get(model_name).fields_get(cr, uid,) if fields.get(prop, False): return(fields[prop].get('relation', False), fields[prop].get('type', False), fields) diff --git a/bin/tools/translate.py b/bin/tools/translate.py index c5630d7bcff..b222daed5ac 100644 --- a/bin/tools/translate.py +++ b/bin/tools/translate.py @@ -109,7 +109,7 @@ class TinyPoFile(object): if line.startswith('#:'): tmp_tnrs.append( line[2:].strip().split(':') ) line = self.lines.pop(0).strip() - while not line: + while (not line) and self.lines: # allow empty lines between comments and msgid line = self.lines.pop(0).strip() if not line.startswith('msgid'): From a2fddb8b40a66f5155eece653bb5eee568d627dc Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sun, 23 Nov 2008 12:11:28 +0100 Subject: [PATCH 28/36] bugfix bzr revid: fp@tinyerp.com-20081123111128-a2vqz7wf6w89popv --- bin/tools/translate.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/bin/tools/translate.py b/bin/tools/translate.py index b222daed5ac..b22d12a136e 100644 --- a/bin/tools/translate.py +++ b/bin/tools/translate.py @@ -100,18 +100,15 @@ class TinyPoFile(object): else: tmp_tnrs = [] line = None - while not line: + while (not line): if 0 == len(self.lines): raise StopIteration() line = self.lines.pop(0).strip() - - while line.startswith('#'): - if line.startswith('#:'): + if line.startswith('#:'): tmp_tnrs.append( line[2:].strip().split(':') ) - line = self.lines.pop(0).strip() - while (not line) and self.lines: - # allow empty lines between comments and msgid - line = self.lines.pop(0).strip() + if line.startswith('#'): + line = None + if not line.startswith('msgid'): raise Exception("malformed file: bad line: %s" % line) source = unquote(line[6:]) From e5b9ee5cf977ede8356df77b7af7793d7cdcb57f Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sun, 23 Nov 2008 12:27:27 +0100 Subject: [PATCH 29/36] improve bzr revid: fp@tinyerp.com-20081123112727-yd1xxf6qe34xgw0i --- bin/osv/osv.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/bin/osv/osv.py b/bin/osv/osv.py index e1f52838224..58a98da347b 100644 --- a/bin/osv/osv.py +++ b/bin/osv/osv.py @@ -229,7 +229,18 @@ class osv(orm.orm): if hasattr(new, 'update'): new.update(cls.__dict__.get(s, {})) else: - new.extend(cls.__dict__.get(s, [])) + if s=='_constraints': + for c in cls.__dict__.get(s, []): + exist = False + for c2 in range(len(new)): + if new[c2][2]==c[2]: + new[c2] = c + exist = True + break + if not exist: + new.append(c) + else: + new.extend(cls.__dict__.get(s, [])) nattr[s] = new name = hasattr(cls, '_name') and cls._name or cls._inherit cls = type(name, (cls, parent_class), nattr) From 56534bebad24a8960411b5c0278185914e939519 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sun, 23 Nov 2008 22:47:44 +0100 Subject: [PATCH 30/36] improved_menu bzr revid: fp@tinyerp.com-20081123214744-aqyz0ffta2wj22ti --- addons/wiki/wiki_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/wiki/wiki_view.xml b/addons/wiki/wiki_view.xml index e9a5402ec27..825537811e2 100644 --- a/addons/wiki/wiki_view.xml +++ b/addons/wiki/wiki_view.xml @@ -2,7 +2,7 @@ - + Date: Sun, 23 Nov 2008 23:55:20 +0100 Subject: [PATCH 31/36] improvement bzr revid: fp@tinyerp.com-20081123225520-sebxtto5cst83ulu --- addons/document/document_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/document/document_view.xml b/addons/document/document_view.xml index 9dd27bba66f..2d76d88341c 100644 --- a/addons/document/document_view.xml +++ b/addons/document/document_view.xml @@ -1,7 +1,7 @@ - + document.directory From 4eda86590cd49045268e9039e5648e0d86ef099b Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Mon, 24 Nov 2008 08:09:34 +0100 Subject: [PATCH 32/36] imprive bzr revid: fp@tinyerp.com-20081124070934-zx6bow02icebsctf --- addons/mrp_operations/mrp_operations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp_operations/mrp_operations.py b/addons/mrp_operations/mrp_operations.py index e5b89de3e10..885a406fe52 100755 --- a/addons/mrp_operations/mrp_operations.py +++ b/addons/mrp_operations/mrp_operations.py @@ -44,7 +44,7 @@ class mrp_production_workcenter_line(osv.osv): _description = 'Production workcenters used' _columns = { 'state': fields.selection([('draft','Draft'),('startworking', 'In Progress'),('pause','Pause'),('cancel','Canceled'),('done','Finished')],'Status', readonly=True), - 'date_planned': fields.related('production_id', 'date_planned', string='Date Planned'), + 'date_planned': fields.related('production_id', 'date_planned', string='Date Planned', type="datetime"), 'date_start': fields.datetime('Start Date'), 'date_finnished': fields.datetime('End Date'), 'delay': fields.char('Delay',size=128,help="This is delay between operation start and stop in this workcenter",readonly=True), From 7e64b850d0d8c90f005f420c6f4a9fa567ae641f Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Mon, 24 Nov 2008 08:12:05 +0100 Subject: [PATCH 33/36] improvement bzr revid: fp@tinyerp.com-20081124071205-akhhww4czqvx1bhs --- bin/osv/fields.py | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/osv/fields.py b/bin/osv/fields.py index 07f72e5b859..db01b4462b8 100644 --- a/bin/osv/fields.py +++ b/bin/osv/fields.py @@ -719,7 +719,6 @@ class related(function): # TODO: call field_get on the object, not in the DB def _field_get(self, cr, uid, obj, model_name, prop): - print model_name, prop fields = obj.pool.get(model_name).fields_get(cr, uid,) if fields.get(prop, False): return(fields[prop].get('relation', False), fields[prop].get('type', False), fields) From 648f4fd0803310f1d0e1ab40debec55833b97504 Mon Sep 17 00:00:00 2001 From: Amit Mendapara Date: Mon, 24 Nov 2008 15:05:32 +0530 Subject: [PATCH 34/36] * Fixed gantt view. bzr revid: ame@tinyerp.com-20081124093532-5jg1w9bdshqq8v2t --- addons/mrp_operations/mrp_operations.py | 2 +- addons/mrp_operations/mrp_operations_view.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/mrp_operations/mrp_operations.py b/addons/mrp_operations/mrp_operations.py index 885a406fe52..eafa078f226 100755 --- a/addons/mrp_operations/mrp_operations.py +++ b/addons/mrp_operations/mrp_operations.py @@ -44,7 +44,7 @@ class mrp_production_workcenter_line(osv.osv): _description = 'Production workcenters used' _columns = { 'state': fields.selection([('draft','Draft'),('startworking', 'In Progress'),('pause','Pause'),('cancel','Canceled'),('done','Finished')],'Status', readonly=True), - 'date_planned': fields.related('production_id', 'date_planned', string='Date Planned', type="datetime"), + 'date_planned': fields.related('production_id', 'date_planned', type='datetime', string='Date Planned'), 'date_start': fields.datetime('Start Date'), 'date_finnished': fields.datetime('End Date'), 'delay': fields.char('Delay',size=128,help="This is delay between operation start and stop in this workcenter",readonly=True), diff --git a/addons/mrp_operations/mrp_operations_view.xml b/addons/mrp_operations/mrp_operations_view.xml index 2b1b55c36f4..1a84e3cfcf8 100755 --- a/addons/mrp_operations/mrp_operations_view.xml +++ b/addons/mrp_operations/mrp_operations_view.xml @@ -60,7 +60,7 @@ mrp.production.workcenter.line gantt - + From 1aeba905db9611e65f66f8d8484be001f82a0795 Mon Sep 17 00:00:00 2001 From: apa-tiny Date: Mon, 24 Nov 2008 15:23:09 +0530 Subject: [PATCH 35/36] total changes in printscreen report-vir bzr revid: patelamit2003@gmail.com-20081124095309-0tasnp02e4b2kjrj --- bin/report/printscreen/ps_list.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/report/printscreen/ps_list.py b/bin/report/printscreen/ps_list.py index f53106e0e46..5349285b9ba 100644 --- a/bin/report/printscreen/ps_list.py +++ b/bin/report/printscreen/ps_list.py @@ -152,8 +152,10 @@ class report_printscreen_list(report_int): for f in fields_order: count += 1 + if fields[f]['type']=='many2one' and line[f]: - line[f] = line[f][1] + line[f]= line[f][1] + if fields[f]['type'] in ('one2many','many2many') and line[f]: line[f] = '( '+str(len(line[f])) + ' )' if fields[f]['type'] == 'float': @@ -181,8 +183,11 @@ class report_printscreen_list(report_int): col.setAttribute('para','yes') col.setAttribute('tree','no') if tsum[f] != None: - total = '%.2f'%(tsum[f]) - txt = new_doc.createTextNode(str(total or '')) + if tsum[f] >= 0.01 : + total = '%.2f'%(tsum[f]) + txt = new_doc.createTextNode(str(total or '')) + else : + txt = new_doc.createTextNode(str(tsum[f] or '')) else: txt = new_doc.createTextNode('/') if f == 0: From ab4e620e833d484e67db3d0224377c8c0fadd709 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Mon, 24 Nov 2008 11:56:29 +0100 Subject: [PATCH 36/36] improved_currency bzr revid: fp@tinyerp.com-20081124105629-qadghr2z23q7r3cy --- addons/mrp_operations/mrp_operations.py | 4 +--- addons/purchase/purchase.py | 2 +- addons/sale/sale.py | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/addons/mrp_operations/mrp_operations.py b/addons/mrp_operations/mrp_operations.py index 885a406fe52..12178cef676 100755 --- a/addons/mrp_operations/mrp_operations.py +++ b/addons/mrp_operations/mrp_operations.py @@ -47,12 +47,10 @@ class mrp_production_workcenter_line(osv.osv): 'date_planned': fields.related('production_id', 'date_planned', string='Date Planned', type="datetime"), 'date_start': fields.datetime('Start Date'), 'date_finnished': fields.datetime('End Date'), - 'delay': fields.char('Delay',size=128,help="This is delay between operation start and stop in this workcenter",readonly=True), + 'delay': fields.float('Delay',size=128,help="This is delay between operation start and stop in this workcenter",readonly=True), 'product':fields.related('production_id','product_id',type='many2one',relation='product.product',string='Product'), 'qty':fields.related('production_id','product_qty',type='float',string='Qty'), 'uom':fields.related('production_id','product_uom',type='many2one',relation='product.uom',string='UOM'), - - } _defaults = { 'state': lambda *a: 'draft', diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 4d9e31836ce..942c3f960d9 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -63,7 +63,7 @@ class purchase_order(osv.osv): cur=order.pricelist_id.currency_id for line in order.order_line: for c in self.pool.get('account.tax').compute(cr, uid, line.taxes_id, line.price_unit, line.product_qty, order.partner_address_id.id, line.product_id, order.partner_id): - val+= cur_obj.round(cr, uid, cur, c['amount']) + val+= c['amount'] res[order.id]=cur_obj.round(cr, uid, cur, val) return res diff --git a/addons/sale/sale.py b/addons/sale/sale.py index dd478f3dca1..404946e1f7b 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -79,7 +79,7 @@ class sale_order(osv.osv): cur=order.pricelist_id.currency_id for line in order.order_line: for c in self.pool.get('account.tax').compute(cr, uid, line.tax_id, line.price_unit * (1-(line.discount or 0.0)/100.0), line.product_uom_qty, order.partner_invoice_id.id, line.product_id, order.partner_id): - val+= cur_obj.round(cr, uid, cur, c['amount']) + val+= c['amount'] res[order.id]=cur_obj.round(cr, uid, cur, val) return res