feature/contract-export-import #2

Merged
hume merged 60 commits from feature/contract-export-import into main 2026-08-10 20:42:32 +00:00
Owner
No description provided.
hume self-assigned this 2026-08-10 20:16:59 +00:00
hume added 57 commits 2026-08-10 20:16:59 +00:00
feat: implement contract export and import functionality
Some checks failed
Backend / backend (push) Failing after 26s
Frontend / frontend (push) Successful in 17s
6c1ed68083
feat: add python-docx dependency for contract export
Some checks failed
Backend / backend (push) Failing after 26s
Frontend / frontend (push) Successful in 16s
a53837a612
fix some pytest issue
Some checks failed
Backend / backend (push) Failing after 32s
Frontend / frontend (push) Successful in 16s
8971bd4fec
fix: resolve test import issue in test_contrat_export.py by using app's dependency override for database session
Some checks failed
Backend / backend (push) Failing after 29s
Frontend / frontend (push) Successful in 15s
c8dd4d49b1
fix tests
All checks were successful
Backend / backend (push) Successful in 30s
Frontend / frontend (push) Successful in 42s
627e8c13fd
Merge remote-tracking branch 'origin/feature/contract-export-import' into feature/contract-export-import
Some checks failed
Backend / backend (push) Successful in 31s
Frontend / frontend (push) Failing after 14s
459fa19d3c
fix: resolve frontend build errors for contracts view - fix imports, types, and function references
All checks were successful
Backend / backend (push) Successful in 30s
Frontend / frontend (push) Successful in 20s
cbb0b5715e
fix: add contracts menu link to AppMenu.vue
All checks were successful
Backend / backend (push) Successful in 33s
Frontend / frontend (push) Successful in 16s
2b586039b2
fix: add Contract model import to exports route and add debug logging to contracts view
All checks were successful
Backend / backend (push) Successful in 31s
Frontend / frontend (push) Successful in 17s
562dc3a4aa
update contrat_template
All checks were successful
Backend / backend (push) Successful in 32s
Frontend / frontend (push) Successful in 17s
d61d1c8255
Merge remote-tracking branch 'origin/feature/contract-export-import' into feature/contract-export-import
Some checks failed
Backend / backend (push) Successful in 33s
Frontend / frontend (push) Failing after 15s
47eda30751
fix: add missing editingDescription and editingCapacity refs in PropertiesView.vue, include them in update payload and cancelEdit
All checks were successful
Backend / backend (push) Successful in 31s
Frontend / frontend (push) Successful in 15s
f74333e447
feat: add deposit_amount, adults_count, children_count to Booking model and update frontend BookingsView with new fields
All checks were successful
Backend / backend (push) Successful in 31s
Frontend / frontend (push) Successful in 15s
f718154162
fix: fix placeholder replacement for split runs, add missing description/capacity fields in PropertiesView edit mode, fix ContractsView tabs visibility
All checks were successful
Backend / backend (push) Successful in 33s
Frontend / frontend (push) Successful in 16s
07b0bbbe2e
fix: correct contract price calculation (base_price * nights), add % to deposit_percentage, fix derived values
All checks were successful
Backend / backend (push) Successful in 31s
Frontend / frontend (push) Successful in 17s
04d66dfe96
feat: add adults/children count support in Excel import - reads Adultes, Enfant +3ans, Enfant -3ans columns and calculates total children count
All checks were successful
Backend / backend (push) Successful in 31s
Frontend / frontend (push) Successful in 16s
d75adb216c
feat: add tax tracking fields to Booking model and tax report endpoint for quarterly declarations
All checks were successful
Backend / backend (push) Successful in 35s
Frontend / frontend (push) Successful in 16s
d39f1e5d69
feat: remove contract list/import features and add tax report view to FinancialDashboard
All checks were successful
Backend / backend (push) Successful in 29s
Frontend / frontend (push) Successful in 16s
f3dec1ec49
- Removed Contract model and contracts table from database
- Removed contract list/import endpoints from backend (exports.py)
- Removed contract list/import tabs from frontend ContractsView.vue
- Added tax report section to FinancialDashboardView.vue with:
  - Quarter selector for tax declarations
  - Summary cards showing tax totals by source (Airbnb/Contrat/Total)
  - Adults count, nights, and bookings count per source
  - Clean integration with existing financial dashboard
- Fixed TypeScript build issues with DataTable/Column imports
- All 34 backend tests pass, frontend builds successfully
chore: cleanup unused files and simplify contract view
All checks were successful
Backend / backend (push) Successful in 30s
Frontend / frontend (push) Successful in 16s
93b4f9132c
- Removed backend/create_template.py (one-time script)
- Removed backend/routes/debug.py (debug endpoints)
- Removed debug router from main.py
- Simplified ContractsView.vue: removed List/Import tabs, kept only Generate
- Simplified contracts.ts API: removed getContracts, importContract
- All tests pass, build successful
fix: fix tax report view - 400 error, quarter linked to year, dedicated tab
All checks were successful
Backend / backend (push) Successful in 30s
Frontend / frontend (push) Successful in 16s
d71d1c1263
- Fixed 400 error: selectedQuarter now properly derived from selectedYear via computed quarterOptions
- Quarter selector now dynamically linked to selected year (updates when year changes)
- Tax report moved to dedicated 'Taxes' tab in FinancialDashboardView (using PrimeVue TabView)
- Added watch for year/quarter changes to auto-reload data
- Improved period display with full date range
- All tests pass, build successful
fix: fix tax report quarter selector - use optionLabel/optionValue for PrimeVue Select, default to Q1 on year change
All checks were successful
Backend / backend (push) Successful in 30s
Frontend / frontend (push) Successful in 16s
96c2a5b1ec
- Added optionLabel='label' and optionValue='value' to Select component for quarterOptions
- Fixed year change watch to default to Q1 instead of current quarter
- Prevents 'quarter=%5Bobject+Object%5D' 400 error
- Build passes, tests pass
fix: add contract generation endpoint and fix tax calculation
All checks were successful
Backend / backend (push) Successful in 29s
Frontend / frontend (push) Successful in 17s
a16673b15c
- Added GET /exports/contrat/{booking_id} endpoint for contract generation
- Fixed tax calculation: uses tax_per_day * adults * nights fallback logic
- Uses property.tax_per_day and booking.adults_count when tax fields not set
- Contract template at /backend/templates/contrat_template.docx
- Filename format: YYYY.MM.DD NOM PRENOM PROPERTY.docx
- All tests pass
fix: contract generation - fix empty file & UUID filename
All checks were successful
Backend / backend (push) Successful in 30s
Frontend / frontend (push) Successful in 15s
8efad93b00
- Backend: fail fast if template missing/corrupt instead of creating empty doc
- Frontend: extract filename from Content-Disposition header (instead of browser UUID)
- Frontend: use fetch directly with a.download = filename
- Removed unused generateContract import
- Added API_URL import for direct fetch

All tests pass, build successful
fix: use relative path for template (cross-platform Windows/Linux)
All checks were successful
Backend / backend (push) Successful in 30s
Frontend / frontend (push) Successful in 18s
5e03540759
- Changed hardcoded /home/hume/... path to relative path using os.path
- Template path: os.path.join(base_dir, 'templates', 'contrat_template.docx')
- base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
- Tested: contract generation works (200 OK, 422KB, correct filename)
- All 34 tests pass, build successful
- Fixed replacement logic to process all placeholders in a paragraph at once (not sequentially)
- Fixed run handling: clear all runs then set first run with new text
- Added all template placeholders: nights_number, adults_number, children_number, property_price, deposit_amount, total_tax, amount_due_at_checkin_without_tax, property_description, etc.
- Verified: all placeholders replaced, 422KB valid .docx, correct filename format YYYY.MM.DD NOM PRENOM PROPERTY.docx
- All 34 backend tests pass, frontend build successful
fix: contract generation - all placeholders now replaced correctly
All checks were successful
Backend / backend (push) Successful in 29s
Frontend / frontend (push) Successful in 16s
00135b54e6
- Fixed replacement logic to process all placeholders in a paragraph at once (not sequentially)
- Fixed run handling: clear all runs then set first run with new text
- Added all template placeholders: nights_number, adults_number, children_number, property_price, deposit_amount, total_tax, amount_due_at_checkin_without_tax, property_description, etc.
- Verified: all placeholders replaced, 422KB valid .docx, correct filename format YYYY.MM.DD NOM PRENOM PROPERTY.docx
- All 34 backend tests pass, frontend build successful
test: add unit tests for contract generation endpoint
All checks were successful
Backend / backend (push) Successful in 32s
Frontend / frontend (push) Successful in 16s
101200e400
- Added test_contract_generation.py with 12 tests covering:
  - Successful contract generation with all placeholders replaced
  - Airbnb booking rejection (400)
  - Non-existent booking (404)
  - Missing property/tenant (404)
  - Filename format validation (YYYY.MM.DD NOM PRENOM PROPERTY.docx)
  - Children support in contract
  - No remaining placeholders in generated document
  - Placeholder mapping completeness verification
  - Edge cases: zero children, price calculation, valid DOCX structure
  - Placeholder mapping completeness check
- All 46 backend tests pass
- Frontend builds successfully
fix: frontend filename extraction from Content-Disposition header
All checks were successful
Backend / backend (push) Successful in 32s
Frontend / frontend (push) Successful in 16s
f6f95bffa0
- Fixed regex to properly extract filename from Content-Disposition header
- Added fallback for lowercase 'content-disposition' header
- Improved regex to handle quoted and unquoted filenames
- Tested: curl returns correct filename, frontend should now extract properly
fix: add CORS expose_headers for Content-Disposition
All checks were successful
Backend / backend (push) Successful in 32s
Frontend / frontend (push) Successful in 17s
e69f2da0a9
- Added expose_headers=['Content-Disposition'] to CORSMiddleware
- This allows frontend JavaScript to access the Content-Disposition header
- Required for extracting the custom filename from the contract download
feat: add OfficialData model for configurable tax rates and deposit percentage
All checks were successful
Backend / backend (push) Successful in 35s
Frontend / frontend (push) Successful in 15s
950aa7538b
- New model: OfficialData with data_type, value, valid_from, valid_to
- Supports tax_per_day (1.10€ before 2026, 1.21€ from 2026) and deposit_percentage (30%)
- Excel import now uses 'Montant location' column (fallback to 'Montant total')
- Import automatically sets deposit_amount and tax_per_day from OfficialData
- Contract generation uses OfficialData based on booking date
- Tax report in dashboard uses OfficialData for historical accuracy
- All 46 backend tests pass, frontend builds successfully
- Database migration applied (alembic revision bb095d3fd8ad)
feat: add admin view for OfficialData management
All checks were successful
Backend / backend (push) Successful in 33s
Frontend / frontend (push) Successful in 15s
3658dad476
Backend:
- New route: /admin/official-data (GET, POST, PATCH, DELETE)
- Auto-update of valid_to when creating/updating entries
- Returns is_current flag for current valid entry

Frontend:
- New view: AdminOfficialDataView.vue at /admin/official-data
- Two tables: Tax (€/jour/adulte) and Deposit (%)
- Dialog for create/edit with DatePicker
- Automatic valid_to management when adding new entries
- Visual indicator for current active entry
- Menu link: 'Paramètres officiels'

All 46 backend tests pass, frontend builds successfully
fix: improve AdminOfficialDataView UX
All checks were successful
Backend / backend (push) Successful in 33s
Frontend / frontend (push) Successful in 15s
a6be7aec92
- Hide 'type' select when creating new entry (pre-filled based on button clicked)
- Show type as read-only tag when editing
- Pass data_type to openNewDialog from button clicks ('tax_per_day' or 'deposit_percentage')
- InputNumber step now uses formData.data_type (supports 0.01 step for tax)
- All 46 backend tests pass, frontend builds successfully
fix: add Vite proxy for /admin endpoints and fix frontend API calls
All checks were successful
Backend / backend (push) Successful in 33s
Frontend / frontend (push) Successful in 16s
08a0d6b544
- Added /admin proxy in vite.config.ts to forward to backend
- Updated adminOfficialData.ts to use proxy path (/admin) instead of direct API_URL
- Fixed CORS issues when frontend calls admin endpoints
- Build successful, all backend tests pass
fix: fix InputNumber float input and fix API response handling
All checks were successful
Backend / backend (push) Successful in 32s
Frontend / frontend (push) Successful in 17s
25f7b5dfb3
- Added mode='decimal' and allowEmpty to InputNumber for float keyboard input
- Fixed getOfficialData return type (array directly, not {data:[]})
- Updated loadData to use response directly
- Frontend builds, backend tests pass
fix: add decimalSeparator and forceSelection to InputNumber for float keyboard input
All checks were successful
Backend / backend (push) Successful in 34s
Frontend / frontend (push) Successful in 16s
993fb97cf6
- Added decimalSeparator='.' to force dot as decimal separator
- Added forceSelection=false to allow manual decimal input
- Build successful
fix: wrap DataTable in template #content slot and add key for reactivity
All checks were successful
Backend / backend (push) Successful in 33s
Frontend / frontend (push) Successful in 15s
c33ecfada2
- PrimeVue DataTable inside Card requires template #content slot
- Added :key on DataTable bound to array length for forced re-render
- Applied to both tax and deposit tables
- Build successful
feat: strict Excel import validation - no fallback, all fields required
All checks were successful
Backend / backend (push) Successful in 34s
Frontend / frontend (push) Successful in 15s
57c323aff2
- Removed fallback to 'Montant total' - 'Montant location' now REQUIRED
- Added validation for all required fields:
  - Montant location (rent amount)
  - Adultes count
  - Children count (at least one of +3ans or -3ans)
  - Email, phone, address of tenant
- Updated error messages to be specific
- All 46 backend tests pass, frontend builds successfully
feat: Airbnb import calculates tax fields from 'Taxes reversées par Airbnb' column
All checks were successful
Backend / backend (push) Successful in 33s
Frontend / frontend (push) Successful in 16s
c0cc445fa0
- Parses 'Taxes reversées par Airbnb' column for total tax amount
- Calculates adults_count = total_tax / (tax_per_day * nights) using OfficialData tax_per_day for booking date
- Sets tax_amount, tax_per_day, tax_adults_count on Airbnb bookings
- Uses OfficialData tax_per_day valid for booking start_date
- Falls back to 1 adult if no tax data
- All 46 tests pass, frontend builds successfully
fix: align preview validation with import validation for all required fields
All checks were successful
Backend / backend (push) Successful in 33s
Frontend / frontend (push) Successful in 15s
b570968d2d
- Preview now validates all fields that import validates:
  - adults_count
  - children_over_3 / children_under_3 (at least one)
  - tenant_mail, tenant_phone, tenant_address
- This prevents 'Ligne invalide malgré la simulation' errors
- All 46 tests pass, frontend builds successfully
fix: import no longer re-validates after preview - uses preview errors directly
All checks were successful
Backend / backend (push) Successful in 34s
Frontend / frontend (push) Successful in 17s
2a88884b00
- import_calendar_file now returns preview errors directly instead of re-validating
- Removed duplicate validation in import phase
- Fixed duplicate error issue in tests (preview now reports each field separately)
- All 46 tests pass, frontend builds successfully
fix: calculate and store tax_amount during Excel calendar import
All checks were successful
Backend / backend (push) Successful in 33s
Frontend / frontend (push) Successful in 16s
1e942a46b5
- Added tax_amount calculation: tax_per_day * adults_count * nights
- Stores tax_amount on Booking model for accurate tax reports
- Applies to non-Airbnb bookings (manual/Excel imports)
- All 46 tests pass, frontend builds successfully
feat: Add dog flag to bookings and update contract template
All checks were successful
Backend / backend (push) Successful in 38s
Frontend / frontend (push) Successful in 16s
07ef73a4f2
Backend:
- Added has_dog column to Booking model (0/1)
- Excel import reads 'Chien' column and sets has_dog
- Contract generation includes email, has_dog, dog_deposit_amount placeholders
- Dog deposit fixed at 50€ if has_dog, otherwise hidden in template
- Fixed € symbols on deposit_amount, deposit_paid, amount_due_at_checkin

Frontend:
- Added has_dog field to Booking types and form
- Checkbox in BookingsView for dog flag
- Included in create/update booking API calls

Template updates:
- Added {{tenant_email}} placeholder
- Added {{has_dog}} with conditional display (Oui/Non)
- Added {{dog_deposit_amount}} (50€ if dog, 0€ otherwise)
- Fixed € symbols on all monetary placeholders
- Removed hardcoded '63000' from tenant address

All 46 backend tests pass, frontend builds successfully
feat: Add dog_deposit_amount to OfficialData
All checks were successful
Backend / backend (push) Successful in 38s
Frontend / frontend (push) Successful in 16s
aa30c8512e
- New official data type: 'dog_deposit_amount' (default 50€)
- Contract generation uses OfficialData for dog deposit instead of hardcoded 50€
- Seed data added in conftest.py for tests
- Admin interface can now configure dog deposit amount per period
- All 46 tests pass, frontend builds successfully
up contrat_template
All checks were successful
Backend / backend (push) Successful in 38s
Frontend / frontend (push) Successful in 16s
83fbd05872
feat: Add dog_deposit_amount button and table in AdminOfficialDataView
All checks were successful
Backend / backend (push) Successful in 37s
Frontend / frontend (push) Successful in 16s
97ebe51161
- Added 'Animaux de compagnie (chèque €)' type to dataTypeOptions
- New button 'Animaux de compagnie' in actions
- New computed dogDepositEntries for filtering
- New table section with same features as tax/deposit tables
- Updated openNewDialog, openEditDialog to support dog_deposit_amount
- Updated FormData interface to include dog_deposit_amount
- Added getTypeLabel, getTypeSeverity, getPlaceholder helper functions
- All 46 tests pass, frontend builds successfully
fix: Update backend validation and frontend labels for dog_deposit_amount
All checks were successful
Backend / backend (push) Successful in 39s
Frontend / frontend (push) Successful in 17s
6563117f52
- Backend: Added 'dog_deposit_amount' to allowed data_type values in validator
- Frontend: Changed label from 'Animaux de compagnie' to 'Caution animal de compagnie'
- Updated table header, button label, and type display
- All 46 tests pass, frontend builds successfully
feat: Add conditional dog deposit paragraph in contract template
All checks were successful
Backend / backend (push) Successful in 38s
Frontend / frontend (push) Successful in 17s
8bbce99f8b
- Added {{dog_deposit_paragraph}} placeholder in backend
- Only shown when has_dog = true (booking.has_dog == 1)
- Paragraph text: 'Un chèque de [dog_deposit_amount] € sera demandé au locataire à son entrée dans les lieux. Il lui sera restitué en fin de séjour et ne sera encaissé que dans le cas où le ménage n'aurait pas été fait correctement.'
- Empty string when no dog (nothing displayed)
- All 46 tests pass, frontend builds successfully
fix: has_dog flag now works for booking creation/update
All checks were successful
Backend / backend (push) Successful in 37s
Frontend / frontend (push) Successful in 16s
3b59e26f16
- Backend: Added has_dog to create_booking() and update_booking() in routes/bookings.py
- Added 3 unit tests:
  - test_create_booking_with_has_dog (has_dog=1)
  - test_create_booking_without_has_dog (defaults to 0)
  - test_update_booking_has_dog (PATCH update)
- All 49 tests pass, frontend builds successfully
fix: Parse has_dog flag in Excel import preview (align with import)
All checks were successful
Backend / backend (push) Successful in 37s
Frontend / frontend (push) Successful in 30s
6bcc1ea916
- Preview now parses 'Chien' column same as import
- Validates has_dog value (0/1) in preview
- Uses same logic: 'oui', 'yes', '1', 'true', 'x' = 1, else 0
- All 49 tests pass, frontend builds successfully
feat: Add tax report by property with custom date range
All checks were successful
Backend / backend (push) Successful in 36s
Frontend / frontend (push) Successful in 17s
8ad499ae60
Backend:
- New endpoint GET /exports/tax-report-by-property?start_date=YYYY-MM-DD&end_date=YYYY-MM-DD
- Returns taxes grouped by property (Airbnb/Contract) with adults, nights, bookings count
- Includes grand totals

Frontend:
- New 'Taxes par logement' tab in FinancialDashboardView
- Date range picker (start/end date)
- DataTable with per-property breakdown (Airbnb/Contract/Total)
- Summary cards with grand totals
- Fixed TypeScript errors (Date type for DatePicker, removed duplicate const)

All 49 backend tests pass, frontend builds successfully
fix
Some checks failed
Backend / backend (push) Failing after 38s
Frontend / frontend (push) Successful in 16s
8463d3d10e
fix pytest (contract generation)
All checks were successful
Backend / backend (push) Successful in 39s
Frontend / frontend (push) Successful in 16s
336ad9bd40
- Added normalize_bool function that correctly handles float values like 1.0 from Excel
- Handles int, float, bool, and string values
- Recognizes: 1, 1.0, '1', '1.0', 'oui', 'yes', 'true', 'x', 'y'
- Used in import_calendar_file for has_dog parsing
- All 49 tests pass, frontend builds successfully
chore: Remove test database files
All checks were successful
Backend / backend (push) Successful in 37s
Frontend / frontend (push) Successful in 18s
95c92ebfef
fix: Remove duplicate normalize_bool function
All checks were successful
Backend / backend (push) Successful in 36s
Frontend / frontend (push) Successful in 16s
eaa90f071a
hume merged commit 1bc252fbb7 into main 2026-08-10 20:42:32 +00:00
hume deleted branch feature/contract-export-import 2026-08-10 20:42:32 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
hume/sci-rental-manager!2
No description provided.