On 28/09/10 13:35 +0200, Paul J Stevens wrote:
> Hi all,
>
>
> I'm trying to use Proteus for xmlrpc access.
>
> With a small tweak(fix?) I can succesfully do crud-operations on most
> objects, but invoices are giving me trouble.
>
> I'm pasting a backtrace from my test below, but the question is: where
> does this field 'journal.rec_name' actually come from. Looking at the
> code in account_invoice it looks like this field is setup in the
> on_change handler, but I haven't even saved anything yet.
>
> Of course I can start adding has_key() checks to proteus' _default_get,
> but I'm not at all sure that's valid.
>
> So where do I go from here.
>
>
>
>
> test_addInvoice (__main__.test_Invoice) ...
> {'account': proteus.Model.get('account.account',
> proteus.config.XmlrpcConfig('http://admin:t...@localhost:8069/test'))(167),
> 'company': proteus.Model.get('company.company',
> proteus.config.XmlrpcConfig('http://admin:t...@localhost:8069/test'))(1),
> 'currency': proteus.Model.get('currency.currency')(50),
> 'description': 'internet bestelling',
> 'invoice_address': proteus.Model.get('party.address',
> proteus.config.XmlrpcConfig('http://admin:t...@localhost:8069/test'))(648),
> 'journal': proteus.Model.get('account.journal',
> proteus.config.XmlrpcConfig('http://admin:t...@localhost:8069/test'))(1),
> 'party': proteus.Model.get('party.party',
> proteus.config.XmlrpcConfig('http://admin:t...@localhost:8069/test'))(267),
> 'payment_term': proteus.Model.get('account.invoice.payment_term',
> proteus.config.XmlrpcConfig('http://admin:t...@localhost:8069/test'))(1),
> 'reference': 'ref#1',
> 'state': 'draft',
> 'type': 'out_invoice'}
> ERROR
>
> ======================================================================
> ERROR: test_addInvoice (__main__.test_Invoice)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "tests.py", line 254, in test_addInvoice
> invoice = self.i.add(**inv)
> File "/home/paul/service/src/nfg.erp/nfg/erp/erp.py", line 173, in add
> new = self.m(**kw)
> File "/home/paul/service/src/proteus/proteus/__init__.py", line 268,
> in __init__
> self._default_get()
> File "/home/paul/service/src/proteus/proteus/__init__.py", line 420,
> in _default_get
> self._config.context))
> File "/home/paul/service/src/proteus/proteus/__init__.py", line 424,
> in _default_set
> definition = self._fields[field]
> KeyError: 'journal.rec_name'
> It comes from the _default_on_change on server side [1]. The method doesn't respect the with_rec_name parameter of the default_get [2]. [1] http://hg.tryton.org/trytond/file/32a3cbee4bdd/trytond/model/model.py#l591 [2] http://hg.tryton.org/trytond/file/32a3cbee4bdd/trytond/model/model.py#l493 -- Cédric Krier B2CK SPRL Rue de Rotterdam, 4 4000 Liège Belgium Tel: +32 472 54 46 59 Email/Jabber: [email protected] Website: http://www.b2ck.com/
pgpNHEFcSLBMa.pgp
Description: PGP signature
