From 73985fd0954b1f4c83031567d63ffae31c89d63d Mon Sep 17 00:00:00 2001 From: Frederik Jaeckel Date: Sun, 28 Aug 2022 14:54:14 +0200 Subject: [PATCH] init --- .hgignore | 5 +++ README.rst | 19 +++++++++ __init__.py | 12 ++++++ category.py | 14 +++++++ category.xml | 10 +++++ locale/de.po | 4 ++ setup.py | 109 +++++++++++++++++++++++++++++++++++++++++++++++++ tryton.cfg | 5 +++ versiondep.txt | 1 + 9 files changed, 179 insertions(+) create mode 100644 .hgignore create mode 100644 README.rst create mode 100644 __init__.py create mode 100644 category.py create mode 100644 category.xml create mode 100644 locale/de.po create mode 100644 setup.py create mode 100644 tryton.cfg create mode 100644 versiondep.txt diff --git a/.hgignore b/.hgignore new file mode 100644 index 0000000..de14f8e --- /dev/null +++ b/.hgignore @@ -0,0 +1,5 @@ +syntax: glob +locale/convert_de2en.py +build/* +mds_cashbook_dataexchange.egg-info/* +dist/* diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..a7e7424 --- /dev/null +++ b/README.rst @@ -0,0 +1,19 @@ +mds-cashbook-dataexchange +========================= +Tryton module to add import/export to cashbook. + +Install +======= + +pip install mds-cashbook-dataexchange + +Requires +======== +- Tryton 6.0 + +Changes +======= + +*6.0.0 - 28.08.2022* + +- init diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..4214b77 --- /dev/null +++ b/__init__.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# This file is part of the cashbook-module from m-ds for Tryton. +# The COPYRIGHT file at the top level of this repository contains the +# full copyright notices and license terms. + +from trytond.pool import Pool +from .category import Category + +def register(): + Pool.register( + Category, + module='cashbook_dataexchange', type_='model') diff --git a/category.py b/category.py new file mode 100644 index 0000000..60d1732 --- /dev/null +++ b/category.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +# This file is part of the cashbook-module from m-ds for Tryton. +# The COPYRIGHT file at the top level of this repository contains the +# full copyright notices and license terms. + +from trytond.transaction import Transaction +from trytond.pool import Pool, PoolMeta + + +class Category(PoolMeta): + __name__ = 'cashbook.category' + + +# end Category diff --git a/category.xml b/category.xml new file mode 100644 index 0000000..25498c4 --- /dev/null +++ b/category.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/locale/de.po b/locale/de.po new file mode 100644 index 0000000..9f86134 --- /dev/null +++ b/locale/de.po @@ -0,0 +1,4 @@ +# +msgid "" +msgstr "Content-Type: text/plain; charset=utf-8\n" + diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..1eff6ad --- /dev/null +++ b/setup.py @@ -0,0 +1,109 @@ +""" Tryton module to add import/export to cashbook +""" + +# Always prefer setuptools over distutils +from setuptools import setup, find_packages +# To use a consistent encoding +from codecs import open +from os import path +import re +try: + from configparser import ConfigParser +except ImportError: + from ConfigParser import ConfigParser + +here = path.abspath(path.dirname(__file__)) +MODULE = 'cashbook_dataexchange' +PREFIX = 'mds' + +# Get the long description from the README file +with open(path.join(here, 'README.rst'), encoding='utf-8') as f: + long_description = f.read() + +# tryton.cfg einlesen +config = ConfigParser() +config.readfp(open('tryton.cfg')) +info = dict(config.items('tryton')) +for key in ('depends', 'extras_depend', 'xml'): + if key in info: + info[key] = info[key].strip().splitlines() + +# Get module-versions +modversion = {} +with open(path.join(here, 'versiondep.txt'), encoding='utf-8') as f: + l1 = f.readlines() + for i in l1: + l2 = i.strip().split(';') + if len(l2) < 4: + continue + modversion[l2[0]] = {'min':l2[1], 'max':l2[2], 'prefix':l2[3]} + +# tryton-version +major_version = 6 +minor_version = 0 + +requires = [] +for dep in info.get('depends', []): + if not re.match(r'(ir|res|webdav)(\W|$)', dep): + if dep in modversion.keys(): + prefix = 'mds' + if len(modversion[dep]['prefix']) > 0: + prefix = modversion[dep]['prefix'] + + if len(modversion[dep]['max']) > 0: + requires.append('%s_%s >= %s, <= %s' % + (prefix, dep, modversion[dep]['min'], modversion[dep]['max'])) + else : + requires.append('%s_%s >= %s' % + (prefix, dep, modversion[dep]['min'])) + else : + requires.append('%s_%s >= %s.%s, < %s.%s' % + ('trytond', dep, major_version, minor_version, + major_version, minor_version + 1)) +requires.append('trytond >= %s.%s, < %s.%s' % + (major_version, minor_version, major_version, minor_version + 1)) + +setup(name='%s_%s' % (PREFIX, MODULE), + version=info.get('version', '0.0.1'), + description='Tryton module to add import/export to cashbook.', + long_description=long_description, + url='https://www.m-ds.de/', + author='martin-data services', + author_email='service@m-ds.de', + license='GPL-3', + classifiers=[ + 'Development Status :: 5 - Production/Stable', + 'Environment :: Plugins', + 'Framework :: Tryton', + 'Intended Audience :: Developers', + 'Intended Audience :: Customer Service', + 'Intended Audience :: Information Technology', + 'Intended Audience :: Financial and Insurance Industry', + 'Topic :: Office/Business', + 'Topic :: Office/Business :: Financial :: Accounting', + 'Natural Language :: German', + 'Natural Language :: English', + 'Operating System :: OS Independent', + 'License :: OSI Approved :: GNU General Public License (GPL)', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + ], + + keywords='tryton cashbook import export', + package_dir={'trytond.modules.%s' % MODULE: '.'}, + packages=[ + 'trytond.modules.%s' % MODULE, + ], + package_data={ + 'trytond.modules.%s' % MODULE: (info.get('xml', []) + + ['tryton.cfg', 'locale/*.po', 'tests/*.py', + 'view/*.xml', 'versiondep.txt', 'README.rst']), + }, + + install_requires=requires, + zip_safe=False, + entry_points=""" + [trytond.modules] + %s = trytond.modules.%s + """ % (MODULE, MODULE), +) diff --git a/tryton.cfg b/tryton.cfg new file mode 100644 index 0000000..80e4d6d --- /dev/null +++ b/tryton.cfg @@ -0,0 +1,5 @@ +[tryton] +version=6.0.1 +depends: + cashbook +xml: diff --git a/versiondep.txt b/versiondep.txt new file mode 100644 index 0000000..1b31d78 --- /dev/null +++ b/versiondep.txt @@ -0,0 +1 @@ +cashbook;6.0.1;6.0.999;mds