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" msgid "Type"
msgstr "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:" msgctxt "model:account_invoice_xrechnung.runrep,name:"
msgid "eDocument Export" msgid "eDocument Export"
msgstr "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 bank
edocument_xrechnung edocument_xrechnung
xml: xml:
message.xml
wizard_runreport.xml wizard_runreport.xml
xreport.xml xreport.xml

View file

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

View file

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