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

where to modify the code to include this calculation?

By
Carlos Carmona
on 9/5/14, 11:07 AM 737 views

Good day mates, above and thanks to you I end up answering a question about how to edit a couple of fields that I have added the link of the question is as follows:

https://www.odoo.com/forum/help-1/question/how-to-enable-these-fields-61922

but now I want to do is know where I have to modify the code to do the calculation by multiplying the width, height, and finally by the established price per square meter in the product also taking into account the discount in place off the field, with this, I would give the total amount of that product. According I have understood, that the addons folder, module sale, sale.py file is what needs to be changed, but the myriad of functions and code which is not. In my opinion the following code is where I need to modify:

class sale_order_line(osv.osv):

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

 

Not if the only code to be modified so that when the calculation is the quote agrege sales, moreover, put the code that I'm not quite sure where it should be changed. could you please help me?

0
Marek Mosiewicz
On 9/11/14, 8:36 AM

What is your measure unit ? If it can square meter then set quantity to calculated value and all will be working well.

 

Odoo consulting

in meters, but I'm trying to do is multiply the top by the width to get the total square meters, and then multiplied by the price per square meter of that product. in my case it's precione per square meter of glass plates.so I need a module to do this if it exists.

Together Consulting, Carlos Carmona
on 9/11/14, 4:37 PM
I do not think it exists. I could do it for you for 200EUR if detail will be known.

Best regards,
    Marek Mosiewicz

2014-09-11 22:37 GMT+02:00 Carlos Carmona <carlos.carmona@tcne.mx>:

in meters, but I'm trying to do is multiply the top by the width to get the total square meters, and then multiplied by the price per square meter of that product. in my case it's precione per square meter of glass plates.so I need a module to do this if it exists.

--
Carlos Carmona
Sent by OpenERP S.A. using Odoo about Forum Post False

Marek Mosiewicz
on 9/13/14, 5:08 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

1 follower(s)

Stats

Asked: 9/5/14, 11:07 AM
Seen: 737 times
Last updated: 3/16/15, 8:10 AM