[IMP] Added checkbox for sending intercompany payment reminders or not

bzr revid: jco@openerp.com-20130118111849-h5dfehmot1231a09
This commit is contained in:
Josse Colpaert 2013-01-18 12:18:49 +01:00
parent 0e3308ef92
commit 0f5eceb07b
3 changed files with 22 additions and 10 deletions

View File

@ -276,14 +276,13 @@ class res_partner(osv.osv):
<center>Amount due: %s </center>''' % (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)

View File

@ -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()

View File

@ -10,8 +10,9 @@
<group col="4">
<field name="followup_id" groups="base.group_multi_company"/>
<field name="date" groups="base.group_no_one"/>
<field name="intercompany"/>
</group>
<p class ="oe_grey">
<p class ="oe_grey">
This action will send follow-up emails, print the letters and
set the manual actions per customer, according to the follow-up levels defined.
</p>