• Harga

# Tax Calculations in Quotation Rounding problem

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:

Please help solve this problem.

TIA

##### 1 Jawaban
le_dilem
Best Answer

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"?>
<openerp>
<data>
<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"/>
</div>
<field name="amount_total" nolabel="1" class="oe_subtotal_footer_separator" widget='monetary' options="{'currency_field': 'currency_id'}"/>
</group>
</group>
</field>
</record>
</data>
</openerp>
``````

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
else:
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."),
}
_defaults={
'add_accise': 0.0,
}
``````
4 Komentar

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!

le_dilem
-

to my knowledge, this is the only way

Robert Rübner
-

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.

Adamz
-

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