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

Hello everybody!!

My friends i am using  the hr.payslip model and i want to call the function compute_sheet().

Here is what i have tried:


@api.onchange('field1')

 def onchange_solde(self):

  for payslip in self :

   if self.field1 == True : 

           self.compute_sheet()

 

But the problem here is my self contains this: <odoo.models.NewId object at 0x7f7769d212d0>

How can i solve this please.

Thanks a lot in advance.

Best reagrds.

อวตาร
ละทิ้ง
ผู้เขียน

no one can anwser plz

คำตอบที่ดีที่สุด

Self being a odoo.models.NewId object simply means, that it is an odoo model that has not yet been committed to the database (at least I think so). That should not prevent you from calling member functions on it though.

What are you exactly trying to accomplish? And does your method not work (I guess so)? If not, can you post the error message?

อวตาร
ละทิ้ง
ผู้เขียน

i have inherited the hr.payslip model and i want to call the compute_sheet() function.

Have you tried something simple like this:

@api.multi

@api.onchange('field1')

def onchange_solde(self):

self.compute_sheet()

What is wrong with your function? Do you get an error? If yes what?

Related Posts ตอบกลับ มุมมอง กิจกรรม
Wrong Number of days on payslip แก้ไขแล้ว
7
พ.ค. 20
3759
1
มิ.ย. 18
5431
2
ก.ค. 25
4558
2
ธ.ค. 24
7714
How to ORDER BY? [Odoo 10] แก้ไขแล้ว
2
พ.ย. 24
28456