So I was busy testing tryton import scripts .. which means constantly re-setting my DB to clear it (deleting just takes 10 times longer than SQL restore)..
But since I drop and recreate the DB the ipython session also needs to disconnect... which is a bit inconvenient because of setup,..
Fortunately ipython has
%load - which makes this super easy:
(screenshot to show off just how nicely everything is even highlighted too)
now here the code to copy paste if someone wants it:
import myinit from proteus import config, Model, Wizard, Report pcfg = config.set_trytond(database='tryton', config_file='/etc/tryton/trytond.conf') Party = Model.get('party.party') Addr = Model.get('party.address') Cont = Model.get('party.contact_mechanism') Note = Model.get('ir.note') Lang = Model.get('ir.lang') Categ = Model.get('party.category') Country = Model.get('country.country') SubD = Model.get('country.subdivision') Cont = Model.get('party.contact_mechanism') Ident = Model.get('party.identifier') try: prm, = Party.find([('code', '=', '1')]) except: print('Could not load party with code 1')
myinit just contains the code to hide warnings from this stackoverflow question
This is super useful in setting up the basic types I need for my testing.Share on Twitter Share on Facebook