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

How to calculate a product with discount and tax on total of sale order?

By
Rakhi sudevan
on 2/5/14, 6:08 AM 3,976 views

I have used open erp 7.0. I want discount and tax are added with sale order.

For eg:Product with price=3390 and discount=10%,tax=1.86 I need the calculation as follows, initial price 3390 after 10% discount=3051 Then the tax 1.86 will reduced from the unit price only ,initial price 3390 after 1.86 tax=63.05(for the product with3390 price_unit) Total of sale order =3051+63.05=3114.05.But I cannot this calculation .Pls help me ?

0

Prakash

--Prakash--
3173
| 5 4 7
Bikaner, India
--Prakash--

OpenERP Devloper at SunARC Technology

Prakash
On 2/6/14, 2:29 AM

Based on your requirement the below steps to follow:-

1) Openerp Menu Configuration --> Sales screen Enable the check box "Allow setting a discount on the sales order lines"

2) Openerp Menu Accounting --> Configuration --> Taxes Screen add new tax with below details Tax Type Percentage 0.01860

3) In the Sale Order default code

   def _amount_line_tax(self, cr, uid, line, context=None):
        val = 0.0
        for c in self.pool.get('account.tax').compute_all(cr, uid, line.tax_id, line.price_unit * (1-(line.discount or 0.0)/100.0), line.product_uom_qty, line.product_id, line.order_id.partner_id)['taxes']:
            val += c.get('amount', 0.0)
        return val

The above code override in custom module as below

   def _amount_line_tax(self, cr, uid, line, context=None):
        val = 0.0
        for c in self.pool.get('account.tax').compute_all(cr, uid, line.tax_id, line.price_unit,  line.product_uom_qty, line.product_id, line.order_id.partner_id)['taxes']:
            val += c.get('amount', 0.0)
        return val

After that create sale order the excepted output will be shown

this code working properly in sale order only. But i want this same function in Account..if any solution to find this?

Rakhi sudevan
on 3/14/14, 1:18 AM
0
Lingom
On 9/23/14, 6:31 AM

Hi Rakhi,

I have gone through the same issue. However I found the way in Tax configuration.

Please follow the steps to configure the tax in exclusive:

Accounting -> Configuration -> Accounts -> Template -> Taxes -> Tax Template, from the list open your tax template; now you can see the tab "Tax Definition"; under the tab there is a check box called "Include in base amount"; tick that check box and save it.

Now go to Accounting -> Configuration -> Taxes -> Taxes,  open the tax form which you configured for the company; there you can see "Tax Definition"; and the same field ""Include in base amount" at the right site you can see; just tick that check box and save it.

Here you go...

Now create the invoice with discount;  your tax will be caculated based on your base amount.

Thanks

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: 2/5/14, 6:08 AM
Seen: 3976 times
Last updated: 3/16/15, 8:10 AM