Metadata-Version: 2.1
Name: pohoda
Version: 1.0.7
Summary: Python library for generating pohoda XML files
Home-page: https://github.com/Salamek/pohoda
Author: Adam Schubert
Author-email: adam.schubert@sg1-game.net
License: LGPL-3.0 
Project-URL: Release notes, https://github.com/Salamek/pohoda/releases
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Software Development
Requires-Python: >=3.4
Description-Content-Type: text/markdown
License-File: LICENSE

# 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](https://github.com/Salamek/pohoda/actions/workflows/python-test.yml/badge.svg)](https://github.com/Salamek/pohoda/actions/workflows/python-test.yml)


## Install


```bash
pip install pohoda
```


## Example of order import

Examples for other agenda imports in  *tests* folder.

```python
from pohoda.Pohoda import Pohoda

pohoda = Pohoda('ICO')

# create file
pohoda.open(filename, '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)

# close import file
pohoda.close()
```

## Example of stock export

Export request is made by creating *ListRequest*


```python
from pohoda.Pohoda import Pohoda

pohoda = Pohoda('ICO')

# create request for export
pohoda.open(filename, '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.close()
```


## Deleting stock example

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


```python
from pohoda.Pohoda import Pohoda

pohoda = Pohoda('ICO')

# create request for deletion
pohoda.open(filename, 'd_zas1', 'Delete stock')

stock = pohoda.create_stock([])

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

pohoda.add_item(code, stock)

pohoda.close()
```


