formatting

This commit is contained in:
Frederik Jaeckel 2024-11-21 14:34:17 +01:00
parent 38295dec35
commit 2dac79debe
4 changed files with 13 additions and 27 deletions

View file

@ -4,7 +4,7 @@
# this repository contains the full copyright notices and license terms. # this repository contains the full copyright notices and license terms.
from trytond.pool import PoolMeta from trytond.pool import PoolMeta
from trytond.pyson import Eval, And, Or from trytond.pyson import Eval, And, Or, Bool
class InvoiceLine(metaclass=PoolMeta): class InvoiceLine(metaclass=PoolMeta):
@ -17,10 +17,7 @@ class InvoiceLine(metaclass=PoolMeta):
cls.unit.states['required'], cls.unit.states['required'],
And( And(
Eval('type') == 'line', Eval('type') == 'line',
Eval('quantity', None) != None, Bool(Eval('quantity'))))
), cls.unit.depends.update(['type', 'quantity'])
)
cls.unit.depends.add('type')
cls.unit.depends.add('quantity')
# end Invoice # end Invoice

View file

@ -4,14 +4,10 @@
# this repository contains the full copyright notices and license terms. # this repository contains the full copyright notices and license terms.
from setuptools import setup from setuptools import setup
# To use a consistent encoding
from codecs import open from codecs import open
from os import path from os import path
import re import re
try: from configparser import ConfigParser
from configparser import ConfigParser
except ImportError:
from ConfigParser import ConfigParser
here = path.abspath(path.dirname(__file__)) here = path.abspath(path.dirname(__file__))
MODULE = 'account_invoice_xrechnung' MODULE = 'account_invoice_xrechnung'
@ -21,7 +17,6 @@ PREFIX = 'mds'
with open(path.join(here, 'README.rst'), encoding='utf-8') as f: with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read() long_description = f.read()
# tryton.cfg einlesen
config = ConfigParser() config = ConfigParser()
config.readfp(open('tryton.cfg')) config.readfp(open('tryton.cfg'))
info = dict(config.items('tryton')) info = dict(config.items('tryton'))
@ -88,9 +83,9 @@ setup(
'Natural Language :: English', 'Natural Language :: English',
'Operating System :: OS Independent', 'Operating System :: OS Independent',
'License :: OSI Approved :: GNU General Public License (GPL)', 'License :: OSI Approved :: GNU General Public License (GPL)',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
], ],
keywords='tryton account invoice xrechnung edocument', keywords='tryton account invoice xrechnung edocument',

View file

@ -18,8 +18,7 @@ sel_edocument = [
edoc_versions = { edoc_versions = {
'edocument.xrechnung.invoice': 'XRechnung-2.2', 'edocument.xrechnung.invoice': 'XRechnung-2.2',
'edocument.uncefact.invoice': '16B-CII', 'edocument.uncefact.invoice': '16B-CII'}
}
class RunXRechnungReportStart(ModelView): class RunXRechnungReportStart(ModelView):
@ -62,8 +61,7 @@ class RunXRechnungReport(Wizard):
buttons=[ buttons=[
Button(string='Cancel', state='end', icon='tryton-cancel'), Button(string='Cancel', state='end', icon='tryton-cancel'),
Button(string='Export', state='export', icon='tryton-export'), Button(string='Export', state='export', icon='tryton-export'),
], ])
)
def default_start(self, fields): def default_start(self, fields):
""" set defaults """ set defaults
@ -75,8 +73,7 @@ class RunXRechnungReport(Wizard):
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 '', 'state': invoice[0].state if invoice else ''}
}
return result return result
def do_export(self, action): def do_export(self, action):
@ -85,12 +82,10 @@ class RunXRechnungReport(Wizard):
if self.start.state != 'posted': if self.start.state != 'posted':
raise UserError(gettext( raise UserError(gettext(
'account_invoice_xrechnung.msg_invoice_must_posted', 'account_invoice_xrechnung.msg_invoice_must_posted',
invname=self.start.invoice.rec_name, 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,
'as_zip': self.start.as_zip, 'as_zip': self.start.as_zip}
}
# end RunXRechnungReport # end RunXRechnungReport

View file

@ -38,10 +38,9 @@ class XReport(Report):
invoice_string = template.render(edoc_versions[data['edocument']]) invoice_string = template.render(edoc_versions[data['edocument']])
file_name = slugify('%(date)s-%(descr)s' % { file_name = slugify('%(date)s-%(descr)s' % {
'date': IrDate.today().isoformat().replace('-', ''), 'date': IrDate.today().isoformat().replace('-', ''),
'descr': invoice.rec_name, 'descr': invoice.rec_name},
}, max_length=100, word_boundary=True, save_order=True)
max_length=100, word_boundary=True, save_order=True)
if data['as_zip'] is True: if data['as_zip'] is True:
return ( return (