On Viernes 03 Febrero 2012 09:28:59 Sharoon Thomas escribió:
> 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


Thanks for yor reply.


my intention is to extend account_invoice, as first step i need to add a new 
state 'nula' to invoices, so my idea is to read from account_invoice.invoice 
to obtain states values, say STATES, and redefine column state = STATES + 
['nula'] , bla


which is the tryton way todo this ?


thanks.


-- 
Felipe Alvarez Harnecker
[email protected] - 9.874.60.17

-- 
[email protected] mailing list

Reply via email to