Skip to main content

Python-bindings for the Collmex import/export API

Project description

Introduction

Collmex is an online ERP system for (small) companies with a focus on simple accounting. <http://www.collmex.de> (Note: Collmex is Germany-based but seems to support English. You’re bound to stumble over German strings, though.)

This package aims to provide pythonic bindings to program against Collmex’ API. It includes transaction management for integration with the ZODB or other databases that can integrate with the transaction package.

Collmex API

Collmex provides a POST- and CSV-based API, which is encapsulated into a utility that provides methods for the various CSV record types. API documentation is available at http://www.collmex.de/cgi-bin/cgi.exe?1005,1,help,api.

The collmex object

The collmex object is a central place to access collmex. In the Zope 3 jargon it is a global utility:

>>> import os
>>> import gocept.collmex.collmex
>>> collmex = gocept.collmex.collmex.Collmex(
...     os.environ['collmex_customer'], os.environ['collmex_company'],
...     os.environ['collmex_username'], os.environ['collmex_password'])

Transaction integration

gocept.collmex has support for transaction integration. All modifying calls are buffered until the transaction is commited. XXX explain more.

[1] [2]

Customers: get_customers

Customers can be listed using the get_customers method:

>>> customers = collmex.get_customers()
>>> customers
[<gocept.collmex.model.Customer object at 0x...>,
 <gocept.collmex.model.Customer object at 0x...>]
>>> len(customers)
2

The first customer is the generic one:

>>> customer = customers[0]
>>> customer['Satzart']
'CMXKND'
>>> customer['Kundennummer']
'9999'
>>> customer['Firma']
'Allgemeiner Gesch\xe4ftspartner'

The second customer is one created during test setup:

>>> customer = customers[1]
>>> customer['Satzart']
'CMXKND'
>>> customer['Kundennummer']
'10000'
>>> customer['Firma']
'Testkunden'

Invoices: create_invoice and get_invoices

Invoices are created using the create_invoice method:

>>> import datetime
>>> start_date = datetime.datetime.now()
>>> item = gocept.collmex.model.InvoiceItem()
>>> item['Kunden-Nr'] = '10000'
>>> item['Rechnungsnummer'] = 100000
>>> item['Menge'] = 3
>>> item['Produktnummer'] = 'TRAFFIC'
>>> item['Rechnungstext'] = 'item text'
>>> item['Positionstyp'] = 0
>>> collmex.create_invoice([item])

Invoices can be looked up again, using the get_invoices method. However, as discussed above the invoice was only registered for addition. Querying right now does not return the invoice:

>>> collmex.get_invoices(customer_id='10000', start_date=start_date)
[]

After committing, the invoice is found:

>>> import transaction
>>> transaction.commit()
>>> collmex.get_invoices(customer_id='10000',
...                      start_date=start_date)[0]['Rechnungstext']
'item text'

Changes

0.2 (2008-11-28)

  • Modifications for changed Collmex API.

  • Added get_customers to query customers (API CUSTOMER_GET).

0.1 (2008-10-14)

  • first release. Supports getting and storing invoices.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gocept.collmex-0.2.zip (16.3 kB view details)

Uploaded Source

File details

Details for the file gocept.collmex-0.2.zip.

File metadata

  • Download URL: gocept.collmex-0.2.zip
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for gocept.collmex-0.2.zip
Algorithm Hash digest
SHA256 1bb7c197490c29449058bbf82a5018e5624bf2fa83bc73e9c1c02be1fe56efaa
MD5 ebf0dd3926c0b1d991834e78c51dd1ec
BLAKE2b-256 a2bda589e4c45d7fbed742ad3097b2732a70018d599b6a1b6b7fa1683fa24517

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page