38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
# -*- 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,
|
|
))
|
|
|
|
# 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
|