Reviewers: ,


Please review this at http://codereview.tryton.org/723003/

Affected files:
  M move.py


Index: move.py
===================================================================
--- a/move.py
+++ b/move.py
@@ -477,16 +477,17 @@ class Reconciliation(ModelSQL, ModelView

     @classmethod
     def validate(cls, reconciliations):
         super(Reconciliation, cls).validate(reconciliations)
         cls.check_lines(reconciliations)

     @classmethod
     def check_lines(cls, reconciliations):
+        Lang = Pool().get('ir.lang')
         for reconciliation in reconciliations:
             amount = Decimal('0.0')
             debit = Decimal('0.0')
             credit = Decimal('0.0')
             account = None
             party = None
             for line in reconciliation.lines:
                 if line.state != 'valid':
@@ -517,18 +518,20 @@ class Reconciliation(ModelSQL, ModelView
                             'party2': party.rec_name,
                             })
             if not account.company.currency.is_zero(debit - credit):
                 language = Transaction().language
                 languages = Lang.search([('code', '=', language)])
                 if not languages:
                     languages = Lang.search([('code', '=', 'en_US')])
                 language = languages[0]
- debit = Lang.currency(lang, debit, account.company.currency) - credit = Lang.currency(lang, credit, account.company.currency)
+                debit = Lang.currency(
+                    language, debit, account.company.currency)
+                credit = Lang.currency(
+                    language, credit, account.company.currency)
                 cls.raise_user_error('reconciliation_unbalanced', {
                         'debit': debit,
                         'credit': credit,
                         })


 class Line(ModelSQL, ModelView):
     'Account Move Line'


Reply via email to