diff --git a/.hgignore b/.hgignore index 3ddd880..201e288 100644 --- a/.hgignore +++ b/.hgignore @@ -2,3 +2,4 @@ syntax: glob build/* dist/* mds_account_invoice_xrechnung.egg-info/* +__pycache__/* diff --git a/__init__.py b/__init__.py index 21fccb2..56db290 100644 --- a/__init__.py +++ b/__init__.py @@ -4,7 +4,9 @@ # full copyright notices and license terms. from trytond.pool import Pool +from .wizard_runreport import RunXRechnungReport -# ~ def register(): - # ~ Pool.register( - # ~ module='account_invoice_xrechnung', type_='model') +def register(): + Pool.register( + RunXRechnungReport, + module='account_invoice_xrechnung', type_='wizard') diff --git a/tryton.cfg b/tryton.cfg index c549d6f..f77a33b 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -2,5 +2,7 @@ version=6.0.0 depends: account_invoice + bank edocument_xrechnung xml: + wizard_runreport.xml diff --git a/wizard_runreport.py b/wizard_runreport.py new file mode 100644 index 0000000..378c0f1 --- /dev/null +++ b/wizard_runreport.py @@ -0,0 +1,36 @@ +# -*- 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.model import ModelView, fields +from trytond.wizard import Wizard, StateAction +from trytond.pool import Pool +from trytond.transaction import Transaction + + +class RunXRechnungReport(Wizard): + 'XRechnung Report' + __name__ = 'account_invoice_xrechnung.runrep' + + start_state = 'open_' + #report_ = StateReport('cashbook.reprecon') + open_ = StateAction('account_invoice.act_invoice_form') + + def do_open_(self, action): + """ run form + """ + pool = Pool() + Invoice = pool.get('account.invoice') + EDocument = pool.get('edocument.xrechnung.invoice') + context = Transaction().context + + invoice, = Invoice.browse([context.get('active_id', -1)]) + template = EDocument(invoice) + invoice_string = template.render('XRechnung-2.2') + print('\n## invoice_string:', invoice_string.decode('utf8')) + + + return action, {} + +# end RunXRechnungReport diff --git a/wizard_runreport.xml b/wizard_runreport.xml new file mode 100644 index 0000000..89b3371 --- /dev/null +++ b/wizard_runreport.xml @@ -0,0 +1,19 @@ + + + + + + + XRechnung Report + account_invoice_xrechnung.runrep + + + form_action + account.invoice,-1 + + + + +