Merge lp:~vauxoo/openerp-venezuela-localization/israel_readonly-partner-name-on-seniat-update into lp:~openerp-venezuela/openerp-venezuela-localization/6.0-trunk

Proposed by Israel Fermin Montilla
Status: Merged
Merge reported by: Israel Fermin Montilla
Merged at revision: not available
Proposed branch: lp:~vauxoo/openerp-venezuela-localization/israel_readonly-partner-name-on-seniat-update
Merge into: lp:~openerp-venezuela/openerp-venezuela-localization/6.0-trunk
Diff against target: 86 lines (+33/-3)
3 files modified
l10n_ve_fiscal_requirements/__openerp__.py (+2/-0)
l10n_ve_fiscal_requirements/partner.py (+19/-3)
l10n_ve_fiscal_requirements/view/partner_view.xml (+12/-0)
To merge this branch: bzr merge lp:~vauxoo/openerp-venezuela-localization/israel_readonly-partner-name-on-seniat-update
Reviewer Review Type Date Requested Status
Nhomar - Vauxoo Pending
Review via email: mp+81192@code.launchpad.net

Description of the change

Added a new feature, more information can be found on related blueprint

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/__openerp__.py'
--- l10n_ve_fiscal_requirements/__openerp__.py 2011-10-25 20:33:16 +0000
+++ l10n_ve_fiscal_requirements/__openerp__.py 2011-11-03 19:27:23 +0000
@@ -38,6 +38,8 @@
38Automatically on install wizard.38Automatically on install wizard.
39 - Damaged "Legal free forms" declaration.39 - Damaged "Legal free forms" declaration.
40 - Tax Units configuration.40 - Tax Units configuration.
41 - When a partner is updated by using the SENIAT Update Button, its name changes to
42 readonly to avoid manual changes.
41 ---------------------------------------------------------------------------43 ---------------------------------------------------------------------------
42 For damaged invoices (Free form formats), you must go to the company and, under the configuration section,44 For damaged invoices (Free form formats), you must go to the company and, under the configuration section,
43 create the corresponding journal and account.45 create the corresponding journal and account.
4446
=== modified file 'l10n_ve_fiscal_requirements/partner.py'
--- l10n_ve_fiscal_requirements/partner.py 2011-11-01 13:42:22 +0000
+++ l10n_ve_fiscal_requirements/partner.py 2011-11-03 19:27:23 +0000
@@ -65,8 +65,14 @@
65class res_partner(osv.osv):65class res_partner(osv.osv):
66 _inherit = 'res.partner'66 _inherit = 'res.partner'
67 logger = netsvc.Logger()67 logger = netsvc.Logger()
68
68 _columns = {69 _columns = {
69 'vat_apply': fields.boolean('Vat Apply', help="This field indicate if partner is subject to vat apply "),70 'vat_apply': fields.boolean('Vat Apply', help="This field indicate if partner is subject to vat apply "),
71 'seniat_updated': fields.boolean('Seniat Updated', help="This field indicates if partner was updated using SENIAT button"),
72 }
73
74 _default = {
75 'seniat_updated': False,
70 }76 }
7177
72 '''78 '''
@@ -192,19 +198,29 @@
192 else:198 else:
193 return False199 return False
194200
201 def _update_partner(self, cr, uid, ids, context=None):
202 self.write(cr, uid, ids, {'seniat_updated': True})
203
195 def update_rif(self, cr, uid, ids, context={}):204 def update_rif(self, cr, uid, ids, context={}):
196 pool = self.pool.get('seniat.url')205 pool = self.pool.get('seniat.url')
197 url_obj = pool.browse(cr, uid, pool.search(cr, uid, []))[0]206 url_obj = pool.browse(cr, uid, pool.search(cr, uid, []))[0]
198 url1 = url_obj.name + '%s'207 url1 = url_obj.name + '%s'
199 url2 = url_obj.url_seniat + '%s'208 url2 = url_obj.url_seniat + '%s'
200 if context.get('exec_wizard'):209 if context.get('exec_wizard'):
201 return self._dom_giver(url1, url2, context, context['vat'])210 res = self._dom_giver(url1, url2, context, context['vat'])
211 if res:
212 self._update_partner(cr, uid, ids, context)
213 return res
214 else:
215 return False
202 for partner in self.browse(cr,uid,ids):216 for partner in self.browse(cr,uid,ids):
203 if partner.vat:217 if partner.vat:
204 xml_data = self._load_url(3,url1 %partner.vat[2:])218 xml_data = self._load_url(3,url1 %partner.vat[2:])
205 if not self._eval_seniat_data(xml_data,context):219 if not self._eval_seniat_data(xml_data,context):
206 dom = parseString(xml_data)220 dom = parseString(xml_data)
207 self.write(cr,uid,partner.id,self._parse_dom(dom,partner.vat[2:],url2))221 res = self.write(cr,uid,partner.id,self._parse_dom(dom,partner.vat[2:],url2))
222 if res:
223 self._update_partner(cr, uid, ids, context)
208 else:224 else:
209 return False225 return False
210 else:226 else:
211227
=== modified file 'l10n_ve_fiscal_requirements/view/partner_view.xml'
--- l10n_ve_fiscal_requirements/view/partner_view.xml 2011-10-25 20:33:16 +0000
+++ l10n_ve_fiscal_requirements/view/partner_view.xml 2011-11-03 19:27:23 +0000
@@ -26,5 +26,17 @@
26 </field>26 </field>
27 </record>27 </record>
2828
29 <record id="view_partner_form4" model="ir.ui.view">
30 <field name="name">res.partner.vat.inherit4</field>
31 <field name="model">res.partner</field>
32 <field name="inherit_id" ref="base_vat.view_partner_form"/>
33 <field name="arch" type="xml">
34 <field name="name" position="replace">
35 <field name="seniat_updated" invisible="1" />
36 <field name="name" attrs="{'readonly': [('seniat_updated', '!=', False)]}" />
37 </field>
38 </field>
39 </record>
40
29 </data>41 </data>
30</openerp>42</openerp>