mark some fields as optional
This commit is contained in:
parent
e0e4c1291d
commit
4408da71a9
2 changed files with 15 additions and 11 deletions
|
@ -323,6 +323,7 @@ employment_codes = (
|
||||||
)
|
)
|
||||||
|
|
||||||
tax_jurisdiction_codes = (
|
tax_jurisdiction_codes = (
|
||||||
|
(' ', 'W-2'),
|
||||||
('V', 'Virgin Islands'),
|
('V', 'Virgin Islands'),
|
||||||
('G', 'Guam'),
|
('G', 'Guam'),
|
||||||
('S', 'American Samoa'),
|
('S', 'American Samoa'),
|
||||||
|
|
|
@ -105,8 +105,8 @@ class EmployerRecord(EFW2Record):
|
||||||
zipcode_ext = TextField(max_length=4, required=False)
|
zipcode_ext = TextField(max_length=4, required=False)
|
||||||
kind_of_employer = TextField(max_length=1)
|
kind_of_employer = TextField(max_length=1)
|
||||||
blank1 = BlankField(max_length=4)
|
blank1 = BlankField(max_length=4)
|
||||||
foreign_state_province = TextField(max_length=23)
|
foreign_state_province = TextField(max_length=23, required=False)
|
||||||
foreign_postal_code = TextField(max_length=15)
|
foreign_postal_code = TextField(max_length=15, required=False)
|
||||||
country_code = TextField(max_length=2, required=False)
|
country_code = TextField(max_length=2, required=False)
|
||||||
employment_code = TextField(max_length=1)
|
employment_code = TextField(max_length=1)
|
||||||
tax_jurisdiction_code = TextField(max_length=1, required=False)
|
tax_jurisdiction_code = TextField(max_length=1, required=False)
|
||||||
|
@ -150,7 +150,7 @@ class EmployeeWageRecord(EFW2Record):
|
||||||
|
|
||||||
ssn = IntegerField(max_length=9, required=False)
|
ssn = IntegerField(max_length=9, required=False)
|
||||||
employee_first_name = TextField(max_length=15)
|
employee_first_name = TextField(max_length=15)
|
||||||
employee_middle_name = TextField(max_length=15)
|
employee_middle_name = TextField(max_length=15, required=False)
|
||||||
employee_last_name = TextField(max_length=20)
|
employee_last_name = TextField(max_length=20)
|
||||||
employee_suffix = TextField(max_length=4, required=False)
|
employee_suffix = TextField(max_length=4, required=False)
|
||||||
location_address = TextField(max_length=22)
|
location_address = TextField(max_length=22)
|
||||||
|
@ -163,7 +163,7 @@ class EmployeeWageRecord(EFW2Record):
|
||||||
blank1 = BlankField(max_length=5)
|
blank1 = BlankField(max_length=5)
|
||||||
foreign_state = TextField(max_length=23, required=False)
|
foreign_state = TextField(max_length=23, required=False)
|
||||||
foreign_postal_code = TextField(max_length=15, required=False)
|
foreign_postal_code = TextField(max_length=15, required=False)
|
||||||
country = TextField(max_length=2)
|
country = TextField(max_length=2, required=True, blank=True)
|
||||||
wages_tips = MoneyField(max_length=11)
|
wages_tips = MoneyField(max_length=11)
|
||||||
federal_income_tax_withheld = MoneyField(max_length=11)
|
federal_income_tax_withheld = MoneyField(max_length=11)
|
||||||
social_security_wages = MoneyField(max_length=11)
|
social_security_wages = MoneyField(max_length=11)
|
||||||
|
@ -199,8 +199,10 @@ class EmployeeWageRecord(EFW2Record):
|
||||||
blank6 = BlankField(max_length=23)
|
blank6 = BlankField(max_length=23)
|
||||||
|
|
||||||
def validate_ssn(self, f):
|
def validate_ssn(self, f):
|
||||||
if str(f.value).startswith('666','9'):
|
if str(f.value).startswith('666'):
|
||||||
raise ValidationError("ssn cannot start with 666 or 9", field=f)
|
raise ValidationError("ssn cannot start with 666", field=f)
|
||||||
|
if str(f.value).startswith('9'):
|
||||||
|
raise ValidationError("ssn cannot start with 9", field=f)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -243,7 +245,7 @@ class StateWageRecord(EFW2Record):
|
||||||
taxing_entity_code = TextField(max_length=5, required=False)
|
taxing_entity_code = TextField(max_length=5, required=False)
|
||||||
ssn = IntegerField(max_length=9, required=False)
|
ssn = IntegerField(max_length=9, required=False)
|
||||||
employee_first_name = TextField(max_length=15)
|
employee_first_name = TextField(max_length=15)
|
||||||
employee_middle_name = TextField(max_length=15)
|
employee_middle_name = TextField(max_length=15, required=False)
|
||||||
employee_last_name = TextField(max_length=20)
|
employee_last_name = TextField(max_length=20)
|
||||||
employee_suffix = TextField(max_length=4, required=False)
|
employee_suffix = TextField(max_length=4, required=False)
|
||||||
location_address = TextField(max_length=22)
|
location_address = TextField(max_length=22)
|
||||||
|
@ -257,10 +259,10 @@ class StateWageRecord(EFW2Record):
|
||||||
foreign_postal_code = TextField(max_length=15, required=False)
|
foreign_postal_code = TextField(max_length=15, required=False)
|
||||||
country_code = TextField(max_length=2, required=False)
|
country_code = TextField(max_length=2, required=False)
|
||||||
optional_code = TextField(max_length=2, required=False)
|
optional_code = TextField(max_length=2, required=False)
|
||||||
reporting_period = MonthYearField()
|
reporting_period = MonthYearField(required=False)
|
||||||
quarterly_unemp_ins_wages = MoneyField(max_length=11)
|
quarterly_unemp_ins_wages = MoneyField(max_length=11)
|
||||||
quarterly_unemp_ins_taxable_wages = MoneyField(max_length=11)
|
quarterly_unemp_ins_taxable_wages = MoneyField(max_length=11)
|
||||||
number_of_weeks_worked = IntegerField(max_length=2)
|
number_of_weeks_worked = IntegerField(max_length=2, required=False)
|
||||||
date_first_employed = DateField(required=False)
|
date_first_employed = DateField(required=False)
|
||||||
date_of_separation = DateField(required=False)
|
date_of_separation = DateField(required=False)
|
||||||
blank2 = BlankField(max_length=5)
|
blank2 = BlankField(max_length=5)
|
||||||
|
@ -270,7 +272,7 @@ class StateWageRecord(EFW2Record):
|
||||||
state_taxable_wages = MoneyField(max_length=11)
|
state_taxable_wages = MoneyField(max_length=11)
|
||||||
state_income_tax_wh = MoneyField(max_length=11)
|
state_income_tax_wh = MoneyField(max_length=11)
|
||||||
other_state_data = TextField(max_length=10, required=False)
|
other_state_data = TextField(max_length=10, required=False)
|
||||||
tax_type_code = TextField(max_length=1) # VALIDATE C, D, E, or F
|
tax_type_code = TextField(max_length=1, required=False) # VALIDATE C, D, E, or F
|
||||||
local_taxable_wages = MoneyField(max_length=11)
|
local_taxable_wages = MoneyField(max_length=11)
|
||||||
local_income_tax_wh = MoneyField(max_length=11)
|
local_income_tax_wh = MoneyField(max_length=11)
|
||||||
state_control_number = IntegerField(max_length=7, required=False)
|
state_control_number = IntegerField(max_length=7, required=False)
|
||||||
|
@ -280,7 +282,8 @@ class StateWageRecord(EFW2Record):
|
||||||
|
|
||||||
def validate_tax_type_code(self, field):
|
def validate_tax_type_code(self, field):
|
||||||
choices = [x for x,y in enums.tax_type_codes]
|
choices = [x for x,y in enums.tax_type_codes]
|
||||||
if field.value.upper() not in choices:
|
value = field.value
|
||||||
|
if value and value.upper() not in choices:
|
||||||
raise ValidationError("%s not one of %s" % (field.value,choices), field=f)
|
raise ValidationError("%s not one of %s" % (field.value,choices), field=f)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue