document_incoming_invoice_xml/configuration.py
2025-01-07 16:08:44 +01:00

60 lines
1.6 KiB
Python

# -*- 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
sel_number_target = [
('reference', "in the 'Reference' field"),
('number', "in the 'Number' field")]
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.')
number_target = fields.Selection(
string='Invoice number',
help='Destination for the invoice number of the supplier invoice.',
selection=sel_number_target)
@classmethod
def default_number_target(cls):
""" targetfield for incoming invoice number
Returns:
str: field 'reference'
"""
return 'reference'
@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