formatting

This commit is contained in:
Frederik Jaeckel 2023-06-30 11:36:17 +02:00
parent 5bb3af1f39
commit 7d20e3d091
4 changed files with 20 additions and 29 deletions

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# This file is part of the cashbook-module from m-ds for Tryton. # This file is part of the edocument-module for Tryton from m-ds.de.
# The COPYRIGHT file at the top level of this repository contains the # The COPYRIGHT file at the top level of this repository contains the
# full copyright notices and license terms. # full copyright notices and license terms.

View file

@ -1,10 +1,11 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# This file is part of the edcoment-module for Tryton. # This file is part of the edocument-module for Tryton from m-ds.de.
# The COPYRIGHT file at the top level of this repository contains the # The COPYRIGHT file at the top level of this repository contains the
# full copyright notices and license terms. # full copyright notices and license terms.
import genshi.template import genshi.template
import os, html import os
import html
from trytond.exceptions import UserError from trytond.exceptions import UserError
from trytond.i18n import gettext from trytond.i18n import gettext
from trytond.modules.edocument_uncefact.edocument import Invoice from trytond.modules.edocument_uncefact.edocument import Invoice
@ -46,16 +47,14 @@ class Invoice(Invoice):
raise UserError(gettext( raise UserError(gettext(
'edocument_xrechnung.msg_linetax_invalid_number', 'edocument_xrechnung.msg_linetax_invalid_number',
linename=line.rec_name, linename=line.rec_name,
numtax = len(line.invoice_taxes), numtax=len(line.invoice_taxes)))
))
allowed_cat = ['AE', 'L', 'M', 'E', 'S', 'Z', 'G', 'O', 'K', 'B'] allowed_cat = ['AE', 'L', 'M', 'E', 'S', 'Z', 'G', 'O', 'K', 'B']
if not line.invoice_taxes[0].tax.unece_category_code in allowed_cat: if not line.invoice_taxes[0].tax.unece_category_code in allowed_cat:
raise UserError(gettext( raise UserError(gettext(
'edocument_xrechnung.msg_linetax_invalid_catcode', 'edocument_xrechnung.msg_linetax_invalid_catcode',
taxname=line.invoice_taxes[0].tax.rec_name, taxname=line.invoice_taxes[0].tax.rec_name,
allowed = ', '.join(allowed_cat), allowed=', '.join(allowed_cat)))
))
return line.invoice_taxes[0].tax return line.invoice_taxes[0].tax
@ -84,8 +83,7 @@ class Invoice(Invoice):
if len(line.unit.unece_code or '') == 0: if len(line.unit.unece_code or '') == 0:
raise UserError(gettext( raise UserError(gettext(
'edocument_xrechnung.msg_uom_code_missing', 'edocument_xrechnung.msg_uom_code_missing',
uomname = line.unit.rec_name, uomname=line.unit.rec_name))
))
return line.unit.unece_code return line.unit.unece_code
def tax_category_code(self, tax): def tax_category_code(self, tax):
@ -94,8 +92,7 @@ class Invoice(Invoice):
if len(tax.unece_category_code or '') == 0: if len(tax.unece_category_code or '') == 0:
raise UserError(gettext( raise UserError(gettext(
'edocument_xrechnung.mds_tax_category_missing', 'edocument_xrechnung.mds_tax_category_missing',
taxname = tax.rec_name, taxname=tax.rec_name))
))
return tax.unece_category_code return tax.unece_category_code
def quote_text(self, text): def quote_text(self, text):

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# This file is part of the edcoment-module for Tryton. # This file is part of the edocument-module for Tryton from m-ds.de.
# The COPYRIGHT file at the top level of this repository contains the # The COPYRIGHT file at the top level of this repository contains the
# full copyright notices and license terms. # full copyright notices and license terms.
@ -19,8 +19,7 @@ class Party(metaclass=PoolMeta):
return ident.code return ident.code
raise UserError(gettext( raise UserError(gettext(
'edocument_xrechnung.msg_missing_xrechnung_route_id', 'edocument_xrechnung.msg_missing_xrechnung_route_id',
partyname = self.rec_name, partyname=self.rec_name))
))
# end Party # end Party

View file

@ -1,23 +1,18 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of # -*- coding: utf-8 -*-
# this repository contains the full copyright notices and license terms. # This file is part of the edocument-module for Tryton from m-ds.de.
# The COPYRIGHT file at the top level of this repository contains the
# full copyright notices and license terms.
import trytond.tests.test_tryton import trytond.tests.test_tryton
import unittest import unittest
from trytond.modules.edocument_xrechnung.tests.test_edocument import EdocTestCase from .test_edocument import EdocTestCase
__all__ = ['suite'] __all__ = ['suite']
class EDocumentTestCase(\
EdocTestCase,\
):
'Test edocument module'
module = 'edocument_xrechnung'
# end EDocumentTestCase
def suite(): def suite():
suite = trytond.tests.test_tryton.suite() suite = trytond.tests.test_tryton.suite()
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(EDocumentTestCase)) suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
EdocTestCase))
return suite return suite