diff --git a/locale/en.po b/locale/en.po
index 3e16682..5d9a36b 100644
--- a/locale/en.po
+++ b/locale/en.po
@@ -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"
diff --git a/message.xml b/message.xml
new file mode 100644
index 0000000..6df4deb
--- /dev/null
+++ b/message.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+ Invoice '%(invname)s' must be posted.
+
+
+
+
diff --git a/tryton.cfg b/tryton.cfg
index ffc3e07..27e058c 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -5,5 +5,6 @@ depends:
bank
edocument_xrechnung
xml:
+ message.xml
wizard_runreport.xml
xreport.xml
diff --git a/view/wizard_form.xml b/view/wizard_form.xml
index 10295d1..9ed0b0c 100644
--- a/view/wizard_form.xml
+++ b/view/wizard_form.xml
@@ -10,5 +10,6 @@ full copyright notices and license terms. -->
+
diff --git a/wizard_runreport.py b/wizard_runreport.py
index dc86ac7..a821963 100644
--- a/wizard_runreport.py
+++ b/wizard_runreport.py
@@ -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,