Skip to content

Commit

Permalink
Add validations for POST /admin/expense_policy_rules (#331)
Browse files Browse the repository at this point in the history
  • Loading branch information
KirtiGautam authored Nov 3, 2023
1 parent bf2f2c9 commit d03d6c9
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 12 deletions.
33 changes: 27 additions & 6 deletions reference/admin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10030,6 +10030,33 @@ components:
description: |
This represents the description of the expense policy rule.
example: Receipt is mandatory for expense above $50
expense_without_receipt_allowed:
type: boolean
description: |
If this is set to false, then for all such expenses that doesn't have receipt, this policy rule will be violated. <br>
**Note: If this field is set to false i.e. receipts are mandatory, only following conditions & actions are allowed =>**
- expense_category_ids
- expense_category_ids_op
- expense_project_ids
- expense_project_ids_op
- expense_cost_center_ids
- expense_cost_center_ids_op
- expense_limit_type (only `INIDIVIDUAL` type is allowed)
- expense_currency
- expense_amount_max
- employee_department_ids
- employee_department_ids_op
- employee_locations
- employee_user_ids
- employee_user_ids_op
- employee_titles
- employee_titles_op
- action_flag
- action_show_warning
- action_make_unreportable
- description
default: true
example: true
expense_limit_type:
oneOf:
- $ref: '#/components/schemas/expense_policy_limit_type'
Expand Down Expand Up @@ -10203,12 +10230,6 @@ components:
If this is set to false, then for all such expenses that are created on holidays, this policy rule will be violated.
default: true
example: true
expense_without_receipt_allowed:
type: boolean
description: |
If this is set to false, then for all such expenses that doesn't have receipt, this policy rule will be violated.
default: true
example: true
expense_spent_at_max:
allOf:
- $ref: '#/components/schemas/timestamptz_pst'
Expand Down
33 changes: 27 additions & 6 deletions src/components/schemas/expense_policies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,33 @@ expense_policy_in:
description: |
This represents the description of the expense policy rule.
example: Receipt is mandatory for expense above $50
expense_without_receipt_allowed:
type: boolean
description: |
If this is set to false, then for all such expenses that doesn't have receipt, this policy rule will be violated. <br>
**Note: If this field is set to false i.e. receipts are mandatory, only following conditions & actions are allowed =>**
- expense_category_ids
- expense_category_ids_op
- expense_project_ids
- expense_project_ids_op
- expense_cost_center_ids
- expense_cost_center_ids_op
- expense_limit_type (only `INIDIVIDUAL` type is allowed)
- expense_currency
- expense_amount_max
- employee_department_ids
- employee_department_ids_op
- employee_locations
- employee_user_ids
- employee_user_ids_op
- employee_titles
- employee_titles_op
- action_flag
- action_show_warning
- action_make_unreportable
- description
default: True
example: True
expense_limit_type:
oneOf:
- $ref: ./fields.yaml#/expense_policy_limit_type
Expand Down Expand Up @@ -186,12 +213,6 @@ expense_policy_in:
If this is set to false, then for all such expenses that are created on holidays, this policy rule will be violated.
default: True
example: True
expense_without_receipt_allowed:
type: boolean
description: |
If this is set to false, then for all such expenses that doesn't have receipt, this policy rule will be violated.
default: True
example: True
expense_spent_at_max:
allOf:
- $ref: './fields.yaml#/timestamptz_pst'
Expand Down

0 comments on commit d03d6c9

Please sign in to comment.