Reviewers: ,
Please review this at http://codereview.tryton.org/854002/ Affected files: M payment_term.py Index: payment_term.py =================================================================== --- a/payment_term.py +++ b/payment_term.py @@ -32,6 +32,26 @@ '"%s".'), }) + @classmethod + def validate(cls, terms): + super(PaymentTerm, cls).validate(terms) + cls.check_missing_remainder(terms) + + @classmethod + def check_missing_remainder(cls, terms): + Company = Pool().get('company.company') + + currency = None + if Transaction().context.get('company'): + currency = Company(Transaction().context['company']).currency + for term in terms: + amount = Decimal('1000') + for line in term.lines: + if line.amount: + amount+= line.amount + term.compute(amount,currency) + + @staticmethod def default_active(): return True
