account, base: fix rounding for reconcile

Add new method on res.currency to check if a amount of currency must be
considered as zero in regards of the definition of the currency.

bzr revid: ced-deffca6a9bc83dbe4663737fb5bc68296dbe5ff3
This commit is contained in:
ced
2007-07-30 13:35:11 +00:00
parent e85779bb19
commit c63d065d75
2 changed files with 5 additions and 3 deletions
+3 -2
View File
@@ -293,11 +293,12 @@ class account_move_line(osv.osv):
#TODO: move this check to a constraint in the account_move_reconcile object
if len(r) != 1:
raise osv.except_osv('Error', 'Entries are not of the same account or already reconciled ! ')
if not self.pool.get('account.account').read(cr, uid, [account_id], ['reconcile'], context=context)[0]['reconcile']:
account = self.pool.get('account.account').browse(cr, uid, account_id, context=context)
if not account.reconcile:
raise osv.except_osv('Error', 'The account is not defined to be reconcile !')
if r[0][1] != None:
raise Exception('Some entries are already reconciled !')
if writeoff != 0:
if self.pool.get('res.currency').is_zero(cr, uid, account.company_id.currency_id, writeoff):
if not writeoff_acc_id:
raise osv.except_osv('Warning', 'You have to provide an account for the write off entry !')
if writeoff > 0:
+2 -1
View File
@@ -63,7 +63,8 @@ def _trans_reconcile(self, cr, uid, data, context):
def _wo_check(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
invoice = pool.get('account.invoice').browse(cr, uid, data['id'], context)
if round(data['form']['amount'], 2) == round(invoice.amount_total, 2):
if pool.get('res.currency').is_zero(cr, uid, invoice.currency_id,
(data['form']['amount'] - invoice.amount_total)):
return 'reconcile'
return 'addendum'