Thank you Sharoon, now it works. In the Tryton 1.8 example at google code that I copied the commit statement is already missing. I added a comment on that page.
Kurt Miebach On Jan 26, 2:36 pm, Sharoon Thomas <[email protected]> wrote: > Hello Kurt, > > You need to manually commit the changes. > > and it is better to start the transaction once and put all the records in at > once and then commit. > > party_obj = self.pool.get('party.party') > with Transaction().start(DBNAME, user, None): > for party in myparties: > party_obj.create({'name': party.name}) > Transaction().cursor.commit() > > On Wed, Jan 26, 2011 at 6:28 PM, Kurt Miebach <[email protected]> wrote: > > I am preparing to import a lot of parties using the "tryton as a > > module" code from this example: > > >http://code.google.com/p/tryton/wiki/HowToUseTrytondAsAModule#Version... > > > I am using this example to add new parties, and it seems to work > > because after each loop I receive an incremented new_party_id > > (3,4,5,...): > > > for party in myparties: > > with Transaction().start(DBNAME, user, None): > > new_party_id = party_obj.create({'name': party.name}) > > > But in the Tryton Client there are no parties visible when I search. I > > suspect I need to add more fields? Or do I need to add adresses to the > > parties? Or maybe connect them to a company? > -- > Sharoon Thomas > Business Analyst & Open Source ERP Consultant > Founder & CEO @http://openlabs.co.in -- [email protected] mailing list
