Merge lp:~vauxoo/openerp-venezuela-localization/miguel-update-partner-info-seniat into lp:~openerp-venezuela/openerp-venezuela-localization/6.0-trunk

Proposed by Miguel Delgado (Vauxoo)
Status: Merged
Merged at revision: 407
Proposed branch: lp:~vauxoo/openerp-venezuela-localization/miguel-update-partner-info-seniat
Merge into: lp:~openerp-venezuela/openerp-venezuela-localization/6.0-trunk
Diff against target: 209 lines (+123/-7)
7 files modified
l10n_ve_fiscal_requirements/wizard/wizard_invoice_nro_ctrl_view.xml (+1/-1)
l10n_ve_withholding_iva/__init__.py (+1/-0)
l10n_ve_withholding_iva/__openerp__.py (+1/-0)
l10n_ve_withholding_iva/partner.py (+23/-6)
l10n_ve_withholding_iva/wizard/__init__.py (+22/-0)
l10n_ve_withholding_iva/wizard/update_info_partner.py (+40/-0)
l10n_ve_withholding_iva/wizard/update_info_partner.xml (+35/-0)
To merge this branch: bzr merge lp:~vauxoo/openerp-venezuela-localization/miguel-update-partner-info-seniat
Reviewer Review Type Date Requested Status
Nhomar - Vauxoo Pending
Review via email: mp+78166@code.launchpad.net

Description of the change

add a wizard to update automatically the fiscal information about all partners
Security was added only if the user belongs to the group account manager could update the information from partners

To post a comment you must log in.
406. By Miguel Delgado (Vauxoo)

 [IMP] the wizard method to update the partners information for automatically close windows when the method ends

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/wizard_invoice_nro_ctrl_view.xml'
2--- l10n_ve_fiscal_requirements/wizard/wizard_invoice_nro_ctrl_view.xml 2011-10-04 02:28:58 +0000
3+++ l10n_ve_fiscal_requirements/wizard/wizard_invoice_nro_ctrl_view.xml 2011-10-04 22:14:42 +0000
4@@ -12,7 +12,7 @@
5 <field name="sure"/>
6 <group colspan="8" col="8">
7 <button icon="gtk-cancel" special="cancel" string="Cancel"/>
8- <button icon="gtk-ok" name="create_invoice" string="Create Invoice" type="object"/>
9+ <button icon="gtk-ok" name="shbda" string="Create Invoice" type="object"/>
10 </group>
11 </form>
12 </field>
13
14=== modified file 'l10n_ve_withholding_iva/__init__.py'
15--- l10n_ve_withholding_iva/__init__.py 2011-10-03 16:12:23 +0000
16+++ l10n_ve_withholding_iva/__init__.py 2011-10-04 22:14:42 +0000
17@@ -26,5 +26,6 @@
18 import report
19 import res_company
20 import installer
21+import wizard
22
23 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
24
25=== modified file 'l10n_ve_withholding_iva/__openerp__.py'
26--- l10n_ve_withholding_iva/__openerp__.py 2011-10-03 16:12:23 +0000
27+++ l10n_ve_withholding_iva/__openerp__.py 2011-10-04 22:14:42 +0000
28@@ -47,6 +47,7 @@
29 "account_workflow.xml",
30 "l10n_ve_withholding_iva_installer.xml",
31 "account_workflow.xml",
32+ "wizard/update_info_partner.xml",
33 ],
34 'demo_xml': ["demo/l10n_ve_withholding_iva_demo.xml"],
35 'test': [],
36
37=== modified file 'l10n_ve_withholding_iva/partner.py'
38--- l10n_ve_withholding_iva/partner.py 2011-10-03 14:27:38 +0000
39+++ l10n_ve_withholding_iva/partner.py 2011-10-04 22:14:42 +0000
40@@ -103,25 +103,42 @@
41 if xml_data.find('450')>=0:
42 if not 'all_rif' in context:
43 self._print_error(_('Vat Error !'),_('Invalid VAT!'))
44+ else:
45+ return True
46
47 if xml_data.find('452')>=0:
48 if not 'all_rif' in context:
49 self._print_error(_('Vat Error !'),_('Unregistered VAT!'))
50+ else:
51+ return True
52
53 if xml_data.find("404")>=0:
54 if not 'all_rif' in context:
55 self._print_error(_('No Connection !'),_("Could not connect! Check the URL "))
56+ else:
57+ return True
58
59 def update_rif(self, cr, uid, ids, context={}):
60 print 'entando update'
61 for partner in self.browse(cr,uid,ids):
62 url1=partner.company_id.url_seniat1_company+'%s'
63 url2=partner.company_id.url_seniat2_company+'%s'
64- xml_data = self._load_url(3,url1 %partner.vat[2:])
65- self._eval_seniat_data(xml_data,context)
66- print 'xml_data',xml_data
67- dom = parseString(xml_data)
68- self.write(cr,uid,partner.id,self._parse_dom(dom,partner.vat[2:],url2))
69+ print "URL1",url1
70+ print "URL2",url2
71+ if partner.vat:
72+ xml_data = self._load_url(3,url1 %partner.vat[2:])
73+ print self._eval_seniat_data(xml_data,context)
74+ if not self._eval_seniat_data(xml_data,context):
75+ print "entro en el if"
76+ print 'xml_data',xml_data
77+ dom = parseString(xml_data)
78+ self.write(cr,uid,partner.id,self._parse_dom(dom,partner.vat[2:],url2))
79+ else:
80+ print "entro en el else"
81+ return False
82+ else:
83+ if not 'all_rif' in context:
84+ self._print_error(_('Vat Error !'),_('The field vat is empty'))
85 return True
86
87 def connect_seniat(self, cr, uid, ids, context={}, all_rif=False):
88@@ -129,7 +146,7 @@
89 ctx = context.copy()
90 ctx.update({'all_rif': True})
91 for partner in self.browse(cr,uid,ids):
92- self. update_rif(cr, uid, [partner.id], context=ctx)
93+ self.update_rif(cr, uid, [partner.id], context=ctx)
94
95 return True
96
97
98=== added directory 'l10n_ve_withholding_iva/wizard'
99=== added file 'l10n_ve_withholding_iva/wizard/__init__.py'
100--- l10n_ve_withholding_iva/wizard/__init__.py 1970-01-01 00:00:00 +0000
101+++ l10n_ve_withholding_iva/wizard/__init__.py 2011-10-04 22:14:42 +0000
102@@ -0,0 +1,22 @@
103+# -*- encoding: utf-8 -*-
104+##############################################################################
105+#
106+# OpenERP, Open Source Management Solution
107+# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
108+# author.name@company.com
109+#
110+# This program is free software: you can redistribute it and/or modify
111+# it under the terms of the GNU General Public License as published by
112+# the Free Software Foundation, either version 3 of the License, or
113+# (at your option) any later version.
114+#
115+# This program is distributed in the hope that it will be useful,
116+# but WITHOUT ANY WARRANTY; without even the implied warranty of
117+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
118+# GNU General Public License for more details.
119+#
120+# You should have received a copy of the GNU General Public License
121+# along with this program. If not, see <http://www.gnu.org/licenses/>.
122+#
123+##############################################################################
124+import update_info_partner
125
126=== added file 'l10n_ve_withholding_iva/wizard/update_info_partner.py'
127--- l10n_ve_withholding_iva/wizard/update_info_partner.py 1970-01-01 00:00:00 +0000
128+++ l10n_ve_withholding_iva/wizard/update_info_partner.py 2011-10-04 22:14:42 +0000
129@@ -0,0 +1,40 @@
130+# -*- encoding: utf-8 -*-
131+##############################################################################
132+#
133+# OpenERP, Open Source Management Solution
134+# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
135+# author.name@company.com
136+#
137+# This program is free software: you can redistribute it and/or modify
138+# it under the terms of the GNU General Public License as published by
139+# the Free Software Foundation, either version 3 of the License, or
140+# (at your option) any later version.
141+#
142+# This program is distributed in the hope that it will be useful,
143+# but WITHOUT ANY WARRANTY; without even the implied warranty of
144+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
145+# GNU General Public License for more details.
146+#
147+# You should have received a copy of the GNU General Public License
148+# along with this program. If not, see <http://www.gnu.org/licenses/>.
149+#
150+##############################################################################
151+import wizard
152+import pooler
153+from osv import osv, fields
154+from tools.translate import _
155+
156+class update_info_partner(osv.osv_memory):
157+ """
158+ OpenERP osv memory wizard : update_info_partner
159+ """
160+ _name = 'update.info.partner'
161+
162+ def update_info(self, cr, uid, ids, context={}):
163+ res_part_obj = self.pool.get('res.partner')
164+ es_partner_ids= res_part_obj.search(cr, uid, [])
165+ res_part_obj.connect_seniat(cr, uid, es_partner_ids, context,True)
166+ return{}
167+
168+
169+update_info_partner()
170
171=== added file 'l10n_ve_withholding_iva/wizard/update_info_partner.xml'
172--- l10n_ve_withholding_iva/wizard/update_info_partner.xml 1970-01-01 00:00:00 +0000
173+++ l10n_ve_withholding_iva/wizard/update_info_partner.xml 2011-10-04 22:14:42 +0000
174@@ -0,0 +1,35 @@
175+<?xml version="1.0" encoding="utf-8"?>
176+<openerp>
177+ <data>
178+
179+ <menuitem id="menu_finance_partner_fiscal_information" name="Partner Fiscal Information" parent="account.menu_finance" groups="account.group_account_manager"/>
180+
181+ <record id="view_wizard_update_info_partner" model="ir.ui.view">
182+ <field name="name">view.update.info.partner</field>
183+ <field name="model">update.info.partner</field>
184+ <field name="type">form</field>
185+ <field name="arch" type="xml">
186+ <form string="">
187+ <separator string="Are you sure you want to do this?" colspan="4"/>
188+ <group colspan="8" col="8">
189+ <button icon="gtk-ok" name="update_info" type="object" string="Yes"/>
190+ <button icon="gtk-cancel" special="cancel" string="No"/>
191+ </group>
192+ </form>
193+ </field>
194+ </record>
195+
196+ <record id="wizard_update_info_partner" model="ir.actions.act_window">
197+ <field name="name">Update Info Partner</field>
198+ <field name="res_model">update.info.partner</field>
199+ <field name="view_type">form</field>
200+ <field name="view_mode">form</field>
201+ <field name="view_id" ref="view_wizard_update_info_partner"/>
202+ <field name="target">new</field>
203+ </record>
204+
205+ <menuitem name="Update All Partner Information" id="wizard_update_all_partner_information"
206+ parent="menu_finance_partner_fiscal_information" action="wizard_update_info_partner"
207+ />
208+ </data>
209+</openerp>