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

change calcul taxe in sale_order_line

By
samir
on 5/31/13, 1:24 PM 1,512 views

hi all , if someone can help , i try to mdofiy the rule to calculate taxes in sale order . i need that the taxes applied only for margin between ( price_unit and purchase_price ) there is a module named product_margin and sale_margin , he add a margin fields in the sale.order.line classes. i am using it , and i was add other class (sale.order.line ) and i try to override the _amount_line functions :

from openerp.osv import fields, osv

class sale_order_line(osv.osv):
    _inherit = "sale.order.line"

    def _amount_line(self, cr, uid, ids, field_name, arg, context=None):
        tax_obj = self.pool.get('account.tax')
        cur_obj = self.pool.get('res.currency')
        res = {}
        if context is None:
            context = {}
        for line in self.browse(cr, uid, ids, context=context):
            price = line.price_unit * (1 - (line.discount or 0.0) / 100.0)
            taxes = tax_obj.compute_all(cr, uid, line.tax_id, ***price ( replaced by line.margin)***, line.product_uom_qty, line.product_id, line.order_id.partner_id)
            cur = line.order_id.pricelist_id.currency_id
            res[line.id] = cur_obj.round(cr, uid, cur, taxes['total'])
        return res
sale_order_line()

but there is no change thanks

0

patrick

--patrick--
1958
| 5 4 7
Baarn, Netherlands
--patrick--
patrick
On 5/31/13, 6:32 PM

Did you make these changes in a new module, or in the existing module?

In both cases, you need to restart the openerp Server, and reload the module (Settings -> Installed modules -> Select your own module or sale -> click on the button upgrade).

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: 5/31/13, 1:24 PM
Seen: 1512 times
Last updated: 3/16/15, 8:10 AM