From 2dac79debe15513e3a1fc95e4c626262b1c49a51 Mon Sep 17 00:00:00 2001 From: Frederik Jaeckel Date: Thu, 21 Nov 2024 14:34:17 +0100 Subject: [PATCH] formatting --- invoice.py | 9 +++------ setup.py | 9 ++------- wizard_runreport.py | 15 +++++---------- xreport.py | 7 +++---- 4 files changed, 13 insertions(+), 27 deletions(-) diff --git a/invoice.py b/invoice.py index 108d7b0..bbdeca2 100644 --- a/invoice.py +++ b/invoice.py @@ -4,7 +4,7 @@ # this repository contains the full copyright notices and license terms. from trytond.pool import PoolMeta -from trytond.pyson import Eval, And, Or +from trytond.pyson import Eval, And, Or, Bool class InvoiceLine(metaclass=PoolMeta): @@ -17,10 +17,7 @@ class InvoiceLine(metaclass=PoolMeta): cls.unit.states['required'], And( Eval('type') == 'line', - Eval('quantity', None) != None, - ), - ) - cls.unit.depends.add('type') - cls.unit.depends.add('quantity') + Bool(Eval('quantity')))) + cls.unit.depends.update(['type', 'quantity']) # end Invoice diff --git a/setup.py b/setup.py index 3d2ee45..fa92fb4 100644 --- a/setup.py +++ b/setup.py @@ -4,14 +4,10 @@ # this repository contains the full copyright notices and license terms. from setuptools import setup -# To use a consistent encoding from codecs import open from os import path import re -try: - from configparser import ConfigParser -except ImportError: - from ConfigParser import ConfigParser +from configparser import ConfigParser here = path.abspath(path.dirname(__file__)) MODULE = 'account_invoice_xrechnung' @@ -21,7 +17,6 @@ PREFIX = 'mds' with open(path.join(here, 'README.rst'), encoding='utf-8') as f: long_description = f.read() -# tryton.cfg einlesen config = ConfigParser() config.readfp(open('tryton.cfg')) info = dict(config.items('tryton')) @@ -88,9 +83,9 @@ setup( 'Natural Language :: English', 'Operating System :: OS Independent', 'License :: OSI Approved :: GNU General Public License (GPL)', - 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', ], keywords='tryton account invoice xrechnung edocument', diff --git a/wizard_runreport.py b/wizard_runreport.py index f1876a8..79977f4 100644 --- a/wizard_runreport.py +++ b/wizard_runreport.py @@ -18,8 +18,7 @@ sel_edocument = [ edoc_versions = { 'edocument.xrechnung.invoice': 'XRechnung-2.2', - 'edocument.uncefact.invoice': '16B-CII', - } + 'edocument.uncefact.invoice': '16B-CII'} class RunXRechnungReportStart(ModelView): @@ -62,8 +61,7 @@ class RunXRechnungReport(Wizard): buttons=[ Button(string='Cancel', state='end', icon='tryton-cancel'), Button(string='Export', state='export', icon='tryton-export'), - ], - ) + ]) def default_start(self, fields): """ set defaults @@ -75,8 +73,7 @@ class RunXRechnungReport(Wizard): result = { 'edocument': 'edocument.xrechnung.invoice', 'invoice': context.get('active_id', -1), - 'state': invoice[0].state if len(invoice) > 0 else '', - } + 'state': invoice[0].state if invoice else ''} return result def do_export(self, action): @@ -85,12 +82,10 @@ class RunXRechnungReport(Wizard): if self.start.state != 'posted': raise UserError(gettext( 'account_invoice_xrechnung.msg_invoice_must_posted', - invname=self.start.invoice.rec_name, - )) + invname=self.start.invoice.rec_name)) return action, { 'invoice': self.start.invoice.id, 'edocument': self.start.edocument, - 'as_zip': self.start.as_zip, - } + 'as_zip': self.start.as_zip} # end RunXRechnungReport diff --git a/xreport.py b/xreport.py index 7a17b06..a62acbc 100644 --- a/xreport.py +++ b/xreport.py @@ -38,10 +38,9 @@ class XReport(Report): invoice_string = template.render(edoc_versions[data['edocument']]) file_name = slugify('%(date)s-%(descr)s' % { - 'date': IrDate.today().isoformat().replace('-', ''), - 'descr': invoice.rec_name, - }, - max_length=100, word_boundary=True, save_order=True) + 'date': IrDate.today().isoformat().replace('-', ''), + 'descr': invoice.rec_name}, + max_length=100, word_boundary=True, save_order=True) if data['as_zip'] is True: return (