Ravi Gohil (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.1-opw-578235-rgo into 
lp:openobject-addons/6.1.

Requested reviews:
  Naresh(OpenERP) (nch-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-578235-rgo/+merge/120331

Hello,

Reminding mail sent to partners for account followup do not have .pdf in as 
attachment, This MP contains fix for this issue. Kindly review the fix.

Thanks.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-578235-rgo/+merge/120331
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.1-opw-578235-rgo.
=== 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	2012-08-20 06:20:38 +0000
@@ -332,6 +332,12 @@
 msgstr ""
 
 #. module: account_followup
+#: code:addons/account_followup/wizard/account_followup_print.py:303
+#, python-format
+msgid "Followup-"
+msgstr ""
+
+#. module: account_followup
 #: help:account.followup.print,date:0
 msgid "This field allow you to select a forecast date to plan your follow-ups"
 msgstr ""

=== 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	2012-08-20 06:20:38 +0000
@@ -25,6 +25,8 @@
 import tools
 from osv import fields, osv
 from tools.translate import _
+import base64
+import netsvc
 
 class account_followup_print(osv.osv_memory):
     _name = 'account.followup.print'
@@ -227,7 +229,16 @@
             msg_sent = ''
             msg_unsent = ''
             data_user = user_obj.browse(cr, uid, uid, context=context)
-            for partner in self.pool.get('res.partner').browse(cr, uid, partners, context=context):
+            line_ids = line_obj.search(cr,uid,[('partner_id', 'in', partners)])
+            partners = []
+            dict_lines = {}
+            for line in line_obj.browse(cr, uid, line_ids, context=context):
+                if line.partner_id.id not in dict_lines.keys():
+                    partners.append(line.partner_id)
+                    dict_lines[line.partner_id.id] = [line]
+                else:
+                    dict_lines[line.partner_id.id].append(line)
+            for partner in partners:
                 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))])
                 data_lines = move_obj.browse(cr, uid, ids_lines, context=context)
                 total_amt = 0.0
@@ -282,7 +293,17 @@
                 msg = ''
                 if dest:
                     try:
-                        mail_message.schedule_with_attach(cr, uid, src, dest, sub, body, context=context)
+                        company_id = context.get('company_id')
+                        data_dict = {'form':{'partner_ids':[partner.id * 10000 + company_id], 'date': time.strftime('%Y-%m-%d')}}
+                        ctx = context.copy()
+                        ctx['lang'] = partner.lang or ctx.get('lang')
+                        datax,frmt = netsvc.LocalService('report.account_followup.followup.print').create(cr, uid, [], data_dict, ctx)
+                        params = {
+                            'datas': base64.encodestring( datax ),
+                            'datas_fname': _('Followup-') + str(partner.name) + '.' + frmt,
+                        }
+                        attach = dict(map(lambda x: (x['datas_fname'], base64.decodestring(x['datas'])), [params]))
+                        mail_message.schedule_with_attach(cr, uid, src, dest, sub, body, attachments=attach, context=context)
                         msg_sent += partner.name + '\n'
                     except Exception, e:
                         raise osv.except_osv('Error !', e )

_______________________________________________
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

Reply via email to