Merge lp:~invitu/openobject-addons/6.1-fix-1193220 into lp:openobject-addons/6.1

Proposed by invitu
Status: Needs review
Proposed branch: lp:~invitu/openobject-addons/6.1-fix-1193220
Merge into: lp:openobject-addons/6.1
Diff against target: 76 lines (+31/-3)
2 files modified
account_followup/i18n/account_followup.pot (+6/-0)
account_followup/wizard/account_followup_print.py (+25/-3)
To merge this branch: bzr merge lp:~invitu/openobject-addons/6.1-fix-1193220
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+170753@code.launchpad.net

Description of the change

[FIX] attachment and sender email are missing in account followup emails (bug 1193220)

To post a comment you must log in.
7225. By rgo-openerp

[FIX] account_followup: mail sent using followup wizard do not have pdf attached: (Maintenance Case : 578235) (6.1-opw-578235-rgo

7226. By invitu

[FIX] account_followup : sender email was missing in followup emails (bug 1193220)

Unmerged revisions

7226. By invitu

[FIX] account_followup : sender email was missing in followup emails (bug 1193220)

7225. By rgo-openerp

[FIX] account_followup: mail sent using followup wizard do not have pdf attached: (Maintenance Case : 578235) (6.1-opw-578235-rgo

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'account_followup/i18n/account_followup.pot'
--- account_followup/i18n/account_followup.pot 2012-02-08 01:08:30 +0000
+++ account_followup/i18n/account_followup.pot 2013-06-21 16:21:31 +0000
@@ -332,6 +332,12 @@
332msgstr ""332msgstr ""
333333
334#. module: account_followup334#. module: account_followup
335#: code:addons/account_followup/wizard/account_followup_print.py:303
336#, python-format
337msgid "Followup-"
338msgstr ""
339
340#. module: account_followup
335#: help:account.followup.print,date:0341#: help:account.followup.print,date:0
336msgid "This field allow you to select a forecast date to plan your follow-ups"342msgid "This field allow you to select a forecast date to plan your follow-ups"
337msgstr ""343msgstr ""
338344
=== modified file 'account_followup/wizard/account_followup_print.py'
--- account_followup/wizard/account_followup_print.py 2012-02-13 16:03:19 +0000
+++ account_followup/wizard/account_followup_print.py 2013-06-21 16:21:31 +0000
@@ -25,6 +25,8 @@
25import tools25import tools
26from osv import fields, osv26from osv import fields, osv
27from tools.translate import _27from tools.translate import _
28import base64
29import netsvc
2830
29class account_followup_print(osv.osv_memory):31class account_followup_print(osv.osv_memory):
30 _name = 'account.followup.print'32 _name = 'account.followup.print'
@@ -227,7 +229,16 @@
227 msg_sent = ''229 msg_sent = ''
228 msg_unsent = ''230 msg_unsent = ''
229 data_user = user_obj.browse(cr, uid, uid, context=context)231 data_user = user_obj.browse(cr, uid, uid, context=context)
230 for partner in self.pool.get('res.partner').browse(cr, uid, partners, context=context):232 line_ids = line_obj.search(cr,uid,[('partner_id', 'in', partners)])
233 partners = []
234 dict_lines = {}
235 for line in line_obj.browse(cr, uid, line_ids, context=context):
236 if line.partner_id.id not in dict_lines.keys():
237 partners.append(line.partner_id)
238 dict_lines[line.partner_id.id] = [line]
239 else:
240 dict_lines[line.partner_id.id].append(line)
241 for partner in partners:
231 ids_lines = move_obj.search(cr,uid,[('partner_id','=',partner.id),('reconcile_id','=',False),('account_id.type','in',['receivable']),('company_id','=',context.get('company_id', False))])242 ids_lines = move_obj.search(cr,uid,[('partner_id','=',partner.id),('reconcile_id','=',False),('account_id.type','in',['receivable']),('company_id','=',context.get('company_id', False))])
232 data_lines = move_obj.browse(cr, uid, ids_lines, context=context)243 data_lines = move_obj.browse(cr, uid, ids_lines, context=context)
233 total_amt = 0.0244 total_amt = 0.0
@@ -242,7 +253,8 @@
242 if (not dest) and adr.type=='default':253 if (not dest) and adr.type=='default':
243 if adr.email:254 if adr.email:
244 dest = [adr.email]255 dest = [adr.email]
245 src = tools.config.options['email_from']256 user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
257 src = user.user_email or tools.config.get('email_from', False)
246 if not data.partner_lang:258 if not data.partner_lang:
247 body = data.email_body259 body = data.email_body
248 else:260 else:
@@ -282,7 +294,17 @@
282 msg = ''294 msg = ''
283 if dest:295 if dest:
284 try:296 try:
285 mail_message.schedule_with_attach(cr, uid, src, dest, sub, body, context=context)297 company_id = context.get('company_id')
298 data_dict = {'form':{'partner_ids':[partner.id * 10000 + company_id], 'date': time.strftime('%Y-%m-%d'), 'followup_id': context.get('followup_id')}}
299 ctx = context.copy()
300 ctx['lang'] = partner.lang or ctx.get('lang')
301 datax,frmt = netsvc.LocalService('report.account_followup.followup.print').create(cr, uid, [], data_dict, ctx)
302 params = {
303 'datas': base64.encodestring( datax ),
304 'datas_fname': _('Followup-') + str(partner.name) + '.' + frmt,
305 }
306 attach = dict(map(lambda x: (x['datas_fname'], base64.decodestring(x['datas'])), [params]))
307 mail_message.schedule_with_attach(cr, uid, src, dest, sub, body, attachments=attach, context=context)
286 msg_sent += partner.name + '\n'308 msg_sent += partner.name + '\n'
287 except Exception, e:309 except Exception, e:
288 raise osv.except_osv('Error !', e )310 raise osv.except_osv('Error !', e )