İçereği Atla
Menü
Bu soru işaretlendi
1141 Görünümler

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?

Avatar
Vazgeç

Pass all the requirement arguments.

İlgili Gönderiler Cevaplar Görünümler Aktivite
1
Ara 22
44594
0
Nis 21
3009
1
Haz 17
3389
1
Tem 25
319
0
Tem 25
336