Compare commits

...

2 commits

Author SHA1 Message Date
Frederik Jaeckel
a5bf930e55 update license 2025-05-02 14:16:47 +02:00
Frederik Jaeckel
ea5a83d7c1 use product.round_price() to round unit_price of invoice-line 2025-01-29 09:33:40 +01:00
3 changed files with 8 additions and 12 deletions

View file

@ -1,7 +1,5 @@
Copyright (C) 2015-2023 Cédric Krier. Copyright (C) 2021-2025 martin-data services.
Copyright (C) 2015-2023 B2CK SPRL. Copyright (C) 2024-2025 Mathias Behrle
Copyright (C) 2021-2024 martin-data services.
Copyright (C) 2024 Mathias Behrle
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View file

@ -4,13 +4,13 @@
# full copyright notices and license terms. # full copyright notices and license terms.
from decimal import Decimal, ROUND_HALF_EVEN from decimal import Decimal
import html import html
from trytond.exceptions import UserError from trytond.exceptions import UserError
from trytond.i18n import gettext from trytond.i18n import gettext
from trytond.tools import cached_property from trytond.tools import cached_property
from trytond.pool import Pool from trytond.pool import Pool
from trytond.modules.product import price_digits from trytond.modules.product import round_price
class EdocumentMixin(object): class EdocumentMixin(object):
@ -193,10 +193,8 @@ class EdocumentMixin(object):
Returns: Returns:
Decimal: rounded value Decimal: rounded value
""" """
if isinstance(value, Decimal): if value is not None:
return value.quantize( return round_price(value)
Decimal(str(1/10 ** price_digits[1])),
ROUND_HALF_EVEN)
return value return value
def quote_text(self, text): def quote_text(self, text):

View file

@ -13,11 +13,9 @@ here = path.abspath(path.dirname(__file__))
MODULE = 'edocument_xrechnung' MODULE = 'edocument_xrechnung'
PREFIX = 'mds' PREFIX = 'mds'
# Get the long description from the README file
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'))
@ -87,6 +85,8 @@ setup(
'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', 'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
], ],
keywords='tryton xrechnung edcoument', keywords='tryton xrechnung edcoument',