~vauxoo/addons-vauxoo/6.0-trunk

« back to all changes in this revision

Viewing changes to account_voucher_tax/account_voucher.py

[MERGE] modified function write to validated field invoice_date_tz and validate round in debit/credit field

Show diffs side-by-side

added added

removed removed

Lines of Context:
535
535
        res_round = {}
536
536
        res_without_round = {}
537
537
        res_ids = {}
 
538
        object_dp = self.pool.get('decimal.precision')
 
539
        round_val = object_dp.precision_get(cr, uid, 'Account')
538
540
 
539
541
        for val_round in dat:
540
542
            res_round.setdefault(val_round['account_id'], 0)
541
543
            res_without_round.setdefault(val_round['account_id'], 0)
542
544
            res_ids.setdefault(val_round['account_id'], 0)
543
 
            res_round[val_round['account_id']] += val_round['round']
 
545
            res_round[val_round['account_id']] += round(val_round['round'], round_val)
544
546
            res_without_round[val_round['account_id']] += val_round['without']
545
547
            res_ids[val_round['account_id']] = val_round['id']
546
548
        for res_diff_id in res_round.items():
547
549
            diff_val = abs(res_without_round[res_diff_id[0]]) - abs(res_round[res_diff_id[0]])
548
 
            diff_val = round(diff_val, 2)
 
550
            diff_val = round(diff_val, round_val)
549
551
            if diff_val != 0.00:
550
552
                move_diff_id = [res_ids[res_diff_id[0]]]
551
553
                for move in self.browse(cr, uid, move_diff_id, context=context):