On 27/10/10 11:03 +0200, Udo Spallek wrote: > Hi Bertrand, > > Thanks for reply! > > Am Dienstag, den 26.10.2010, 23:50 +0200 schrieb Bertrand Chenal: > > Le Tue, 26 Oct 2010 22:11:38 +0200, > > Udo Spallek <[email protected]> a écrit : > > > Hi, > > > having massive problems to create a purchase with proteus. > > > Please take a look to my console session pasted here: > > > http://paste.pocoo.org/show/281813/ > > If I understand correctly: > > The first > > >>> purchase_line1.product = Product.find([]).pop() > > on line 6 raise an exception because purchase_line1 is not linked to > > any purchase so no currency is unknown when on_change_product is > > triggered, hence the exception. Maybe we should fix this on_change to > > handle this case, but I'm not sure this make sense to create line > > without purchase. So one think I would try is to first do : > > >>> purchase_line1.purchase = purchase > >>> purchase = Purchase() > >>> purchase.party = party3 > >>> purchase_line1 = PurchaseLine1() > >>> purchase_line1.purchase = purchase > Traceback (most recent call last): > File "<console>", line 1, in <module> > File "proteus/__init__.py", line 89, in set_method > assert value.id > 0 and not value._changed > AssertionError > > But the hint seems to be good anway. 'Assert value.id > 0' means > purchase must be saved before, so again:
You must do the other way: append purchase line to purchase. -- Cédric Krier B2CK SPRL Rue de Rotterdam, 4 4000 Liège Belgium Tel: +32 472 54 46 59 Email/Jabber: [email protected] Website: http://www.b2ck.com/
pgphSyL0rYEOU.pgp
Description: PGP signature
