account_invoice_xrechnung/wizard_runreport.py

37 lines
1.1 KiB
Python
Raw Normal View History

2022-10-18 15:33:31 +00:00
# -*- 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