diff --git a/addons/account/company.py b/addons/account/company.py index 403b886e012..e724b3a9775 100644 --- a/addons/account/company.py +++ b/addons/account/company.py @@ -25,7 +25,7 @@ from osv import fields, osv class res_company(osv.osv): _inherit = "res.company" _columns = { - 'overdue_msg' : fields.text('Overdue Payments Message'), + 'overdue_msg' : fields.text('Overdue Payments Message', translate=True), } _defaults = { diff --git a/addons/account/report/overdue.py b/addons/account/report/overdue.py index 76ebbe7efa4..861ad82ef9c 100644 --- a/addons/account/report/overdue.py +++ b/addons/account/report/overdue.py @@ -35,6 +35,7 @@ class Overdue(report_sxw.rml_parse): 'adr_get' : self._adr_get, 'getLines' : self._lines_get, 'tel_get' : self._tel_get, + 'message' : self._message, }) self.context = context def _adr_get(self, partner, type): @@ -80,7 +81,12 @@ class Overdue(report_sxw.rml_parse): ('state', '<>', 'draft'), ('reconcile_id', '=', False)]) movelines = moveline_obj.browse(self.cr, self.uid, movelines) return movelines - + + def _message(self, obj, company): + company_pool = pooler.get_pool(self.cr.dbname).get('res.company') + message = company_pool.browse(self.cr, self.uid, company.id, {'lang':obj.lang}).overdue_msg + return message + report_sxw.report_sxw('report.account.overdue', 'res.partner', 'addons/account/report/overdue.rml', parser=Overdue) diff --git a/addons/account/report/overdue.rml b/addons/account/report/overdue.rml index df4c69c45b4..2713b665d06 100644 --- a/addons/account/report/overdue.rml +++ b/addons/account/report/overdue.rml @@ -127,7 +127,7 @@ - [[ company.overdue_msg ]] + [[ message(o, company) ]] diff --git a/addons/account_followup/followup_data.xml b/addons/account_followup/followup_data.xml new file mode 100644 index 00000000000..2a33e65b2c8 --- /dev/null +++ b/addons/account_followup/followup_data.xml @@ -0,0 +1,19 @@ + + + + + Date : %(date)s + +Dear %(partner_name)s, + +Please find in attachment a reminder of all your unpaid invoices, for a total amount due of: + +%(followup_amount).2f %(company_currency)s + +Thanks, +-- +%(user_signature)s +%(company_name)s + + + diff --git a/addons/account_followup/wizard/wizard_followup_print.py b/addons/account_followup/wizard/wizard_followup_print.py index 9d1f4c6deef..70f90f2d6ae 100644 --- a/addons/account_followup/wizard/wizard_followup_print.py +++ b/addons/account_followup/wizard/wizard_followup_print.py @@ -60,8 +60,9 @@ _followup_wizard_all_form = """ + - + @@ -94,6 +95,12 @@ _followup_wizard_all_fields = { 'size': 64, 'default': 'Invoices Reminder' }, + 'partner_lang':{ + 'string': "Send Email in Partner Language", + 'type': 'boolean', + 'default':True, + 'help':'Do not change message text, if you want to send email in partner language, or configre from company' + }, 'email_body': { 'string': "Email body", 'type': 'text', @@ -156,7 +163,13 @@ class followup_all_print(wizard.interface): if adr.email: dest = [adr.email] src = tools.config.options['smtp_user'] - body=data['form']['email_body'] + if not data['form']['partner_lang']: + body = data['form']['email_body'] + else: + cxt = context.copy() + cxt['lang'] = partner.lang + body = pool.get('res.users').browse(cr, uid, uid, context=cxt).company_id.follow_up_msg + total_amt = followup_data.debit - followup_data.credit move_line = '' subtotal_due = 0.0 @@ -257,7 +270,7 @@ class followup_all_print(wizard.interface): partner_list.append(partner_id) to_update[str(id)] = fups[followup_line_id][1] - message = pool.get('res.users').browse(cr, uid, uid).company_id.follow_up_msg + message = pool.get('res.users').browse(cr, uid, uid, context=context).company_id.follow_up_msg return {'partner_ids': partner_list, 'to_update': to_update, 'email_body':message}