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
=== modified file 'l10n_ve_withholding_iva/model/wh_iva.py'
--- l10n_ve_withholding_iva/model/wh_iva.py 2012-01-18 19:59:37 +0000
+++ l10n_ve_withholding_iva/model/wh_iva.py 2012-01-19 01:37:24 +0000
@@ -268,6 +268,7 @@
268 if context is None: context = {}268 if context is None: context = {}
269 res = {}269 res = {}
270 note = _('Taxes in the following invoices have been miscalculated\n\n')270 note = _('Taxes in the following invoices have been miscalculated\n\n')
271 error_msg = ''
271 for wh_line in self.browse(cr,uid, ids[0]).wh_lines:272 for wh_line in self.browse(cr,uid, ids[0]).wh_lines:
272 for tax in wh_line.tax_line:273 for tax in wh_line.tax_line:
273 if not self._get_valid_wh(cr, uid, tax.amount_ret, tax.amount, tax.wh_vat_line_id.wh_iva_rate, context=context):274 if not self._get_valid_wh(cr, uid, tax.amount_ret, tax.amount, tax.wh_vat_line_id.wh_iva_rate, context=context):
@@ -275,8 +276,13 @@
275 note += _('\tInvoice: %s, %s, %s\n')%(wh_line.invoice_id.name,wh_line.invoice_id.number,wh_line.invoice_id.reference or '/')276 note += _('\tInvoice: %s, %s, %s\n')%(wh_line.invoice_id.name,wh_line.invoice_id.number,wh_line.invoice_id.reference or '/')
276 res[wh_line.id] = True277 res[wh_line.id] = True
277 note += '\t\t%s\n'%tax.name278 note += '\t\t%s\n'%tax.name
278 if res:279 if tax.amount_ret > tax.amount:
280 porcent='%'
281 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)
282 if res and self.browse(cr,uid, ids[0]).type=='in_invoice':
279 raise osv.except_osv(_('Miscalculated Withheld Taxes'),note)283 raise osv.except_osv(_('Miscalculated Withheld Taxes'),note)
284 elif error_msg:
285 raise osv.except_osv(_('Invalid action !'),error_msg)
280 return True286 return True
281287
282 def check_vat_wh(self, cr, uid, ids, context={}):288 def check_vat_wh(self, cr, uid, ids, context={}):