From 8a48fb723677fdecba38b50b79da7eb72d612c15 Mon Sep 17 00:00:00 2001 From: Frederik Jaeckel Date: Tue, 7 Jan 2025 15:32:19 +0100 Subject: [PATCH] add configuration --- __init__.py | 2 + configuration.py | 42 +++++++++++++++++++ configuration.xml | 13 ++++++ tryton.cfg | 1 + view/document_incoming_configuration_form.xml | 12 ++++++ 5 files changed, 70 insertions(+) create mode 100644 configuration.py create mode 100644 configuration.xml create mode 100644 view/document_incoming_configuration_form.xml diff --git a/__init__.py b/__init__.py index 8ffc89c..6ae3e17 100644 --- a/__init__.py +++ b/__init__.py @@ -5,9 +5,11 @@ from trytond.pool import Pool from .document import Incoming +from .configuration import Configuration def register(): Pool.register( + Configuration, Incoming, module='document_incoming_invoice_xml', type_='model') diff --git a/configuration.py b/configuration.py new file mode 100644 index 0000000..30bde88 --- /dev/null +++ b/configuration.py @@ -0,0 +1,42 @@ + +# -*- coding: utf-8 -*- +# This file is part of the document-incoming-invoice-xml-module +# from m-ds 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.model import fields + + +class Configuration(metaclass=PoolMeta): + __name__ = 'document.incoming.configuration' + + create_supplier = fields.Boolean( + string='Create Supplier Party', + help='Creates the vendor party if it does not exist. ' + + 'Generates an import error when turned off and the party is missing.') + accept_other_company = fields.Boolean( + string='Accept other company', + help='Accepts invoices created for a company other ' + + 'than the current one.') + + @classmethod + def default_create_supplier(cls): + """ auto create supplier party + + Returns: + boolean: True + """ + return True + + @classmethod + def default_accept_other_company(cls): + """ deny import of invoices for other companies + + Returns: + boolean: False + """ + return False + +# end Configuration diff --git a/configuration.xml b/configuration.xml new file mode 100644 index 0000000..0e5b76c --- /dev/null +++ b/configuration.xml @@ -0,0 +1,13 @@ + + + + + + document.incoming.configuration + + document_incoming_configuration_form + + + diff --git a/tryton.cfg b/tryton.cfg index 8d8f2eb..da80e85 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -4,4 +4,5 @@ depends: document_incoming_invoice xml: message.xml + configuration.xml document.xml diff --git a/view/document_incoming_configuration_form.xml b/view/document_incoming_configuration_form.xml new file mode 100644 index 0000000..edf4033 --- /dev/null +++ b/view/document_incoming_configuration_form.xml @@ -0,0 +1,12 @@ + + + + + +