Merge lp:~vauxoo/openerp-venezuela-localization/gaby_l10n_ve_withholding_iva into lp:~openerp-venezuela/openerp-venezuela-localization/6.0-trunk

Proposed by Gabriela Quilarque
Status: Merged
Merged at revision: 550
Proposed branch: lp:~vauxoo/openerp-venezuela-localization/gaby_l10n_ve_withholding_iva
Merge into: lp:~openerp-venezuela/openerp-venezuela-localization/6.0-trunk
Diff against target: 26 lines (+7/-1)
1 file modified
l10n_ve_withholding_iva/model/wh_iva.py (+7/-1)
To merge this branch: bzr merge lp:~vauxoo/openerp-venezuela-localization/gaby_l10n_ve_withholding_iva
Reviewer Review Type Date Requested Status
Nhomar - Vauxoo Pending
Gabriela Quilarque Pending
Review via email: mp+89180@code.launchpad.net

Description of the change

 Added validation for determine if amount withheld is less than amount tax in l10n_ve_withholding_iva module.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'l10n_ve_withholding_iva/model/wh_iva.py'
2--- l10n_ve_withholding_iva/model/wh_iva.py 2012-01-18 19:59:37 +0000
3+++ l10n_ve_withholding_iva/model/wh_iva.py 2012-01-19 01:37:24 +0000
4@@ -268,6 +268,7 @@
5 if context is None: context = {}
6 res = {}
7 note = _('Taxes in the following invoices have been miscalculated\n\n')
8+ error_msg = ''
9 for wh_line in self.browse(cr,uid, ids[0]).wh_lines:
10 for tax in wh_line.tax_line:
11 if not self._get_valid_wh(cr, uid, tax.amount_ret, tax.amount, tax.wh_vat_line_id.wh_iva_rate, context=context):
12@@ -275,8 +276,13 @@
13 note += _('\tInvoice: %s, %s, %s\n')%(wh_line.invoice_id.name,wh_line.invoice_id.number,wh_line.invoice_id.reference or '/')
14 res[wh_line.id] = True
15 note += '\t\t%s\n'%tax.name
16- if res:
17+ if tax.amount_ret > tax.amount:
18+ porcent='%'
19+ error_msg +=_("The withheld amount: %s(%s%s), must be less than tax amount %s(%s%s).")%(tax.amount_ret,wh_line.wh_iva_rate,porcent,tax.amount,tax.amount*100,porcent)
20+ if res and self.browse(cr,uid, ids[0]).type=='in_invoice':
21 raise osv.except_osv(_('Miscalculated Withheld Taxes'),note)
22+ elif error_msg:
23+ raise osv.except_osv(_('Invalid action !'),error_msg)
24 return True
25
26 def check_vat_wh(self, cr, uid, ids, context={}):