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

compute multiple prices when one price is changed or modified

By
Vivekrajan
on 6/18/13, 4:28 AM 1,828 views

Hi,

I would like to link multiple price calculation. In the sense, When I change any price value of one field, I should be able to recalculate multiple price fields and update.

How to do that?

1

Ghanshyam Prajapati

--Ghanshyam Prajapati--
1377
| 4 4 8
Pune, India
--Ghanshyam Prajapati--
OpenERP Developer
Ghanshyam Prajapati
On 6/18/13, 4:45 AM

You should use on_change method of OpenERP,

for example,

in your .py file,

'number': fields.integer('Number'),
'sum': fields.integer('Sum'),
'mulitply': fields.integer('Multiply'),

    def onchange_number(self, cr, uid, ids, number,context=None):        
        val = { 'sum': 0, 'multiply': 0}
        if number:
                val['sum'] = number + 4
                val['multiply'] = number * 20
        return {'value': val}

in xml,

<field name="number" on_change="onchange_number(number)"/>
<field name="sum" />
<field name="multiply"/>

Hi, The onchance_functions become weak in front of the functional fields. ex: 'amount_total': fields.function(_amount_total, digits_compute= dp.get_precision('Sale Price'), string='Total', store = { 'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['order_line','shipping', 'shipping_discount','discount'], 10), 'sale.order.line': (_get_order, ['price_unit', 'tax_id', 'discount', 'product_uom_qty'], 10), }, multi='sums1', help="The total amount."),

Vivekrajan
on 6/18/13, 4:52 AM
1
Dharmesh Rathod
On 6/18/13, 5:30 AM

Hi,

Use "Function" type field and write fields in store on which it depend.

Thanks
www.acespritech.com

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: 6/18/13, 4:28 AM
Seen: 1828 times
Last updated: 3/16/15, 8:10 AM