# V1W4-5
# HMC & Approval Workflow
###### tags: `OneLeap v1`
# HMC
## Employee
* Position Degree - 10
* Position Level - 5
* Spause
* Children
* Academic degree
* Employee Benefits
* Employee Deductions
* Employee Contributions
## Org Infromation
## Org Structure / Position
* Associated A/P, A/R (Optional)
* Treenode
* Level 1 - Pyramid Tip -> General Manager or CEO
* Level 2 - Line 1 managers -> Unit Manager or Directors
* Level 3 - Line 2 managers -> Department Manager or Supervisor
* Level 4 - Line 3 -> Employee or Team leader or whatever
* JD
* Permissions
* Organizationl Title
* Title
* Occupier -> Employee -> Operations (Occupy, Unoccupy, Transfer)
* Alternative Occopation -> Position
* Bonus
* Sales bonus
* Realized profit bonus - Profit statement
* Position Benefits - reverse relationship
* Position Deductions - reverse relationship
* Position Contributions - reverse relationship
* Attachments - reverse relationship
* Assets - reverse relationship
## Permissions
* Model permissions (CRUD, custom) - Preventive
* Object Ownership - Preventive
* Object level permissions - Permitive - https://github.com/dfunckt/django-rules
* Predicated by default return either True or False
* Custom Predicated should return django query (Q)
* I need more information to make OLP decisions:
* https://github.com/jazzband/django-taggit
## Payroll
* payroll is calculated for occopied positions, the amount of the salary is calculated based on Employee information
# Approval Workflow
Basically it is the logic that defines who can do what and when
## Workflow
* relationship with workflow assiciates (Transaction)
* depends on the State of the associate
* is_template
* steps - reverse relationship to Step
* step permissions
* is_mandatory
## Step
* permitted position
* step name
* step target
* is_approved
### approval template doesn't exist
- Transaction Created -> state DRAFT
- Mid states are irrelivant
- Transaction finalization (POSTING)
### approval template exists
- Transaction Created -> state DRAFT
- step 1 -> state PENDING
- step n -> state PENDING
- step final -> state NEW
- Transaction Uapproved by last or mid approved step
- step n -> state PENDING
- step n -> unapprove all upper steps
- Transaction Uapproved by first step
- same as mid step -> state DRAFT
- Transaction finalization (POSTING)
# Auditing
- just use this library
- https://django-activity-stream.readthedocs.io/en/latest/