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

I have created a method in a model,

def update_book_price(self, book, updated_price):
if not book:
raise UserError('The book is not found')

book.retail_price = updated_price

I tried calling this method from XML file like this,


ref('library.book_the_alchemist')
499

I have provided two arguments for the method here. but an error shows up,


TypeError: Book.update_book_price() missing 1 required positional argument: 'updated_price'


I think its because the first argument is passed to 'self'. How do i fix this?

อวตาร
ละทิ้ง

Pass all the requirement arguments.

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ธ.ค. 22
44714
0
เม.ย. 21
3052
1
มิ.ย. 17
3422
1
ก.ค. 25
354
0
ก.ค. 25
387