A Diumenge, 28 d'abril de 2013 19:50:15, Sergi Almacellas Abellana va escriure: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi All, > > I have quite a strange thing, there is a module that doesn't got > registered in the pool. > > I have the following code (I only copied the relevant parts, tellme if > you need more code): > > In __init__.py: > > from .account_reporting import * > > > def register(): > Pool.register( > AccountReportingReport, > AccountReportingReportLine, > module='account_reporting', type_='model') > > > and in account_reporting.py I have declared the following classes: > > class AccountReportingReport(ModelSQL, ModelView): > 'Account report' > __name__ = 'account.reporting.report' > > class AccountReportingReportLine(ModelSQL, ModelView): > 'Account report line / Accounting concept.' > > __name__ = "account.reporting.report.line" > > > The strange thing is that 'account.reporting.report' is correctly > imported in register but it doesn't get in the pool so when it > processes 'account.reporting.report.line', which has a Many2One with > 'account.reporting.report' it doesn't find the model and I got the > following error:
Did you override __register__ or __setup__ in account.reporting.report? Maybe there is a bug in there and it's not registering correctly silently. > > Traceback (most recent call last): > File "bin/trytond", line 109, in <module> > trytond.server.TrytonServer(options).run() > File "/home/pokoli/tryton/trytond/trytond/server.py", line 131, in run > Pool(db_name).init(update=update, lang=lang) > File "/home/pokoli/tryton/trytond/trytond/pool.py", line 134, in init > lang=lang) > File "/home/pokoli/tryton/trytond/trytond/modules/__init__.py", line > 391, in load_modules > load_module_graph(graph, pool, lang) > File "/home/pokoli/tryton/trytond/trytond/modules/__init__.py", line > 229, in load_module_graph > cls.__register__(module) > File "/home/pokoli/tryton/trytond/trytond/model/modelsql.py", line > 150, in __register__ > ref = pool.get(field.model_name)._table > File "/home/pokoli/tryton/trytond/trytond/pool.py", line 151, in get > return self._pool[self.database_name][type][name] > KeyError: 'account.reporting.report' > > > I'm stuck with this. Could you give me any tips? > > Thanks in advance! > > - -- > Sergi Almacellas Abellana > www.koolpi.com > Twitter: @pokoli_srk > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.11 (GNU/Linux) > Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ > > iQEcBAEBAgAGBQJRfWFUAAoJEGRfwiQCVal5BOkH/0Lre/1y2+IctiLHShj9kp9A > etSdlfOBEHIdO+RnGmnjMF+5QtJfR6McL8GTYhFj0q1exBIw+4YN7pNOxmYxBatu > 7+3qR58sxlKL4cBTpOaP0J3oidhozTXbD+ZMstgFrxUwsD1E7LEk+XyIDJqqHe54 > 6ouEmXynRxo68uW3phrkFtJ7BMJdhpkNmOa3vDkcnlE0AyWONkRKwf/PnTuYseEs > dCBVxRiA30o5Xj9PjN1XqHkYTL3YXNAUiCAUBsghZcPVngVPe/5o+su/5fBoyNyN > Nk59PBQv8u9+TtBgcrcLav6Dhrzh2lv6oxXjEAYDEZBs/0TwavLX1fDbMipQj7A= > =zrUI > -----END PGP SIGNATURE----- -- Albert Cervera i Areny http://www.NaN-tic.com Tel: +34 93 553 18 03 http://twitter.com/albertnan http://www.nan-tic.com/blog
