-
Notifications
You must be signed in to change notification settings - Fork 780
/
Copy pathmodels.py
115 lines (102 loc) · 5.66 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# coding=utf-8
from django.db import models
from django.db import connection
from django.utils.translation import ugettext_lazy as _
from common import const
from common import generic
class Organization(generic.BO):
"""
组织单位
"""
index_weight = 1
code = models.CharField(_("organ code"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True)
name = models.CharField(_("organ name"),max_length=const.DB_CHAR_NAME_120)
short = models.CharField(_("short name"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True)
pinyin = models.CharField(_("pinyin"),max_length=const.DB_CHAR_NAME_120,blank=True,null=True)
status = models.BooleanField(_("in use"),default=True)
tax_num = models.CharField(_("tax num"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True)
tax_address = models.CharField(_("tax address"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True)
tax_account = models.CharField(_("tax account"),max_length=const.DB_CHAR_NAME_80,blank=True,null=True)
represent = models.CharField(_("representative "),max_length=const.DB_CHAR_NAME_40,blank=True,null=True)
address = models.CharField(_("address"),max_length=const.DB_CHAR_NAME_120,blank=True,null=True)
zipcode = models.CharField(_("zipcode"),max_length=const.DB_CHAR_CODE_8,blank=True,null=True)
fax = models.CharField(_("fax"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True)
contacts = models.CharField(_("contacts"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True)
phone = models.CharField(_("phone"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True)
website = models.CharField(_("website"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True)
email = models.CharField(_("email"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True)
lic_code = models.CharField(_("license code"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True)
cer_code = models.CharField(_("certificate code"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True)
license = models.FileField(_("business license"),blank=True,null=True,upload_to='organ')
certificate = models.FileField(_("organization code certificate"),blank=True,null=True,upload_to='organ')
weight = models.IntegerField(_("weight"),default=9)
class Meta:
verbose_name = _('organization')
verbose_name_plural = _('organization')
class OrgUnit(generic.BO):
"""
组织单元
"""
UNIT_LEVEL = (
(1,_('BRANCH')),
(2,_('DEPARTMENT')),
(3,_('OFFICE')),
(4,_('TEAM')),
(5,_('COMMITTEE'))
)
index_weight = 2
parent = models.ForeignKey('self',verbose_name=_("parent"),null=True,blank=True)
organization = models.ForeignKey(Organization,verbose_name = _('organization'),null=True,blank=True)
code = models.CharField(_("code"),max_length=const.DB_CHAR_CODE_8,blank=True,null=True)
name = models.CharField(_("name"),max_length=const.DB_CHAR_NAME_120)
short = models.CharField(_("short name"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True)
pinyin = models.CharField(_("pinyin"),max_length=const.DB_CHAR_NAME_120,blank=True,null=True)
unit_type = models.IntegerField(_("type"),choices=UNIT_LEVEL,default=2)
status = models.BooleanField(_("in use"),default=True)
virtual = models.BooleanField(_("is virtual"),default=False)
fax = models.CharField(_("fax"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True)
phone = models.CharField(_("phone"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True)
contacts = models.CharField(_("contacts"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True)
email = models.CharField(_("email"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True)
weight = models.IntegerField(_("weight"),default=99)
class Meta:
verbose_name = _('org unit')
verbose_name_plural = _('org unit')
class Position(generic.BO):
"""
岗位
"""
SERIES = (
('A',_("Admin Position")),
('S',_("Sale Position")),
('T',_("Technology Position")),
('P',_("Produce Position")),
)
GRADE = (
('01', _("BASIC")),
('02', _("MEDIUM")),
('03', _("SENIOR")),
('04', _("PROFESSOR")),
('05', _("EXPERT")),
)
index_weight = 3
unit = models.ForeignKey(OrgUnit,verbose_name=_('org unit'))
organization = models.ForeignKey(Organization,verbose_name=_('organization'),null=True,blank=True)
parent = models.ForeignKey('self',verbose_name=_("parent"),null=True,blank=True)
code = models.CharField(_("position code"),max_length=const.DB_CHAR_CODE_8,blank=True,null=True)
name = models.CharField(_("position name"),max_length=const.DB_CHAR_NAME_120)
short = models.CharField(_("short name"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True)
pinyin = models.CharField(_("pinyin"),max_length=const.DB_CHAR_NAME_120,blank=True,null=True)
series = models.CharField(_("position series"),max_length=1,default='A',choices=const.get_value_list('S014'))
grade = models.CharField(_("position grade"),max_length=const.DB_CHAR_CODE_2,default='01',choices=const.get_value_list('S015'))
virtual = models.BooleanField(_("is virtual"),default=False)
status = models.BooleanField(_("in use"),default=True)
description = models.TextField(_("position description"),blank=True,null=True)
qualification = models.TextField(_("qualification"),blank=True,null=True)
document = models.FileField(_("reference"),blank=True,null=True)
weight = models.IntegerField(_("weight"),default=99)
def __unicode__(self):
return u'%s %s' % (self.code,self.name)
class Meta:
verbose_name = _('position')
verbose_name_plural = _('position')