[IMP]Improved code as per suggation

bzr revid: pan@tinyerp.com-20130304090235-o7i8jt936c2tvoyk
This commit is contained in:
Anand Patel (OpenERP) 2013-03-04 14:32:35 +05:30
parent b899234680
commit 055fe6804c
2 changed files with 2 additions and 3 deletions

View File

@ -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:

View File

@ -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']])