View difference between Paste ID: uhjLbywQ and PghazrUY
SHOW: | | - or go back to the newest paste.
1-
     c = book.CustomerLookupByID(data['invoice']['invoicedata']['customerid'])
1+
c = book.CustomerLookupByID(data['invoice']['invoicedata']['customerid'])
2-
     assert( isinstance(c, Customer) )
2+
assert( isinstance(c, Customer) )
3-
     CUR = c.GetCurrency()
3+
CUR = c.GetCurrency()
4-
     #print CUR.get_fullname(), data['customer']['currency']
4+
assert( isinstance(CUR, GncCommodity) )
5-
     assert( isinstance(CUR, GncCommodity) )
5+
6
invoice = Invoice(
7-
     invoice = Invoice(
7+
8
             id=next_invoice_id(book=book, format=data['invoice']['invoicedata']['format_inv    oiceid']),
9
             currency=CUR,
10
             owner=c
11
             )
12
13
"""
14
PROBLEM:
15
16
this piece of code produces:
17
18
* 19:41:21  CRIT <gnc.backend.sql> gnc_sql_save_commodity: assertion `pCommodity != NULL' failed
19
* 19:41:21  WARN <gnc.backend.sql> [add_gvalue_owner_to_slist()] Invalid owner type: 0
20
21
both c and CUR are not None.
22
CUR is identical to book.get_table().lookup('CURRENCY', 'EUR').
23
c is a valid customer created with the normal gnucash GUI (.GetName etc. are correct). 
24
25
Any ideas?
26
27
"""