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

Proposed by Luis Escobar V. (Vauxoo)
Status: Merged
Merged at revision: 560
Proposed branch: lp:~vauxoo/openerp-venezuela-localization/luiseev_fiscal_requeriments
Merge into: lp:~openerp-venezuela/openerp-venezuela-localization/6.0-trunk
Diff against target: 116 lines (+41/-42)
3 files modified
l10n_ve_fiscal_requirements/wizard/account_invoice_refund.py (+3/-42)
l10n_ve_withholding_islr/invoice.py (+18/-0)
l10n_ve_withholding_iva/model/invoice.py (+20/-0)
To merge this branch: bzr merge lp:~vauxoo/openerp-venezuela-localization/luiseev_fiscal_requeriments
Reviewer Review Type Date Requested Status
Gabriela Quilarque Pending
Review via email: mp+89976@code.launchpad.net

Description of the change

[IMP] Move funtionality from invoice refund to invoice 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_fiscal_requirements/wizard/account_invoice_refund.py'
--- l10n_ve_fiscal_requirements/wizard/account_invoice_refund.py 2012-01-24 17:29:26 +0000
+++ l10n_ve_fiscal_requirements/wizard/account_invoice_refund.py 2012-01-24 18:55:29 +0000
@@ -253,49 +253,10 @@
253 return False253 return False
254 return True254 return True
255255
256 def validate_wh_iva_done(self, cr, uid, ids, context=None):
257 """
258 Method that check if wh vat is validated in invoice refund.
259
260 return: True: the wh vat is validated.
261 False: the wh vat is not validated.
262 """
263 inv_obj = self.pool.get('account.invoice')
264 for inv in inv_obj.browse(cr, uid, context.get('active_ids'), context=context):
265 if inv.type in ('out_invoice', 'out_refund') and not inv.islr_wh_doc_id:
266 rislr = True
267 else:
268 rislr = not inv.islr_wh_doc_id and True or \
269 inv.islr_wh_doc_id.state in ('done') and True or False
270 if not rislr:
271 raise osv.except_osv(_('Error !'), \
272 _('The Document you are trying to refund has a income withholding "%s" which is not yet validated!' % inv.islr_wh_doc_id.code ))
273 return False
274 return True
275
276 def validate_wh_income_done(self, cr, uid, ids, context=None):
277 """
278 Method that check if wh income is validated in invoice refund.
279
280 return: True: the wh income is validated.
281 False: the wh income is not validated.
282 """
283 inv_obj = self.pool.get('account.invoice')
284 for inv in inv_obj.browse(cr, uid, context.get('active_ids'), context=context):
285 if inv.type in ('out_invoice', 'out_refund') and not inv.wh_iva_id:
286 riva = True
287 else:
288 riva = not inv.wh_iva_id and True or \
289 inv.wh_iva_id.state in ('done') and True or False
290 if not riva:
291 raise osv.except_osv(_('Error !'), \
292 _('The withholding VAT "%s" is not validated!' % inv.wh_iva_id.code ))
293 return False
294 return True
295
296 def invoice_refund(self, cr, uid, ids, context=None):256 def invoice_refund(self, cr, uid, ids, context=None):
297 self.validate_wh_iva_done(cr, uid, ids, context=context)257 inv_obj = self.pool.get('account.invoice')
298 self.validate_wh_income_done(cr, uid, ids, context=context)258 inv_obj.validate_wh_iva_done(cr, uid, context.get('active_ids'), context=context)
259 inv_obj.validate_wh_income_done(cr, uid, context.get('active_ids'), context=context)
299 data_refund = self.read(cr, uid, ids, [],context=context)[0]['filter_refund']260 data_refund = self.read(cr, uid, ids, [],context=context)[0]['filter_refund']
300 return self.compute_refund(cr, uid, ids, data_refund, context=context)261 return self.compute_refund(cr, uid, ids, data_refund, context=context)
301262
302263
=== modified file 'l10n_ve_withholding_islr/invoice.py'
--- l10n_ve_withholding_islr/invoice.py 2012-01-19 14:04:28 +0000
+++ l10n_ve_withholding_islr/invoice.py 2012-01-24 18:55:29 +0000
@@ -667,6 +667,24 @@
667 return True 667 return True
668 return False668 return False
669669
670 def validate_wh_income_done(self, cr, uid, ids, context=None):
671 """
672 Method that check if wh income is validated in invoice refund.
673 @params: ids: list of invoices.
674 return: True: the wh income is validated.
675 False: the wh income is not validated.
676 """
677 for inv in self.browse(cr, uid, ids, context=context):
678 if inv.type in ('out_invoice', 'out_refund') and not inv.islr_wh_doc_id:
679 rislr = True
680 else:
681 rislr = not inv.islr_wh_doc_id and True or inv.islr_wh_doc_id.state in ('done') and True or False
682 if not rislr:
683 raise osv.except_osv(_('Error !'), \
684 _('The Document you are trying to refund has a income withholding "%s" which is not yet validated!' % inv.islr_wh_doc_id.code ))
685 return False
686 return True
687
670account_invoice()688account_invoice()
671689
672690
673691
=== modified file 'l10n_ve_withholding_iva/model/invoice.py'
--- l10n_ve_withholding_iva/model/invoice.py 2012-01-19 17:33:24 +0000
+++ l10n_ve_withholding_iva/model/invoice.py 2012-01-24 18:55:29 +0000
@@ -271,6 +271,26 @@
271 }))271 }))
272 272
273 return res273 return res
274
275 def validate_wh_iva_done(self, cr, uid, ids, context=None):
276 """
277 Method that check if wh vat is validated in invoice refund.
278 @params: ids: list of invoices.
279 return: True: the wh vat is validated.
280 False: the wh vat is not validated.
281 """
282 for inv in self.browse(cr, uid, ids, context=context):
283 if inv.type in ('out_invoice', 'out_refund') and not inv.wh_iva_id:
284 riva = True
285 else:
286 riva = not inv.wh_iva_id and True or inv.wh_iva_id.state in ('done') and True or False
287 if not riva:
288 raise osv.except_osv(_('Error !'), \
289 _('The withholding VAT "%s" is not validated!' % inv.wh_iva_id.code ))
290 return False
291 return True
292
293
274account_invoice()294account_invoice()
275295
276class account_invoice_tax(osv.osv):296class account_invoice_tax(osv.osv):