Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
2532 Zobrazení

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

Avatar
Zrušit
Nejlepší odpověď

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.

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
2
čvc 24
13311
1
čvc 21
7361
0
dub 20
4152
0
dub 18
2973
4
bře 25
3298