My need is to display tax amount seperately like this
* Tax 5%: 0.00 Tax 14.5%: 0.00* In the invoice form, For this i inherit the module account.invoice.
In this i need to display the tax amount seperately .Ie i have only two type of taxes 5% and 14.5% For this i have given a if condition and elif condition but i dont know how to give the condition/which variable is given as condition inside the if and elif Anyone please help me... Here is my py file.
class ov_tax(osv.osv):
_inherit = 'account.invoice'
def _amount_all(self, cr, uid, ids, name, args, context=None):
res = {}
for invoice in self.browse(cr, uid, ids, context=context):
res[invoice.id] = {
'amount_untaxed': 0.0,
#'amount_tax': 0.0,
'amount_total': 0.0,
'tax1': 0.0,
#'tax2': 0.0
}
for line in invoice.invoice_line:
res[invoice.id]['amount_untaxed'] += line.price_subtotal
for line in invoice.tax_line:
if line. == : #Newly added line
res[invoice.id]['tax1'] += line.amount
# res[invoice.id]['amount_tax'] += line.amount
res[invoice.id]['amount_total'] = res[invoice.id]['tax1'] + res[invoice.id]['amount_untaxed']
return res
_columns = {
'tax1' : fields.function(_amount_all, digits_compute=dp.get_precision('Account'), string='Tax 5%', track_visibility='always',store=True ,multi='all'),
}
ov_tax()
in XM
L
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record model="ir.ui.view" id='invoice_form' >
<field name="name">account.invoice.form2</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form"/>
<field name="arch" type="xml">
<!-- <form string="Sales Order" version="7.0"> -->
<field name="amount_untaxed" position="after">
<field name="tax1"/>
<!-- <field name="tax2"/>-->
</field>
<!-- </form>-->
</field>
</record>
<record model="ir.actions.act_window" id="action_orders">
<field name="name">Accountinvoice2</field>
<field name="res_model">account.invoice</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
</data>
</openerp
>