Invalid value for `calculation_type`, must not be `None`
SoSDylan opened this issue · 2 comments
I've been getting this really weird issue when trying to get a single xero employee.
Invalid value for 'calculation_type', must not be 'None'
It only occours with a single employee, EmployeeId: 2a210015-2e0d-45bf-8a56-9030b0b487be
.
xero_tenant_id = self.get_xero_tenant_id()
payrollau_api = PayrollAuApi(self.api_client)
try:
read_employees = payrollau_api.get_employee(xero_tenant_id, employee_id)
except AccountingBadRequestException as exception:
print("Error: " + exception.reason)
print(jsonify(exception.error_data))
raise
return read_employees
When I debug, the json that is returned from the server is
I've redacted a fair bit of the data for privacy reasons
{
"Id": "3f5d7000-4107-4358-bbba-3ab4afc50d7b",
"Status": "OK",
"ProviderName": "CrewTraka",
"DateTimeUTC": "/Date(1620867495758)/",
"Employees": [
{
"EmployeeID": "2a210015-2e0d-45bf-8a56-9030b0b487be",
"FirstName": "__redacted__",
"LastName": "__redacted__",
"Status": "ACTIVE",
"Email": "__redacted__",
"DateOfBirth": "__redacted__",
"Gender": "__redacted__",
"HomeAddress": {
"AddressLine1": "__redacted__",
"AddressLine2": "__redacted__",
"City": "__redacted__",
"Region": "__redacted__",
"PostalCode": "__redacted__",
"Country": "AUSTRALIA"
},
"Phone": "__redacted__",
"Mobile": "__redacted__",
"StartDate": "__redacted__",
"Classification": "__redacted__",
"OrdinaryEarningsRateID": "b153f5d8-9ceb-4305-bc09-5948371c796d",
"PayrollCalendarID": "36e30476-c1fa-483b-8ab9-8f1d01ca9dbd",
"UpdatedDateUTC": "/Date(1619480114000+0000)/",
"IsAuthorisedToApproveLeave": false,
"IsAuthorisedToApproveTimesheets": false,
"TaxDeclaration": {
"TaxFileNumber": "__redacted__",
"EmploymentBasis": "FULLTIME",
"AustralianResidentForTaxPurposes": true,
"TaxFreeThresholdClaimed": true,
"HasHELPDebt": false,
"HasSFSSDebt": false,
"EligibleToReceiveLeaveLoading": true,
"UpdatedDateUTC": "/Date(1619480114000+0000)/",
"HasStudentStartupLoan": false,
"ResidencyStatus": "AUSTRALIANRESIDENT"
},
"BankAccounts": [
{
"StatementText": "__redacted__",
"AccountName": "__redacted__",
"BSB": "__redacted__",
"AccountNumber": "__redacted__",
"Remainder": true
}
],
"OpeningBalances": {
"OpeningBalanceDate": "/Date(1581379200000+0000)/",
"EarningsLines": [
{ "EarningsRateID": "b153f5d8-9ceb-4305-bc09-5948371c796d", "Amount": "__redacted__" },
{ "EarningsRateID": "4f29bf0d-a354-4647-8d9d-349779a2b77c", "Amount": "__redacted__" },
{ "EarningsRateID": "90366230-6127-40a2-8912-165f1b42b6ed", "Amount": "__redacted__" },
{ "EarningsRateID": "cff7762c-a6c2-47b6-932d-f1fd53168850", "Amount": "__redacted__" },
{ "EarningsRateID": "0ecf019b-cd1f-4d6a-86c7-71ccd2b48d3e", "Amount": "__redacted__" },
{ "EarningsRateID": "a7f80c98-1aeb-4f8b-960f-ffbc2392c63d", "Amount": "__redacted__" },
{ "EarningsRateID": "0a16226e-06ae-45dd-a642-cb2146eddb63", "Amount": "__redacted__" },
{ "EarningsRateID": "b87c5284-69e2-4479-a1db-75df53407f76", "Amount": "__redacted__" },
{ "EarningsRateID": "ba3b69a7-897c-4a10-8463-22be033558eb", "Amount": "__redacted__" },
{ "EarningsRateID": "dd1b60ba-c327-41b5-9f49-135f338028d7", "Amount": "__redacted__" },
{ "EarningsRateID": "72d665ce-6a88-4891-85a8-f7d2fe21519f", "Amount": "__redacted__" }
],
"DeductionLines": [{ "DeductionTypeID": "56425644-1cae-48c0-a0f1-9178c1f9e93c", "Amount": "__redacted__" }],
"Tax": "__redacted__",
"SuperLines": [
{
"SuperMembershipID": "0635dd33-0122-4a28-8bd1-b89f384e4973",
"ContributionType": "__redacted__",
"Amount": "__redacted__"
}
],
"ReimbursementLines": [],
"LeaveLines": [
{ "LeaveTypeID": "1e6ecff6-d5b4-4d1b-ac31-820e0d1192a9", "NumberOfUnits": "__redacted__" },
{ "LeaveTypeID": "288e984b-fdf3-461b-af3f-ad4e989a5124", "NumberOfUnits": "__redacted__" },
{ "LeaveTypeID": "9bf63566-26ea-46db-896b-1b49253fe4a2", "NumberOfUnits": "__redacted__" }
]
},
"PayTemplate": {
"EarningsLines": [
{
"EarningsRateID": "b153f5d8-9ceb-4305-bc09-5948371c796d",
"CalculationType": "ENTEREARNINGSRATE",
"RatePerUnit": "__redacted__",
"NormalNumberOfUnits": "__redacted__"
},
{
"EarningsRateID": "4f29bf0d-a354-4647-8d9d-349779a2b77c",
"CalculationType": "USEEARNINGSRATE",
"NormalNumberOfUnits": "__redacted__"
},
{
"EarningsRateID": "cff7762c-a6c2-47b6-932d-f1fd53168850",
"CalculationType": "USEEARNINGSRATE",
"NormalNumberOfUnits": "__redacted__"
},
{
"EarningsRateID": "a7f80c98-1aeb-4f8b-960f-ffbc2392c63d",
"CalculationType": "ENTEREARNINGSRATE",
"RatePerUnit": "__redacted__",
"NormalNumberOfUnits": "__redacted__"
},
{
"EarningsRateID": "d143eb07-14e4-49e7-a883-c6aa25324dde",
"CalculationType": "ENTEREARNINGSRATE",
"FixedAmount": "__redacted__"
},
{
"EarningsRateID": "b87c5284-69e2-4479-a1db-75df53407f76",
"CalculationType": "USEEARNINGSRATE",
"NormalNumberOfUnits": "__redacted__"
},
{
"EarningsRateID": "72d665ce-6a88-4891-85a8-f7d2fe21519f",
"CalculationType": "ENTEREARNINGSRATE",
"RatePerUnit": "__redacted__",
"NormalNumberOfUnits": "__redacted__"
},
{
"EarningsRateID": "dd1b60ba-c327-41b5-9f49-135f338028d7",
"CalculationType": "ENTEREARNINGSRATE",
"RatePerUnit": "__redacted__"
}
],
"DeductionLines": [
{
"DeductionTypeID": "aa2f33d7-d41e-467a-ac83-1073a0209e17",
"CalculationType": "FIXEDAMOUNT",
"Amount": "__redacted__"
},
{
"DeductionTypeID": "00cea9c5-a120-41c7-aebb-613f44fc4f03",
"CalculationType": "FIXEDAMOUNT",
"Amount": "__redacted__"
}
],
"SuperLines": [
{
"SuperMembershipID": "0635dd33-0122-4a28-8bd1-b89f384e4973",
"ContributionType": "__redacted__",
"CalculationType": "STATUTORY",
"MinimumMonthlyEarnings": "__redacted__",
"ExpenseAccountCode": "__redacted__",
"LiabilityAccountCode": "__redacted__"
},
{
"SuperMembershipID": "0635dd33-0122-4a28-8bd1-b89f384e4973",
"ContributionType": "EMPLOYERADDITIONAL",
"CalculationType": "PERCENTAGEOFEARNINGS",
"MinimumMonthlyEarnings": "__redacted__",
"ExpenseAccountCode": "__redacted__",
"LiabilityAccountCode": "__redacted__",
"Percentage": "__redacted__"
}
],
"ReimbursementLines": [
{ "ReimbursementTypeID": "544f287a-dcfa-4d02-8fec-c07b1cf0c579", "Amount": "__redacted__" },
{ "ReimbursementTypeID": "8800445c-6f42-48b1-b3f5-87f3a288ac6e", "Amount": "__redacted__" }
],
"LeaveLines": [
{
"LeaveTypeID": "1e6ecff6-d5b4-4d1b-ac31-820e0d1192a9",
"CalculationType": "FIXEDAMOUNTEACHPERIOD",
"AnnualNumberOfUnits": "__redacted__",
"EntitlementFinalPayPayoutType": "NOTPAIDOUT"
},
{
"LeaveTypeID": "288e984b-fdf3-461b-af3f-ad4e989a5124",
"CalculationType": "FIXEDAMOUNTEACHPERIOD",
"AnnualNumberOfUnits": "__redacted__",
"EntitlementFinalPayPayoutType": "PAIDOUT"
},
{
"LeaveTypeID": "9bf63566-26ea-46db-896b-1b49253fe4a2",
"CalculationType": "FIXEDAMOUNTEACHPERIOD",
"AnnualNumberOfUnits": "__redacted__",
"EntitlementFinalPayPayoutType": "PAIDOUT"
}
]
},
"SuperMemberships": [
{
"SuperMembershipID": "0635dd33-0122-4a28-8bd1-b89f384e4973",
"SuperFundID": "7929b170-dcd8-41aa-91e6-016cbb31f960",
"EmployeeNumber": "__redacted__"
}
],
"LeaveBalances": [
{
"LeaveName": "Holiday Leave Accrual",
"LeaveTypeID": "288e984b-fdf3-461b-af3f-ad4e989a5124",
"NumberOfUnits": "__redacted__",
"TypeOfUnits": "Hours"
},
{
"LeaveName": "RDO Accrual",
"LeaveTypeID": "9bf63566-26ea-46db-896b-1b49253fe4a2",
"NumberOfUnits": "__redacted__",
"TypeOfUnits": "Hours"
},
{
"LeaveName": "Sick Leave Accrual",
"LeaveTypeID": "1e6ecff6-d5b4-4d1b-ac31-820e0d1192a9",
"NumberOfUnits": "__redacted__",
"TypeOfUnits": "Hours"
}
]
}
]
}
I've got a temporary 'fix' in place that will just skip over this employee when we run our algorithm, however this isn't a good solution as the company that is using out product doesn't get payroll timesheets created for the employee with this issue.
Thanks, Dylan.
@SoSDylan - thanks for the feedback.
We've just released 1.6.0. Have a look to see if this solves your issue and let us know.
https://github.com/XeroAPI/xero-python/releases/tag/1.6.0
Thanks @SidneyAllen
That has fixed the issue, thanks for your support!