add configuration
This commit is contained in:
parent
313c811ac3
commit
8a48fb7236
5 changed files with 70 additions and 0 deletions
|
@ -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')
|
||||
|
|
42
configuration.py
Normal file
42
configuration.py
Normal file
|
@ -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
|
13
configuration.xml
Normal file
13
configuration.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- 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. -->
|
||||
<tryton>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="document_incoming_configuration_view_form">
|
||||
<field name="model">document.incoming.configuration</field>
|
||||
<field name="inherit" ref="document_incoming.document_incoming_configuration_view_form"/>
|
||||
<field name="name">document_incoming_configuration_form</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
|
@ -4,4 +4,5 @@ depends:
|
|||
document_incoming_invoice
|
||||
xml:
|
||||
message.xml
|
||||
configuration.xml
|
||||
document.xml
|
||||
|
|
12
view/document_incoming_configuration_form.xml
Normal file
12
view/document_incoming_configuration_form.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- 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. -->
|
||||
<data>
|
||||
<xpath expr="/form/field[@name='default_supplier']" position="after">
|
||||
<label name="create_supplier"/>
|
||||
<field name="create_supplier"/>
|
||||
<label name="accept_other_company"/>
|
||||
<field name="accept_other_company"/>
|
||||
</xpath>
|
||||
</data>
|
Loading…
Reference in a new issue