info bei nicht-festgeschriebener rechnung

This commit is contained in:
Frederik Jaeckel 2022-10-20 15:42:55 +02:00
parent 150174f455
commit 2c6102054f
5 changed files with 31 additions and 1 deletions

View file

@ -22,6 +22,10 @@ msgctxt "field:account_invoice_xrechnung.runrep.start,edocument:"
msgid "Type"
msgstr "Type"
msgctxt "field:account_invoice_xrechnung.runrep.start,as_zip:"
msgid "ZIP-File"
msgstr "ZIP-File"
msgctxt "model:account_invoice_xrechnung.runrep,name:"
msgid "eDocument Export"
msgstr "eDocument Export"

13
message.xml Normal file
View file

@ -0,0 +1,13 @@
<?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.message" id="msg_invoice_must_posted">
<field name="text">Invoice '%(invname)s' must be posted.</field>
</record>
</data>
</tryton>

View file

@ -5,5 +5,6 @@ depends:
bank
edocument_xrechnung
xml:
message.xml
wizard_runreport.xml
xreport.xml

View file

@ -10,5 +10,6 @@ full copyright notices and license terms. -->
<label name="as_zip"/>
<field name="as_zip"/>
<field name="state"/>
</form>

View file

@ -6,6 +6,8 @@
from trytond.model import ModelView, fields
from trytond.wizard import Wizard, StateView, StateReport, Button
from trytond.pool import Pool
from trytond.exceptions import UserError
from trytond.i18n import gettext
from trytond.transaction import Transaction
@ -20,13 +22,14 @@ edoc_versions = {
}
class RunXRechnungReportStart(ModelView):
'eDocument Export'
__name__ = 'account_invoice_xrechnung.runrep.start'
invoice = fields.Many2One(string='Invoice', readonly=True,
model_name='account.invoice', required=True)
state = fields.Char(string='State', readonly=True,
states={'invisible': True})
edocument = fields.Selection(string='Type', required=True,
selection=sel_edocument)
as_zip = fields.Boolean(string='ZIP-File')
@ -65,16 +68,24 @@ class RunXRechnungReport(Wizard):
""" set defaults
"""
context = Transaction().context
Invoice = Pool().get('account.invoice')
invoice = Invoice.browse([context.get('active_id', -1)])
result = {
'edocument': 'edocument.xrechnung.invoice',
'invoice': context.get('active_id', -1),
'state': invoice[0].state if len(invoice) > 0 else '',
}
return result
def do_export(self, action):
""" run export
"""
if self.start.state != 'posted':
raise UserError(gettext(
'account_invoice_xrechnung.msg_invoice_must_posted',
invname = self.start.invoice.rec_name,
))
return action, {
'invoice': self.start.invoice.id,
'edocument': self.start.edocument,