This commit is contained in:
Frederik Jaeckel 2023-06-30 15:58:48 +02:00
parent 15dbf83233
commit 294c3869a6
2 changed files with 47 additions and 38 deletions

View file

@ -2,7 +2,7 @@
""" """
# Always prefer setuptools over distutils # Always prefer setuptools over distutils
from setuptools import setup, find_packages from setuptools import setup
# To use a consistent encoding # To use a consistent encoding
from codecs import open from codecs import open
from os import path from os import path
@ -51,19 +51,21 @@ for dep in info.get('depends', []):
prefix = modversion[dep]['prefix'] prefix = modversion[dep]['prefix']
if len(modversion[dep]['max']) > 0: if len(modversion[dep]['max']) > 0:
requires.append('%s_%s >= %s, <= %s' % requires.append('%s_%s >= %s, <= %s' % (
(prefix, dep, modversion[dep]['min'], modversion[dep]['max'])) prefix, dep, modversion[dep]['min'],
modversion[dep]['max']))
else: else:
requires.append('%s_%s >= %s' % requires.append('%s_%s >= %s' % (
(prefix, dep, modversion[dep]['min'])) prefix, dep, modversion[dep]['min']))
else: else:
requires.append('%s_%s >= %s.%s, < %s.%s' % requires.append('%s_%s >= %s.%s, < %s.%s' % (
('trytond', dep, major_version, minor_version, 'trytond', dep, major_version, minor_version,
major_version, minor_version + 1)) major_version, minor_version + 1))
requires.append('trytond >= %s.%s, < %s.%s' % requires.append('trytond >= %s.%s, < %s.%s' % (
(major_version, minor_version, major_version, minor_version + 1)) major_version, minor_version, major_version, minor_version + 1))
setup(name='%s_%s' % (PREFIX, MODULE), setup(
name='%s_%s' % (PREFIX, MODULE),
version=info.get('version', '0.0.1'), version=info.get('version', '0.0.1'),
description='Tryton module to XRechnung to edocument.', description='Tryton module to XRechnung to edocument.',
long_description=long_description, long_description=long_description,
@ -87,6 +89,7 @@ setup(name='%s_%s' % (PREFIX, MODULE),
'License :: OSI Approved :: GNU General Public License (GPL)', 'License :: OSI Approved :: GNU General Public License (GPL)',
'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
], ],
keywords='tryton xrechnung edcoument', keywords='tryton xrechnung edcoument',
@ -95,7 +98,8 @@ setup(name='%s_%s' % (PREFIX, MODULE),
'trytond.modules.%s' % MODULE, 'trytond.modules.%s' % MODULE,
], ],
package_data={ package_data={
'trytond.modules.%s' % MODULE: (info.get('xml', []) 'trytond.modules.%s' % MODULE: (
info.get('xml', [])
+ ['tryton.cfg', 'locale/*.po', 'tests/*.py', + ['tryton.cfg', 'locale/*.po', 'tests/*.py',
'template/*/*.xml', 'versiondep.txt', 'README.rst']), 'template/*/*.xml', 'versiondep.txt', 'README.rst']),
}, },

View file

@ -1,12 +1,12 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# This file is part of the cashbook-module from m-ds for Tryton. # This file is part of the edocument-module for Tryton from m-ds.de.
# The COPYRIGHT file at the top level of this repository contains the # The COPYRIGHT file at the top level of this repository contains the
# full copyright notices and license terms. # full copyright notices and license terms.
from trytond.tests.test_tryton import ModuleTestCase, with_transaction from trytond.tests.test_tryton import ModuleTestCase, with_transaction
from trytond.pool import Pool from trytond.pool import Pool
from trytond.modules.edocument_uncefact.tests.test_edocument_uncefact import get_invoice from trytond.modules.edocument_uncefact.tests.test_edocument_uncefact import get_invoice
from unittest.mock import Mock, MagicMock from unittest.mock import Mock
from decimal import Decimal from decimal import Decimal
@ -20,7 +20,6 @@ class EdocTestCase(ModuleTestCase):
""" """
pool = Pool() pool = Pool()
Template = pool.get('edocument.xrechnung.invoice') Template = pool.get('edocument.xrechnung.invoice')
Address = pool.get('party.address')
Identifier = pool.get('party.identifier') Identifier = pool.get('party.identifier')
Party = pool.get('party.party') Party = pool.get('party.party')
Bank = pool.get('bank') Bank = pool.get('bank')
@ -28,9 +27,11 @@ class EdocTestCase(ModuleTestCase):
BankNumber = pool.get('bank.account.number') BankNumber = pool.get('bank.account.number')
invoice = get_invoice() invoice = get_invoice()
invoice.party.get_xrechnung_route_id = Mock(return_value='xrechn-route-id-123') invoice.party.get_xrechnung_route_id = Mock(
return_value='xrechn-route-id-123')
invoice.company.party.bank_accounts = [ invoice.company.party.bank_accounts = [
Mock(spec=BankAccount, Mock(
spec=BankAccount,
currency=invoice.currency, currency=invoice.currency,
bank=Mock(spec=Bank, party=Mock(spec=Party, name='Bank')), bank=Mock(spec=Bank, party=Mock(spec=Party, name='Bank')),
owners=[invoice.company.party], owners=[invoice.company.party],
@ -40,7 +41,8 @@ class EdocTestCase(ModuleTestCase):
invoice.comment = 'note line 1\nnote line 2' invoice.comment = 'note line 1\nnote line 2'
invoice.taxes[0].tax.rate = Decimal('0.1') invoice.taxes[0].tax.rate = Decimal('0.1')
invoice.identifiers = [ invoice.identifiers = [
Mock(spec=Identifier, Mock(
spec=Identifier,
type='edoc_route_id', type='edoc_route_id',
code='xrechn-route-id-123') code='xrechn-route-id-123')
] ]
@ -100,3 +102,6 @@ class EdocTestCase(ModuleTestCase):
fhdl.write(invoice_string.decode('utf8')) fhdl.write(invoice_string.decode('utf8'))
# end EdocTestCase # end EdocTestCase
del ModuleTestCase