API Forum

This forum is in read-only mode.
Please refer to our API support in case you have any questions.
We can be reached at api@e-conomic.com
e-conomic API developer forum

Python Abstraction SDK

0
 
Hey,
 
Made a small abstraction / SDK of the API for python in case anyone needs it:
 
Feel free to modify and add to the code as you like.

 

created Aug 2, 2013 by mikkeljans
0% Accept Rate
Q 1 A 0 C 1

1 Answer

0

I'm trying to make a simple CashBookEntry using pyconomic like this:

        aCashBook = pycon.get(models.CashBook, number=1)
        debet_account = pycon.get(
                models.Account, number='1340')
        credit_account = pycon.get(
                models.Account, number='5820')
        entry = pycon.create(models.CashBookEntry, cash_book=aCashBook, account=debet_account, contra_account=credit_account)
 
I'm getting the error:
 
  File "build/bdist.macosx-10.8-intel/egg/suds/mx/literal.py", line 87, in start
suds.TypeNotFound: Type not found: 'ContraAccount'
 
It seems that I have to specify that the contra_account is of type ContraAccount, or? Would it be easy for you to make a working example of creating a CashBookEntry in Python?

 

answered Oct 28, 2013 by jfroejk
Hey,

I haven't got the time to look into it, but it sounds like the contra_account property definition is messed up.
The model classes code is generated from a assumption on naming convention, which is not always correct.
I think your best option would be to change all the contra_account properties in pyconomic.models to a reference.
I think it would be something like:
contra_account = EConomicsReference('ContraAccount', 'Account')
Thanks for the advice. It worked with contra_account as reference and a few more parameters:

pycon.create(models.CashBookEntry, cash_book=aCashBook, type="FinanceVoucher", account=debet_account, contra_account=credit_account, date="2013-10-28T00:00:00", voucher_number="9999", text="Test", amount=1.00, currency=currency, amount_default_currency=1)

Network

Find all the documentation and resources you need to build great apps.
Go to Developer site

Newsletter

Get the latest news and important info from the e-conomic developer world.
Sign up now

Visma e-conomic A/S
...