Passed
Push — master ( feb3de...56c573 )
by Jordi
04:25
created

build.bika.lims.content.supplier   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 96
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 63
dl 0
loc 96
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A Supplier._renameAfterCreation() 0 3 1
1
# -*- coding: utf-8 -*-
2
#
3
# This file is part of SENAITE.CORE
4
#
5
# Copyright 2018 by it's authors.
6
# Some rights reserved. See LICENSE.rst, CONTRIBUTORS.rst.
7
8
from AccessControl import ClassSecurityInfo
9
from bika.lims import bikaMessageFactory as _
10
from bika.lims.browser.fields.remarksfield import RemarksField
11
from bika.lims.browser.widgets import RemarksWidget
12
from bika.lims.config import PROJECTNAME
13
from bika.lims.content.organisation import Organisation
14
from bika.lims.interfaces import ISupplier, IDeactivable
15
from zope.interface import implements
16
from Products.Archetypes.public import registerType
17
from Products.Archetypes.public import StringField
18
from Products.Archetypes.public import ManagedSchema
19
from Products.Archetypes.public import StringWidget
20
21
22
schema = Organisation.schema.copy() + ManagedSchema((
23
24
    RemarksField(
25
        "Remarks",
26
        searchable=True,
27
        widget=RemarksWidget(
28
            label=_("Remarks"),
29
        ),
30
    ),
31
32
    StringField(
33
        "Website",
34
        searchable=1,
35
        required=0,
36
        widget=StringWidget(
37
            visible={"view": "visible", "edit": "visible"},
38
            label=_("Website."),
39
        ),
40
    ),
41
42
    StringField(
43
        "NIB",
44
        searchable=1,
45
        schemata="Bank details",
46
        required=0,
47
        widget=StringWidget(
48
            visible={"view": "visible", "edit": "visible"},
49
            label=_("NIB"),
50
        ),
51
        validators=("NIBvalidator"),
52
    ),
53
54
    StringField(
55
        "IBN",
56
        searchable=1,
57
        schemata="Bank details",
58
        required=0,
59
        widget=StringWidget(
60
            visible={"view": "visible", "edit": "visible"},
61
            label=_("IBN"),
62
        ),
63
        validators=("IBANvalidator"),
64
    ),
65
66
    StringField(
67
        "SWIFTcode",
68
        searchable=1,
69
        required=0,
70
        schemata="Bank details",
71
        widget=StringWidget(
72
            visible={"view": "visible", "edit": "visible"},
73
            label=_("SWIFT code."),
74
        ),
75
    ),
76
))
77
78
79
class Supplier(Organisation):
80
    """Supplier content
81
    """
82
    implements(ISupplier, IDeactivable)
83
84
    _at_rename_after_creation = True
85
    displayContentsTab = False
86
    isPrincipiaFolderish = 0
87
    schema = schema
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable schema does not seem to be defined.
Loading history...
88
    security = ClassSecurityInfo()
89
90
    def _renameAfterCreation(self, check_auto_id=False):
91
        from bika.lims.idserver import renameAfterCreation
92
        renameAfterCreation(self)
93
94
95
registerType(Supplier, PROJECTNAME)
96