Skip to content

docs: document AU timesheet line creation best practice in tool descriptions#170

Open
elliotchisholm wants to merge 5 commits into
XeroAPI:mainfrom
elliotchisholm:feat/au-v2/6-timesheet-docs
Open

docs: document AU timesheet line creation best practice in tool descriptions#170
elliotchisholm wants to merge 5 commits into
XeroAPI:mainfrom
elliotchisholm:feat/au-v2/6-timesheet-docs

Conversation

@elliotchisholm

Copy link
Copy Markdown
Contributor

Summary

Updates tool descriptions to document the correct pattern for creating AU timesheets: create the timesheet empty first, then add lines individually.

Why

Adding lines at create time resulted in duplicate rows in the Xero UI due to how the v2 API handles batch line creation. The tool descriptions now guide callers toward the correct two-step approach.

Note for reviewer

This is part of a stacked series — please merge in order (#165#169 first). Once those merge into main, this PR's diff will show only these changes.


Part 6 of 8 — AU timesheet v2 migration stack.

elliotchisholm and others added 5 commits June 5, 2026 20:16
- Upgrade xero-node from ^13.3.0 to ^15.0.1
- Add PayrollAuV2Api client to xero-client.ts with lazy init and token sync
- Add payroll-au-v2-types.ts shim for AU v2 Timesheet/TimesheetLine types
- Fix SDK breaking change: hoursAccruedAnnually renamed to unitsAccruedAnnually
- Add vitest for test infrastructure

The PayrollAuV2Api is a separate class not wired into XeroClient, so it
requires manual instantiation and access token management.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace all AU-specific workaround code with v2 API calls via
PayrollAuV2Api. This aligns AU with NZ/UK — all three regions now use
the same v2 endpoint patterns.

Changes per handler:
- approve: remove GET-then-PUT status workaround, call approveTimesheet
- revert: remove GET-then-PUT status workaround, call revertTimesheet
- delete: remove AU error block, call deleteTimesheet (previously unsupported)
- create: remove array wrapping, use single-object createTimesheet
- add-line: remove GET-append-PUT workaround, call createTimesheetLine
- update-line: remove earningsRateID matching, call updateTimesheetLine by ID
- get: call getTimesheet via v2 client
- list: remove AU-only params (where/order/ifModifiedSince), use v2 params

Breaking input changes for AU callers:
- numberOfUnits is now a single number (not array) with a date per line
- payrollCalendarID is now required on create
- timesheetLineID is now required on update-line

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
New handler, tool, and tests for DELETE /timesheets/{id}/lines/{lineId}.
Previously this operation had no MCP tool. Supports AU (via
PayrollAuV2Api), NZ, and UK.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
New tools:
- list-payroll-calendars: shows pay calendar names, types, and upcoming
  payment dates. AU uses payrollAUApi.getPayrollCalendars (v1), NZ/UK
  use getPayRunCalendars.
- list-earnings-rates: shows earnings rate IDs, names, and types needed
  for creating timesheet lines. AU uses payrollAUApi.getPayItems (v1)
  and extracts the earningsRates array, NZ/UK use getEarningsRates.

Both tools support AU, NZ, and UK with region auto-detection.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
For AU payroll, timesheets should be created empty then lines added
individually via add-timesheet-line. Passing lines at creation time
creates separate rows per day in the Xero UI instead of consolidating
them by earnings rate.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@elliotchisholm elliotchisholm force-pushed the feat/au-v2/6-timesheet-docs branch from 9b79979 to 040d2e0 Compare June 5, 2026 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant