On Feb 3, 2012, at 7:18 AM, Felipe Alvarez Harnecker wrote: > and if define a tryton module with a single file with > > import trytond.modules.account_invoice.invoice > > trytond.modules.account_invoice.invoice > > > fails loading with: > > File "/usr/lib/python2.7/dist- > packages/trytond/modules/ql_account_invoice/invoice.py", line 31, in <module> > trytond.modules.account_invoice.invoice > AttributeError: 'module' object has no attribute 'account_invoice' >
This is because the modules and classes are not registered. See the example of how to use tryton as a module here: http://code.google.com/p/tryton/wiki/HowToUseTrytondAsAModule However, this direct import is NOT the preferred way to use Tryton as a module. This will only serve the purpose when you want to import some other python object (Not one of the Model instances of triton) to reuse them elsewhere in your code. The final state of a Tryton model (its attributes, method etc) depends on the modules installed in a specific database. So fetching from the pool is the "best way" if you want to access trytond model objects in your script or from the command line. Thanks, Sharoon Thomas http://openlabs.co.in
signature.asc
Description: Message signed with OpenPGP using GPGMail
