[REF] account_followup: use payment_amount_due instead of credit field

bzr revid: qdp-launchpad@openerp.com-20121207085746-fcnkni42jruaiqlu
This commit is contained in:
Quentin (OpenERP) 2012-12-07 09:57:46 +01:00
parent 85e8ece99c
commit 767fad5f96
3 changed files with 9 additions and 6 deletions

View File

@ -309,6 +309,10 @@ class res_partner(osv.osv):
def _get_amounts_and_date(self, cr, uid, ids, name, arg, context=None):
'''
Function that computes values for the followup functional fields. Note that 'payment_amount_due'
is similar to 'credit' field on res.partner except it filters on user's company.
'''
res = {}
company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id
current_date = fields.date.context_today(cr, uid, context)

View File

@ -67,9 +67,9 @@
<page string="Payment Follow-up" groups="account.group_account_invoice" name="followup_tab">
<div class="oe_right oe_button_box" name="followup_button">
<button name="do_button_print" type="object" string="Print Overdue Payments" groups="account.group_account_user"
help="Print overdue payments report independent of follow-up line" attrs="{'invisible':[('credit', '&lt;=', 0.0)]}" />
help="Print overdue payments report independent of follow-up line" attrs="{'invisible':[('payment_amount_due', '&lt;=', 0.0)]}" />
<button name="do_partner_mail" type="object" string="Send Overdue Email" groups="account.group_account_user"
help="If not specified by the latest follow-up level, it will send from the default email template" attrs="{'invisible':[('credit', '&lt;=', 0.0)]}"/>
help="If not specified by the latest follow-up level, it will send from the default email template" attrs="{'invisible':[('payment_amount_due', '&lt;=', 0.0)]}"/>
</div>
<p attrs="{'invisible':[('latest_followup_date','=', False)]}">
The <field name="latest_followup_date" class = "oe_inline"/>, the latest payment follow-up

View File

@ -108,7 +108,7 @@ class TestAccountFollowup(TransactionCase):
def test_03_filter_on_credit(self):
""" Check the partners can be filtered on having credits """
cr, uid = self.cr, self.uid
ids = self.partner.search(cr, uid, [('credit', '>=', 0.0)])
ids = self.partner.search(cr, uid, [('payment_amount_due', '>=', 0.0)])
self.assertIn(self.partner_id, ids)
def test_04_action_done(self):
@ -153,7 +153,6 @@ class TestAccountFollowup(TransactionCase):
}, context={"followup_id": self.followup_id})
self.wizard.do_process(cr, uid, [self.wizard_id], context={"followup_id": self.followup_id})
partner_ref = self.partner.browse(cr, uid, self.partner_id)
print partner_ref.credit, partner_ref.payment_next_action_date, partner_ref.payment_responsible_id
self.assertEqual(0, self.partner.browse(cr, uid, self.partner_id).credit, "Credit != 0")
self.assertEqual(0, self.partner.browse(cr, uid, self.partner_id).payment_amount_due, "Amount Due != 0")
self.assertFalse(self.partner.browse(cr, uid, self.partner_id).payment_next_action_date, "Next action date not cleared")