コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1185 ビュー

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
12月 22
44726
0
4月 21
3063
1
6月 17
3425
1
7月 25
360
0
7月 25
392