Commit 15cac9d
committed
- **Added
- 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.is_role_default and force_role_default to account creation logic:**1 parent e0a4bbb commit 15cac9d
File tree
4 files changed
+206
-529
lines changed- django_ledger
- models
- views
4 files changed
+206
-529
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | | - | |
| 46 | + | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
52 | | - | |
53 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
58 | 57 | | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | 58 | | |
63 | | - | |
64 | 59 | | |
65 | | - | |
| 60 | + | |
66 | 61 | | |
67 | 62 | | |
68 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
69 | 68 | | |
70 | 69 | | |
71 | 70 | | |
| |||
605 | 604 | | |
606 | 605 | | |
607 | 606 | | |
| 607 | + | |
| 608 | + | |
608 | 609 | | |
609 | 610 | | |
610 | 611 | | |
| |||
624 | 625 | | |
625 | 626 | | |
626 | 627 | | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
627 | 633 | | |
628 | 634 | | |
629 | 635 | | |
630 | 636 | | |
631 | 637 | | |
632 | 638 | | |
633 | | - | |
634 | | - | |
635 | | - | |
636 | | - | |
637 | | - | |
638 | | - | |
639 | | - | |
640 | | - | |
641 | | - | |
642 | 639 | | |
643 | | - | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
644 | 672 | | |
645 | 673 | | |
646 | 674 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
686 | 686 | | |
687 | 687 | | |
688 | 688 | | |
689 | | - | |
690 | | - | |
| 689 | + | |
691 | 690 | | |
692 | 691 | | |
693 | 692 | | |
| |||
1689 | 1688 | | |
1690 | 1689 | | |
1691 | 1690 | | |
1692 | | - | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
| 1695 | + | |
| 1696 | + | |
1693 | 1697 | | |
1694 | 1698 | | |
1695 | 1699 | | |
| |||
0 commit comments