Mayur Maheshwari(OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-bug-1045794-mma into
lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
Related bugs:
Bug #1045794 in OpenERP Addons: "[Trunk]traceback when click on Send Reminder
Button"
https://bugs.launchpad.net/openobject-addons/+bug/1045794
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1045794-mma/+merge/122674
Hello
I have Fixed [traceback when click on Send Reminder Button lp:1045794]
Thanks
Mayur
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1045794-mma/+merge/122674
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-bug-1045794-mma.
=== modified file 'base_status/base_stage.py'
--- base_status/base_stage.py 2012-08-10 14:43:39 +0000
+++ base_status/base_stage.py 2012-09-04 13:35:12 +0000
@@ -292,62 +292,6 @@
rule_ids = rule_obj.search(cr, uid, [('model_id','=',model_ids[0])], context=context)
return rule_obj._action(cr, uid, rule_ids, cases, scrit=scrit, context=context)
- def remind_partner(self, cr, uid, ids, context=None, attach=False):
- return self.remind_user(cr, uid, ids, context, attach,
- destination=False)
-
- def remind_user(self, cr, uid, ids, context=None, attach=False, destination=True):
- mail_message = self.pool.get('mail.message')
- for case in self.browse(cr, uid, ids, context=context):
- if not destination and not case.email_from:
- return False
- if not case.user_id.email:
- return False
- if destination and case.section_id.user_id:
- case_email = case.section_id.user_id.email
- else:
- case_email = case.user_id.email
-
- src = case_email
- dest = case.user_id.email or ""
- body = case.description or ""
- for message in case.message_ids:
- if message.email_from and message.body_text:
- body = message.body_text
- break
-
- if not destination:
- src, dest = dest, case.email_from
- if body and case.user_id.signature:
- if body:
- body += '\n\n%s' % (case.user_id.signature)
- else:
- body = '\n\n%s' % (case.user_id.signature)
-
- body = self.format_body(body)
-
- attach_to_send = {}
-
- if attach:
- attach_ids = self.pool.get('ir.attachment').search(cr, uid, [('res_model', '=', self._name), ('res_id', '=', case.id)])
- attach_to_send = self.pool.get('ir.attachment').read(cr, uid, attach_ids, ['datas_fname', 'datas'])
- attach_to_send = dict(map(lambda x: (x['datas_fname'], base64.decodestring(x['datas'])), attach_to_send))
-
- # Send an email
- subject = "Reminder: [%s] %s" % (str(case.id), case.name, )
- mail_message.schedule_with_attach(cr, uid,
- src,
- [dest],
- subject,
- body,
- model=self._name,
- reply_to=case.section_id.reply_to,
- res_id=case.id,
- attachments=attach_to_send,
- context=context
- )
- return True
-
def _check(self, cr, uid, ids=False, context=None):
""" Function called by the scheduler to process cases for date actions.
Must be overriden by inheriting classes.
=== modified file 'base_status/base_state.py'
--- base_status/base_state.py 2012-08-10 14:43:39 +0000
+++ base_status/base_state.py 2012-09-04 13:35:12 +0000
@@ -92,6 +92,62 @@
data.update(self.onchange_partner_address_id(cr, uid, ids, addr['contact'])['value'])
return {'value': data}
+ def remind_partner(self, cr, uid, ids, context=None, attach=False):
+ return self.remind_user(cr, uid, ids, context, attach,
+ destination=False)
+
+ def remind_user(self, cr, uid, ids, context=None, attach=False, destination=True):
+ mail_message = self.pool.get('mail.message')
+ for case in self.browse(cr, uid, ids, context=context):
+ if not destination and not case.email_from:
+ return False
+ if not case.user_id.email:
+ return False
+ if destination and case.section_id.user_id:
+ case_email = case.section_id.user_id.email
+ else:
+ case_email = case.user_id.email
+
+ src = case_email
+ dest = case.user_id.email or ""
+ body = case.description or ""
+ for message in case.message_ids:
+ if message.email_from and message.body_text:
+ body = message.body_text
+ break
+
+ if not destination:
+ src, dest = dest, case.email_from
+ if body and case.user_id.signature:
+ if body:
+ body += '\n\n%s' % (case.user_id.signature)
+ else:
+ body = '\n\n%s' % (case.user_id.signature)
+
+ body = self.format_body(body)
+
+ attach_to_send = {}
+
+ if attach:
+ attach_ids = self.pool.get('ir.attachment').search(cr, uid, [('res_model', '=', self._name), ('res_id', '=', case.id)])
+ attach_to_send = self.pool.get('ir.attachment').read(cr, uid, attach_ids, ['datas_fname', 'datas'])
+ attach_to_send = dict(map(lambda x: (x['datas_fname'], base64.decodestring(x['datas'])), attach_to_send))
+
+ # Send an email
+ subject = "Reminder: [%s] %s" % (str(case.id), case.name, )
+ mail_message.schedule_with_attach(cr, uid,
+ src,
+ [dest],
+ subject,
+ body,
+ model=self._name,
+ reply_to=case.section_id.reply_to,
+ res_id=case.id,
+ attachments=attach_to_send,
+ context=context
+ )
+ return True
+
def case_escalate(self, cr, uid, ids, context=None):
""" Escalates case to parent level """
cases = self.browse(cr, uid, ids, context=context)
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp