wizard für export

This commit is contained in:
Frederik Jaeckel 2022-10-18 17:33:31 +02:00
parent 458dfecf72
commit 7b160d84af
5 changed files with 63 additions and 3 deletions

View file

@ -2,3 +2,4 @@ syntax: glob
build/* build/*
dist/* dist/*
mds_account_invoice_xrechnung.egg-info/* mds_account_invoice_xrechnung.egg-info/*
__pycache__/*

View file

@ -4,7 +4,9 @@
# full copyright notices and license terms. # full copyright notices and license terms.
from trytond.pool import Pool from trytond.pool import Pool
from .wizard_runreport import RunXRechnungReport
# ~ def register(): def register():
# ~ Pool.register( Pool.register(
# ~ module='account_invoice_xrechnung', type_='model') RunXRechnungReport,
module='account_invoice_xrechnung', type_='wizard')

View file

@ -2,5 +2,7 @@
version=6.0.0 version=6.0.0
depends: depends:
account_invoice account_invoice
bank
edocument_xrechnung edocument_xrechnung
xml: xml:
wizard_runreport.xml

36
wizard_runreport.py Normal file
View file

@ -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

19
wizard_runreport.xml Normal file
View file

@ -0,0 +1,19 @@
<?xml version="1.0"?>
<!-- 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. -->
<tryton>
<data>
<record model="ir.action.wizard" id="act_wizard_report">
<field name="name">XRechnung Report</field>
<field name="wiz_name">account_invoice_xrechnung.runrep</field>
</record>
<record model="ir.action.keyword" id="wizrecon_line-keyword">
<field name="keyword">form_action</field>
<field name="model">account.invoice,-1</field>
<field name="action" ref="act_wizard_report"/>
</record>
</data>
</tryton>