Skip to main content

Python library for generating pohoda XML files

Project description

Pohoda XML in Python

This project is basically a rewrite of https://github.com/riesenia/pohoda into Python3 and i will try to match their versioning if possible

Python package

Please consider sponsoring if you're using this package commercially, my time is not free :) You can sponsor me by clicking on "Sponsor" button in top button row. Thank You./Prosím pouvažujte nad sponzorováním tohoto projektu pokud používáte tento projekt komerčně, můj čas není zadarmo :) Sponzorovat můžete kliknutím na tlačítko "Sponsor" v horní řadě tlačítkek. Děkuji.

Install

pip install pohoda

Example of order import

Examples for other agenda imports in tests folder.

from pohoda.Pohoda import Pohoda

pohoda = Pohoda('ICO', 'i_obj1', 'Import orders')

# create order
order = pohoda.create_order({
    'numberOrder': order_number,
    'isReserved': True,
    'date': created,
    'text': '...',
    'partnerIdentity': {
        'address': {
            'name': billing_name,
            'street': billing_street,
            'city': billing_city,
            'zip': billing_zip,
            'email': email,
            'phone': phone
        },
        'shipToAddress': {
            'name': shipping_name,
            'street': shipping_street,
            'city': shipping_city,
            'zip': shipping_zip,
            'email': email,
            'phone' phone
        }
    }
})

# add items
for item in items:
    order.add_item({
        'code': item.code,
        'text': item.text,
        'quantity': item.quantity,
        'payVAT': False,
        'rateVAT': item.rate,
        'homeCurrency': {
            'unitPrice': item.unit_price
        },
        'stockItem': {
            'stockItem': {
                'id': item.pohoda_id
            }
        }
    })

# add summary
order.add_summary({
    'roundingDocument': 'none'
})

# add order to import (identified by $order_number)
pohoda.add_item(order_number, order)

# Write data into file
pohoda.write(filename)

Example of stock export

Export request is made by creating ListRequest

from pohoda.Pohoda import Pohoda

pohoda = Pohoda('ICO', 'e_zas1', 'Export stock')


request = pohoda.create_list_request({
    'type': 'Stock'
})

# optional filter
request.add_user_filter_name('MyFilter')

pohoda.add_item('Export 001', request)

pohoda.write(filename)

Deleting stock example

We need to create a empty agenda with delete actionType to delete stock.

from pohoda.Pohoda import Pohoda

pohoda = Pohoda('ICO', 'd_zas1', 'Delete stock')


stock = pohoda.create_stock({})

stock.add_action_type('delete', {
    'code': code
})

pohoda.add_item(code, stock)

pohoda.write(filename)

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

pohoda-1.17.3.tar.gz (23.8 kB view details)

Uploaded Source

Built Distribution

pohoda-1.17.3-py3-none-any.whl (60.3 kB view details)

Uploaded Python 3

File details

Details for the file pohoda-1.17.3.tar.gz.

File metadata

  • Download URL: pohoda-1.17.3.tar.gz
  • Upload date:
  • Size: 23.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for pohoda-1.17.3.tar.gz
Algorithm Hash digest
SHA256 270b2f42f219e09d341bae1f4270b48167b27b91c6cc8a7785ea9d792134eba5
MD5 2e0652546d58bc87b0880b1c196247c2
BLAKE2b-256 501a99b593e364d68794f4b20026549236a812b60ee5335fc92a78ebe38b8c65

See more details on using hashes here.

File details

Details for the file pohoda-1.17.3-py3-none-any.whl.

File metadata

  • Download URL: pohoda-1.17.3-py3-none-any.whl
  • Upload date:
  • Size: 60.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for pohoda-1.17.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7c9c2f13d7b81bc5fb65af8bb624b04db479fe73a2cdff8f173a74442d873830
MD5 b6dd0ea72221f73d0f5dfa1f4badcfbb
BLAKE2b-256 239b281033bc99e59c3eb9a7c7273d600440e95e5922a9e8e0983b271fb0d5c4

See more details on using hashes here.

Supported by

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