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,
}