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

Hi,

In Odoo12: Invoicing / vendor / payment form, i inherent and created new fields

-check_number_char

-check_number


In account.payment.py model i create the following codes

def create (self, vals):   * it run all right.

        rslt = super (AccountPayment, self) .create (vals)

       rslt.update ({ 'ck_number': vals.get ("check_number_char")   })

        return rslt

* cant find the write function of it so i created a new one *

@ api.multi

    def write (self, vals):   * this is where i got the error when try to edit/save it.

             #update the check_number_char to check_number (readonly)

              self.check_number = vals.get ("check_number_char")


I lost , need you help!

Thank you for taking time to read and reply.


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

Hi,

Update the write method like this,

@api.multi
def write(self, vals):
vals.update({'ck_number': vals.get("check_number_char")})
res = super(ClassName, self).write(vals)
return res


See : How To Override Write Function in Odoo

Thanks

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ส.ค. 20
2274
1
มิ.ย. 19
4048
save button JavaScript file แก้ไขแล้ว
1
ม.ค. 23
7003
0
ม.ค. 20
2587
Sale order line don't saved new field แก้ไขแล้ว
2
พ.ค. 19
6697