~vauxoo/openerp-venezuela-localization/sprint_global_javi

« back to all changes in this revision

Viewing changes to l10n_ve_withholding_islr/product.py

  • Committer: Javier Duran
  • Author(s): javier at vauxoo
  • Date: 2012-03-30 19:20:23 UTC
  • Revision ID: javier@squezee-vir-20120330192023-1zo2a9nh76l7fwdh
[IMP] Se agrega método onchange y grupos en la vista al campo type del prodcuto, en el modulo l10n_ve_withholding_islr

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
        'concept_id': fields.many2one('islr.wh.concept','Withhold  Concept',help="Concept Withholding Income to apply to the service", required=False),
41
41
    }
42
42
 
 
43
    def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
 
44
        res = super(product_template, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
 
45
        partner_pool = self.pool.get('res.partner')
 
46
 
 
47
        if view_type == 'form':
 
48
            partner_obj = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.partner_id
 
49
            country_obj = partner_pool.get_country_fiscal(cr, uid, partner_obj.id)
 
50
            if country_obj and country_obj.name == 'Venezuela':
 
51
                doc = etree.XML(res['arch'])
 
52
                nodes = doc.xpath("//field[@name='type']")
 
53
                for node in nodes:
 
54
                    node.set('on_change', "onchange_product_type(type)")
 
55
                    node.set('groups', "l10n_ve_withholding_islr.group_acc_wh_islr_manager,l10n_ve_withholding_islr.group_acc_wh_islr_user")
 
56
                res['arch'] = etree.tostring(doc)
 
57
        return res
 
58
 
43
59
product_template()
44
60
 
45
61