From 00dd70e877a25a906778c69f794aae31ad15cd3a Mon Sep 17 00:00:00 2001 From: Frederik Jaeckel Date: Wed, 19 Oct 2022 17:47:47 +0200 Subject: [PATCH] exprt wizard begonnen --- __init__.py | 7 +++++- invoice.py | 25 ++++++++++++++++++++ tests/__init__.py | 24 +++++++++++++++++++ tests/test_invoice.py | 19 +++++++++++++++ view/wizard_form.xml | 11 +++++++++ wizard_runreport.py | 55 ++++++++++++++++++++++++++++++++++++++----- wizard_runreport.xml | 9 ++++++- 7 files changed, 142 insertions(+), 8 deletions(-) create mode 100644 invoice.py create mode 100644 tests/__init__.py create mode 100644 tests/test_invoice.py create mode 100644 view/wizard_form.xml diff --git a/__init__.py b/__init__.py index 56db290..0c9d2d3 100644 --- a/__init__.py +++ b/__init__.py @@ -4,9 +4,14 @@ # full copyright notices and license terms. from trytond.pool import Pool -from .wizard_runreport import RunXRechnungReport +from .wizard_runreport import RunXRechnungReport, RunXRechnungReportStart +from .invoice import InvoiceLine def register(): + Pool.register( + InvoiceLine, + RunXRechnungReportStart, + module='account_invoice_xrechnung', type_='model') Pool.register( RunXRechnungReport, module='account_invoice_xrechnung', type_='wizard') diff --git a/invoice.py b/invoice.py new file mode 100644 index 0000000..05b5e6c --- /dev/null +++ b/invoice.py @@ -0,0 +1,25 @@ +# -*- 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 PoolMeta +from trytond.pyson import Eval, And, Or + + +class InvoiceLine(metaclass=PoolMeta): + __name__ = 'account.invoice.line' + + @classmethod + def __setup__(cls): + super(InvoiceLine, cls).__setup__() + cls.unit.states['required'] = Or( + cls.unit.states['required'], + And( + Eval('type') == 'line', + Eval('quantity', None) != None, + ), + ) + cls.unit.depends.extend(['type', 'quantity']) + +# end Invoice diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..b936445 --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1,24 @@ +# This file is part of Tryton. The COPYRIGHT file at the top level of +# this repository contains the full copyright notices and license terms. + +import trytond.tests.test_tryton +import unittest + +from trytond.modules.account_invoice_xrechnung.tests.test_invoice import InvoiceTestCase + + +__all__ = ['suite'] + + +class XRechnungTestCase(\ + InvoiceTestCase,\ + ): + 'Test xrechnung module' + module = 'account_invoice_xrechnung' + +# end XRechnungTestCase + +def suite(): + suite = trytond.tests.test_tryton.suite() + suite.addTests(unittest.TestLoader().loadTestsFromTestCase(XRechnungTestCase)) + return suite diff --git a/tests/test_invoice.py b/tests/test_invoice.py new file mode 100644 index 0000000..811b717 --- /dev/null +++ b/tests/test_invoice.py @@ -0,0 +1,19 @@ +# -*- 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.tests.test_tryton import ModuleTestCase, with_transaction + + +class InvoiceTestCase(ModuleTestCase): + 'Test invoice module' + module = 'account_invoice_xrechnung' + + @with_transaction() + def test_xrechnung(self): + """ run default tests + """ + pass + +# end InvoiceTestCase diff --git a/view/wizard_form.xml b/view/wizard_form.xml new file mode 100644 index 0000000..d301445 --- /dev/null +++ b/view/wizard_form.xml @@ -0,0 +1,11 @@ + + +
+