edocument_xrechnung/party.py

39 lines
1.1 KiB
Python
Raw Normal View History

2022-10-17 15:20:25 +00:00
# -*- coding: utf-8 -*-
# This file is part of the edcoment-module for Tryton.
# The COPYRIGHT file at the top level of this repository contains the
# full copyright notices and license terms.
from trytond.pool import PoolMeta
from trytond.exceptions import UserError
from trytond.i18n import gettext
class Party(metaclass=PoolMeta):
__name__ = 'party.party'
def get_xrechnung_route_id(self):
""" search for route-id at party, fire-exception if missing
"""
for ident in self.identifiers:
if ident.type == 'edoc_route_id':
return ident.code
raise UserError(gettext(
'edocument_xrechnung.msg_missing_xrechnung_route_id',
partyname = self.rec_name,
))
2022-10-18 15:33:17 +00:00
2022-10-17 15:20:25 +00:00
# end Party
class PartyConfiguration(metaclass=PoolMeta):
__name__ = 'party.configuration'
@classmethod
def __setup__(cls):
super(PartyConfiguration, cls).__setup__()
cls.identifier_types.selection.append(
('edoc_route_id', 'X-Rechnung Route-ID')
)
# end Configuration