diff --git a/addons/account_followup/account_followup.py b/addons/account_followup/account_followup.py index 6ea90f5c204..3e6f3e5a4e7 100644 --- a/addons/account_followup/account_followup.py +++ b/addons/account_followup/account_followup.py @@ -276,14 +276,13 @@ class res_partner(osv.osv):
Amount due: %s
''' % (total) return followup_table - def write(self, cr, uid, ids, vals, context=None): - if vals.get("payment_responsible_id", False): - for part in self.browse(cr, uid, ids, context=context): - if part.payment_responsible_id <> vals["payment_responsible_id"]: - pass - #message_post() - res = super(res_partner, self).write(cr, uid, ids, vals, context=context) - return res +# def write(self, cr, uid, ids, vals, context=None): +# if vals.get("payment_responsible_id", False): +# for part in self.browse(cr, uid, ids, context=context): +# if part.payment_responsible_id <> vals["payment_responsible_id"]: +# self.message_post(cr, uid, part.id, body = _('New responsible registered: %s'), context=context) +# res = super(res_partner, self).write(cr, uid, ids, vals, context=context) +# return res def action_done(self, cr, uid, ids, context=None): return self.write(cr, uid, ids, {'payment_next_action_date': False, 'payment_next_action':'', 'payment_responsible_id': False, 'payment_no_email': False}, context=context) diff --git a/addons/account_followup/wizard/account_followup_print.py b/addons/account_followup/wizard/account_followup_print.py index 456ccb5b642..490127252c2 100644 --- a/addons/account_followup/wizard/account_followup_print.py +++ b/addons/account_followup/wizard/account_followup_print.py @@ -127,7 +127,8 @@ class account_followup_print(osv.osv_memory): 'email_body': fields.text('Email Body'), 'summary': fields.text('Summary', readonly=True), 'test_print': fields.boolean('Test Print', - help='Check if you want to print follow-ups without changing follow-ups level.'), + help='Check if you want to print follow-ups without changing follow-up level.'), + 'intercompany':fields.boolean('Do follow-up for own companies too') } def _get_followup(self, cr, uid, context=None): @@ -301,6 +302,7 @@ class account_followup_print(osv.osv_memory): for partner_id, followup_line_id, date_maturity,date, id in move_lines: if not partner_id: continue + if followup_line_id not in fups: continue stat_line_id = partner_id * 10000 + company_id @@ -313,6 +315,16 @@ class account_followup_print(osv.osv_memory): if stat_line_id not in partner_list: partner_list.append(stat_line_id) to_update[str(id)]= {'level': fups[followup_line_id][1], 'partner_id': stat_line_id} + #Remove intercompany partners if asked for in the wizard + if not data.intercompany: + comp_obj = self.pool.get("res.company") + comp_ids = comp_obj.search(cr, 1, [], context=context) + for comp in comp_obj.browse(cr, 1, comp_ids, context=context): + # With user 1 because it is possible there is access to the partner + # that is the company and not to the company itself + partner_ind = comp.partner_id.id * 10000 + company_id + if partner_ind in partner_list: + partner_list.remove(partner_ind) return {'partner_ids': partner_list, 'to_update': to_update} account_followup_print() diff --git a/addons/account_followup/wizard/account_followup_print_view.xml b/addons/account_followup/wizard/account_followup_print_view.xml index 62943330d63..755ee74ae57 100644 --- a/addons/account_followup/wizard/account_followup_print_view.xml +++ b/addons/account_followup/wizard/account_followup_print_view.xml @@ -10,8 +10,9 @@ + -

+

This action will send follow-up emails, print the letters and set the manual actions per customer, according to the follow-up levels defined.