diff --git a/bin/addons/__init__.py b/bin/addons/__init__.py index 82761d647bd..e0073d3f123 100644 --- a/bin/addons/__init__.py +++ b/bin/addons/__init__.py @@ -644,16 +644,13 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, **kwargs): try: _load_data(cr, module_name, id_map, mode, 'test') except Exception, e: - if tools.config.options['test-continue']: - logger.notifyChannel('ERROR', netsvc.LOG_TEST, e) - pass - else: - raise + logger.notifyChannel('ERROR', netsvc.LOG_TEST, e) + pass finally: - if tools.config.options['test-rollback']: - cr.rollback() - else: + if tools.config.options['test-commit']: cr.commit() + else: + cr.rollback() def _load_data(cr, module_name, id_map, mode, kind): noupdate = (kind == 'demo') diff --git a/bin/addons/base/__terp__.py b/bin/addons/base/__openerp__.py similarity index 98% rename from bin/addons/base/__terp__.py rename to bin/addons/base/__openerp__.py index d0dc9b68dd3..72517183e77 100644 --- a/bin/addons/base/__terp__.py +++ b/bin/addons/base/__openerp__.py @@ -49,6 +49,7 @@ 'module/module_report.xml', 'res/res_request_view.xml', 'res/res_lang_view.xml', + 'res/res_log_view.xml', 'res/res_company_view.xml', 'res/partner/partner_report.xml', 'res/partner/partner_view.xml', diff --git a/bin/addons/base/base_update.xml b/bin/addons/base/base_update.xml index f89614c7440..864cae2f5ba 100644 --- a/bin/addons/base/base_update.xml +++ b/bin/addons/base/base_update.xml @@ -118,7 +118,7 @@ - + diff --git a/bin/addons/base/data/res.country.state.csv b/bin/addons/base/data/res.country.state.csv index bdcb745eb08..d6b902e493b 100644 --- a/bin/addons/base/data/res.country.state.csv +++ b/bin/addons/base/data/res.country.state.csv @@ -1,52 +1,52 @@ -"country_id:id","name","code" -us,"Alabama","AL" -us,"Alaska","AK" -us,"Arizona","AZ" -us,"Arkansas","AR" -us,"California","CA" -us,"Colorado","CO" -us,"Connecticut","CT" -us,"Delaware","DE" -us,"District of Columbia","DC" -us,"Florida","FL" -us,"Georgia","GA" -us,"Hawaii","HI" -us,"Idaho","ID" -us,"Illinois","IL" -us,"Indiana","IN" -us,"Iowa","IA" -us,"Kansas","KS" -us,"Kentucky","KY" -us,"Louisiana","LA" -us,"Maine","ME" -us,"Montana","MT" -us,"Nebraska","NE" -us,"Nevada","NV" -us,"New Hampshire","NH" -us,"New Jersey","NJ" -us,"New Mexico","NM" -us,"New York","NY" -us,"North Carolina","NC" -us,"North Dakota","ND" -us,"Ohio","OH" -us,"Oklahoma","OK" -us,"Oregon","OR" -us,"Maryland","MD" -us,"Massachusetts","MA" -us,"Michigan","MI" -us,"Minnesota","MN" -us,"Mississippi","MS" -us,"Missouri","MO" -us,"Pennsylvania","PA" -us,"Rhode Island","RI" -us,"South Carolina","SC" -us,"South Dakota","SD" -us,"Tennessee","TN" -us,"Texas","TX" -us,"Utah","UT" -us,"Vermont","VT" -us,"Virginia","VA" -us,"Washington","WA" -us,"West Virginia","WV" -us,"Wisconsin","WI" -us,"Wyoming","WY" +"id","country_id:id","name","code" +state_us_1,us,"Alabama","AL" +state_us_2,us,"Alaska","AK" +state_us_3,us,"Arizona","AZ" +state_us_4,us,"Arkansas","AR" +state_us_5,us,"California","CA" +state_us_6,us,"Colorado","CO" +state_us_7,us,"Connecticut","CT" +state_us_8,us,"Delaware","DE" +state_us_9,us,"District of Columbia","DC" +state_us_10,us,"Florida","FL" +state_us_11,us,"Georgia","GA" +state_us_12,us,"Hawaii","HI" +state_us_13,us,"Idaho","ID" +state_us_14,us,"Illinois","IL" +state_us_15,us,"Indiana","IN" +state_us_16,us,"Iowa","IA" +state_us_17,us,"Kansas","KS" +state_us_18,us,"Kentucky","KY" +state_us_19,us,"Louisiana","LA" +state_us_20,us,"Maine","ME" +state_us_21,us,"Montana","MT" +state_us_22,us,"Nebraska","NE" +state_us_23,us,"Nevada","NV" +state_us_24,us,"New Hampshire","NH" +state_us_25,us,"New Jersey","NJ" +state_us_26,us,"New Mexico","NM" +state_us_27,us,"New York","NY" +state_us_28,us,"North Carolina","NC" +state_us_29,us,"North Dakota","ND" +state_us_30,us,"Ohio","OH" +state_us_31,us,"Oklahoma","OK" +state_us_32,us,"Oregon","OR" +state_us_33,us,"Maryland","MD" +state_us_34,us,"Massachusetts","MA" +state_us_35,us,"Michigan","MI" +state_us_36,us,"Minnesota","MN" +state_us_37,us,"Mississippi","MS" +state_us_38,us,"Missouri","MO" +state_us_39,us,"Pennsylvania","PA" +state_us_40,us,"Rhode Island","RI" +state_us_41,us,"South Carolina","SC" +state_us_42,us,"South Dakota","SD" +state_us_43,us,"Tennessee","TN" +state_us_44,us,"Texas","TX" +state_us_45,us,"Utah","UT" +state_us_46,us,"Vermont","VT" +state_us_47,us,"Virginia","VA" +state_us_48,us,"Washington","WA" +state_us_49,us,"West Virginia","WV" +state_us_50,us,"Wisconsin","WI" +state_us_51,us,"Wyoming","WY" diff --git a/bin/addons/base/i18n/hr.po b/bin/addons/base/i18n/hr.po index ab4957ecb3e..ceb4ce677f3 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-05-17 05:29+0000\n" +"PO-Revision-Date: 2010-05-18 08:05+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-05-18 05:14+0000\n" +"X-Launchpad-Export-Date: 2010-05-19 05:11+0000\n" "X-Generator: Launchpad (build Unknown)\n" "Language: hr\n" diff --git a/bin/addons/base/i18n/ja.po b/bin/addons/base/i18n/ja.po index 663a0ea6fc2..0634b5afa02 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-05-17 05:28+0000\n" +"PO-Revision-Date: 2010-05-18 08:03+0000\n" "Last-Translator: Harry (Open ERP) \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-05-18 05:14+0000\n" +"X-Launchpad-Export-Date: 2010-05-19 05:10+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: base diff --git a/bin/addons/base/i18n/lv.po b/bin/addons/base/i18n/lv.po index 54ec07dc9d1..9f8e98c67c5 100644 --- a/bin/addons/base/i18n/lv.po +++ b/bin/addons/base/i18n/lv.po @@ -8,13 +8,13 @@ msgstr "" "Project-Id-Version: openobject-addons\n" "Report-Msgid-Bugs-To: FULL NAME \n" "POT-Creation-Date: 2009-12-18 08:39+0000\n" -"PO-Revision-Date: 2010-01-04 06:03+0000\n" -"Last-Translator: Fabien (Open ERP) \n" +"PO-Revision-Date: 2010-05-18 09:58+0000\n" +"Last-Translator: sraps (KN dati) \n" "Language-Team: Latvian \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-04-17 03:51+0000\n" +"X-Launchpad-Export-Date: 2010-05-19 05:11+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: base @@ -176,7 +176,7 @@ msgstr "ir.report.custom.fields" #. module: base #: view:res.partner:0 msgid "Search Partner" -msgstr "" +msgstr "Meklēt Partneri" #. module: base #: code:addons/base/module/wizard/wizard_export_lang.py:0 @@ -419,7 +419,7 @@ msgstr "Kolumbija" #. module: base #: view:ir.module.module:0 msgid "Schedule Upgrade" -msgstr "" +msgstr "Ieplānot Jauninājumus" #. module: base #: field:ir.actions.report.custom,report_id:0 @@ -593,7 +593,7 @@ msgstr "," #. module: base #: view:res.partner:0 msgid "My Partners" -msgstr "" +msgstr "Mani Partneri" #. module: base #: model:res.country,name:base.es @@ -745,7 +745,7 @@ msgstr "Irāna" #: model:ir.actions.act_window,name:base.res_request-act #: model:ir.ui.menu,name:base.menu_res_request_act msgid "My Requests" -msgstr "" +msgstr "Mani Pieprasījumi" #. module: base #: field:ir.sequence,name:0 @@ -1009,7 +1009,7 @@ msgstr "STOCK_COPY" #: code:addons/base/ir/ir_model.py:0 #, python-format msgid "Model %s Does not Exist !" -msgstr "" +msgstr "Modelis %s neeksistē !" #. module: base #: code:addons/base/module/module.py:0 @@ -1137,7 +1137,7 @@ msgstr "Lietotāja Atskaite" #: code:addons/base/res/res_user.py:0 #, python-format msgid " (copy)" -msgstr "" +msgstr " (kopija)" #. module: base #: view:ir.sequence:0 @@ -1303,7 +1303,7 @@ msgstr "Copy text \t STOCK_PROPERTIES" #. module: base #: view:res.partner.address:0 msgid "Search Contact" -msgstr "" +msgstr "Meklēt Kontaktu" #. module: base #: view:ir.module.module:0 @@ -1484,7 +1484,7 @@ msgstr "Esošā Likme" #. module: base #: selection:module.lang.install,init,lang:0 msgid "Greek / Ελληνικά" -msgstr "" +msgstr "Grieķu / Ελληνικά" #. module: base #: view:ir.values:0 @@ -1565,7 +1565,7 @@ msgstr "Epasta Adrese" #. module: base #: selection:module.lang.install,init,lang:0 msgid "French (BE) / Français (BE)" -msgstr "" +msgstr "Franču (BE) / Français (BE)" #. module: base #: code:addons/base/ir/ir_model.py:0 @@ -1603,7 +1603,7 @@ msgstr "Lauka Sasaistes" #: model:ir.actions.act_window,name:base.res_request-closed #: model:ir.ui.menu,name:base.next_id_12_close msgid "My Closed Requests" -msgstr "" +msgstr "Mani Slēgie Pieprasījumi" #. module: base #: model:ir.ui.menu,name:base.menu_custom @@ -1861,7 +1861,7 @@ msgstr "Pieejas Kontrole" #: view:ir.module.module:0 #: field:ir.module.module,dependencies_id:0 msgid "Dependencies" -msgstr "Atkarīgie objekti" +msgstr "Atkarīgs no" #. module: base #: field:ir.report.custom.fields,bgcolor:0 @@ -1988,7 +1988,7 @@ msgstr "Modulis" #: model:ir.actions.act_window,name:base.action_res_bank_form #: model:ir.ui.menu,name:base.menu_action_res_bank_form msgid "Bank List" -msgstr "" +msgstr "Banku Saraksts" #. module: base #: field:ir.attachment,description:0 @@ -2401,7 +2401,7 @@ msgstr "" #: model:ir.actions.act_window,name:base.action_partner_customer_form #: view:res.partner:0 msgid "Customers" -msgstr "" +msgstr "Klienti" #. module: base #: model:res.country,name:base.au @@ -2603,7 +2603,7 @@ msgstr "STOCK_SAVE_AS" #. module: base #: selection:ir.translation,type:0 msgid "SQL Constraint" -msgstr "" +msgstr "SQL Ierobežojums" #. module: base #: field:ir.actions.server,srcmodel_id:0 @@ -2669,7 +2669,7 @@ msgstr "%c - Atbilstošais datuma un laika attēlojums." #. module: base #: selection:module.lang.install,init,lang:0 msgid "Finland / Suomi" -msgstr "" +msgstr "Somu / Suomi" #. module: base #: model:res.country,name:base.bo @@ -2931,7 +2931,7 @@ msgstr "Likmes" #. module: base #: selection:module.lang.install,init,lang:0 msgid "Albanian / Shqipëri" -msgstr "" +msgstr "Albāņu / Shqipëri" #. module: base #: model:res.country,name:base.sy @@ -3192,7 +3192,7 @@ msgstr "Demo dati" #. module: base #: selection:module.lang.install,init,lang:0 msgid "English (UK)" -msgstr "" +msgstr "Angļu (UK)" #. module: base #: model:res.country,name:base.aq @@ -3217,7 +3217,7 @@ msgstr "Tīmeklis" #. module: base #: selection:module.lang.install,init,lang:0 msgid "English (CA)" -msgstr "" +msgstr "Angļu (CA)" #. module: base #: field:res.partner.event,planned_revenue:0 @@ -3460,7 +3460,7 @@ msgstr "Partnera Adreses" #. module: base #: selection:module.lang.install,init,lang:0 msgid "Indonesian / Bahasa Indonesia" -msgstr "" +msgstr "Indonēziešu / Bahasa Indonesia" #. module: base #: model:res.country,name:base.cv @@ -3625,7 +3625,7 @@ msgstr "Izveidot darbību" #. module: base #: selection:ir.actions.report.xml,report_type:0 msgid "HTML from HTML" -msgstr "" +msgstr "HTML no HTML" #. module: base #: selection:ir.actions.report.xml,report_type:0 @@ -4086,7 +4086,7 @@ msgstr "Faila Formāts" #. module: base #: field:res.lang,iso_code:0 msgid "ISO code" -msgstr "" +msgstr "ISO kods" #. module: base #: model:ir.model,name:base.model_res_config_view @@ -4222,7 +4222,7 @@ msgstr "Izmainīt manus Uzstādījumus" #. module: base #: constraint:ir.actions.act_window:0 msgid "Invalid model name in the action definition." -msgstr "" +msgstr "Procesa definīcijā nepareizs modeļa nosaukums." #. module: base #: wizard_field:res.partner.sms_send,init,text:0 @@ -4344,7 +4344,7 @@ msgstr "Objekta Lauks" #. module: base #: selection:module.lang.install,init,lang:0 msgid "French (CH) / Français (CH)" -msgstr "" +msgstr "Franču (CH) / Français (CH)" #. module: base #: selection:ir.ui.menu,icon:0 @@ -4418,7 +4418,7 @@ msgstr "Atcelt atinstalāciju" #: view:res.partner:0 #: view:res.partner.address:0 msgid "Communication" -msgstr "" +msgstr "Saziņa" #. module: base #: model:ir.model,name:base.model_ir_server_object_lines @@ -6981,7 +6981,7 @@ msgstr "(year)=" #. module: base #: rml:ir.module.reference:0 msgid "Dependencies :" -msgstr "Atkarīgie objekti:" +msgstr "Atkarīgs no:" #. module: base #: selection:ir.ui.menu,icon:0 diff --git a/bin/addons/base/i18n/sv.po b/bin/addons/base/i18n/sv.po index 5bc05de1676..41571073e30 100644 --- a/bin/addons/base/i18n/sv.po +++ b/bin/addons/base/i18n/sv.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-05-17 05:27+0000\n" +"PO-Revision-Date: 2010-05-18 08:01+0000\n" "Last-Translator: Anders Wallenquist \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-05-18 05:14+0000\n" +"X-Launchpad-Export-Date: 2010-05-19 05:11+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: base diff --git a/bin/addons/base/i18n/uk.po b/bin/addons/base/i18n/uk.po index d850fe2e2a4..6ff2cae1d3f 100644 --- a/bin/addons/base/i18n/uk.po +++ b/bin/addons/base/i18n/uk.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-05-17 05:31+0000\n" +"PO-Revision-Date: 2010-05-18 08:07+0000\n" "Last-Translator: Fabien (Open ERP) \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-05-18 05:14+0000\n" +"X-Launchpad-Export-Date: 2010-05-19 05:11+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: base diff --git a/bin/addons/base/i18n/zh_CN.po b/bin/addons/base/i18n/zh_CN.po index 29ac671c388..c1712a50da5 100644 --- a/bin/addons/base/i18n/zh_CN.po +++ b/bin/addons/base/i18n/zh_CN.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-05-17 05:28+0000\n" +"PO-Revision-Date: 2010-05-18 08:05+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-05-18 05:14+0000\n" +"X-Launchpad-Export-Date: 2010-05-19 05:11+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: base diff --git a/bin/addons/base/res/__init__.py b/bin/addons/base/res/__init__.py index 66278c82087..b7a14c78a93 100644 --- a/bin/addons/base/res/__init__.py +++ b/bin/addons/base/res/__init__.py @@ -31,8 +31,6 @@ import res_company import res_user import res_request import res_lang - +import res_log import ir_property -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/bin/addons/base/res/partner/partner_demo.xml b/bin/addons/base/res/partner/partner_demo.xml index 90a8e635756..915ab903a3e 100644 --- a/bin/addons/base/res/partner/partner_demo.xml +++ b/bin/addons/base/res/partner/partner_demo.xml @@ -377,7 +377,7 @@ ASUSTEK-Subject - res.partner,2 + diff --git a/bin/addons/base/res/partner/partner_view.xml b/bin/addons/base/res/partner/partner_view.xml index 840ee132481..b4c9f9bc67f 100644 --- a/bin/addons/base/res/partner/partner_view.xml +++ b/bin/addons/base/res/partner/partner_view.xml @@ -347,24 +347,27 @@ - - - - + + + + + + + - Partners + Customers ir.actions.act_window res.partner form @@ -639,7 +642,7 @@ /> - Partner + Address Book ir.ui.menu diff --git a/bin/addons/base/res/res_company.py b/bin/addons/base/res/res_company.py index 011e6f87a42..7d8a9cda8f3 100644 --- a/bin/addons/base/res/res_company.py +++ b/bin/addons/base/res/res_company.py @@ -24,7 +24,6 @@ from osv import fields import os import tools from tools.translate import _ -import base64 class multi_company_default(osv.osv): """ @@ -181,8 +180,9 @@ class res_company(osv.osv): return True def _get_logo(self, cr, uid, ids): - file_data = open('../pixmaps/openerp-header.png','rb').read() - return base64.encodestring(file_data) + return open(os.path.join( + tools.config['root_path'], '..', 'pixmaps', 'openerp-header.png'), + 'rb') .read().encode('base64') def _get_header2(self,cr,uid,ids): diff --git a/bin/addons/base/res/res_log.py b/bin/addons/base/res/res_log.py new file mode 100644 index 00000000000..b83e380ac55 --- /dev/null +++ b/bin/addons/base/res/res_log.py @@ -0,0 +1,44 @@ +# -*- 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 + +class res_log(osv.osv_memory): + _name = 'res.log' + _columns = { + 'name': fields.char('Message', size=128, help='The logging message.', required=True), + 'user_id': fields.many2one('res.users','User', required=True), + 'res_model': fields.char('Object', size=128), + 'res_id': fields.integer('Object ID'), + 'secondary': fields.boolean('Secondary Log', help='Do not display this log if it belongs to the same object the user is working on') + } + _defaults = { + 'user_id': lambda self,cr,uid,ctx: uid + } + _order='id desc' + # TODO: do not return secondary log if same object than in the model (but unlink it) + def get(self, cr, uid, context={}): + ids = self.search(cr, uid, [('user_id','=',uid)], context=context) + result = self.read(cr, uid, ids, ['name','res_model','res_id'], context=context) + self.unlink(cr, uid, ids, context=context) + return result +res_log() + diff --git a/bin/addons/base/res/res_log_view.xml b/bin/addons/base/res/res_log_view.xml new file mode 100644 index 00000000000..6f08434b266 --- /dev/null +++ b/bin/addons/base/res/res_log_view.xml @@ -0,0 +1,56 @@ + + + + + res.log.search + res.log + search + + + + + + + + + + + + res.log.tree + res.log + tree + + + + + + + + + res.log.form + res.log + form + +
+ + + + + + +
+
+
+ + + Logs + res.log + form + {'search_default_my': 1} + + +
+
diff --git a/bin/netsvc.py b/bin/netsvc.py index d32513f6f39..f0fe4687417 100644 --- a/bin/netsvc.py +++ b/bin/netsvc.py @@ -24,9 +24,11 @@ # ############################################################################## +import errno import logging import logging.handlers import os +import socket import sys import threading import time @@ -358,6 +360,21 @@ class Server: res.extend(srv.stats() for srv in cls.__servers) return '\n'.join(res) + def _close_socket(self): + if os.name != 'nt': + try: + self.socket.shutdown(getattr(socket, 'SHUT_RDWR', 2)) + except socket.error, e: + if e.errno != errno.ENOTCONN: raise + # OSX, socket shutdowns both sides if any side closes it + # causing an error 57 'Socket is not connected' on shutdown + # of the other side (or something), see + # http://bugs.python.org/issue4397 + self.__logger.debug( + '"%s" when shutting down server socket, ' + 'this is normal under OS X', e) + self.socket.close() + class OpenERPDispatcherException(Exception): def __init__(self, exception, traceback): self.exception = exception diff --git a/bin/osv/orm.py b/bin/osv/orm.py index e21dd9f500d..e3514df8ae0 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -399,8 +399,17 @@ class orm_template(object): _inherits = {} _table = None _invalids = set() + _log_create = False CONCURRENCY_CHECK_FIELD = '__last_update' + def log(self, cr, uid, id, message, secondary=False, context=None): + return self.pool.get('res.log').create(cr, uid, { + 'name': message, + 'res_model': self._name, + 'secondary': secondary, + 'res_id': id}, + context=context + ) def view_init(self, cr , uid , fields_list, context=None): """Override this method to do specific things when a view on the object is opened.""" @@ -1031,7 +1040,14 @@ class orm_template(object): for constraint in self._constraints: fun, msg, fields = constraint if not fun(self, cr, uid, ids): - translated_msg = trans._get_source(cr, uid, self._name, 'constraint', lng, source=msg) or msg + # Check presence of __call__ directly instead of using + # callable() because it will be deprecated as of Python 3.0 + if hasattr(msg, '__call__'): + txt_msg, params = msg(self, cr, uid, ids) + tmp_msg = trans._get_source(cr, uid, self._name, 'constraint', lng, source=txt_msg) or txt_msg + translated_msg = tmp_msg % params + else: + translated_msg = trans._get_source(cr, uid, self._name, 'constraint', lng, source=msg) or msg error_msgs.append( _("Error occurred while validating the field(s) %s: %s") % (','.join(fields), translated_msg) ) @@ -1832,6 +1848,12 @@ class orm_memory(orm_template): for field in upd_todo: self._columns[field].set_memory(cr, self, id_new, field, vals[field], user, context) self._validate(cr, user, [id_new], context) + if self._log_create and not (context and context.get('no_store_function', False)): + message = self._description + \ + " '" + \ + self.name_get(cr, user, [id_new], context=context)[0][1] + \ + "' "+ _("created.") + self.log(cr, user, id_new, message, True, context=context) wf_service = netsvc.LocalService("workflow") wf_service.trg_create(user, self._name, id_new, cr) return id_new @@ -1919,7 +1941,6 @@ class orm_memory(orm_template): res=e.__dict__['_expression__exp'] return res or [] - def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): if not context: @@ -3478,6 +3499,12 @@ class orm(orm_template): self.pool.get(object)._store_set_values(cr, user, ids, fields2, context) done.append((object, ids, fields2)) + if self._log_create and not (context and context.get('no_store_function', False)): + message = self._description + \ + " '" + \ + self.name_get(cr, user, [id_new], context=context)[0][1] + \ + "' "+ _("created.") + self.log(cr, user, id_new, message, True, context=context) wf_service = netsvc.LocalService("workflow") wf_service.trg_create(user, self._name, id_new, cr) return id_new diff --git a/bin/service/http_server.py b/bin/service/http_server.py index 47ae6c35ae8..98bbd9ad337 100644 --- a/bin/service/http_server.py +++ b/bin/service/http_server.py @@ -31,9 +31,11 @@ """ from websrv_lib import * import netsvc +import errno import threading import tools import os +import select import socket import xmlrpclib @@ -128,31 +130,25 @@ class BaseHttpDaemon(threading.Thread, netsvc.Server): "Error occur when starting the server daemon: %s" % (e,)) raise + @property + def socket(self): + return self.server.socket + def attach(self, path, gw): pass def stop(self): self.running = False - if os.name != 'nt': - try: - self.server.socket.shutdown( - getattr(socket, 'SHUT_RDWR', 2)) - except socket.error, e: - if e.errno != 57: raise - # OSX, socket shutdowns both sides if any side closes it - # causing an error 57 'Socket is not connected' on shutdown - # of the other side (or something), see - # http://bugs.python.org/issue4397 - netsvc.Logger().notifyChannel( - 'server', netsvc.LOG_DEBUG, - '"%s" when shutting down server socket, ' - 'this is normal under OS X'%e) - self.server.socket.close() + self._close_socket() def run(self): self.running = True while self.running: - self.server.handle_request() + try: + self.server.handle_request() + except (socket.error, select.error), e: + if self.running or e.args[0] != errno.EBADF: + raise return True class HttpDaemon(BaseHttpDaemon): diff --git a/bin/service/netrpc_server.py b/bin/service/netrpc_server.py index 9a8a699cb76..1f860e4d4b0 100644 --- a/bin/service/netrpc_server.py +++ b/bin/service/netrpc_server.py @@ -27,6 +27,7 @@ import netsvc import threading import tools import os +import select import socket import tiny_socket @@ -50,7 +51,6 @@ class TinySocketClientThread(threading.Thread, netsvc.OpenERPDispatcher): self.sock = None def run(self): - # import select self.running = True try: ts = tiny_socket.mysocket(self.sock) @@ -103,10 +103,13 @@ class TinySocketServerThread(threading.Thread,netsvc.Server): "starting NET-RPC service at %s port %d" % (interface or '0.0.0.0', port,)) def run(self): - # import select try: self.running = True while self.running: + timeout = self.socket.gettimeout() + fd_sets = select.select([self.socket], [], [], timeout) + if not fd_sets[0]: + continue (clientsocket, address) = self.socket.accept() ct = TinySocketClientThread(clientsocket, self.threads) clientsocket = None @@ -129,12 +132,7 @@ class TinySocketServerThread(threading.Thread,netsvc.Server): self.running = False for t in self.threads: t.stop() - try: - self.socket.shutdown( - getattr(socket, 'SHUT_RDWR', 2)) - self.socket.close() - except: - return False + self._close_socket() def stats(self): res = "Net-RPC: " + ( (self.running and "running") or "stopped") diff --git a/bin/tools/config.py b/bin/tools/config.py index f539b98d41b..a629e97fc11 100644 --- a/bin/tools/config.py +++ b/bin/tools/config.py @@ -83,8 +83,7 @@ class configmanager(object): 'list_db' : True, 'timezone' : False, # to override the default TZ 'test-disable' : False, - 'test-rollback' : True, - 'test-continue' : False + 'test-commit' : False, } self.misc = {} @@ -141,10 +140,8 @@ class configmanager(object): group = optparse.OptionGroup(parser, "Testing Configuration") group.add_option("--test-disable", action="store_true", dest="test_disable", default=False, help="Disable loading test files.") - group.add_option("--test-no-rollback", action="store_false", dest="test_rollback", - default=True, help="Don't rollback after running test.") - group.add_option("--test-continue", action="store_true", dest="test_continue", - default=False, help="Display exception but then test should continue.") + group.add_option("--test-commit", action="store_true", dest="test_commit", + default=False, help="Commit database changes performed by tests.") parser.add_option_group(group) # Logging Group @@ -294,8 +291,7 @@ class configmanager(object): self.options['init'] = opt.init and dict.fromkeys(opt.init.split(','), 1) or {} self.options["demo"] = not opt.without_demo and self.options['init'] or {} self.options["test-disable"] = opt.test_disable - self.options["test-rollback"] = opt.test_rollback - self.options["test-continue"] = opt.test_continue + self.options["test-commit"] = opt.test_commit self.options['update'] = opt.update and dict.fromkeys(opt.update.split(','), 1) or {} self.options['translate_modules'] = opt.translate_modules and map(lambda m: m.strip(), opt.translate_modules.split(',')) or ['all'] diff --git a/bin/tools/convert.py b/bin/tools/convert.py index c4b3a459e04..a7e002e1a61 100644 --- a/bin/tools/convert.py +++ b/bin/tools/convert.py @@ -741,7 +741,12 @@ form: module.record_id""" % (xml_id,) if f_ref=="null": f_val = False else: - f_val = self.id_get(cr, f_model, f_ref) + if f_name in model._columns \ + and model._columns[f_name]._type == 'reference': + val = self.model_id_get(cr, f_model, f_ref) + f_val = val[0] + ',' + str(val[1]) + else: + f_val = self.id_get(cr, f_model, f_ref) else: f_val = _eval_xml(self,field, self.pool, cr, self.uid, self.idref) if model._columns.has_key(f_name): @@ -759,13 +764,17 @@ form: module.record_id""" % (xml_id,) def id_get(self, cr, model, id_str): if id_str in self.idref: return self.idref[id_str] + return self.model_id_get(cr, model, id_str)[1] + + def model_id_get(self, cr, model, id_str): + model_data_obj = self.pool.get('ir.model.data') mod = self.module if '.' in id_str: mod,id_str = id_str.split('.') - result = self.pool.get('ir.model.data')._get_id(cr, self.uid, mod, id_str) - res = self.pool.get('ir.model.data').read(cr, self.uid, [result], ['res_id']) + result = model_data_obj._get_id(cr, self.uid, mod, id_str) + res = model_data_obj.read(cr, self.uid, [result], ['model', 'res_id']) if res and res[0] and res[0]['res_id']: - return int(res[0]['res_id']) + return res[0]['model'], int(res[0]['res_id']) return False def parse(self, de): diff --git a/bin/tools/misc.py b/bin/tools/misc.py index af76357b4e4..e60213ca740 100644 --- a/bin/tools/misc.py +++ b/bin/tools/misc.py @@ -101,7 +101,7 @@ def init_db(cr): values (%s, %s, %s, %s, %s, %s, %s, %s, %s)', ( id, info.get('author', ''), info.get('website', ''), i, info.get('name', False), - info.get('description', ''), p_id, state, info.get('certificate'))) + info.get('description', ''), p_id, state, info.get('certificate') or None)) cr.execute('insert into ir_model_data \ (name,model,module, res_id, noupdate) values (%s,%s,%s,%s,%s)', ( 'module_meta_information', 'ir.module.module', i, id, True)) diff --git a/bin/tools/yaml_import.py b/bin/tools/yaml_import.py index 108a5ff0d32..df825f09cbb 100644 --- a/bin/tools/yaml_import.py +++ b/bin/tools/yaml_import.py @@ -682,7 +682,7 @@ class YamlInterpreter(object): self.logger.exception(e) except Exception, e: self.logger.exception(e) - raise e + raise def _process_node(self, node): if is_comment(node): diff --git a/doc/Changelog-6.x b/doc/Changelog-6.x new file mode 100644 index 00000000000..78d65c8e809 --- /dev/null +++ b/doc/Changelog-6.x @@ -0,0 +1,9 @@ +2010-07-XX: 6.0.0 +================= + +Improvements (server) +--------------------- + + * support of 'ref' attribute for importing 'reference' field values, as for many2one fields. + + diff --git a/setup.py b/setup.py index 41f517f1689..cb51961ed3c 100755 --- a/setup.py +++ b/setup.py @@ -60,6 +60,7 @@ required_modules = [ ('pytz', 'Timezone handling library for Python'), ('reportlab', 'reportlab module'), ('yaml', 'YAML parser and emitter for Python'), + ('pywebdav', 'PyWebDAV is a standards compliant WebDAV server and library written in Python'), ] def check_modules(): @@ -182,7 +183,7 @@ options = { "encodings", "dateutil", "wizard", "pychart", "PIL", "pyparsing", "pydot", "asyncore","asynchat", "reportlab", "vobject", "HTMLParser", "select", "mako", "poplib", - "imaplib", "smtplib", "email", "yaml", + "imaplib", "smtplib", "email", "yaml","pywebdav", ], "excludes" : ["Tkconstants","Tkinter","tcl"], }