Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1183 Переглядів

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
44725
0
квіт. 21
3061
1
черв. 17
3425
1
лип. 25
359
0
лип. 25
391