diff --git a/addons/account_analytic_plans/account_analytic_plans.py b/addons/account_analytic_plans/account_analytic_plans.py index af197076c23..7f1e3854f6a 100644 --- a/addons/account_analytic_plans/account_analytic_plans.py +++ b/addons/account_analytic_plans/account_analytic_plans.py @@ -404,7 +404,6 @@ class sale_order_line(osv.osv): if rec: pool_inv_line.write(cr, uid, [line.id], {'analytics_id':rec.analytics_id.id}, context=context) - cr.commit() return create_ids sale_order_line() diff --git a/addons/account_chart/i18n/ru.po b/addons/account_chart/i18n/ru.po index a7f14094a82..519eb416a3b 100644 --- a/addons/account_chart/i18n/ru.po +++ b/addons/account_chart/i18n/ru.po @@ -13,7 +13,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-03-31 03:55+0000\n" +"X-Launchpad-Export-Date: 2010-04-01 03:41+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: account_chart diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 17202c3ba83..3c99b7b5410 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -562,7 +562,6 @@ are both optional, but if one occurs, so MUST the other"""), cr.execute('Update %s set base_calendar_alarm_id=%s, alarm_id=%s \ where id=%s' % (model_obj._table, \ alarm_id, basic_alarm.id, data.id)) - cr.commit() return True def do_alarm_unlink(self, cr, uid, ids, model, context={}): diff --git a/addons/base_contact/i18n/bg.po b/addons/base_contact/i18n/bg.po index dfdcd14a63b..134f79092f6 100644 --- a/addons/base_contact/i18n/bg.po +++ b/addons/base_contact/i18n/bg.po @@ -13,7 +13,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-03-31 03:55+0000\n" +"X-Launchpad-Export-Date: 2010-04-01 03:41+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: base_contact diff --git a/addons/base_report_designer/base_report_designer.py b/addons/base_report_designer/base_report_designer.py index bddc9da9e17..311449fd46c 100644 --- a/addons/base_report_designer/base_report_designer.py +++ b/addons/base_report_designer/base_report_designer.py @@ -60,7 +60,6 @@ class report_xml(osv.osv): 'report_sxw_content': base64.decodestring(file_sxw), 'report_rml_content': str(sxw2rml(sxwval, xsl=fp.read())), }) - cr.commit() db = pooler.get_db_only(cr.dbname) interface.register_all(db) return True diff --git a/addons/board/board.py b/addons/board/board.py index 29e8a3310b4..5154a7cb993 100644 --- a/addons/board/board.py +++ b/addons/board/board.py @@ -57,15 +57,12 @@ class board_board(osv.osv): def write(self, cr, uid, ids, vals, context={}): result = super(board_board, self).write(cr, uid, ids, vals, context) - cr.commit() board = self.pool.get('board.board').browse(cr, uid, ids[0]) view = self.create_view(cr, uid, ids[0], context) id = board.view_id.id cr.execute("update ir_ui_view set arch=%s where id=%s" , (view, id)) - cr.commit() - return result def create(self, cr, user, vals, context=None): diff --git a/addons/board_account/i18n/ru.po b/addons/board_account/i18n/ru.po index fd7e9d8b9fe..3b86324170b 100644 --- a/addons/board_account/i18n/ru.po +++ b/addons/board_account/i18n/ru.po @@ -13,7 +13,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-03-31 03:55+0000\n" +"X-Launchpad-Export-Date: 2010-04-01 03:41+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: board_account diff --git a/addons/board_project/i18n/ru.po b/addons/board_project/i18n/ru.po index 60115d0e65b..da870866b24 100644 --- a/addons/board_project/i18n/ru.po +++ b/addons/board_project/i18n/ru.po @@ -13,7 +13,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-03-31 03:55+0000\n" +"X-Launchpad-Export-Date: 2010-04-01 03:41+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: board_project diff --git a/addons/crm/crm.py b/addons/crm/crm.py index f19cd4bfb19..a6baed45b4e 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -344,11 +344,13 @@ class crm_case(osv.osv): obj = self.pool.get('crm.case.history') data['description'] = details or case.description data['email_to'] = email or \ + (case.section_id and case.section_id.reply_to) or \ (case.user_id and case.user_id.address_id and \ - case.user_id.address_id.email) or False + case.user_id.address_id.email) or tools.config.get('email_from',False) data['email_from'] = email_from or \ + (case.section_id and case.section_id.reply_to) or \ (case.user_id and case.user_id.address_id and \ - case.user_id.address_id.email) or False + case.user_id.address_id.email) or tools.config.get('email_from',False) res = obj.create(cr, uid, data, context) return True _history = __history diff --git a/addons/crm/crm_action_rule.py b/addons/crm/crm_action_rule.py index 1e7c50588db..cd9c8f39ede 100644 --- a/addons/crm/crm_action_rule.py +++ b/addons/crm/crm_action_rule.py @@ -55,11 +55,14 @@ class case(osv.osv): if case.section_id.reply_to and case.email_from: src = case.email_from dest = case.section_id.reply_to - body = case.email_last or case.description + body = "" + body = case.email_last or case.description if not destination: src, dest = dest, src - if case.user_id.signature: - body += '\n\n%s' % (case.user_id.signature or '') + if body and case.user_id.signature: + body += '\n\n%s' % (case.user_id.signature) + + body = self.format_body(body) dest = [dest] attach_to_send = None @@ -74,15 +77,16 @@ class case(osv.osv): src, dest, "Reminder: [%s] %s" % (str(case.id), case.name, ), - self.format_body(body), + body, reply_to=case.section_id.reply_to, openobject_id=str(case.id), attach=attach_to_send ) - if flag: - raise osv.except_osv(_('Email!'),("Email Successfully Sent")) - else: - raise osv.except_osv(_('Email Fail!'),("Email is not sent successfully")) + self._history(cr, uid, [case], _('Send'), history=True, email=dest, details=body, email_from=src) + #if flag: + # raise osv.except_osv(_('Email!'),("Email Successfully Sent")) + #else: + # raise osv.except_osv(_('Email Fail!'),("Email is not sent successfully")) return True def _check(self, cr, uid, ids=False, context={}): @@ -120,6 +124,23 @@ case() class base_action_rule(osv.osv): _inherit = 'base.action.rule' _description = 'Action Rules' + + def email_send(self, cr, uid, obj, emails, body, emailfrom=tools.config.get('email_from',False), context={}): + body = self.format_mail(obj, body) + if not emailfrom: + if hasattr(obj, 'user_id') and obj.user_id and obj.user_id.address_id and obj.user_id.address_id.email: + emailfrom = obj.user_id.address_id.email + + name = '[%d] %s' % (obj.id, tools.ustr(obj.name)) + emailfrom = tools.ustr(emailfrom) + if hasattr(obj, 'section_id') and obj.section_id and obj.section_id.reply_to: + reply_to = obj.section_id.reply_to + else: + reply_to = emailfrom + if not emailfrom: + raise osv.except_osv(_('Error!'), + _("No E-Mail ID Found for your Company address!")) + return tools.email_send(emailfrom, emails, name, body, reply_to=reply_to, openobject_id=str(obj.id)) def do_check(self, cr, uid, action, obj, context={}): ok = super(base_action_rule, self).do_check(cr, uid, action, obj, context=context) @@ -146,7 +167,7 @@ class base_action_rule(osv.osv): res = super(base_action_rule, self).do_action(cr, uid, action, model_obj, obj, context=context) write = {} - if action.act_section_id: + if hasattr(action, act_section_id) and action.act_section_id: obj.section_id = action.act_section_id write['section_id'] = action.act_section_id.id diff --git a/addons/crm/crm_mailgate.py b/addons/crm/crm_mailgate.py index 8b2f3bdef88..60bd4f430f2 100644 --- a/addons/crm/crm_mailgate.py +++ b/addons/crm/crm_mailgate.py @@ -34,24 +34,28 @@ from osv.orm import except_orm class crm_cases(osv.osv): _name = "crm.case" - _inherit = "crm.case" + _inherit = "crm.case" def msg_new(self, cr, uid, msg): mailgate_obj = self.pool.get('mail.gateway') msg_body = mailgate_obj.msg_body_get(msg) + msg_subject = mailgate_obj._decode_header(msg['Subject']) + msg_from = mailgate_obj._decode_header(msg['From']) + msg_cc = mailgate_obj._decode_header(msg['Cc']) + body = self.format_body(msg_body['body']) data = { - 'name': msg['Subject'], - 'email_from': msg['From'], - 'email_cc': msg['Cc'], + 'name': msg_subject, + 'email_from': msg_from, + 'email_cc': msg_cc, 'user_id': False, - 'description': msg_body['body'], + 'description': body, } - res = mailgate_obj.partner_get(cr, uid, msg['From']) + res = mailgate_obj.partner_get(cr, uid, msg_from) if res: data.update(res) res = self.create(cr, uid, data) cases = self.browse(cr, uid, [res]) - self._history(cr, uid, cases, _('Receive'), history=True, email=msg['From']) + self._history(cr, uid, cases, _('Receive'), history=True, details=body, email_from=msg_from) return res def msg_update(self, cr, uid, ids, msg, data={}, default_act='pending'): @@ -79,10 +83,10 @@ class crm_cases(osv.osv): if 'partner' in msg_actions: data['email_from'] = msg_actions['partner'][:128] - + msg_from = self._decode_header(msg['From']) res = self.write(cr, uid, select, data) cases = self.browse(cr, uid, select) - self._history(cr, uid, cases, _('Receive'), history=True, email=msg['From']) + self._history(cr, uid, cases, _('Receive'), history=True, details=body_data, email_from=msg['From']) getattr(self,act)(cr, uid, select) return res diff --git a/addons/crm/crm_segmentation.py b/addons/crm/crm_segmentation.py index 2f0e2a1c650..2844cd02881 100644 --- a/addons/crm/crm_segmentation.py +++ b/addons/crm/crm_segmentation.py @@ -78,10 +78,8 @@ class crm_segmentation(osv.osv): for partner_id in partners: cr.execute('insert into res_partner_category_rel (category_id,partner_id) values (%s,%s)', (categ['categ_id'][0],partner_id)) - cr.commit() self.write(cr, uid, [id], {'state':'not running', 'partner_id':0}) - cr.commit() return True def process_stop(self, cr, uid, ids, *args): diff --git a/addons/crm/crm_view.xml b/addons/crm/crm_view.xml index a7feed54d3c..3348083eb0b 100644 --- a/addons/crm/crm_view.xml +++ b/addons/crm/crm_view.xml @@ -216,10 +216,12 @@ - + @@ -233,9 +235,11 @@ - + diff --git a/addons/crm/i18n/es.po b/addons/crm/i18n/es.po index e1fbc85e8c0..16a23891c8a 100644 --- a/addons/crm/i18n/es.po +++ b/addons/crm/i18n/es.po @@ -13,7 +13,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-03-31 03:55+0000\n" +"X-Launchpad-Export-Date: 2010-04-01 03:41+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: crm diff --git a/addons/crm/i18n/fi.po b/addons/crm/i18n/fi.po index 5a16207d10c..d3e4f18e025 100644 --- a/addons/crm/i18n/fi.po +++ b/addons/crm/i18n/fi.po @@ -8,13 +8,13 @@ msgstr "" "Project-Id-Version: openobject-addons\n" "Report-Msgid-Bugs-To: FULL NAME \n" "POT-Creation-Date: 2010-01-05 05:59+0000\n" -"PO-Revision-Date: 2010-03-30 20:39+0000\n" +"PO-Revision-Date: 2010-03-31 14:33+0000\n" "Last-Translator: smii \n" "Language-Team: Finnish \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-03-31 03:55+0000\n" +"X-Launchpad-Export-Date: 2010-04-01 03:41+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: crm @@ -2799,12 +2799,12 @@ msgstr "Aseta kokous" #. module: crm #: field:crm.menu.config_wizard,meeting:0 msgid "Calendar of Meetings" -msgstr "" +msgstr "Kokouskalenteri" #. module: crm #: view:crm.case:0 msgid "Cases By Stage and Estimates" -msgstr "" +msgstr "Tapahtumat vaiheen ja arvioiden mukaan" #. module: crm #: code:addons/crm/crm.py:0 @@ -2834,18 +2834,18 @@ msgstr "Suurin kommunikointihistoria" #. module: crm #: view:crm.lead:0 msgid "Meeting For Leads Generation" -msgstr "" +msgstr "Kokous ohjausten luomiseksi" #. module: crm #: wizard_view:crm.lead.opportunity_set,create_partner:0 #: wizard_view:crm.lead.partner_create,init:0 msgid "Are you sure you want to create a partner based on this lead ?" -msgstr "" +msgstr "Oletko varma, että haluat luoda kumppanin perustuen tähän johtoon ?" #. module: crm #: model:crm.case.stage,name:crm.stage_job6 msgid "Refused by Employee" -msgstr "" +msgstr "Hylätty työntekijän toimesta" #. module: crm #: field:crm.case,partner_name:0 @@ -2855,7 +2855,7 @@ msgstr "" #. module: crm #: model:crm.case.stage,name:crm.stage_job2 msgid "First Interview" -msgstr "" +msgstr "Ensimmäinen haastattelu" #. module: crm #: view:report.crm.case.section.categ.categ2:0 @@ -2863,7 +2863,7 @@ msgstr "" #: view:report.crm.case.section.categ2:0 #: view:report.crm.case.section.stage:0 msgid "This Month" -msgstr "" +msgstr "Tässä kuussa" #. module: crm #: view:crm.job:0 diff --git a/addons/crm/scripts/openerp_mailgate/openerp_mailgate.py b/addons/crm/scripts/openerp_mailgate/openerp_mailgate.py index a5cfa7c58f1..76a9f9bfeaf 100755 --- a/addons/crm/scripts/openerp_mailgate/openerp_mailgate.py +++ b/addons/crm/scripts/openerp_mailgate/openerp_mailgate.py @@ -34,7 +34,7 @@ import time, socket email_re = re.compile(r"([A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6})") case_re = re.compile(r"\[([0-9]+)\]", re.UNICODE) command_re = re.compile("^Set-([a-z]+) *: *(.+)$", re.I + re.UNICODE) -reference_re = re.compile("<.*-tinycrm-(\\d+)@(.*)>", re.UNICODE) +reference_re = re.compile("<.*-openobject-(\\d+)@(.*)>", re.UNICODE) priorities = { '1': '1 (Highest)', @@ -157,21 +157,37 @@ class email_parser(object): 'partner_id': adr[0].get('partner_id', False) and adr[0]['partner_id'][0] or False } + def _to_decode(self, s, charsets): + for charset in charsets: + if charset: + try: + return s.decode(charset) + except UnicodeError: + pass + try: + return s.decode('ascii') + except UnicodeError: + return s + def _decode_header(self, s): from email.Header import decode_header - s = decode_header(s) - return ''.join(map(lambda x:x[0].decode(x[1] or 'ascii', 'replace'), s)) + s = decode_header(s) + return ''.join(map(lambda x:self._to_decode(x[0], [x[1]]), s)) def msg_new(self, msg): message = self.msg_body_get(msg) + msg_subject = self._decode_header(msg['Subject']) + msg_from = self._decode_header(msg['From']) + msg_cc = self._decode_header(msg['Cc'] or '') + data = { - 'name': self._decode_header(msg['Subject']), - 'email_from': self._decode_header(msg['From']), - 'email_cc': self._decode_header(msg['Cc'] or ''), + 'name': msg_subject, + 'email_from': msg_from, + 'email_cc': msg_cc, 'user_id': False, 'description': message['body'], } - data.update(self.partner_get(self._decode_header(msg['From']))) + data.update(self.partner_get(msg_from)) try: id = self.rpc(self.model, 'create', data) @@ -222,7 +238,7 @@ class email_parser(object): if part.get_content_maintype()=='text': buf = part.get_payload(decode=True) if buf: - txt = buf.decode(part.get_charsets()[0] or 'ascii', 'replace') + txt = self._to_decode(buf, part.get_charsets()) txt = re.sub("<(\w)>", replace, txt) txt = re.sub("<\/(\w)>", replace, txt) if txt and part.get_content_subtype() == 'plain': diff --git a/addons/crm/wizard/crm_send_email.py b/addons/crm/wizard/crm_send_email.py index da141186240..1f1e12d2b85 100644 --- a/addons/crm/wizard/crm_send_email.py +++ b/addons/crm/wizard/crm_send_email.py @@ -44,23 +44,12 @@ class crm_send_new_email(osv.osv_memory): } def action_cancel(self, cr, uid, ids, context=None): - """ - Closes Phonecall to Opportunity form - @param self: The object pointer - @param cr: the current row, from the database cursor, - @param uid: the current user’s ID for security checks, - @param ids: List of Phonecall to Opportunity's IDs - @param context: A standard dictionary for contextual values + """ Closes Phonecall to Opportunity form """ return {'type':'ir.actions.act_window_close'} def action_send(self, cr, uid, ids, context=None): """ This sends an email to ALL the addresses of the selected partners. - @param self: The object pointer - @param cr: the current row, from the database cursor, - @param uid: the current user’s ID for security checks, - @param ids: List of Phonecall to Opportunity's IDs - @param context: A standard dictionary for contextual values """ if not context: context = {} @@ -90,18 +79,19 @@ class crm_send_new_email(osv.osv_memory): if case.user_id.signature: body += '\n\n%s' % (case.user_id.signature) - - case_pool._history(cr, uid, [case], _('Send'), history=True, email=data['email_to'], details=body) + body = case_pool.format_body(body) email_from = data.get('email_from', False) + case_pool._history(cr, uid, [case], _('Send'), history=True, email=data['email_to'], details=body, email_from=email_from) + flag = tools.email_send( email_from, emails, data['subject'], - case_pool.format_body(body), + body, attach=attach, reply_to=case.section_id.reply_to, - openobject_id=str(case.id), - ) + openobject_id=str(case.id), + ) if flag: if data['state'] == 'unchanged': pass @@ -118,18 +108,12 @@ class crm_send_new_email(osv.osv_memory): # raise osv.except_osv(_('Email!'), ("Email Successfully Sent")) # else: # raise osv.except_osv(_('Warning!'), _("Email not sent !")) + return {} def default_get(self, cr, uid, fields, context=None): """ This function gets default values - @param self: The object pointer - @param cr: the current row, from the database cursor, - @param uid: the current user’s ID for security checks, - @param fields: List of fields for default value - @param context: A standard dictionary for contextual values - - @return : default values of fields. """ if not context: context = {} @@ -151,7 +135,8 @@ class crm_send_new_email(osv.osv_memory): if 'email_to' in fields: res.update({'email_to': case.email_from}) if 'email_from' in fields: - res.update({'email_from': (case.user_id and case.user_id.address_id and \ + res.update({'email_from': (case.section_id and case.section_id.reply_to) or \ + (case.user_id and case.user_id.address_id and \ case.user_id.address_id.email) or tools.config.get('email_from',False)}) if 'subject' in fields: res.update({'subject': '[%s] %s' %(str(case.id), case.name or '')}) @@ -166,13 +151,6 @@ class crm_send_new_email(osv.osv_memory): def get_reply_defaults(self, cr, uid, fields, context=None): """ This function gets default values for reply mail - @param self: The object pointer - @param cr: the current row, from the database cursor, - @param uid: the current user’s ID for security checks, - @param fields: List of fields for default value - @param context: A standard dictionary for contextual values - - @return : default values of fields. """ hist_obj = self.pool.get('crm.case.history') res_ids = context and context.get('active_ids', []) or [] @@ -182,24 +160,24 @@ class crm_send_new_email(osv.osv_memory): model_pool = self.pool.get(model) case = model_pool.browse(cr, uid, hist.log_id.res_id) if 'email_to' in fields: - res.update({'email_to': hist.email_from or (case.user_id and case.user_id.address_id and \ - case.user_id.address_id.email) or tools.config.get('email_from',False)}) + res.update({'email_to': case.email_from or hist.email_from or False}) if 'email_from' in fields: - res.update({'email_from': (case.user_id and case.user_id.address_id and \ - case.user_id.address_id.email) or tools.config.get('email_from',False)}) + res.update({'email_from': (case.section_id and case.section_id.reply_to) or \ + (case.user_id and case.user_id.address_id and \ + case.user_id.address_id.email) or hist.email_to or tools.config.get('email_from',False)}) if 'text' in fields: header = '-------- Original Message --------' - sender = 'From: %s' %(hist.email_from or tools.config.get('email_from',False)) - to = 'To: %s' % (hist.email_to) - sentdate = 'Sent: %s' % (hist.date) + sender = 'From: %s' %(hist.email_from or '') + to = 'To: %s' % (hist.email_to or '') + sentdate = 'Date: %s' % (hist.date) desc = '\n%s'%(hist.description) original = [header, sender, to, sentdate, desc] original = '\n'.join(original) - res.update({'text': '\n\n%s'%(original)}) + res['text']=original if 'subject' in fields: res.update({'subject': '[%s] %s' %(str(case.id), case.name or '')}) if 'state' in fields: - res.update({'state': 'pending'}) + res['state']='pending' return res def view_init(self, cr, uid, fields_list, context=None): diff --git a/addons/crm_profiling/crm_profiling.py b/addons/crm_profiling/crm_profiling.py index 7e70df3dc4a..dc019f9a4be 100644 --- a/addons/crm_profiling/crm_profiling.py +++ b/addons/crm_profiling/crm_profiling.py @@ -243,10 +243,8 @@ class crm_segmentation(osv.osv): for partner_id in partners: cr.execute('insert into res_partner_category_rel (category_id,partner_id) values (%s,%s)', (categ['categ_id'][0],partner_id)) - cr.commit() self.write(cr, uid, [id], {'state':'not running', 'partner_id':0}) - cr.commit() return True crm_segmentation() diff --git a/addons/idea/i18n/ru.po b/addons/idea/i18n/ru.po index 052052be880..9f8622ada30 100644 --- a/addons/idea/i18n/ru.po +++ b/addons/idea/i18n/ru.po @@ -13,7 +13,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-03-31 03:55+0000\n" +"X-Launchpad-Export-Date: 2010-04-01 03:41+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: idea diff --git a/addons/mail_gateway/mail_gateway.py b/addons/mail_gateway/mail_gateway.py index ee7676d4423..6a7df28b2d1 100644 --- a/addons/mail_gateway/mail_gateway.py +++ b/addons/mail_gateway/mail_gateway.py @@ -210,10 +210,22 @@ class mail_gateway(osv.osv): } return res - def _decode_header(self, s): + def _to_decode(self, s, charsets): + for charset in charsets: + if charset: + try: + return s.decode(charset) + except UnicodeError: + pass + try: + return s.decode('ascii') + except UnicodeError: + return s + + def _decode_header(self, s): from email.Header import decode_header s = decode_header(s) - return ''.join(map(lambda x:x[0].decode(x[1] or 'ascii', 'replace'), s)) + return ''.join(map(lambda x:self._to_decode(x[0], x[1]), s)) def msg_new(self, cr, uid, msg, model): message = self.msg_body_get(msg) @@ -250,7 +262,7 @@ class mail_gateway(osv.osv): if part.get_content_maintype()=='text': buf = part.get_payload(decode=True) if buf: - txt = buf.decode(part.get_charsets()[0] or 'ascii', 'replace') + txt = self._to_decode(buf, part.get_charsets()) txt = re.sub("<(\w)>", replace, txt) txt = re.sub("<\/(\w)>", replace, txt) if txt and part.get_content_subtype() == 'plain': @@ -362,13 +374,11 @@ class mail_gateway(osv.osv): del msg['Subject'] msg['Subject'] = '[%s] %s' %(str(res_id), subject) - em = [user_email, from_email] + (cc_email or '').split(',') + em = [user_email or '', from_email] + (cc_email or '').split(',') emails = map(self.emails_get, filter(None, em)) - mm = [self._decode_header(msg['From']), self._decode_header(msg['To'])]+self._decode_header(msg.get('Cc','')).split(',') msg_mails = map(self.emails_get, filter(None, mm)) - - emails = filter(lambda m: m and m not in msg_mails, emails) + emails = filter(lambda m: m and m not in msg_mails, emails) try: self.msg_send(msg, mailgateway.reply_to, emails, priority, res_id) if hasattr(self.pool.get(res_model), 'msg_send'): diff --git a/addons/mrp/i18n/bg.po b/addons/mrp/i18n/bg.po index e1660a8aea4..c0bfc16aa98 100644 --- a/addons/mrp/i18n/bg.po +++ b/addons/mrp/i18n/bg.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-08-28 16:01+0000\n" -"PO-Revision-Date: 2010-01-15 20:33+0000\n" -"Last-Translator: lem0na \n" +"PO-Revision-Date: 2010-03-31 09:02+0000\n" +"Last-Translator: Boris \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-03-30 03:54+0000\n" +"X-Launchpad-Export-Date: 2010-04-01 03:40+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: mrp @@ -1889,7 +1889,7 @@ msgstr "" #. module: mrp #: model:ir.ui.menu,name:mrp.menu_mrp_root msgid "Manufacturing" -msgstr "" +msgstr "Производство" #. module: mrp #: model:ir.actions.act_window,name:mrp.mrp_procurement_action3 diff --git a/addons/mrp/i18n/fr.po b/addons/mrp/i18n/fr.po index 34f1b5c332f..e55720e2c9e 100644 --- a/addons/mrp/i18n/fr.po +++ b/addons/mrp/i18n/fr.po @@ -13,7 +13,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-03-31 03:54+0000\n" +"X-Launchpad-Export-Date: 2010-04-01 03:41+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: mrp diff --git a/addons/mrp/i18n/ru.po b/addons/mrp/i18n/ru.po index dad225a5f3c..cf3fc9234cf 100644 --- a/addons/mrp/i18n/ru.po +++ b/addons/mrp/i18n/ru.po @@ -13,7 +13,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-03-31 03:54+0000\n" +"X-Launchpad-Export-Date: 2010-04-01 03:41+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: mrp diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index 6864b542396..fe7d45cdb6c 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -144,8 +144,7 @@ class mrp_bom(osv.osv): @return: True - """ - + """ result = {} for bom in self.browse(cr, uid, ids, context=context): result[bom.id] = map(lambda x: x.id, bom.bom_lines) @@ -156,10 +155,7 @@ class mrp_bom(osv.osv): sids = self.pool.get('mrp.bom').search(cr, uid, [('bom_id','=',False),('product_id','=',bom.product_id.id)]) if sids: bom2 = self.pool.get('mrp.bom').browse(cr, uid, sids[0], context=context) - result[bom.id] += map(lambda x: x.id, bom2.bom_lines) - print "name",name - print "arg",arg - print "result",result + result[bom.id] += map(lambda x: x.id, bom2.bom_lines) return result def _compute_type(self, cr, uid, ids, field_name, arg, context): res = dict(map(lambda x: (x,''), ids)) diff --git a/addons/point_of_sale/__terp__.py b/addons/point_of_sale/__terp__.py index b1838a28fc1..f1d847cf76d 100644 --- a/addons/point_of_sale/__terp__.py +++ b/addons/point_of_sale/__terp__.py @@ -62,6 +62,7 @@ Main features : 'wizard/pos_payment_report_user.xml', 'wizard/pos_payment_report.xml', 'wizard/pos_payment.xml', + 'wizard/pos_scan_product_view.xml', 'pos_report.xml', 'pos_wizard.xml', 'pos_view.xml', diff --git a/addons/point_of_sale/pos.py b/addons/point_of_sale/pos.py index 4b3f73f34d8..cda897104fc 100644 --- a/addons/point_of_sale/pos.py +++ b/addons/point_of_sale/pos.py @@ -158,28 +158,8 @@ class pos_order(osv.osv): if val