info bei nicht-festgeschriebener rechnung

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

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,