From 09cc1b4c5bd0b99f28b766afc1e7442411621571 Mon Sep 17 00:00:00 2001 From: Christophe Chauvet Date: Mon, 2 Mar 2009 16:54:56 +0100 Subject: [PATCH 1/6] [IMP] * Check if sender or default email in config file * Add X-Header (help filter on mail client) * Add dynamic X-Header on def method * Correct incoherent reply to when it exists bzr revid: christophe.chauvet@syleam.fr-20090302155456-vsu5rjlg3r694m6q --- bin/tools/misc.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/bin/tools/misc.py b/bin/tools/misc.py index 5eee773f0f1..a67c1821f72 100644 --- a/bin/tools/misc.py +++ b/bin/tools/misc.py @@ -302,7 +302,8 @@ def reverse_enumerate(l): #---------------------------------------------------------- # Emails #---------------------------------------------------------- -def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=None, reply_to=False, attach=None, tinycrm=False, ssl=False, debug=False, subtype='plain'): +def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=None, reply_to=False, + attach=None, tinycrm=False, ssl=False, debug=False, subtype='plain', x_headers=None): """Send an email.""" import smtplib from email.MIMEText import MIMEText @@ -316,6 +317,9 @@ def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=Non if not ssl: ssl = config.get('smtp_ssl', False) + if not email_from and not config['email_from']: + raise Exception("No Email sender by default, see config file") + if not email_cc: email_cc = [] if not email_bcc: @@ -330,7 +334,9 @@ def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=Non msg['From'] = email_from del msg['Reply-To'] if reply_to: - msg['Reply-To'] = msg['From']+', '+reply_to + msg['Reply-To'] = reply_to + else: + msg['Reply-To'] = msg['From'] msg['To'] = COMMASPACE.join(email_to) if email_cc: msg['Cc'] = COMMASPACE.join(email_cc) @@ -338,6 +344,15 @@ def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=Non msg['Bcc'] = COMMASPACE.join(email_bcc) msg['Date'] = formatdate(localtime=True) + # Add OpenERP Server information + msg['X-Generated-By'] = 'OpenERP (http://www.openerp.com)' + msg['X-OpenERP-Server-Host'] = socket.gethostname() + msg['X-OpenERP-Server-Version'] = release.version + + # Add dynamic X Header + for key, value in x_headers.items(): + msg['X-OpenERP-%s' % key] = str(value) + if tinycrm: msg['Message-Id'] = "<%s-tinycrm-%s@%s>" % (time.time(), tinycrm, socket.gethostname()) From 56d838a0a69d30090b4ef3656498970e2a7486bc Mon Sep 17 00:00:00 2001 From: Christophe Chauvet Date: Fri, 6 Mar 2009 16:14:02 +0100 Subject: [PATCH 2/6] [IMP] * Remove incoherence in export language (remove required field to export pot file) * Add missing tools.translate import syntax * replace tabs per spaces * if only one module export and no language select, the name fo the file is the name of the module bzr revid: christophe.chauvet@syleam.fr-20090306151402-4gj8g9cba8sw3xms --- bin/addons/base/module/module_wizard.xml | 12 ++++++------ bin/addons/base/module/wizard/wizard_export_lang.py | 8 +++++--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/bin/addons/base/module/module_wizard.xml b/bin/addons/base/module/module_wizard.xml index a7e3ceba627..0d21f1eecbe 100644 --- a/bin/addons/base/module/module_wizard.xml +++ b/bin/addons/base/module/module_wizard.xml @@ -6,23 +6,23 @@ base.module.import - + Update Modules List module.module.update - + - + Load an Official Translation module.lang.install - + Export a Translation File wizard.module.lang.export form @@ -32,7 +32,7 @@ - + @@ -105,6 +105,6 @@ new - + diff --git a/bin/addons/base/module/wizard/wizard_export_lang.py b/bin/addons/base/module/wizard/wizard_export_lang.py index 2a56cac2fcc..58de337f45e 100644 --- a/bin/addons/base/module/wizard/wizard_export_lang.py +++ b/bin/addons/base/module/wizard/wizard_export_lang.py @@ -27,7 +27,7 @@ import cStringIO import csv import pooler from osv import fields,osv - +from tools.translate import _ class wizard_export_lang(osv.osv_memory): @@ -60,8 +60,10 @@ class wizard_export_lang(osv.osv_memory): elif this.format == 'tgz': ext = this.lang and '.po' or '.pot' this.advice = _('Save this document to a .tgz file. This archive containt UTF-8 %s files and may be uploaded to launchpad.') % (ext,) - - this.name = "%s.%s" % (this.lang or _('new'), this.format) + filename = _('new') + if not this.lang and len(mods) == 1: + filename = mods[0] + this.name = "%s.%s" % (this.lang or filename, this.format) out=base64.encodestring(buf.getvalue()) buf.close() return self.write(cr, uid, ids, {'state':'get', 'data':out, 'advice':this.advice, 'name':this.name}, context=context) From 24c7d75964daa777752c6f6786272f9f5a2286d7 Mon Sep 17 00:00:00 2001 From: Christophe Chauvet Date: Fri, 6 Mar 2009 19:06:50 +0100 Subject: [PATCH 3/6] [IMP] * Add "from tools.translate import _" in all missing file was used _('xxx') bzr revid: christophe.chauvet@syleam.fr-20090306180650-5g11fkzbbhh61aql --- bin/addons/base/ir/ir_actions.py | 1 + bin/addons/base/ir/ir_model.py | 1 + bin/addons/base/module/module.py | 1 + bin/addons/base/module/wizard/wizard_module_import.py | 1 + bin/addons/base/res/partner/partner.py | 1 + bin/addons/base/res/res_user.py | 1 + 6 files changed, 6 insertions(+) diff --git a/bin/addons/base/ir/ir_actions.py b/bin/addons/base/ir/ir_actions.py index 312bd2db7e3..58cd6f455c9 100644 --- a/bin/addons/base/ir/ir_actions.py +++ b/bin/addons/base/ir/ir_actions.py @@ -24,6 +24,7 @@ from osv import fields,osv import tools import time from tools.config import config +from tools.translate import _ import netsvc import re diff --git a/bin/addons/base/ir/ir_model.py b/bin/addons/base/ir/ir_model.py index 25507e2496e..aa2e2f4d10b 100644 --- a/bin/addons/base/ir/ir_model.py +++ b/bin/addons/base/ir/ir_model.py @@ -28,6 +28,7 @@ from osv.orm import except_orm, browse_record import time import tools from tools import config +from tools.translate import _ import pooler def _get_fields_type(self, cr, uid, context=None): diff --git a/bin/addons/base/module/module.py b/bin/addons/base/module/module.py index e5e764184c5..c9160e482cf 100644 --- a/bin/addons/base/module/module.py +++ b/bin/addons/base/module/module.py @@ -36,6 +36,7 @@ import pooler import netsvc from tools.parse_version import parse_version +from tools.translate import _ class module_repository(osv.osv): diff --git a/bin/addons/base/module/wizard/wizard_module_import.py b/bin/addons/base/module/wizard/wizard_module_import.py index fbf66d4c222..b8ddcd6269c 100644 --- a/bin/addons/base/module/wizard/wizard_module_import.py +++ b/bin/addons/base/module/wizard/wizard_module_import.py @@ -30,6 +30,7 @@ import tools import zipfile from StringIO import StringIO import base64 +from tools.translate import _ finish_form ='''
diff --git a/bin/addons/base/res/partner/partner.py b/bin/addons/base/res/partner/partner.py index cfe1cb41710..223386220c9 100644 --- a/bin/addons/base/res/partner/partner.py +++ b/bin/addons/base/res/partner/partner.py @@ -26,6 +26,7 @@ from osv import fields,osv import tools import ir import pooler +from tools.translate import _ class res_partner_function(osv.osv): _name = 'res.partner.function' diff --git a/bin/addons/base/res/res_user.py b/bin/addons/base/res/res_user.py index e2d438ea6a3..ec96b07dc0c 100644 --- a/bin/addons/base/res/res_user.py +++ b/bin/addons/base/res/res_user.py @@ -24,6 +24,7 @@ from osv import fields,osv from osv.orm import except_orm import tools import pytz +from tools.translate import _ class groups(osv.osv): _name = "res.groups" From 0a3d0dc90a04f874e1c5882b6d66cba015dcd279 Mon Sep 17 00:00:00 2001 From: "ame (Tiny/Axelor)" Date: Mon, 16 Mar 2009 10:52:11 +0530 Subject: [PATCH 4/6] [FIX] invalid locale (en_EN) lp bug: https://launchpad.net/bugs/338190 fixed bzr revid: ame@tinyerp.com-20090316052211-wp1gjr3uxjovbz29 --- bin/tools/misc.py | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/tools/misc.py b/bin/tools/misc.py index 9e2d1f51dae..4dd11c5a71c 100644 --- a/bin/tools/misc.py +++ b/bin/tools/misc.py @@ -756,7 +756,6 @@ def get_languages(): 'de_DE': u'German / Deutsch', 'el_EL': u'Greek / Ελληνικά', 'en_CA': u'English (CA)', - 'en_EN': u'English (default)', 'en_GB': u'English (UK)', 'en_US': u'English (US)', 'es_AR': u'Spanish (AR) / Español (AR)', From 54e4ec52f560a63d8b2cff86ec1dc9786c668c83 Mon Sep 17 00:00:00 2001 From: "ame (Tiny/Axelor)" Date: Thu, 19 Mar 2009 15:18:33 +0530 Subject: [PATCH 5/6] [IMP] min_rows attribute for tree view. bzr revid: ame@tinyerp.com-20090319094833-ohapsr16h0s8yemr --- bin/addons/base/rng/view.rng | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/addons/base/rng/view.rng b/bin/addons/base/rng/view.rng index beb1a2487a4..2fd6d5cb987 100644 --- a/bin/addons/base/rng/view.rng +++ b/bin/addons/base/rng/view.rng @@ -37,6 +37,7 @@ + From 148e3979fcde8d4d00f7d536529e70c4bf0e306d Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Mon, 23 Mar 2009 14:50:57 +0100 Subject: [PATCH 6/6] [FIX] fix attachment right access (full access when not linked to an object) lp bug: https://launchpad.net/bugs/347192 fixed bzr revid: christophe@tinyerp.com-20090323135057-h4w3k6hnbzq88abz --- bin/addons/base/ir/ir_attachment.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/addons/base/ir/ir_attachment.py b/bin/addons/base/ir/ir_attachment.py index dd1934de698..b1a1eef9e4c 100644 --- a/bin/addons/base/ir/ir_attachment.py +++ b/bin/addons/base/ir/ir_attachment.py @@ -33,7 +33,8 @@ class ir_attachment(osv.osv): ids = [ids] cr.execute('select distinct res_model from ir_attachment where id in ('+','.join(map(str, ids))+')') for obj in cr.fetchall(): - ima.check(cr, uid, obj[0], mode) + if obj[0]: + ima.check(cr, uid, obj[0], mode) def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):