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
1=== modified file 'account_followup/i18n/account_followup.pot'
2--- account_followup/i18n/account_followup.pot 2012-02-08 01:08:30 +0000
3+++ account_followup/i18n/account_followup.pot 2013-06-21 16:21:31 +0000
4@@ -332,6 +332,12 @@
5 msgstr ""
6
7 #. module: account_followup
8+#: code:addons/account_followup/wizard/account_followup_print.py:303
9+#, python-format
10+msgid "Followup-"
11+msgstr ""
12+
13+#. module: account_followup
14 #: help:account.followup.print,date:0
15 msgid "This field allow you to select a forecast date to plan your follow-ups"
16 msgstr ""
17
18=== modified file 'account_followup/wizard/account_followup_print.py'
19--- account_followup/wizard/account_followup_print.py 2012-02-13 16:03:19 +0000
20+++ account_followup/wizard/account_followup_print.py 2013-06-21 16:21:31 +0000
21@@ -25,6 +25,8 @@
22 import tools
23 from osv import fields, osv
24 from tools.translate import _
25+import base64
26+import netsvc
27
28 class account_followup_print(osv.osv_memory):
29 _name = 'account.followup.print'
30@@ -227,7 +229,16 @@
31 msg_sent = ''
32 msg_unsent = ''
33 data_user = user_obj.browse(cr, uid, uid, context=context)
34- for partner in self.pool.get('res.partner').browse(cr, uid, partners, context=context):
35+ line_ids = line_obj.search(cr,uid,[('partner_id', 'in', partners)])
36+ partners = []
37+ dict_lines = {}
38+ for line in line_obj.browse(cr, uid, line_ids, context=context):
39+ if line.partner_id.id not in dict_lines.keys():
40+ partners.append(line.partner_id)
41+ dict_lines[line.partner_id.id] = [line]
42+ else:
43+ dict_lines[line.partner_id.id].append(line)
44+ for partner in partners:
45 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))])
46 data_lines = move_obj.browse(cr, uid, ids_lines, context=context)
47 total_amt = 0.0
48@@ -242,7 +253,8 @@
49 if (not dest) and adr.type=='default':
50 if adr.email:
51 dest = [adr.email]
52- src = tools.config.options['email_from']
53+ user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
54+ src = user.user_email or tools.config.get('email_from', False)
55 if not data.partner_lang:
56 body = data.email_body
57 else:
58@@ -282,7 +294,17 @@
59 msg = ''
60 if dest:
61 try:
62- mail_message.schedule_with_attach(cr, uid, src, dest, sub, body, context=context)
63+ company_id = context.get('company_id')
64+ data_dict = {'form':{'partner_ids':[partner.id * 10000 + company_id], 'date': time.strftime('%Y-%m-%d'), 'followup_id': context.get('followup_id')}}
65+ ctx = context.copy()
66+ ctx['lang'] = partner.lang or ctx.get('lang')
67+ datax,frmt = netsvc.LocalService('report.account_followup.followup.print').create(cr, uid, [], data_dict, ctx)
68+ params = {
69+ 'datas': base64.encodestring( datax ),
70+ 'datas_fname': _('Followup-') + str(partner.name) + '.' + frmt,
71+ }
72+ attach = dict(map(lambda x: (x['datas_fname'], base64.decodestring(x['datas'])), [params]))
73+ mail_message.schedule_with_attach(cr, uid, src, dest, sub, body, attachments=attach, context=context)
74 msg_sent += partner.name + '\n'
75 except Exception, e:
76 raise osv.except_osv('Error !', e )