[IMP] l10n_in: improve code in account_multi_chart_wizard_view.py add new onchange method
bzr revid: jap@tinyerp.com-20120522132119-0mwnk1ue8r2ct7q0
This commit is contained in:
parent
b4676557b4
commit
2808efa6fd
|
@ -30,19 +30,37 @@ class account_multi_charts_wizard(osv.osv_memory):
|
|||
'vat': fields.boolean('VAT resellers',help='If this field is true it allows you use VAT'),
|
||||
'service_tax': fields.boolean('Service tax', help='If this field is true it allows you use Service tax'),
|
||||
'excise_duty': fields.boolean('Excise duty', help='If this field is true it allows you use Excise duty'),
|
||||
'is_indian_chart': fields.boolean('Flag')
|
||||
}
|
||||
|
||||
def onchange_chart_template_id(self, cr, uid, ids, chart_template_id=False, context=None):
|
||||
res = super(account_multi_charts_wizard, self).onchange_chart_template_id(cr, uid, ids, chart_template_id, context)
|
||||
tax_templ_obj = self.pool.get('account.tax.template')
|
||||
res['value'] = {'complete_tax_set': False, 'sale_tax': False, 'purchase_tax': False}
|
||||
data = self.pool.get('account.chart.template').browse(cr, uid, chart_template_id, context=context)
|
||||
if data.name in ('Public Firm Chart of Account','Partnership/Private Firm Chart of Account'):
|
||||
res.update({'value': {'is_indian_chart': True}})
|
||||
else:
|
||||
res.update({'value': {'is_indian_chart': False}})
|
||||
if data.complete_tax_set:
|
||||
sale_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id"
|
||||
, "=", chart_template_id), ('type_tax_use', 'in', ('sale','all'))], order="sequence, id desc")
|
||||
purchase_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id"
|
||||
, "=", chart_template_id), ('type_tax_use', 'in', ('purchase','all'))], order="sequence, id desc")
|
||||
res['value'].update({'sale_tax': sale_tax_ids and sale_tax_ids[0] or False, 'purchase_tax': purchase_tax_ids and purchase_tax_ids[0] or False})
|
||||
return res
|
||||
|
||||
def execute(self, cr, uid, ids, context=None):
|
||||
obj_multi = self.browse(cr, uid, ids[0])
|
||||
if obj_multi.chart_template_id.name == 'Public Firm Chart of Account':
|
||||
if obj_multi.sales_tax == True:
|
||||
path = tools.file_open(opj('l10n_in', 'tax', 'public_firm_sales_tax.xml'))
|
||||
tools.convert_xml_import(cr, 'l10n_in', path, {}, 'init', True, None)
|
||||
path.close()
|
||||
path.close()
|
||||
if obj_multi.vat == True:
|
||||
path = tools.file_open(opj('l10n_in', 'tax', 'public_firm_vat.xml'))
|
||||
tools.convert_xml_import(cr, 'l10n_in', path, {}, 'init', True, None)
|
||||
path.close()
|
||||
path.close()
|
||||
if obj_multi.service_tax == True:
|
||||
path = tools.file_open(opj('l10n_in', 'tax', 'public_firm_service.xml'))
|
||||
tools.convert_xml_import(cr, 'l10n_in', path, {}, 'init', True, None)
|
||||
|
@ -67,7 +85,7 @@ class account_multi_charts_wizard(osv.osv_memory):
|
|||
if obj_multi.excise_duty == True:
|
||||
path = tools.file_open(opj('l10n_in', 'tax', 'private_exice_duty.xml'))
|
||||
tools.convert_xml_import(cr, 'l10n_in', path, {}, 'init', True, None)
|
||||
path.close()
|
||||
path.close()
|
||||
return super(account_multi_charts_wizard, self).execute(cr, uid, ids, context)
|
||||
|
||||
account_multi_charts_wizard()
|
||||
|
|
|
@ -10,10 +10,11 @@
|
|||
<field name="arch" type="xml">
|
||||
<field name="purchase_tax_rate" position="after">
|
||||
<newline/>
|
||||
<field name="sales_tax"/>
|
||||
<field name="service_tax"/>
|
||||
<field name="vat"/>
|
||||
<field name="excise_duty"/>
|
||||
<field name="is_indian_chart" invisible="1"/>
|
||||
<field name="sales_tax" attrs="{'invisible': [('is_indian_chart','=', False)]}"/>
|
||||
<field name="service_tax" attrs="{'invisible': [('is_indian_chart','=', False)]}"/>
|
||||
<field name="vat" attrs="{'invisible': [('is_indian_chart','=', False)]}"/>
|
||||
<field name="excise_duty" attrs="{'invisible': [('is_indian_chart','=', False)]}"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<field name="reconcile" eval="False"/>
|
||||
<field name="parent_id" ref="a20000"/>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="sales_tax_public_main" model="account.tax.template">
|
||||
<field name="description">Sale Tax - 15%</field>
|
||||
<field name="name">Sale Tax - 15% </field>
|
||||
|
|
Loading…
Reference in New Issue