Skip to content

Commit f5eac0a

Browse files
committed
feat(employee): make contract_type and entry_date optional
Allow creating employees with minimal required information: - Required fields: first_name, last_name, workspace, role - Optional fields: status, contract_type, entry_date, email, phone Changes: - Update Employee model to allow NULL for contract_type and entry_date - Update employee form to remove * from optional field labels - Update form validation to only check required fields - Update form save() to handle optional fields correctly - Add database migration to update existing databases - Add seniority property guard for NULL entry_date Closes #79
1 parent 7bfc071 commit f5eac0a

5 files changed

Lines changed: 483 additions & 23 deletions

File tree

CLAUDE.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Instructions for Claude
2+
3+
## Language
4+
- Always speak and write in English throughout this conversation
5+
6+
## Feature Completion & Release Process
7+
When a feature is completed:
8+
1. Use `gh` CLI to fetch the latest tag: `gh release list --limit 1`
9+
2. Create a new tag for the new feature release
10+
3. Publish the exe with the new tag
11+
12+
## Issue Creation Process
13+
When adding a new issue:
14+
1. First create an MD file in `docs/issues/` directory
15+
2. Write the issue in English, without metadata
16+
3. Then create the issue using `gh` CLI: `gh issue create --title "Title" --body "Body content"`
17+
4. Verify that labels are coherent and existent before applying them
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# ISSUE-066: Make Employee Creation Fields Optional
2+
3+
## Description
4+
5+
Currently, when creating a new employee, too many fields are mandatory. Users want to be able to create an employee quickly with minimal information and complete the rest later. Only essential fields should be required: first name, last name, workspace, and role.
6+
7+
## Current State
8+
9+
**Employee form requires 7 fields:**
10+
- First name (required)
11+
- Last name (required)
12+
- Status (required - defaults to "Active")
13+
- Workspace (required)
14+
- Role (required)
15+
- Contract type (required)
16+
- Entry date (required)
17+
18+
**Email and phone are already optional.**
19+
20+
## Problem
21+
22+
When creating a new employee, users must fill in all fields including contract type and entry date, which may not be immediately available. This slows down employee onboarding and creates friction in the workflow.
23+
24+
## Expected Behavior
25+
26+
### Minimum Required Fields
27+
28+
Only these 4 fields should be mandatory:
29+
- **First name** - required
30+
- **Last name** - required
31+
- **Workspace** - required (e.g., Quai, Zone A, Zone B, Bureau)
32+
- **Role** - required (e.g., Cariste, Préparateur, Magasinier)
33+
34+
### Optional Fields with Defaults
35+
36+
These fields should be optional:
37+
- **Status** - optional, defaults to "Actif" if not provided
38+
- **Contract type** - optional, can be null/empty
39+
- **Entry date** - optional, can be null/empty
40+
- **Email** - optional (already implemented)
41+
- **Phone** - optional (already implemented)
42+
43+
## Affected Files
44+
45+
- `src/ui_ctk/forms/employee_form.py` - Remove required indicators, update validation
46+
- `src/employee/validators.py` - Allow null values for optional fields
47+
- `src/controllers/employee_controller.py` - Handle optional fields in create/update
48+
49+
## Implementation Plan
50+
51+
1. Update form UI to remove `*` from optional field labels
52+
2. Update `validate()` method to only check required fields
53+
3. Update `save()` method to handle None values for optional fields
54+
4. Update validator/controller to accept null values
55+
5. Test employee creation with minimum fields
56+
6. Test employee creation with all fields
57+
7. Test employee edit mode to ensure optional fields remain optional
58+
59+
## Acceptance Criteria
60+
61+
- [ ] Can create employee with only: first name, last name, workspace, role
62+
- [ ] Status defaults to "Actif" when not specified
63+
- [ ] Contract type can be left empty
64+
- [ ] Entry date can be left empty
65+
- [ ] Form validation only checks required fields
66+
- [ ] No errors when saving employee without optional fields
67+
- [ ] Edit mode works the same way (optional fields are optional)
68+
- [ ] All tests pass
69+
70+
## Estimated Effort
71+
72+
**Total:** 2-3 hours
73+
- Form UI updates: 30 minutes
74+
- Validation logic updates: 30 minutes
75+
- Controller/validator updates: 30 minutes
76+
- Testing: 1 hour
77+
78+
## Related Issues
79+
80+
None
81+
82+
## Example Use Cases
83+
84+
### Use Case 1: Quick Employee Creation
85+
86+
1. New temp worker arrives
87+
2. HR opens "Add Employee" form
88+
3. Enters: First name "Jean", Last name "Dupont", Workspace "Zone A", Role "Préparateur"
89+
4. Leaves: Contract type and Entry date empty
90+
5. Clicks "Save"
91+
6. Employee created successfully with defaults applied
92+
93+
### Use Case 2: Complete Employee Creation
94+
95+
1. New permanent hire
96+
2. HR opens "Add Employee" form
97+
3. Enters all fields including contract type "CDI" and entry date "01/03/2026"
98+
4. Clicks "Save"
99+
5. Employee created with all information
100+
101+
### Use Case 3: Progressive Data Entry
102+
103+
1. Create employee with minimal info
104+
2. Employee appears in list
105+
3. Later, edit employee to add contract type and entry date
106+
4. Information is progressively completed
107+
108+
## Notes
109+
110+
This improvement makes the employee creation process more flexible and user-friendly. It aligns with real-world HR workflows where not all information is available at the time of initial employee record creation.

0 commit comments

Comments
 (0)