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:

> Hi,
>
> 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_1.8
>
> 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?
>
> Thank You
> Kurt Miebach
>
> --
> [email protected] mailing list
>



-- 
Sharoon Thomas
Business Analyst & Open Source ERP Consultant
Founder & CEO @ http://openlabs.co.in

-- 
[email protected] mailing list

Reply via email to