This question has been flagged

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?

Avatar
Discard
Best Answer

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

 

Odoo consulting

Avatar
Discard
Author

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.

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