Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1204 Prikazi

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
Opusti

Pass all the requirement arguments.

Related Posts Odgovori Prikazi Aktivnost
1
dec. 22
44783
0
apr. 21
3107
1
jun. 17
3430
1
jul. 25
409
0
jul. 25
439