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/addons/base/base_data.xml b/bin/addons/base/base_data.xml index c8ad4c2b636..4f61dd1ddfc 100644 --- a/bin/addons/base/base_data.xml +++ b/bin/addons/base/base_data.xml @@ -1271,6 +1271,32 @@ + + + AUD + AUD + 0.01 + 4 + + + + 1.5266 + + + + + + UAH + UAH + 0.01 + 4 + + + + 10.8266 + + + 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/i18n/ar.po b/bin/addons/base/i18n/ar.po index f9cc72bc321..01887ba31d2 100644 --- a/bin/addons/base/i18n/ar.po +++ b/bin/addons/base/i18n/ar.po @@ -2801,11 +2801,6 @@ msgstr "" msgid "Scan for new modules" msgstr "" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/base.pot b/bin/addons/base/i18n/base.pot index 57b0f3c2426..4bf5a808e5e 100644 --- a/bin/addons/base/i18n/base.pot +++ b/bin/addons/base/i18n/base.pot @@ -2741,11 +2741,6 @@ msgstr "" msgid "Scan for new modules" msgstr "" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/bg.po b/bin/addons/base/i18n/bg.po index ad0302db898..1e17e3f0311 100644 --- a/bin/addons/base/i18n/bg.po +++ b/bin/addons/base/i18n/bg.po @@ -2863,11 +2863,6 @@ msgstr "Мавриций" msgid "Scan for new modules" msgstr "Провери за нови модули" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "Хранилище с модули" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/bs.po b/bin/addons/base/i18n/bs.po index 802d99633c7..7d1ea53fba1 100644 --- a/bin/addons/base/i18n/bs.po +++ b/bin/addons/base/i18n/bs.po @@ -2805,11 +2805,6 @@ msgstr "" msgid "Scan for new modules" msgstr "" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/ca.po b/bin/addons/base/i18n/ca.po index aef0d915101..a3807a51026 100644 --- a/bin/addons/base/i18n/ca.po +++ b/bin/addons/base/i18n/ca.po @@ -2875,11 +2875,6 @@ msgstr "Maurici" msgid "Scan for new modules" msgstr "Cerca nous mòduls" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "Biblioteca del mòdul" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/cs.po b/bin/addons/base/i18n/cs.po index d0934128ea6..66faac84e83 100644 --- a/bin/addons/base/i18n/cs.po +++ b/bin/addons/base/i18n/cs.po @@ -2804,11 +2804,6 @@ msgstr "Mauricius" msgid "Scan for new modules" msgstr "Najít nové moduly" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "Repozitář modulu" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/da.po b/bin/addons/base/i18n/da.po index cd2de726199..512aa96e53f 100644 --- a/bin/addons/base/i18n/da.po +++ b/bin/addons/base/i18n/da.po @@ -2802,11 +2802,6 @@ msgstr "" msgid "Scan for new modules" msgstr "" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/de.po b/bin/addons/base/i18n/de.po index 1602277866b..d9c01c352c7 100644 --- a/bin/addons/base/i18n/de.po +++ b/bin/addons/base/i18n/de.po @@ -2875,11 +2875,6 @@ msgstr "Mauritius" msgid "Scan for new modules" msgstr "Suche Neue Module" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "Verzeichnis der Module" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/el.po b/bin/addons/base/i18n/el.po index acc5617bf95..5c68f7a380f 100644 --- a/bin/addons/base/i18n/el.po +++ b/bin/addons/base/i18n/el.po @@ -2880,11 +2880,6 @@ msgstr "Mauritius" msgid "Scan for new modules" msgstr "Αναζήτηση νέων Αρθρωμάτων" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "Τοποθεσία Αρθρωμάτων" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/es.po b/bin/addons/base/i18n/es.po index 10583cc1b8d..d2b5c5c9837 100644 --- a/bin/addons/base/i18n/es.po +++ b/bin/addons/base/i18n/es.po @@ -2878,11 +2878,6 @@ msgstr "Mauricio" msgid "Scan for new modules" msgstr "Buscar nuevos módulos" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "Biblioteca de módulos" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/es_AR.po b/bin/addons/base/i18n/es_AR.po index 78c0061c090..7c11a450582 100644 --- a/bin/addons/base/i18n/es_AR.po +++ b/bin/addons/base/i18n/es_AR.po @@ -2858,11 +2858,6 @@ msgstr "Mauricio" msgid "Scan for new modules" msgstr "Buscar nuevos módulos" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "Repositorio de Módulos" - #. module: base #: model:ir.ui.menu,name:base.menu_security msgid "Security" diff --git a/bin/addons/base/i18n/es_EC.po b/bin/addons/base/i18n/es_EC.po index 106609ff372..13bc2e28a25 100644 --- a/bin/addons/base/i18n/es_EC.po +++ b/bin/addons/base/i18n/es_EC.po @@ -2877,11 +2877,6 @@ msgstr "Mauricio" msgid "Scan for new modules" msgstr "Buscar nuevos módulos" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "Biblioteca de módulos" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/et.po b/bin/addons/base/i18n/et.po index 0607fdae667..81ccf3ae5ed 100644 --- a/bin/addons/base/i18n/et.po +++ b/bin/addons/base/i18n/et.po @@ -2844,11 +2844,6 @@ msgstr "Mauritius" msgid "Scan for new modules" msgstr "Otsi uusi mooduleid" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "Moodulite Varamu" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/eu.po b/bin/addons/base/i18n/eu.po index 1ff2ed9b3d8..6f7a7f5cbcf 100644 --- a/bin/addons/base/i18n/eu.po +++ b/bin/addons/base/i18n/eu.po @@ -2802,11 +2802,6 @@ msgstr "" msgid "Scan for new modules" msgstr "" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/fi.po b/bin/addons/base/i18n/fi.po index 44637213de7..554dc2dfb21 100644 --- a/bin/addons/base/i18n/fi.po +++ b/bin/addons/base/i18n/fi.po @@ -2864,11 +2864,6 @@ msgstr "Mauritius" msgid "Scan for new modules" msgstr "Etsi uusia moduuleja" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "Moduulin ohjelmalähde" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/fr.po b/bin/addons/base/i18n/fr.po index de122c126cb..80dbd3c1559 100644 --- a/bin/addons/base/i18n/fr.po +++ b/bin/addons/base/i18n/fr.po @@ -2882,11 +2882,6 @@ msgstr "Île Maurice" msgid "Scan for new modules" msgstr "Recherche de nouveaux modules" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "Dépot de modules" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/gl.po b/bin/addons/base/i18n/gl.po index cd5166cb7cb..d64a8919bdf 100644 --- a/bin/addons/base/i18n/gl.po +++ b/bin/addons/base/i18n/gl.po @@ -2802,11 +2802,6 @@ msgstr "" msgid "Scan for new modules" msgstr "" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/he.po b/bin/addons/base/i18n/he.po index f90dfaeb8ba..1f8196732f8 100644 --- a/bin/addons/base/i18n/he.po +++ b/bin/addons/base/i18n/he.po @@ -2842,11 +2842,6 @@ msgstr "Mauritius" msgid "Scan for new modules" msgstr "סרוק לחיפוש מודול חדש" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "מאגר מודולים" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/hr.po b/bin/addons/base/i18n/hr.po index 4be565e330e..c6f03c89808 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-22 05:40+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-02-23 05:05+0000\n" +"X-Launchpad-Export-Date: 2010-03-03 04:45+0000\n" "X-Generator: Launchpad (build Unknown)\n" "Language: hr\n" @@ -1458,7 +1458,7 @@ msgstr "Madagaskar" msgid "" "The Object name must start with x_ and not contain any special character !" msgstr "" -"aziv objekta mora početi s x_ i ne smije sadržavati posebne znakove !" +"Naziv objekta mora početi s x_ i ne smije sadržavati posebne znakove !" #. module: base #: help:ir.rule.group,global:0 @@ -2846,11 +2846,6 @@ msgstr "Mauricijus" msgid "Scan for new modules" msgstr "Pretraži za nove module" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "Repozitorij modula" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/hu.po b/bin/addons/base/i18n/hu.po index 6175ad39a6e..bac9fe8367a 100644 --- a/bin/addons/base/i18n/hu.po +++ b/bin/addons/base/i18n/hu.po @@ -2801,11 +2801,6 @@ msgstr "" msgid "Scan for new modules" msgstr "" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/id.po b/bin/addons/base/i18n/id.po index aba6ce62586..4fdb4ad9bee 100644 --- a/bin/addons/base/i18n/id.po +++ b/bin/addons/base/i18n/id.po @@ -2802,11 +2802,6 @@ msgstr "" msgid "Scan for new modules" msgstr "" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/is.po b/bin/addons/base/i18n/is.po index bc69b4ecfa7..c8ca81600aa 100644 --- a/bin/addons/base/i18n/is.po +++ b/bin/addons/base/i18n/is.po @@ -2802,11 +2802,6 @@ msgstr "" msgid "Scan for new modules" msgstr "" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/it.po b/bin/addons/base/i18n/it.po index d600b56eb44..06b5cc1d49c 100644 --- a/bin/addons/base/i18n/it.po +++ b/bin/addons/base/i18n/it.po @@ -2881,11 +2881,6 @@ msgstr "Mauritius" msgid "Scan for new modules" msgstr "Cerca nuovi Moduli" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "Repository dei Moduli" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/ja.po b/bin/addons/base/i18n/ja.po index 9edb5c9979d..834624306a4 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-22 05:38+0000\n" -"Last-Translator: Fabien (Open ERP) \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-02-23 05:04+0000\n" +"X-Launchpad-Export-Date: 2010-03-03 04:45+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: base @@ -25,7 +25,7 @@ msgstr "セント・ヘレナ" #. module: base #: wizard_view:res.partner.sms_send,init:0 msgid "SMS - Gateway: clickatell" -msgstr "" +msgstr "SMS - ゲートウェイ:clickatell" #. module: base #: view:res.lang:0 @@ -2804,11 +2804,6 @@ msgstr "" msgid "Scan for new modules" msgstr "" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/ko.po b/bin/addons/base/i18n/ko.po index d4dde7d5c16..eea2628578a 100644 --- a/bin/addons/base/i18n/ko.po +++ b/bin/addons/base/i18n/ko.po @@ -2827,11 +2827,6 @@ msgstr "" msgid "Scan for new modules" msgstr "새 모듈 스캔" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "모듈 리포지토리" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/lt.po b/bin/addons/base/i18n/lt.po index c61b12fc13c..3e1c6eb239f 100644 --- a/bin/addons/base/i18n/lt.po +++ b/bin/addons/base/i18n/lt.po @@ -2801,11 +2801,6 @@ msgstr "" msgid "Scan for new modules" msgstr "" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/lt_LT.po b/bin/addons/base/i18n/lt_LT.po index aaeb0ca628f..a4b2b6fd21a 100644 --- a/bin/addons/base/i18n/lt_LT.po +++ b/bin/addons/base/i18n/lt_LT.po @@ -2735,11 +2735,6 @@ msgstr "" msgid "Scan for new modules" msgstr "" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "" - #. module: base #: model:ir.ui.menu,name:base.menu_security msgid "Security" diff --git a/bin/addons/base/i18n/lv.po b/bin/addons/base/i18n/lv.po index fe5918b3494..757b2510492 100644 --- a/bin/addons/base/i18n/lv.po +++ b/bin/addons/base/i18n/lv.po @@ -2869,11 +2869,6 @@ msgstr "Maurīcija" msgid "Scan for new modules" msgstr "Pārbaudīt vai ir pieejami jauni moduļi" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "Moduļu Repozitorijs" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/mn.po b/bin/addons/base/i18n/mn.po index 9197be54d72..13ccfe38ac4 100644 --- a/bin/addons/base/i18n/mn.po +++ b/bin/addons/base/i18n/mn.po @@ -2802,11 +2802,6 @@ msgstr "" msgid "Scan for new modules" msgstr "" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/nl.po b/bin/addons/base/i18n/nl.po index e76cc67b8ea..3a87f0b2bde 100644 --- a/bin/addons/base/i18n/nl.po +++ b/bin/addons/base/i18n/nl.po @@ -2879,11 +2879,6 @@ msgstr "Mauritius" msgid "Scan for new modules" msgstr "Zoek naar nieuwe modules" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "Module-repository" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/nl_BE.po b/bin/addons/base/i18n/nl_BE.po index 7875ffe4c9a..3040e379b45 100644 --- a/bin/addons/base/i18n/nl_BE.po +++ b/bin/addons/base/i18n/nl_BE.po @@ -2836,11 +2836,6 @@ msgstr "Mauritius" msgid "Scan for new modules" msgstr "Zoeken naar nieuwe modules" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "" - #. module: base #: model:ir.ui.menu,name:base.menu_security msgid "Security" diff --git a/bin/addons/base/i18n/nl_NL.po b/bin/addons/base/i18n/nl_NL.po index 7923932bf59..f74f81ef602 100644 --- a/bin/addons/base/i18n/nl_NL.po +++ b/bin/addons/base/i18n/nl_NL.po @@ -2873,11 +2873,6 @@ msgstr "Mauritius" msgid "Scan for new modules" msgstr "Zoeken naar nieuwe modules" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "Module opslagplaats" - #. module: base #: model:ir.ui.menu,name:base.menu_security msgid "Security" diff --git a/bin/addons/base/i18n/pl.po b/bin/addons/base/i18n/pl.po index 287ead0cf20..8fbd25231e0 100644 --- a/bin/addons/base/i18n/pl.po +++ b/bin/addons/base/i18n/pl.po @@ -2876,11 +2876,6 @@ msgstr "Mauritius" msgid "Scan for new modules" msgstr "Sprawdź, czy są nowe moduły" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "Repozytorium modułów" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/pt.po b/bin/addons/base/i18n/pt.po index cb11b2455ac..6859a40b7c8 100644 --- a/bin/addons/base/i18n/pt.po +++ b/bin/addons/base/i18n/pt.po @@ -2872,11 +2872,6 @@ msgstr "Maurícia" msgid "Scan for new modules" msgstr "Pesquizar novos módulos" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "Repositorio do módulo" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/pt_BR.po b/bin/addons/base/i18n/pt_BR.po index 011bc62d2d0..11e0be4a1c1 100644 --- a/bin/addons/base/i18n/pt_BR.po +++ b/bin/addons/base/i18n/pt_BR.po @@ -2864,11 +2864,6 @@ msgstr "" msgid "Scan for new modules" msgstr "Procurando por novos módulos" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "Repositório de módulos" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/ro.po b/bin/addons/base/i18n/ro.po index b1dcd72c422..cd94fb57e9f 100644 --- a/bin/addons/base/i18n/ro.po +++ b/bin/addons/base/i18n/ro.po @@ -2812,11 +2812,6 @@ msgstr "" msgid "Scan for new modules" msgstr "" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/ru.po b/bin/addons/base/i18n/ru.po index f3d1d39aaa9..c8d85bdf6b9 100644 --- a/bin/addons/base/i18n/ru.po +++ b/bin/addons/base/i18n/ru.po @@ -2878,11 +2878,6 @@ msgstr "Маврикий" msgid "Scan for new modules" msgstr "Поиск новых модулей" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "Хранилище модулей" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/sk.po b/bin/addons/base/i18n/sk.po index b1b175cee59..ebb80dd0f2d 100644 --- a/bin/addons/base/i18n/sk.po +++ b/bin/addons/base/i18n/sk.po @@ -2818,11 +2818,6 @@ msgstr "" msgid "Scan for new modules" msgstr "" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/sl.po b/bin/addons/base/i18n/sl.po index 4fa460b6eca..debca94c116 100644 --- a/bin/addons/base/i18n/sl.po +++ b/bin/addons/base/i18n/sl.po @@ -2821,11 +2821,6 @@ msgstr "" msgid "Scan for new modules" msgstr "Preveri za nove module" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "Odlagališče modulov" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/sq.po b/bin/addons/base/i18n/sq.po index 3333ada11b2..b38730bfd88 100644 --- a/bin/addons/base/i18n/sq.po +++ b/bin/addons/base/i18n/sq.po @@ -2807,11 +2807,6 @@ msgstr "" msgid "Scan for new modules" msgstr "" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/sr.po b/bin/addons/base/i18n/sr.po index c6e5372908d..5268df4105f 100644 --- a/bin/addons/base/i18n/sr.po +++ b/bin/addons/base/i18n/sr.po @@ -2867,11 +2867,6 @@ msgstr "Mauricijus" msgid "Scan for new modules" msgstr "Traži nove module" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "Skladište modula" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/sv.po b/bin/addons/base/i18n/sv.po index e3da4471493..9a340d489a6 100644 --- a/bin/addons/base/i18n/sv.po +++ b/bin/addons/base/i18n/sv.po @@ -2802,11 +2802,6 @@ msgstr "" msgid "Scan for new modules" msgstr "" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/th.po b/bin/addons/base/i18n/th.po index 5efeed5e9b7..cea9ad23fa8 100644 --- a/bin/addons/base/i18n/th.po +++ b/bin/addons/base/i18n/th.po @@ -2802,11 +2802,6 @@ msgstr "" msgid "Scan for new modules" msgstr "" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/tlh.po b/bin/addons/base/i18n/tlh.po index 61249b514af..a17185b9edc 100644 --- a/bin/addons/base/i18n/tlh.po +++ b/bin/addons/base/i18n/tlh.po @@ -2801,11 +2801,6 @@ msgstr "" msgid "Scan for new modules" msgstr "" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/tr.po b/bin/addons/base/i18n/tr.po index 1f5a169c390..2e3bd449ed1 100644 --- a/bin/addons/base/i18n/tr.po +++ b/bin/addons/base/i18n/tr.po @@ -2867,11 +2867,6 @@ msgstr "Mauritus" msgid "Scan for new modules" msgstr "Yeni modülleri tara" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "Modül Deposu" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/uk.po b/bin/addons/base/i18n/uk.po index b7fb262db74..66bb3b18544 100644 --- a/bin/addons/base/i18n/uk.po +++ b/bin/addons/base/i18n/uk.po @@ -2853,11 +2853,6 @@ msgstr "Маврикій" msgid "Scan for new modules" msgstr "Пошук нових модулів" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "Репозитарій модулів" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/uk_UA.po b/bin/addons/base/i18n/uk_UA.po index fe1776abd64..d7199d5d3de 100644 --- a/bin/addons/base/i18n/uk_UA.po +++ b/bin/addons/base/i18n/uk_UA.po @@ -2753,11 +2753,6 @@ msgstr "" msgid "Scan for new modules" msgstr "Пошук нових модулів" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "Репозитарій модулів" - #. module: base #: model:ir.ui.menu,name:base.menu_security msgid "Security" diff --git a/bin/addons/base/i18n/vi.po b/bin/addons/base/i18n/vi.po index e5840fcc25b..c2dd2eccbd3 100644 --- a/bin/addons/base/i18n/vi.po +++ b/bin/addons/base/i18n/vi.po @@ -2802,11 +2802,6 @@ msgstr "" msgid "Scan for new modules" msgstr "" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/zh_CN.po b/bin/addons/base/i18n/zh_CN.po index 7f3bfda80d4..b3f0c8573fd 100644 --- a/bin/addons/base/i18n/zh_CN.po +++ b/bin/addons/base/i18n/zh_CN.po @@ -2814,11 +2814,6 @@ msgstr "毛里求斯" msgid "Scan for new modules" msgstr "查找新模块" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "模块库" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security diff --git a/bin/addons/base/i18n/zh_TW.po b/bin/addons/base/i18n/zh_TW.po index 467fb6f2462..bdc82ef531c 100644 --- a/bin/addons/base/i18n/zh_TW.po +++ b/bin/addons/base/i18n/zh_TW.po @@ -7,13 +7,13 @@ msgstr "" "Project-Id-Version: OpenERP Server 5.0.0\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-12-18 08:39+0000\n" -"PO-Revision-Date: 2010-02-15 05:47+0000\n" -"Last-Translator: Walter Cheuk \n" +"PO-Revision-Date: 2010-02-24 06:09+0000\n" +"Last-Translator: OpenERP Administrators \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-02-17 04:54+0000\n" +"X-Launchpad-Export-Date: 2010-02-25 04:50+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: base @@ -40,7 +40,7 @@ msgstr "" #: field:ir.ui.view,arch:0 #: field:ir.ui.view.custom,arch:0 msgid "View Architecture" -msgstr "视图结构" +msgstr "視圖結構" #. module: base #: code:addons/base/ir/ir_model.py:0 @@ -58,7 +58,7 @@ msgstr "" #: field:workflow.activity,wkf_id:0 #: field:workflow.instance,wkf_id:0 msgid "Workflow" -msgstr "工作流" +msgstr "工作流程" #. module: base #: view:wizard.module.lang.export:0 @@ -2801,11 +2801,6 @@ msgstr "" msgid "Scan for new modules" msgstr "" -#. module: base -#: model:ir.model,name:base.model_ir_module_repository -msgid "Module Repository" -msgstr "" - #. module: base #: view:ir.actions.act_window:0 #: model:ir.ui.menu,name:base.menu_security @@ -7784,7 +7779,7 @@ msgstr "" #. module: base #: field:ir.actions.server,mobile:0 msgid "Mobile No" -msgstr "" +msgstr "手機號碼" #. module: base #: model:ir.actions.act_window,name:base.action_partner_by_category @@ -7886,12 +7881,12 @@ msgstr "" #: code:addons/base/res/partner/partner.py:0 #, python-format msgid "Partners: " -msgstr "" +msgstr "合作伙伴 " #. module: base #: model:res.country,name:base.kp msgid "North Korea" -msgstr "" +msgstr "北韓(North Korea)" #. module: base #: view:ir.report.custom:0 @@ -7921,7 +7916,7 @@ msgstr "" #. module: base #: field:ir.exports,name:0 msgid "Export Name" -msgstr "" +msgstr "匯出名稱" #. module: base #: help:res.partner.address,type:0 diff --git a/bin/addons/base/ir/ir_fields_description.py b/bin/addons/base/ir/ir_fields_description.py deleted file mode 100644 index 9a3b5424a58..00000000000 --- a/bin/addons/base/ir/ir_fields_description.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - -from osv import fields,osv -import ir - - - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/bin/addons/base/ir/ir_model.py b/bin/addons/base/ir/ir_model.py index 37ded33397b..db03cef116f 100644 --- a/bin/addons/base/ir/ir_model.py +++ b/bin/addons/base/ir/ir_model.py @@ -18,7 +18,8 @@ # along with this program. If not, see . # ############################################################################## - +import logging +from operator import itemgetter from osv import fields,osv import ir, re import netsvc @@ -417,6 +418,7 @@ ir_model_access() class ir_model_data(osv.osv): _name = 'ir.model.data' + __logger = logging.getLogger('addons.base.'+_name) _columns = { 'name': fields.char('XML Identifier', required=True, size=128), 'model': fields.char('Object', required=True, size=64), @@ -599,22 +601,37 @@ class ir_model_data(osv.osv): wf_service.trg_write(uid, model, id, cr) cr.commit() - if not config.get('import_partial', False): - logger = netsvc.Logger() + if not config.get('import_partial'): for (model, res_id) in self.unlink_mark.keys(): if self.pool.get(model): - logger.notifyChannel('init', netsvc.LOG_INFO, 'Deleting %s@%s' % (res_id, model)) + self.__logger.info('Deleting %s@%s', res_id, model) try: self.pool.get(model).unlink(cr, uid, [res_id]) - id = self.unlink_mark[(model, res_id)] if id: - self.unlink(cr, uid, [id]) - cr.execute('DELETE FROM ir_values WHERE value=%s', ('%s,%s' % (model, res_id),)) + ids = self.search(cr, uid, [('res_id','=',res_id), + ('model','=',model)]) + self.__logger.debug('=> Deleting %s: %s', + self._name, ids) + if len(ids) > 1 and \ + self.__logger.isEnabledFor(logging.WARNING): + self.__logger.warn( + 'Got %d %s for (%s, %d): %s', + len(ids), self._name, model, res_id, + map(itemgetter('module','name'), + self.read(cr, uid, ids, + ['name', 'module']))) + self.unlink(cr, uid, ids) + cr.execute( + 'DELETE FROM ir_values WHERE value=%s', + ('%s,%s'%(model, res_id),)) cr.commit() - except Exception, e: + except Exception: cr.rollback() - logger.notifyChannel('init', netsvc.LOG_ERROR, e) - logger.notifyChannel('init', netsvc.LOG_ERROR, 'Could not delete id: %d of model %s\nThere should be some relation that points to this resource\nYou should manually fix this and restart --update=module' % (res_id, model)) + self.__logger.exception( + 'Could not delete id: %d of model %s\nThere ' + 'should be some relation that points to this ' + 'resource\nYou should manually fix this and ' + 'restart with --update=module', res_id, model) return True ir_model_data() diff --git a/bin/addons/base/module/module.py b/bin/addons/base/module/module.py index 769ef4687e8..a474866f885 100644 --- a/bin/addons/base/module/module.py +++ b/bin/addons/base/module/module.py @@ -37,29 +37,6 @@ import netsvc from tools.parse_version import parse_version from tools.translate import _ - -class module_repository(osv.osv): - _name = "ir.module.repository" - _description = "Module Repository" - _columns = { - 'name': fields.char('Name', size=128), - 'url': fields.char('URL', size=256, required=True), - 'sequence': fields.integer('Sequence', required=True), - 'filter': fields.char('Filter', size=128, required=True, - help='Regexp to search module on the repository webpage:\n' - '- The first parenthesis must match the name of the module.\n' - '- The second parenthesis must match the whole version number.\n' - '- The last parenthesis must match the extension of the module.'), - 'active': fields.boolean('Active'), - } - _defaults = { - 'sequence': lambda *a: 5, - 'filter': lambda *a: 'href="([a-zA-Z0-9_]+)-('+release.major_version+'.(\\d+)((\\.\\d+)*)([a-z]?)((_(pre|p|beta|alpha|rc)\\d*)*)(-r(\\d+))?)(\.zip)"', - 'active': lambda *a: 1, - } - _order = "sequence" -module_repository() - class module_category(osv.osv): _name = "ir.module.category" _description = "Module Category" @@ -298,7 +275,6 @@ class module(osv.osv): # update the list of available packages def update_list(self, cr, uid, context={}): - robj = self.pool.get('ir.module.repository') res = [0, 0] # [update, add] # iterate through installed modules and mark them as being so @@ -345,50 +321,6 @@ class module(osv.osv): self._update_dependencies(cr, uid, id, terp.get('depends', [])) self._update_category(cr, uid, id, terp.get('category', 'Uncategorized')) - for repository in robj.browse(cr, uid, robj.search(cr, uid, [])): - try: - index_page = urllib.urlopen(repository.url).read() - except IOError, e: - if e.errno == 21: - raise orm.except_orm(_('Error'), - _("This url '%s' must provide an html file with links to zip modules") % (repository.url)) - else: - raise - modules = re.findall(repository.filter, index_page, re.I+re.M) - mod_sort = {} - for m in modules: - name, version, extension = m[0], m[1], m[-1] - if not version or version == 'x': # 'x' version was a mistake - version = '0' - if name in mod_sort: - if parse_version(version) <= parse_version(mod_sort[name][0]): - continue - mod_sort[name] = [version, extension] - for name in mod_sort.keys(): - version, extension = mod_sort[name] - url = repository.url+'/'+name+'-'+version+extension - ids = self.search(cr, uid, [('name','=',name)]) - if not ids: - self.create(cr, uid, { - 'name': name, - 'published_version': version, - 'url': url, - 'state': 'uninstalled', - }) - res[1] += 1 - else: - id = ids[0] - installed_version = self.read(cr, uid, id, ['latest_version'])['latest_version'] - if not installed_version or installed_version == 'x': # 'x' version was a mistake - installed_version = '0' - if parse_version(version) > parse_version(installed_version): - self.write(cr, uid, id, { 'url': url }) - res[0] += 1 - published_version = self.read(cr, uid, id, ['published_version'])['published_version'] - if published_version == 'x' or not published_version: - published_version = '0' - if parse_version(version) > parse_version(published_version): - self.write(cr, uid, id, {'published_version': version}) return res def download(self, cr, uid, ids, download=True, context=None): diff --git a/bin/addons/base/module/module_data.xml b/bin/addons/base/module/module_data.xml index 6176b229e13..bca3f30d67a 100644 --- a/bin/addons/base/module/module_data.xml +++ b/bin/addons/base/module/module_data.xml @@ -1,13 +1,6 @@ - - - OpenERP - http://www.openerp.com/download/modules/ - - - - + Modules ir.ui.menu diff --git a/bin/addons/base/module/module_view.xml b/bin/addons/base/module/module_view.xml index 10582bb711b..ef0cf239042 100644 --- a/bin/addons/base/module/module_view.xml +++ b/bin/addons/base/module/module_view.xml @@ -38,7 +38,7 @@ - + ir.module.module.list.select ir.module.module @@ -51,14 +51,14 @@ - - + + - + - + Modules @@ -66,7 +66,7 @@ form tree,form [('category_id','=',active_id)] - + @@ -154,43 +154,7 @@ - - - - ir.module.repository.form - ir.module.repository - form - -
- - - - - - - -
- - ir.module.repository.tree - ir.module.repository - tree - - - - - - - - - - - Repository list - ir.module.repository - form - tree,form - {'active_test': False} - - +
diff --git a/bin/addons/base/module/wizard/wizard_update_module.py b/bin/addons/base/module/wizard/wizard_update_module.py index d9548d5cdb9..c4f794a87de 100644 --- a/bin/addons/base/module/wizard/wizard_update_module.py +++ b/bin/addons/base/module/wizard/wizard_update_module.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (). # @@ -15,7 +15,7 @@ # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# along with this program. If not, see . # ############################################################################## @@ -27,11 +27,11 @@ class wizard_update_module(wizard.interface): arch = '''
-
- - + + - + @@ -457,7 +457,7 @@ form
- + @@ -467,12 +467,12 @@ - + - - + + @@ -539,7 +539,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/addons/base/security/base_security.xml b/bin/addons/base/security/base_security.xml index 6fe5731713c..ca1f33aa23e 100644 --- a/bin/addons/base/security/base_security.xml +++ b/bin/addons/base/security/base_security.xml @@ -17,8 +17,8 @@ Employee - - Useability / Multi Company + + Multi Companies @@ -29,10 +29,6 @@ Useability / No One - - Multi Companies - - diff --git a/bin/addons/base/security/ir.model.access.csv b/bin/addons/base/security/ir.model.access.csv index 2373ef2d581..1d772991e76 100644 --- a/bin/addons/base/security/ir.model.access.csv +++ b/bin/addons/base/security/ir.model.access.csv @@ -18,9 +18,8 @@ "access_ir_module_category_group_user","ir_module_category group_user","model_ir_module_category","group_system",1,0,0,0 "access_ir_module_module_group_user","ir_module_module group_user","model_ir_module_module","group_system",1,1,1,1 "access_ir_module_module_dependency_group_system","ir_module_module_dependency group_system","model_ir_module_module_dependency","group_system",1,1,1,1 -"access_ir_module_repository_group_system","ir_module_repository group_system","model_ir_module_repository","group_system",1,1,1,1 "access_ir_property_group_user","ir_property group_user","model_ir_property",,1,0,0,0 -"access_ir_property_group_user_manager","ir_property group_manager","model_ir_property",base.group_partner_manager,1,1,1,1 +"access_ir_property_group_user_manager","ir_property group_manager","model_ir_property","base.group_partner_manager",1,1,1,1 "access_ir_report_custom_group_system","ir_report_custom group_system","model_ir_report_custom",,1,0,0,0 "access_ir_report_custom_fields_group_system","ir_report_custom_fields group_system","model_ir_report_custom_fields",,1,0,0,0 "access_ir_rule_group_user","ir_rule group_user","model_ir_rule",,1,0,0,0 @@ -37,7 +36,7 @@ "access_ir_ui_view_custom_group_user","ir_ui_view_custom_group_user","model_ir_ui_view_custom",,1,0,0,0 "access_ir_ui_view_custom_group_system","ir_ui_view_custom_group_system","model_ir_ui_view_custom","group_system",1,1,1,1 "access_ir_ui_view_sc_group_user","ir_ui_view_sc group_user","model_ir_ui_view_sc",,1,1,1,1 -"access_ir_values_group_erp_manager","ir_values group_erp_manager","model_ir_values",group_erp_manager,1,1,1,1 +"access_ir_values_group_erp_manager","ir_values group_erp_manager","model_ir_values","group_erp_manager",1,1,1,1 "access_ir_values_group_all","ir_values group_all","model_ir_values",,1,0,0,0 "access_wizard_ir_model_menu_create_group_system","wizard_ir_model_menu_create group_system","model_wizard_ir_model_menu_create","group_system",1,1,1,1 "access_wizard_ir_model_menu_create_line_group_system","wizard_ir_model_menu_create_line group_system","model_wizard_ir_model_menu_create_line","group_system",1,1,1,1 @@ -59,29 +58,29 @@ "access_res_lang_group_all","res_lang group_all","model_res_lang",,1,0,0,0 "access_res_lang_group_user","res_lang group_user","model_res_lang","group_system",1,1,1,1 "access_res_partner_group_partner_manager","res_partner group_partner_manager","model_res_partner","group_partner_manager",1,1,1,1 -"access_res_partner_group_user","res_partner group_user","model_res_partner",group_user,1,0,0,0 +"access_res_partner_group_user","res_partner group_user","model_res_partner","group_user",1,0,0,0 "access_res_partner_address_group_partner_manager","res_partner_address group_partner_manager","model_res_partner_address","group_partner_manager",1,1,1,1 -"access_res_partner_address_group_user","res_partner_address group_user","model_res_partner_address",group_user,1,0,0,0 -"access_res_partner_bank_group_user","res_partner_bank group_user","model_res_partner_bank",group_user,1,0,0,0 +"access_res_partner_address_group_user","res_partner_address group_user","model_res_partner_address","group_user",1,0,0,0 +"access_res_partner_bank_group_user","res_partner_bank group_user","model_res_partner_bank","group_user",1,0,0,0 "access_res_partner_bank_group_partner_manager","res_partner_bank group_partner_manager","model_res_partner_bank","group_partner_manager",1,1,1,1 "access_res_partner_bank_type_group_partner_manager","res_partner_bank_type group_partner_manager","model_res_partner_bank_type","group_partner_manager",1,1,1,1 -"access_res_partner_bank_type_group_user","res_partner_bank_type group_user","model_res_partner_bank_type",group_user,1,0,0,0 +"access_res_partner_bank_type_group_user","res_partner_bank_type group_user","model_res_partner_bank_type","group_user",1,0,0,0 "access_res_partner_bank_type_field_group_partner_manager","res_partner_bank_type_field group_partner_manager","model_res_partner_bank_type_field","group_partner_manager",1,1,1,1 -"access_res_partner_bank_type_field_group_user","res_partner_bank_type_field group_user","model_res_partner_bank_type_field",group_user,1,0,0,0 -"access_res_partner_canal_group_user","res_partner_canal group_user","model_res_partner_canal",group_user,1,0,0,0 +"access_res_partner_bank_type_field_group_user","res_partner_bank_type_field group_user","model_res_partner_bank_type_field","group_user",1,0,0,0 +"access_res_partner_canal_group_user","res_partner_canal group_user","model_res_partner_canal","group_user",1,0,0,0 "access_res_partner_canal_group_partner_manager","res_partner_canal group_partner_manager","model_res_partner_canal","group_partner_manager",1,1,1,1 -"access_res_partner_category_group_user","res_partner_category group_user","model_res_partner_category",group_user,1,0,0,0 +"access_res_partner_category_group_user","res_partner_category group_user","model_res_partner_category","group_user",1,0,0,0 "access_res_partner_category_group_partner_manager","res_partner_category group_partner_manager","model_res_partner_category","group_partner_manager",1,1,1,1 -"access_res_partner_event_group_user","res_partner_event group_user","model_res_partner_event",group_user,1,1,1,1 +"access_res_partner_event_group_user","res_partner_event group_user","model_res_partner_event","group_user",1,1,1,1 "access_res_partner_event_group_partner_manager","res_partner_event group_partner_manager","model_res_partner_event","group_partner_manager",1,1,1,1 "access_res_partner_event_type_group_partner_manager","res_partner_event_type group_partner_manager","model_res_partner_event_type","group_partner_manager",1,1,1,1 -"access_res_partner_event_type_group_user","res_partner_event_type group_user","model_res_partner_event_type",group_user,1,0,0,0 +"access_res_partner_event_type_group_user","res_partner_event_type group_user","model_res_partner_event_type","group_user",1,0,0,0 "access_res_partner_function_group_user","res_partner_function group_user","model_res_partner_function","group_partner_manager",1,1,1,1 -"access_res_partner_function_group_partner_manager","res_partner_function group_partner_manager","model_res_partner_function",group_user,1,0,0,0 +"access_res_partner_function_group_partner_manager","res_partner_function group_partner_manager","model_res_partner_function","group_user",1,0,0,0 "access_res_partner_som_group_user","res_partner_som group_user","model_res_partner_som","group_partner_manager",1,1,1,1 -"access_res_partner_som_group_partner_manager","res_partner_som group_partner_manager","model_res_partner_som",group_user,1,0,0,0 +"access_res_partner_som_group_partner_manager","res_partner_som group_partner_manager","model_res_partner_som","group_user",1,0,0,0 "access_res_partner_title_group_user","res_partner_title group_user","model_res_partner_title","group_partner_manager",1,1,1,1 -"access_res_partner_title_group_partner_manager","res_partner_title group_partner_manager","model_res_partner_title",group_user,1,0,0,0 +"access_res_partner_title_group_partner_manager","res_partner_title group_partner_manager","model_res_partner_title","group_user",1,0,0,0 "access_res_request_group_user","res_request group_user","model_res_request",,1,1,1,1 "access_res_request_history_group_user","res_request_history group_user","model_res_request_history",,1,1,1,1 "access_res_request_link_group_system","res_request_link group_system","model_res_request_link","group_system",1,1,1,1 diff --git a/bin/netsvc.py b/bin/netsvc.py index 49d68c8479e..d8548db5d6a 100644 --- a/bin/netsvc.py +++ b/bin/netsvc.py @@ -24,18 +24,14 @@ # ############################################################################## -import SimpleXMLRPCServer -import SocketServer import logging import logging.handlers -import os -import signal -import socket import sys import threading import time -import xmlrpclib import release +from pprint import pformat +import warnings class Service(object): """ Base class for *Local* services @@ -77,6 +73,7 @@ class LocalService(object): Any instance of this class will behave like the single instance of Service(name) """ + __logger = logging.getLogger('service') def __init__(self, name): self.__name = name try: @@ -84,8 +81,9 @@ class LocalService(object): for method_name, method_definition in self._service._methods.items(): setattr(self, method_name, method_definition) except KeyError, keyError: - Logger().notifyChannel('module', LOG_ERROR, 'This service does not exist: %s' % (str(keyError),) ) + self.__logger.error('This service does not exist: %s' % (str(keyError),) ) raise + def __call__(self, method, *params): return getattr(self, method)(*params) @@ -129,15 +127,13 @@ 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.DEBUG_RPC = logging.DEBUG2 - 1 +logging.DEBUG_RPC = logging.DEBUG - 2 +logging.addLevelName(logging.DEBUG_RPC, 'DEBUG_RPC') def init_logger(): import os @@ -197,7 +193,6 @@ def init_logger(): mapping = { 'DEBUG_RPC': ('blue', 'white'), - 'DEBUG2': ('green', 'white'), 'DEBUG': ('blue', 'default'), 'INFO': ('green', 'default'), 'WARNING': ('yellow', 'default'), @@ -211,16 +206,20 @@ 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", + 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", + PendingDeprecationWarning, stacklevel=2) from service.web_services import common 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) @@ -232,7 +231,7 @@ class Logger(object): try: msg = tools.ustr(msg).strip() - if level in (LOG_ERROR,LOG_CRITICAL) and tools.config.get_misc('debug','env_info',False): + if level in (LOG_ERROR, LOG_CRITICAL) and tools.config.get_misc('debug','env_info',False): msg = common().exp_get_server_environment() + "\n" + msg result = msg.split('\n') @@ -268,10 +267,12 @@ class Agent(object): _timers = {} _logger = Logger() + __logger = logging.getLogger('timer') + def setAlarm(self, fn, dt, db_name, *args, **kwargs): wait = dt - time.time() if wait > 0: - self._logger.notifyChannel('timers', LOG_DEBUG, "Job scheduled in %.3g seconds for %s.%s" % (wait, fn.im_class.__name__, fn.func_name)) + self.__logger.debug("Job scheduled in %.3g seconds for %s.%s" % (wait, fn.im_class.__name__, fn.func_name)) timer = threading.Timer(wait, fn, args, kwargs) timer.start() self._timers.setdefault(db_name, []).append(timer) @@ -298,25 +299,26 @@ import traceback class Server: """ Generic interface for all servers with an event loop etc. Override this to impement http, net-rpc etc. servers. - + Servers here must have threaded behaviour. start() must not block, there is no run(). """ __is_started = False __servers = [] - + + + __logger = logging.getLogger('server') + def __init__(self): if Server.__is_started: raise Exception('All instances of servers must be inited before the startAll()') Server.__servers.append(self) def start(self): - print "called stub Server.start" - pass - + self.__logger.debug("called stub Server.start") + def stop(self): - print "called stub Server.stop" - pass + self.__logger.debug("called stub Server.stop") def stats(self): """ This function should return statistics about the server """ @@ -326,35 +328,25 @@ class Server: def startAll(cls): if cls.__is_started: return - Logger().notifyChannel("services", LOG_INFO, - "Starting %d services" % len(cls.__servers)) + cls.__logger.info("Starting %d services" % len(cls.__servers)) for srv in cls.__servers: srv.start() cls.__is_started = True - + @classmethod def quitAll(cls): if not cls.__is_started: return - Logger().notifyChannel("services", LOG_INFO, - "Stopping %d services" % len(cls.__servers)) + cls.__logger.info("Stopping %d services" % len(cls.__servers)) for srv in cls.__servers: srv.stop() cls.__is_started = False @classmethod def allStats(cls): - res = '' - if cls.__is_started: - res += "Servers started\n" - else: - res += "Servers stopped\n" - for srv in cls.__servers: - try: - res += srv.stats() + "\n" - except: - pass - return res + res = ["Servers %s" % ('stopped', 'started')[cls.__is_started]] + res.extend(srv.stats() for srv in cls.__servers) + return '\n'.join(res) class OpenERPDispatcherException(Exception): def __init__(self, exception, traceback): @@ -363,7 +355,6 @@ class OpenERPDispatcherException(Exception): class OpenERPDispatcher: def log(self, title, msg): - from pprint import pformat Logger().notifyChannel('%s' % title, LOG_DEBUG_RPC, pformat(msg)) def dispatch(self, service_name, method, params): 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 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/osv/orm.py b/bin/osv/orm.py index 63235e158d4..4dd222f561c 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -41,6 +41,7 @@ import calendar import copy import datetime +import logging import pickle import random import re @@ -139,6 +140,8 @@ class browse_record(object): self._id = id self._table = table self._table_name = self._table._name + self.__logger = logging.getLogger( + 'osv.browse_record.' + self._table_name) self._context = context self._fields_process = fields_process @@ -210,9 +213,8 @@ class browse_record(object): if not datas: # Where did those ids come from? Perhaps old entries in ir_model_dat? - self.logger.notifyChannel("browse_record", netsvc.LOG_WARNING, - "No datas found for ids %s in %s \n%s" % ( - ids, self, ''.join(traceback.format_exc()))) + self.__logger.warn("No datas found for ids %s in %s", + ids, self) raise KeyError('Field %s not found in %s'%(name,self)) # create browse records for 'remote' objects for data in datas: @@ -247,7 +249,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 +1102,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,'')) @@ -1837,17 +1839,21 @@ class orm(orm_template): 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 '' @@ -1855,7 +1861,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) @@ -1872,7 +1878,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(): @@ -1888,21 +1895,33 @@ 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': - 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']]) 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, )) @@ -2032,12 +2051,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] 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 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 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), 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']: 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() diff --git a/bin/sql_db.py b/bin/sql_db.py index 2cc71408f5c..17bfa340653 100644 --- a/bin/sql_db.py +++ b/bin/sql_db.py @@ -21,7 +21,7 @@ __all__ = ['db_connect', 'close_db'] -import netsvc +import logging from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT, ISOLATION_LEVEL_READ_COMMITTED, ISOLATION_LEVEL_SERIALIZABLE from psycopg2.psycopg1 import cursor as psycopg1cursor from psycopg2.pool import PoolError @@ -60,15 +60,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_DEBUG2): - 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 +98,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') @@ -121,19 +118,17 @@ class Cursor(object): params = params or None res = self._obj.execute(query, params) except psycopg2.ProgrammingError, pe: - logger= netsvc.Logger() - logger.notifyChannel('sql_db', netsvc.LOG_ERROR, "Programming error: %s, in query %s" % (pe, query)) + self.__logger.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 +153,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') @@ -213,6 +210,8 @@ class Cursor(object): class ConnectionPool(object): + __logger = logging.getLogger('db.connection_pool') + def locked(fun): @wraps(fun) def _locked(self, *args, **kwargs): @@ -228,7 +227,6 @@ class ConnectionPool(object): self._connections = [] self._maxconn = max(maxconn, 1) self._lock = threading.Lock() - self._logger = netsvc.Logger() def __repr__(self): used = len([1 for c, u in self._connections[:] if u]) @@ -236,8 +234,8 @@ class ConnectionPool(object): return "ConnectionPool(used=%d/count=%d/max=%d)" % (used, count, self._maxconn) def _debug(self, msg): - self._logger.notifyChannel('ConnectionPool', netsvc.LOG_DEBUG, repr(self)) - self._logger.notifyChannel('ConnectionPool', netsvc.LOG_DEBUG, msg) + self.__logger.debug(repr(self)) + self.__logger.debug(msg) @locked def borrow(self, dsn): @@ -293,17 +291,15 @@ class ConnectionPool(object): class Connection(object): - def _debug(self, msg): - self._logger.notifyChannel('Connection', netsvc.LOG_DEBUG, msg) + __logger = logging.getLogger('db.connection') def __init__(self, pool, dbname): self.dbname = dbname self._pool = pool - self._logger = netsvc.Logger() def cursor(self, serialized=False): cursor_type = serialized and 'serialized ' or '' - self._debug('create %scursor to "%s"' % (cursor_type, self.dbname,)) + self.__logger.debug('create %scursor to "%s"' % (cursor_type, self.dbname,)) return Cursor(self._pool, self.dbname, serialized=serialized) def serialized_cursor(self): diff --git a/bin/tools/convert.py b/bin/tools/convert.py index 4314651d084..db3edf380f7 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): @@ -838,7 +837,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 @@ -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: - diff --git a/bin/tools/misc.py b/bin/tools/misc.py index cb4f58004fd..f105cd81256 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: @@ -883,29 +883,15 @@ 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 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 +906,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 +1186,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 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 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"], } }