This commit is contained in:
Frederik Jaeckel 2022-10-14 10:10:29 +02:00
commit 0100653643
5 changed files with 176 additions and 0 deletions

19
README.rst Normal file
View file

@ -0,0 +1,19 @@
mds-cashbook-media
==================
Tryton module to add a file-field to cashbook.
Install
=======
pip install mds-cashbook-media
Requires
========
- Tryton 6.0
Changes
=======
*6.0.0 - 14.10.2022*
- init

42
__init__.py Normal file
View file

@ -0,0 +1,42 @@
# -*- 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 .book import Book
from .types import Type
from .line import Line, LineContext
from .splitline import SplitLine
from .wizard_openline import OpenCashBook, OpenCashBookStart, OpenCashBookTree
from .wizard_runreport import RunCbReport, RunCbReportStart
from .wizard_booking import EnterBookingWizard, EnterBookingStart
from .configuration import Configuration, UserConfiguration
from .category import Category
from .reconciliation import Reconciliation
from .cbreport import ReconciliationReport
def register():
Pool.register(
Configuration,
UserConfiguration,
Type,
Category,
Book,
LineContext,
Line,
SplitLine,
Reconciliation,
OpenCashBookStart,
RunCbReportStart,
EnterBookingStart,
module='cashbook', type_='model')
Pool.register(
ReconciliationReport,
module='cashbook', type_='report')
Pool.register(
OpenCashBook,
OpenCashBookTree,
RunCbReport,
EnterBookingWizard,
module='cashbook', type_='wizard')

109
setup.py Normal file
View file

@ -0,0 +1,109 @@
""" Tryton module to add a file-field 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_media'
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 a file-field 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 pdf png image file',
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),
)

5
tryton.cfg Normal file
View file

@ -0,0 +1,5 @@
[tryton]
version=6.0.0
depends:
cashbook
xml:

1
versiondep.txt Normal file
View file

@ -0,0 +1 @@
cashbook;6.0.18;6.0.999;mds