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
1=== modified file 'l10n_ve_fiscal_requirements/wizard/account_invoice_refund.py'
2--- l10n_ve_fiscal_requirements/wizard/account_invoice_refund.py 2012-01-24 17:29:26 +0000
3+++ l10n_ve_fiscal_requirements/wizard/account_invoice_refund.py 2012-01-24 18:55:29 +0000
4@@ -253,49 +253,10 @@
5 return False
6 return True
7
8- def validate_wh_iva_done(self, cr, uid, ids, context=None):
9- """
10- Method that check if wh vat is validated in invoice refund.
11-
12- return: True: the wh vat is validated.
13- False: the wh vat is not validated.
14- """
15- inv_obj = self.pool.get('account.invoice')
16- for inv in inv_obj.browse(cr, uid, context.get('active_ids'), context=context):
17- if inv.type in ('out_invoice', 'out_refund') and not inv.islr_wh_doc_id:
18- rislr = True
19- else:
20- rislr = not inv.islr_wh_doc_id and True or \
21- inv.islr_wh_doc_id.state in ('done') and True or False
22- if not rislr:
23- raise osv.except_osv(_('Error !'), \
24- _('The Document you are trying to refund has a income withholding "%s" which is not yet validated!' % inv.islr_wh_doc_id.code ))
25- return False
26- return True
27-
28- def validate_wh_income_done(self, cr, uid, ids, context=None):
29- """
30- Method that check if wh income is validated in invoice refund.
31-
32- return: True: the wh income is validated.
33- False: the wh income is not validated.
34- """
35- inv_obj = self.pool.get('account.invoice')
36- for inv in inv_obj.browse(cr, uid, context.get('active_ids'), context=context):
37- if inv.type in ('out_invoice', 'out_refund') and not inv.wh_iva_id:
38- riva = True
39- else:
40- riva = not inv.wh_iva_id and True or \
41- inv.wh_iva_id.state in ('done') and True or False
42- if not riva:
43- raise osv.except_osv(_('Error !'), \
44- _('The withholding VAT "%s" is not validated!' % inv.wh_iva_id.code ))
45- return False
46- return True
47-
48 def invoice_refund(self, cr, uid, ids, context=None):
49- self.validate_wh_iva_done(cr, uid, ids, context=context)
50- self.validate_wh_income_done(cr, uid, ids, context=context)
51+ inv_obj = self.pool.get('account.invoice')
52+ inv_obj.validate_wh_iva_done(cr, uid, context.get('active_ids'), context=context)
53+ inv_obj.validate_wh_income_done(cr, uid, context.get('active_ids'), context=context)
54 data_refund = self.read(cr, uid, ids, [],context=context)[0]['filter_refund']
55 return self.compute_refund(cr, uid, ids, data_refund, context=context)
56
57
58=== modified file 'l10n_ve_withholding_islr/invoice.py'
59--- l10n_ve_withholding_islr/invoice.py 2012-01-19 14:04:28 +0000
60+++ l10n_ve_withholding_islr/invoice.py 2012-01-24 18:55:29 +0000
61@@ -667,6 +667,24 @@
62 return True
63 return False
64
65+ def validate_wh_income_done(self, cr, uid, ids, context=None):
66+ """
67+ Method that check if wh income is validated in invoice refund.
68+ @params: ids: list of invoices.
69+ return: True: the wh income is validated.
70+ False: the wh income is not validated.
71+ """
72+ for inv in self.browse(cr, uid, ids, context=context):
73+ if inv.type in ('out_invoice', 'out_refund') and not inv.islr_wh_doc_id:
74+ rislr = True
75+ else:
76+ rislr = not inv.islr_wh_doc_id and True or inv.islr_wh_doc_id.state in ('done') and True or False
77+ if not rislr:
78+ raise osv.except_osv(_('Error !'), \
79+ _('The Document you are trying to refund has a income withholding "%s" which is not yet validated!' % inv.islr_wh_doc_id.code ))
80+ return False
81+ return True
82+
83 account_invoice()
84
85
86
87=== modified file 'l10n_ve_withholding_iva/model/invoice.py'
88--- l10n_ve_withholding_iva/model/invoice.py 2012-01-19 17:33:24 +0000
89+++ l10n_ve_withholding_iva/model/invoice.py 2012-01-24 18:55:29 +0000
90@@ -271,6 +271,26 @@
91 }))
92
93 return res
94+
95+ def validate_wh_iva_done(self, cr, uid, ids, context=None):
96+ """
97+ Method that check if wh vat is validated in invoice refund.
98+ @params: ids: list of invoices.
99+ return: True: the wh vat is validated.
100+ False: the wh vat is not validated.
101+ """
102+ for inv in self.browse(cr, uid, ids, context=context):
103+ if inv.type in ('out_invoice', 'out_refund') and not inv.wh_iva_id:
104+ riva = True
105+ else:
106+ riva = not inv.wh_iva_id and True or inv.wh_iva_id.state in ('done') and True or False
107+ if not riva:
108+ raise osv.except_osv(_('Error !'), \
109+ _('The withholding VAT "%s" is not validated!' % inv.wh_iva_id.code ))
110+ return False
111+ return True
112+
113+
114 account_invoice()
115
116 class account_invoice_tax(osv.osv):