Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
5674 มุมมอง

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?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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."),

คำตอบที่ดีที่สุด

Hi,

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

Thanks
www.acespritech.com

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
Multiple Price for Products แก้ไขแล้ว
2
พ.ค. 22
3339
1
มี.ค. 17
13210
0
พ.ย. 19
4068
2
มี.ค. 24
2035
Problem with tax included price แก้ไขแล้ว
1
มิ.ย. 23
242