تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
983 أدوات العرض

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.

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
ديسمبر 22
44337
0
أبريل 21
2828
1
يونيو 17
3230
1
مايو 25
514
0
مارس 25
710