diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py
index 173f0651a90..b1c85c5cf45 100644
--- a/addons/account/account_bank_statement.py
+++ b/addons/account/account_bank_statement.py
@@ -297,14 +297,24 @@ class account_bank_statement(osv.osv):
def get_next_st_line_number(self, cr, uid, st_number, st_line, context=None):
return st_number + '/' + str(st_line.sequence)
- def balance_check(self, cr, uid, st_id, journal_type='bank', context=None):
- st = self.browse(cr, uid, st_id, context)
- if not (abs((st.balance_end or 0.0) - st.balance_end_real) < 0.0001):
- raise osv.except_osv(_('Error !'),
- _('The statement balance is incorrect !\n') +
- _('The expected balance (%.2f) is different than the computed one. (%.2f)') % (st.balance_end_real, st.balance_end))
+# def balance_check(self, cr, uid, st_id, journal_type='bank', context=None):
+# st = self.browse(cr, uid, st_id, context)
+# if not (abs((st.balance_end or 0.0) - st.balance_end_real) < 0.0001):
+# raise osv.except_osv(_('Error !'),
+# _('The statement balance is incorrect !\n') +
+# _('The expected balance (%.2f) is different than the computed one. (%.2f)') % (st.balance_end_real, st.balance_end))
+# return True
+
+ def _balance_check(self, cr, uid, ids, context=None):
+ for st in self.browse(cr, uid, ids):
+ if not (abs((st.balance_end or 0.0) - st.balance_end_real) < 0.0001):
+ return False
return True
+ _constraints = [
+ (_balance_check, 'The statement balance is incorrect !\n The expected balance is different than the computed one.', ['balance_end','balance_end_real']),
+ ]
+
def statement_close(self, cr, uid, ids, journal_type='bank', context=None):
return self.write(cr, uid, ids, {'state':'confirm'}, context=context)
@@ -323,7 +333,7 @@ class account_bank_statement(osv.osv):
if not self.check_status_condition(cr, uid, st.state, journal_type=j_type):
continue
- self.balance_check(cr, uid, st.id, journal_type=j_type, context=context)
+# self.balance_check(cr, uid, st.id, journal_type=j_type, context=context)
if (not st.journal_id.default_credit_account_id) \
or (not st.journal_id.default_debit_account_id):
raise osv.except_osv(_('Configuration Error !'),
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index c4a1d447ad9..398755486ae 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -2436,7 +2436,7 @@
-
+
diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py
index 03ac3b87ba0..3fcccb82c5d 100644
--- a/addons/account_voucher/account_voucher.py
+++ b/addons/account_voucher/account_voucher.py
@@ -826,7 +826,6 @@ class account_voucher_line(osv.osv):
_defaults = {
'name': ''
}
-
def onchange_move_line_id(self, cr, user, ids, move_line_id, context={}):
"""
Returns a dict that contains new values and context
@@ -949,6 +948,17 @@ class account_bank_statement_line(osv.osv):
res[line.id] = 0.0
return res
+ def _check_amount(self, cr, uid, ids, context=None):
+ obj = self.browse(cr, uid, ids[0])
+ if obj.voucher_id:
+ if not (obj.amount == obj.voucher_id.amount):
+ return False
+ return True
+
+ _constraints = [
+ (_check_amount, 'The amount of the voucher must be the same amount as the one on the statement line', ['statement_id']),
+ ]
+
_columns = {
'amount_reconciled': fields.function(_amount_reconciled,
string='Amount reconciled', method=True, type='float'),
@@ -968,4 +978,4 @@ class account_bank_statement_line(osv.osv):
account_bank_statement_line()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account_voucher/wizard/account_statement_from_invoice_view.xml b/addons/account_voucher/wizard/account_statement_from_invoice_view.xml
index 1da95285c24..1c0c00bd662 100644
--- a/addons/account_voucher/wizard/account_statement_from_invoice_view.xml
+++ b/addons/account_voucher/wizard/account_statement_from_invoice_view.xml
@@ -38,7 +38,7 @@