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

first im a novice in python

here is the code im using 

@api.multi

    def _prepare_invoice(self):

        invoice_vals = super(SaleOrder, self)._prepare_invoice()

        invoice_vals = {

'field1' : self.field1 ,

'field2' : self.field2

}

but it got me an account error

when i use only 

invoice_vals['field1'] =self.field1

it works perfectly but i dont know how to add other field since i have 5 in total

アバター
破棄
最善の回答

Hi Blaise, 
function _prepare_invoice from sale order returns a dict. If you want to add other values ( field1 and field2 in your case), you need to do this : 

invoice_vals.update(field1=self.field1, field2=self.field2)

If u have only one item to add, it is preferable, for me, to do this : invoice_vals['field1'] =self.field1

Upvote if this helps.

Thank you.

アバター
破棄
関連投稿 返信 ビュー 活動
2
7月 24
13326
1
7月 21
7367
0
4月 20
4161
0
4月 18
2977
4
3月 25
3324