Skip to content

Conversation

@elarroba
Copy link
Member

Set default role during account creation.
Data import bug fix preventing parent and single accounts to be mapped.

…ion logic:**

  - Updated `EntityModel.create_account` method to support new flags for default role assignment.
  - Passed `is_role_default` and `force_role_default` to the `ChartOfAccountsModel.create_account` method.

- **Implemented default role handling in `ChartOfAccountsModel.create_account`:**
  - Added validation to prevent multiple default accounts for the same role unless `force_role_default` is enabled.
  - Updated existing default account behavior to unset the previous default when `force_role_default` is used.
  - Included transaction atomicity to ensure account creation consistency.

- **Refactored account creation logic for clarity and maintainability:**
  - Reorganized parameter handling and method logic for `AccountModel` creation.
  - Enhanced validation error messaging for default role assignment conflicts.

### **Summary**
Introduced `is_role_default` and `force_role_default` flags for `AccountModel` creation to manage default role accounts more effectively. Implemented validation and transaction safety measures for default account assignments.

### **Backwards Compatibility**
Changes are backwards compatible. Default behavior is preserved unless the new flags are explicitly used.
@elarroba elarroba self-assigned this Nov 17, 2025
  - Improved role default validation logic to utilize more detailed error messaging, replacing queryset code reference with actual `AccountModel` instance code for clarity.
  - Refactored existing account model handling by replacing variable names (`default_role_account` -> `existing_account_model`) for consistency.
  - Made line formatting adjustments for improved readability.

- **Updated QuickStart Notebook:**
  - Removed all execution-specific metadata (`ExecuteTime`, `execution_count`) to clean up notebook revisions.
  - Refined outputs across cells by clearing response data and any previously stored execution results for a fresher state.

### **Summary**
Refactored the account creation logic in `ChartOfAccountsModel` for better naming and messaging, enhancing consistency and clarity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add flag to mark an account as default for its role during creation

2 participants