Merge lp:~vauxoo/openerp-venezuela-localization/miguel-l10n-ve-wh-iva into lp:~openerp-venezuela/openerp-venezuela-localization/6.0-trunk

Proposed by Miguel Delgado (Vauxoo)
Status: Merged
Merged at revision: 440
Proposed branch: lp:~vauxoo/openerp-venezuela-localization/miguel-l10n-ve-wh-iva
Merge into: lp:~openerp-venezuela/openerp-venezuela-localization/6.0-trunk
Diff against target: 100 lines (+22/-15)
4 files modified
l10n_ve_withholding_iva/invoice.py (+8/-2)
l10n_ve_withholding_iva/security/wh_iva_security.xml (+0/-1)
l10n_ve_withholding_iva/wh_iva.py (+11/-10)
l10n_ve_withholding_iva/wh_iva_view.xml (+3/-2)
To merge this branch: bzr merge lp:~vauxoo/openerp-venezuela-localization/miguel-l10n-ve-wh-iva
Reviewer Review Type Date Requested Status
Javier Duran (community) Approve
Miguel Delgado (Vauxoo) (community) Needs Resubmitting
Review via email: mp+79567@code.launchpad.net

Description of the change

[ADD] the copy method to copy the supplier invoice without wh_iva_id
[ADD] a method to verify if the amount is greater than the tax
[IMP] change the fields name for form view

To post a comment you must log in.
Revision history for this message
Javier Duran (javieredm) wrote :

Se esta presentando un error en la línea 324, revisar

review: Needs Fixing
440. By Miguel Delgado (Vauxoo)

[IMP] the logic to calculate the withholding amount

Revision history for this message
Miguel Delgado (Vauxoo) (miguel-delgado07) wrote :

El error ha sido corregido satisfactoriamente.

review: Needs Resubmitting
Revision history for this message
Javier Duran (javieredm) wrote :

Merged en el trunk:

revno: 440 [merge]
revision-id: javier@squezee-vir-20111017175208-snkylelbltfvr8x7

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'l10n_ve_withholding_iva/invoice.py'
2--- l10n_ve_withholding_iva/invoice.py 2011-10-03 02:58:44 +0000
3+++ l10n_ve_withholding_iva/invoice.py 2011-10-17 17:26:26 +0000
4@@ -93,8 +93,14 @@
5 partner = self.pool.get('res.partner').browse(cr, uid,partner_id)
6 vals['wh_iva_rate'] = partner.wh_iva_rate
7 return super(account_invoice, self).create(cr, uid, vals, context)
8-
9-
10+
11+ def copy(self, cr, uid, id, default=None, context=None):
12+ if default is None:
13+ default = {}
14+ default = default.copy()
15+ default.update({'wh_iva_id':False})
16+ return super(account_invoice, self).copy(cr, uid, id, default, context)
17+
18 def test_retenida(self, cr, uid, ids, *args):
19 type2journal = {'out_invoice': 'iva_sale', 'in_invoice': 'iva_purchase', 'out_refund': 'iva_sale', 'in_refund': 'iva_purchase'}
20 type_inv = self.browse(cr, uid, ids[0]).type
21
22=== modified file 'l10n_ve_withholding_iva/security/wh_iva_security.xml'
23--- l10n_ve_withholding_iva/security/wh_iva_security.xml 2011-09-09 20:25:27 +0000
24+++ l10n_ve_withholding_iva/security/wh_iva_security.xml 2011-10-17 17:26:26 +0000
25@@ -8,6 +8,5 @@
26 <record id="group_account_wh_iva_manager" model="res.groups">
27 <field name="name">Withhold VAT / Manager</field>
28 </record>
29-
30 </data>
31 </openerp>
32
33=== modified file 'l10n_ve_withholding_iva/wh_iva.py'
34--- l10n_ve_withholding_iva/wh_iva.py 2011-10-03 02:58:44 +0000
35+++ l10n_ve_withholding_iva/wh_iva.py 2011-10-17 17:26:26 +0000
36@@ -21,6 +21,7 @@
37
38 from osv import osv, fields
39 import time
40+from tools.translate import _
41 import decimal_precision as dp
42
43
44@@ -80,8 +81,8 @@
45 ('done','Done'),
46 ('cancel','Cancelled')
47 ],'State', readonly=True, help="Withholding State"),
48- 'date_ret': fields.date('Withholding date', readonly=True, states={'draft':[('readonly',False)]}, help="Keep empty to use the current date"),
49- 'date': fields.date('Date', readonly=True, states={'draft':[('readonly',False)]}, help="Date"),
50+ 'date_ret': fields.date('Accounting date', readonly=True, states={'draft':[('readonly',False)]}, help="Keep empty to use the current date"),
51+ 'date': fields.date('Voucher Date', readonly=True, states={'draft':[('readonly',False)]}, help="Date"),
52 'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done')], readonly=True, states={'draft':[('readonly',False)]}, help="Keep empty to use the period of the validation(Withholding date) date."),
53 'account_id': fields.many2one('account.account', 'Account', required=True, readonly=True, states={'draft':[('readonly',False)]}, help="The pay account used for this withholding."),
54 'partner_id': fields.many2one('res.partner', 'Partner', readonly=True, required=True, states={'draft':[('readonly',False)]}, help="Withholding customer/supplier"),
55@@ -317,14 +318,14 @@
56
57 return res
58
59-# def _retention_rate(self, cr, uid, ids, name, args, context=None):
60-# res = {}
61-# for ret_line in self.browse(cr, uid, ids, context=context):
62-# if ret_line.invoice_id:
63-# res[ret_line.id] = ret_line.invoice_id.p_ret
64-# else:
65-# res[ret_line.id] = 0.0
66-# return res
67+ def check_a_retention(self, cr, uid, ids, context=None):
68+ amount = 0.0
69+ for tax_line in self.browse(cr,uid, ids[0]).tax_line:
70+ amount+= tax_line.amount
71+ wh_vat_line=self.browse(cr, uid, ids, context)[0]
72+ if wh_vat_line.amount_base_wh > amount:
73+ raise osv.except_osv(_('Amount Error'),_('the amount is greater than the tax'))
74+ return True
75
76
77 _name = "account.wh.iva.line"
78
79=== modified file 'l10n_ve_withholding_iva/wh_iva_view.xml'
80--- l10n_ve_withholding_iva/wh_iva_view.xml 2011-10-03 21:26:50 +0000
81+++ l10n_ve_withholding_iva/wh_iva_view.xml 2011-10-17 17:26:26 +0000
82@@ -57,6 +57,7 @@
83 <field name="amount_base_wh"/>
84 <field name="amount_tax_wh"/>
85 </group>
86+ <button name="check_a_retention" string="Validate Amount Retention" type="object" icon="gtk-ok"/>
87 </page>
88 </notebook>
89 </form>
90@@ -155,8 +156,8 @@
91 <button colspan="2" name="compute_amount_wh" states="draft" string="Compute Withholding Vat" type="object" icon="terp-stock_format-scientific"/>
92 <field name="amount_base_ret"/>
93 <field name="total_tax_ret"/>
94- <field name="tot_amount_base_wh"/>
95- <field name="tot_amount_tax_wh"/>
96+ <field name="tot_amount_base_wh" groups='l10n_ve_withholding_iva.group_account_wh_iva_manager'/>
97+ <field name="tot_amount_tax_wh" groups='l10n_ve_withholding_iva.group_account_wh_iva_manager'/>
98 </group>
99 </page>
100 <page string="Other Information">