Odoo Help


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.


Tax Calculations in Quotation Rounding problem

Merlin TecSol Pvt. Ltd.
on 6/1/13, 11:47 AM 2,317 views

I am trying to setup so that when a Quote or Sales Order is created OpenERP should calculate the Tax as follows: 1. Excise (@ 10.3%) on Total Amount 2. VAT (@ 5%) on the Excise amount calculated.

Looking at above scenario if the bill amount is 10000.00 then Excise should be 1030.00 (@ 10.3% of 10000.00 ) and VAT should 551.50 (@ 5% of (10000.00 + 1030.00 = 11030.00)).

Totaling above should give us 11581.5 (which is 10000.00 + 1030.00 + 551.50).

But what we get in OpenERP is 11580.00 which is wrong. Here is the screen shot: image description

Please help solve this problem.


On 6/1/13, 3:29 PM

you can create a new inherit Module "J'ai mis un champ libre pour saisir l'accise 10.3%" car il faut d'autres contrôles pour l'exécuter automatiquement. Tu dois faire pareil pour la facture.

NB: Faut laisser la Taxe a ZERO. car le calcul TVA est sur les lignes pas sur le Total.

xml :

<?xml version="1.0" encoding="UTF-8"?>


        <record id="view_order_accise" model="ir.ui.view">
            <field name="name">sale.order.form</field>
            <field name="model">sale.order</field>
            <field name="type">form</field>
            <field name="inherit_id" ref="sale.view_order_form"/>
            <field name="arch" type="xml">
        <group class="oe_subtotal_footer oe_right" colspan="2" name="sale_total" position ="replace">
        <group class="oe_subtotal_footer oe_right" colspan="2" name="sale_total">   
                <field name="add_accise" widget='monetary' options="{'currency_field': 'currency_id'}"/>
                                <field name="accise" widget='monetary' options="{'currency_field': 'currency_id'}"/>
                                <field name="amount_untaxed" widget='monetary' options="{'currency_field': 'currency_id'}"/>
                                <field name="amount_tax" widget='monetary' options="{'currency_field': 'currency_id'}"/>
                                <div class="oe_subtotal_footer_separator oe_inline">
                                    <label for="amount_total" />
                                    <button name="button_dummy"
                                        states="draft,sent" string="(update)" type="object" class="oe_edit_only oe_link"/>
                                <field name="amount_total" nolabel="1" class="oe_subtotal_footer_separator" widget='monetary' options="{'currency_field': 'currency_id'}"/>



Python :

from osv import fields, osv
from tools.translate import _
import decimal_precision as dp
import netsvc

class Sale_order(osv.osv):

    _name = 'sale.order'
    _inherit = 'sale.order'

    def _amount_all(self, cr, uid, ids, field_name, arg, context=None):
        cur_obj = self.pool.get('res.currency')
        res = {}
        for order in self.browse(cr, uid, ids, context=context):
            res[order.id] = {
                'amount_untaxed': 0.0,
                'amount_tax': 0.0,
                'amount_total': 0.0,
                'accise': 0.0,
                'amount_net': 0.0,
            val = val1 = val2 = tva = 0.0
            cur = order.pricelist_id.currency_id
            for line in order.order_line:
                val1 += line.price_subtotal
                val += self._amount_line_tax(cr, uid, line, context=context)
            val2 = val1 * order.add_accise/100
        tva = (val1 + val2)* 0.05   
            if val2 :
               if val == 0.0: 
                  val = tva
                  val = val
          val2= 0.0     
            res[order.id]['accise'] = cur_obj.round(cr, uid, cur, val2)
            res[order.id]['amount_tax'] = cur_obj.round(cr, uid, cur, val)
            res[order.id]['amount_untaxed'] = cur_obj.round(cr, uid, cur, val1)
            res[order.id]['amount_net'] = res[order.id]['amount_untaxed']
            res[order.id]['amount_total'] = res[order.id]['amount_net'] + res[order.id]['amount_tax'] + res[order.id]['accise']
        return res

    _columns = {

            'add_accise':fields.float('Accise(%)',digits=(4,2), readonly=True, states={'draft': [('readonly', False)]}),
            'accise': fields.function(_amount_all, method=True, digits_compute= dp.get_precision('Sale Price'), string='Montant accise',
                                            store =True,multi='sums', help="The additional discount on untaxed amount."),
            'amount_untaxed': fields.function(_amount_all, method=True, digits_compute= dp.get_precision('Sale Price'), string='Untaxed Amount',
                                              store = True,multi='sums', help="The amount without tax."),
            'amount_net': fields.function(_amount_all, method=True, digits_compute= dp.get_precision('Sale Price'), string='Net Amount',
                                              store = True,multi='sums', help="The amount after additional discount."),                                              
            'amount_tax': fields.function(_amount_all, method=True, digits_compute= dp.get_precision('Sale Price'), string='Taxes',
                                          store = True,multi='sums', help="The tax amount."),
            'amount_total': fields.function(_amount_all, method=True, digits_compute= dp.get_precision('Sale Price'), string='Total',
                                            store = True,multi='sums', help="The total amount."),

               'add_accise': 0.0,               

You mean to say that this is the only way out. Can't we solve this by setting up the TAX part in some way? I think bug is a serious show stopper!

Merlin TecSol Pvt. Ltd., Merlin TecSol Pvt. Ltd.
on 6/3/13, 2:15 AM

to my knowledge, this is the only way

on 6/3/13, 5:52 AM

I know this is an old question but we have a similar problem. I tried to describe it in https://github.com/odoo/odoo/issues/9417. Maybe there was some update in the meantime so we don't need an additional module.

Robert Rübner
on 11/4/15, 10:13 AM

Its a joke, I cant work it out.. dont want to look stupid on quotes..

on 4/13/16, 3:33 AM

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)


Asked: 6/1/13, 11:47 AM
Seen: 2317 times
Last updated: 11/4/15, 10:13 AM