Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Filtering tax amounts in invoice form

By
Ashmsh.M
on 3/14/14, 9:58 AM 732 views

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

>

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 3/14/14, 9:58 AM
Seen: 732 times
Last updated: 3/16/15, 8:10 AM