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
1=== modified file 'l10n_ve_fiscal_requirements/__openerp__.py'
2--- l10n_ve_fiscal_requirements/__openerp__.py 2011-10-25 20:33:16 +0000
3+++ l10n_ve_fiscal_requirements/__openerp__.py 2011-11-03 19:27:23 +0000
4@@ -38,6 +38,8 @@
5 Automatically on install wizard.
6 - Damaged "Legal free forms" declaration.
7 - Tax Units configuration.
8+ - When a partner is updated by using the SENIAT Update Button, its name changes to
9+ readonly to avoid manual changes.
10 ---------------------------------------------------------------------------
11 For damaged invoices (Free form formats), you must go to the company and, under the configuration section,
12 create the corresponding journal and account.
13
14=== modified file 'l10n_ve_fiscal_requirements/partner.py'
15--- l10n_ve_fiscal_requirements/partner.py 2011-11-01 13:42:22 +0000
16+++ l10n_ve_fiscal_requirements/partner.py 2011-11-03 19:27:23 +0000
17@@ -65,8 +65,14 @@
18 class res_partner(osv.osv):
19 _inherit = 'res.partner'
20 logger = netsvc.Logger()
21+
22 _columns = {
23- 'vat_apply': fields.boolean('Vat Apply', help="This field indicate if partner is subject to vat apply "),
24+ 'vat_apply': fields.boolean('Vat Apply', help="This field indicate if partner is subject to vat apply "),
25+ 'seniat_updated': fields.boolean('Seniat Updated', help="This field indicates if partner was updated using SENIAT button"),
26+ }
27+
28+ _default = {
29+ 'seniat_updated': False,
30 }
31
32 '''
33@@ -192,19 +198,29 @@
34 else:
35 return False
36
37+ def _update_partner(self, cr, uid, ids, context=None):
38+ self.write(cr, uid, ids, {'seniat_updated': True})
39+
40 def update_rif(self, cr, uid, ids, context={}):
41 pool = self.pool.get('seniat.url')
42 url_obj = pool.browse(cr, uid, pool.search(cr, uid, []))[0]
43 url1 = url_obj.name + '%s'
44 url2 = url_obj.url_seniat + '%s'
45 if context.get('exec_wizard'):
46- return self._dom_giver(url1, url2, context, context['vat'])
47+ res = self._dom_giver(url1, url2, context, context['vat'])
48+ if res:
49+ self._update_partner(cr, uid, ids, context)
50+ return res
51+ else:
52+ return False
53 for partner in self.browse(cr,uid,ids):
54 if partner.vat:
55 xml_data = self._load_url(3,url1 %partner.vat[2:])
56 if not self._eval_seniat_data(xml_data,context):
57 dom = parseString(xml_data)
58- self.write(cr,uid,partner.id,self._parse_dom(dom,partner.vat[2:],url2))
59+ res = self.write(cr,uid,partner.id,self._parse_dom(dom,partner.vat[2:],url2))
60+ if res:
61+ self._update_partner(cr, uid, ids, context)
62 else:
63 return False
64 else:
65
66=== modified file 'l10n_ve_fiscal_requirements/view/partner_view.xml'
67--- l10n_ve_fiscal_requirements/view/partner_view.xml 2011-10-25 20:33:16 +0000
68+++ l10n_ve_fiscal_requirements/view/partner_view.xml 2011-11-03 19:27:23 +0000
69@@ -26,5 +26,17 @@
70 </field>
71 </record>
72
73+ <record id="view_partner_form4" model="ir.ui.view">
74+ <field name="name">res.partner.vat.inherit4</field>
75+ <field name="model">res.partner</field>
76+ <field name="inherit_id" ref="base_vat.view_partner_form"/>
77+ <field name="arch" type="xml">
78+ <field name="name" position="replace">
79+ <field name="seniat_updated" invisible="1" />
80+ <field name="name" attrs="{'readonly': [('seniat_updated', '!=', False)]}" />
81+ </field>
82+ </field>
83+ </record>
84+
85 </data>
86 </openerp>