From 055fe6804cbca72d8f1c4907c044706b82d96572 Mon Sep 17 00:00:00 2001 From: "Anand Patel (OpenERP)" Date: Mon, 4 Mar 2013 14:32:35 +0530 Subject: [PATCH] [IMP]Improved code as per suggation bzr revid: pan@tinyerp.com-20130304090235-o7i8jt936c2tvoyk --- addons/account/account_invoice.py | 3 --- addons/sale/sale.py | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 0f02e98d234..52bcd29622c 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -1767,9 +1767,6 @@ class mail_compose_message(osv.Model): if context.get('default_model') == 'account.invoice' and context.get('default_res_id') and context.get('mark_invoice_as_sent'): context = dict(context, mail_post_autofollow=True) self.pool.get('account.invoice').write(cr, uid, [context['default_res_id']], {'sent': True}, context=context) - if context.get('active_model') == "sale.order": - for sale in self.pool.get(context.get('active_model')).browse(cr, uid, [context.get('active_id')], context): - sale.message_post(body=_("Invoice sent")) return super(mail_compose_message, self).send_mail(cr, uid, ids, context=context) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 8dcdc676196..8ccbfd6f194 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -1002,6 +1002,8 @@ class mail_compose_message(osv.Model): def send_mail(self, cr, uid, ids, context=None): context = context or {} + if context.get('mark_invoice_as_sent'): + self.pool.get('account.invoice').message_post(cr, uid,[context['default_res_id']], body=_("Invoice sent"), context=context) if context.get('default_model') == 'sale.order' and context.get('default_res_id') and context.get('mark_so_as_sent'): context = dict(context, mail_post_autofollow=True) self.pool.get('sale.order').signal_quotation_sent(cr, uid, [context['default_res_id']])