تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
3852 أدوات العرض

I have a form with:

    <field name="qty" on_change="onchange_transaction(tr_id, qty)"/>

relevant code:

@api.depends('amount','subtotal','vat','total')

    def onchange_transaction(self, cr, uid, ids, tr_id, qty, context=None):

    # some code here which is calculating my receipt

    res = { 'value': {'amount':locamount , 'subtotal':locsubtotal , 'vat': locvat , 'total':loctotal} }

    return res

fields declarations :

'amount':fields.float('Amount', store=True, readonly=True),

'qty':fields.integer('Qty'),

'subtotal':fields.float('Sub Total', store=True, readonly=True ),

'vat':fields.float('VAT', store=True, readonly=True),

'total':fields.float('Total', store=True, readonly=True),

On editing my form and logic is behaving fine up to the point of saving. If I alter the quantity my form is picking the newly calculated amount BUT when I save figures revert to old amount. This problem only happens on editing a record. It does not happen on a new record.


الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
0
أغسطس 20
3316
5
مايو 16
4040
0
مارس 15
5105
1
أكتوبر 23
1919
2
أكتوبر 23
2139