콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
5577 화면

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

아바타
취소
관련 게시물 답글 화면 활동
2
5월 22
3229
1
3월 17
13146
0
11월 19
3941
2
3월 24
1820
1
6월 23
242