[IMP] sale, purchase, invoice: automatically subscibe recipints of Send by email as document followers.
bzr revid: tde@openerp.com-20121221095902-k2xk928po48cogdm
This commit is contained in:
parent
0f62de1b2f
commit
b37450ba49
|
@ -1779,12 +1779,13 @@ class res_partner(osv.osv):
|
|||
return super(res_partner, self).copy(cr, uid, id, default, context)
|
||||
|
||||
|
||||
class mail_compose_message(osv.osv):
|
||||
class mail_compose_message(osv.Model):
|
||||
_inherit = 'mail.compose.message'
|
||||
|
||||
def send_mail(self, cr, uid, ids, context=None):
|
||||
context = context or {}
|
||||
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)
|
||||
return super(mail_compose_message, self).send_mail(cr, uid, ids, context=context)
|
||||
|
||||
|
|
|
@ -214,6 +214,9 @@ class mail_compose_message(osv.TransientModel):
|
|||
new_attachments = email_dict.pop('attachments', [])
|
||||
post_values['attachments'] += new_attachments
|
||||
post_values.update(email_dict)
|
||||
# automatically subscribe recipients if asked to
|
||||
if context.get('mail_post_autofollow') and wizard.model and post_values.get('partner_ids'):
|
||||
active_model_pool.message_subscribe(cr, uid, [res_id], [item[1] for item in post_values.get('partner_ids')], context=context)
|
||||
# post the message
|
||||
active_model_pool.message_post(cr, uid, [res_id], type='comment', subtype='mt_comment', context=context, **post_values)
|
||||
|
||||
|
|
|
@ -1214,9 +1214,8 @@ class procurement_order(osv.osv):
|
|||
body = _("Draft Purchase Order created")
|
||||
self.message_post(cr, uid, [procurement.id], body=body, context=context)
|
||||
|
||||
procurement_order()
|
||||
|
||||
class mail_mail(osv.osv):
|
||||
class mail_mail(osv.Model):
|
||||
_name = 'mail.mail'
|
||||
_inherit = 'mail.mail'
|
||||
|
||||
|
@ -1226,9 +1225,8 @@ class mail_mail(osv.osv):
|
|||
wf_service.trg_validate(uid, 'purchase.order', mail.res_id, 'send_rfq', cr)
|
||||
return super(mail_mail, self)._postprocess_sent_message(cr, uid, mail=mail, context=context)
|
||||
|
||||
mail_mail()
|
||||
|
||||
class product_template(osv.osv):
|
||||
class product_template(osv.Model):
|
||||
_name = 'product.template'
|
||||
_inherit = 'product.template'
|
||||
_columns = {
|
||||
|
@ -1238,13 +1236,14 @@ class product_template(osv.osv):
|
|||
'purchase_ok': 1,
|
||||
}
|
||||
|
||||
product_template()
|
||||
|
||||
class mail_compose_message(osv.osv):
|
||||
class mail_compose_message(osv.Model):
|
||||
_inherit = 'mail.compose.message'
|
||||
|
||||
def send_mail(self, cr, uid, ids, context=None):
|
||||
context = context or {}
|
||||
if context.get('default_model') == 'purchase.order' and context.get('default_res_id'):
|
||||
context = dict(context, mail_post_autofollow=True)
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'purchase.order', context['default_res_id'], 'send_rfq', cr)
|
||||
return super(mail_compose_message, self).send_mail(cr, uid, ids, context=context)
|
||||
|
|
|
@ -1010,11 +1010,13 @@ class sale_order_line(osv.osv):
|
|||
return super(sale_order_line, self).unlink(cr, uid, ids, context=context)
|
||||
|
||||
|
||||
class mail_compose_message(osv.osv):
|
||||
class mail_compose_message(osv.Model):
|
||||
_inherit = 'mail.compose.message'
|
||||
|
||||
def send_mail(self, cr, uid, ids, context=None):
|
||||
context = context or {}
|
||||
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)
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'sale.order', context['default_res_id'], 'quotation_sent', cr)
|
||||
return super(mail_compose_message, self).send_mail(cr, uid, ids, context=context)
|
||||
|
|
Loading…
Reference in New Issue