[MERGE] Fix of the customer portal wizard. Override of schedule_with_attach was wrong: 1-behavior specific to purchase.order was always executed; it is now ecexuted only for purchase.order objects, and the method checks that model and res_id are set; 2-subtype field was wrong, it is now named content_subtype.
bzr revid: tde@openerp.com-20120806122835-fxzgmhogbh6do8bz
This commit is contained in:
@@ -199,19 +199,20 @@ class mail_message(osv.osv):
|
||||
|
||||
def schedule_with_attach(self, cr, uid, email_from, email_to, subject, body, model=False, email_cc=None,
|
||||
email_bcc=None, reply_to=False, attachments=None, message_id=False, references=False,
|
||||
res_id=False, subtype='plain', headers=None, mail_server_id=False, auto_delete=False,
|
||||
res_id=False, content_subtype='plain', headers=None, mail_server_id=False, auto_delete=False,
|
||||
context=None):
|
||||
purchase_order_obj = self.pool.get('purchase.order')
|
||||
requisition_id = purchase_order_obj.browse(cr, uid, res_id, context=context).requisition_id.id
|
||||
result = super(mail_message, self).schedule_with_attach(cr, uid, email_from, email_to, subject, body, model=model, email_cc=email_cc,
|
||||
email_bcc=email_bcc, reply_to=reply_to, attachments=attachments, message_id=message_id, references=references,
|
||||
res_id=res_id, subtype='plain', headers=headers, mail_server_id=mail_server_id, auto_delete=auto_delete,
|
||||
context=context)
|
||||
if requisition_id:
|
||||
result = self.schedule_with_attach(cr, uid, email_from, email_to, subject, body, 'purchase.requisition', email_cc=email_cc,
|
||||
email_bcc=email_bcc, reply_to=reply_to, attachments=attachments, message_id=message_id, references=references,
|
||||
res_id=requisition_id, subtype='plain', headers=headers, mail_server_id=mail_server_id, auto_delete=auto_delete,
|
||||
context=context)
|
||||
email_bcc=email_bcc, reply_to=reply_to, attachments=attachments, message_id=message_id, references=references,
|
||||
res_id=res_id, content_subtype=content_subtype, headers=headers, mail_server_id=mail_server_id, auto_delete=auto_delete,
|
||||
context=context)
|
||||
# check model is purchase.order
|
||||
if model and model == 'purchase.order' and res_id:
|
||||
requisition_id = self.pool.get('purchase.order').browse(cr, uid, res_id, context=context).requisition_id
|
||||
if requisition_id:
|
||||
result = self.schedule_with_attach(cr, uid, email_from, email_to, subject, body, model='purchase.requisition', email_cc=email_cc,
|
||||
email_bcc=email_bcc, reply_to=reply_to, attachments=attachments, message_id=message_id, references=references,
|
||||
res_id=requisition_id.id, content_subtype=content_subtype, headers=headers, mail_server_id=mail_server_id, auto_delete=auto_delete,
|
||||
context=context)
|
||||
return result
|
||||
|
||||
class purchase_requisition_line(osv.osv):
|
||||
|
||||
Reference in New Issue
Block a user