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

Hi

If the user opens a record in edit mode, changes a field, @api.onchange/depends may be triggered, when the user hit the UI's [Save] button everything get saved.

I would like to reproduce this programatically:

for record in proxy.browse(cr, uid, active_ids, context=context):
    record.field = record.field + " new"
    # onchange/depends may be triggered and change other fields
    record.write(...) # Here I am forced to pass the values to save,
                      # how to save all values ? (or at least the one changed)


How to achieve such thing ?


Regards

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

which versions are you using? 

​As far as I recall correctly from version 12 odoo implement server-side form reading for batter emulate/test form view and trigger the relevant action like default_get, onchage 
ef https://github.com/odoo/odoo/blob/12.0/odoo/tests/common.py#L1043

There is no real use case to implement in odoo codebase (except test) so you couldn't find any example. but the feature is well documented (https://github.com/odoo/odoo/blob/12.0/odoo/tests/common.py#L1059).

I am really interested to know about your use case. why do you want to implement it?

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

This 'simple' thing is apparently impossible ?

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
@api.onchange doesn't save in Odoo11? แก้ไขแล้ว
2
เม.ย. 19
6484
0
ม.ค. 16
3890
2
มี.ค. 18
15759
5
พ.ค. 16
4118
0
มี.ค. 15
5139