Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1254 Lượt xem

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?

Ảnh đại diện
Huỷ bỏ

Pass all the requirement arguments.

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 12 22
44856
0
thg 4 21
3157
1
thg 6 17
3480
1
thg 7 25
429
0
thg 7 25
493