# Create Odoo Timesheet (Gitea Action) Create a new Odoo timesheet entry via a FastAPI middleware whenever time is added on a Gitea Issue. The action reads time-tracking details directly from the issue event context and POSTs the following JSON to your FastAPI endpoint: ```json { "date": "2025-05-06", "description": "/", "gitea_username": "Tom", "hour_spent": 1.3, "task_id": 1 } ``` --- ## Inputs - `base_url` (required): Base URL of the FastAPI server, e.g. `https://fastapi.example.com`. --- ## Event context used - `${{ gitea.event.issue.number }}` → `task_id` - `${{ gitea.event.issue.title }}` → description fallback - `${{ gitea.event.sender.login }}` → `gitea_username` - `${{ gitea.event.tracked_time.time }}` → seconds spent (converted to hours) - `${{ gitea.event.tracked_time.created }}` → ISO timestamp (date extracted) - `${{ gitea.event.action }}` → filtered to time-related actions No Gitea API or tokens are required; all data comes from the event payload. --- ## Usage Trigger on the Gitea issues event when time is added. If your instance emits a generic `issues: edited` event for time tracking, include it as shown: ```yaml name: Create Odoo Timesheet on: issues: types: [edited] jobs: timesheet: runs-on: ubuntu-latest steps: - name: Create timesheet in Odoo uses: https://gitea.ethumada.com/gitea/create-odoo-timesheet with: base_url: ${{ vars.FASTAPI_BASE_URL }} ``` --- ## Endpoint contract (FastAPI) - Method: POST - URL: `{base_url}/api/v1/account_analytic_gitea_odoo/` - Body: JSON object with fields as shown above - 2xx indicates success; response body is logged