Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
8364 Lượt xem
def onchange_resvalue(self, cr, uid, ids, iscopy, description, context=None):
   context = context or {}
   v = {}
   if iscopy:
      v['res_val'] = description
   return {'value': v}

<field name="iscopy"  on_change="onchange_restime(iscopy, description)"/>
<field name="description" on_change="onchange_restime(iscopy, description)"/>
<field name="res_val"/>

In the New record (not save in db) above on change method How to get res_val previous value entered by the user? For example in the above code working in the way, 1) If user Entered res_val output value 2) And then user checked iscopy boolean field it will copy the res_val into description 3) And again unchecked how to shows previous value entered by the user.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

suppose if you have a record which previously was recorded in db  in onchange you can search for same id via browse,  and then you can accees to data which differ from that one then you have in self,

if you want get not saved in db data in onchange you should go js, I don't think there is solution in odoo core for that

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

I don't know who put a -1 on the comment of @voathnak lim below,  

but I think that this question about old value in "onchange" procedures is not obvious, usefull, I didn't found any answer on the web,  

so it may have been more usefull to explain why this question is a bad question, and more usefull give a link to the possibly obvious answer ....  

(a militant for a peacefull and usefull web ....)

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

I got the same question, can any one answer please?

How to get the previous value in onchange function

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 10 23
2037
2
thg 10 23
2271
2
thg 8 23
4293
4
thg 8 23
20607
3
thg 10 22
11067