wbcommission 1.52.1__tar.gz → 1.52.2rc0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of wbcommission might be problematic. Click here for more details.

Files changed (82) hide show
  1. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/PKG-INFO +1 -1
  2. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/analytics/marginality.py +6 -6
  3. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/models/account_service.py +3 -3
  4. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/models/signals.py +4 -4
  5. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/tests/analytics/test_marginality.py +4 -4
  6. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/tests/models/test_account_service.py +14 -19
  7. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/tests/models/test_commission.py +4 -8
  8. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/tests/models/test_rebate.py +10 -10
  9. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/.gitignore +0 -0
  10. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/pyproject.toml +0 -0
  11. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/__init__.py +0 -0
  12. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/admin/__init__.py +0 -0
  13. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/admin/accounts.py +0 -0
  14. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/admin/commission.py +0 -0
  15. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/admin/rebate.py +0 -0
  16. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/analytics/__init__.py +0 -0
  17. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/apps.py +0 -0
  18. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/dynamic_preferences_registry.py +0 -0
  19. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/factories/__init__.py +0 -0
  20. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/factories/commission.py +0 -0
  21. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/factories/rebate.py +0 -0
  22. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/filters/__init__.py +0 -0
  23. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/filters/rebate.py +0 -0
  24. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/filters/signals.py +0 -0
  25. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/generators/__init__.py +0 -0
  26. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/generators/rebate_generator.py +0 -0
  27. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/locale/de/LC_MESSAGES/django.mo +0 -0
  28. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/locale/de/LC_MESSAGES/django.po +0 -0
  29. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/locale/en/LC_MESSAGES/django.mo +0 -0
  30. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/locale/en/LC_MESSAGES/django.po +0 -0
  31. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/locale/fr/LC_MESSAGES/django.mo +0 -0
  32. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/locale/fr/LC_MESSAGES/django.po +0 -0
  33. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/migrations/0001_initial.py +0 -0
  34. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/migrations/0002_commissionrule_remove_accountcustomer_account_and_more.py +0 -0
  35. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/migrations/0003_alter_commission_account.py +0 -0
  36. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/migrations/0004_rebate_audit_log.py +0 -0
  37. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/migrations/0005_alter_rebate_audit_log.py +0 -0
  38. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/migrations/0006_commissionrule_consider_zero_percent_for_exclusion.py +0 -0
  39. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/migrations/0007_remove_commission_unique_crm_recipient_account_and_more.py +0 -0
  40. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/migrations/0008_alter_commission_options_alter_commission_order.py +0 -0
  41. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/migrations/__init__.py +0 -0
  42. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/models/__init__.py +0 -0
  43. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/models/commission.py +0 -0
  44. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/models/rebate.py +0 -0
  45. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/permissions.py +0 -0
  46. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/reports/__init__.py +0 -0
  47. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/reports/audit_report.py +0 -0
  48. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/reports/customer_report.py +0 -0
  49. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/reports/utils.py +0 -0
  50. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/serializers/__init__.py +0 -0
  51. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/serializers/commissions.py +0 -0
  52. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/serializers/rebate.py +0 -0
  53. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/serializers/signals.py +0 -0
  54. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/tests/__init__.py +0 -0
  55. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/tests/analytics/__init__.py +0 -0
  56. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/tests/conftest.py +0 -0
  57. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/tests/models/__init__.py +0 -0
  58. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/tests/models/mixins.py +0 -0
  59. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/tests/signals.py +0 -0
  60. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/tests/test_permissions.py +0 -0
  61. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/tests/viewsets/__init__.py +0 -0
  62. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/tests/viewsets/test_rebate.py +0 -0
  63. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/urls.py +0 -0
  64. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/viewsets/__init__.py +0 -0
  65. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/viewsets/buttons/__init__.py +0 -0
  66. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/viewsets/buttons/rebate.py +0 -0
  67. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/viewsets/buttons/signals.py +0 -0
  68. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/viewsets/commissions.py +0 -0
  69. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/viewsets/display/__init__.py +0 -0
  70. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/viewsets/display/commissions.py +0 -0
  71. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/viewsets/display/rebate.py +0 -0
  72. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/viewsets/endpoints/__init__.py +0 -0
  73. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/viewsets/endpoints/commissions.py +0 -0
  74. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/viewsets/endpoints/rebate.py +0 -0
  75. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/viewsets/menu/__init__.py +0 -0
  76. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/viewsets/menu/commissions.py +0 -0
  77. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/viewsets/menu/rebate.py +0 -0
  78. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/viewsets/mixins.py +0 -0
  79. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/viewsets/rebate.py +0 -0
  80. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/viewsets/titles/__init__.py +0 -0
  81. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/viewsets/titles/commissions.py +0 -0
  82. {wbcommission-1.52.1 → wbcommission-1.52.2rc0}/wbcommission/viewsets/titles/rebate.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wbcommission
3
- Version: 1.52.1
3
+ Version: 1.52.2rc0
4
4
  Summary: A workbench module for managing human resources.
5
5
  Author-email: Christopher Wittlinger <c.wittlinger@stainly.com>
6
6
  Requires-Dist: reportlab==3.*
@@ -71,10 +71,10 @@ class MarginalityCalculator:
71
71
 
72
72
  # Build the fees dataframe where product id is the index and colum are the every fees type available and value are the amount.
73
73
  fees = Fees.valid_objects.filter(
74
- transaction_date__lte=bday_to_date,
75
- transaction_date__gte=bday_from_date,
74
+ fee_date__lte=bday_to_date,
75
+ fee_date__gte=bday_from_date,
76
76
  transaction_subtype__in=self.FEE_MAP.keys(),
77
- linked_product__in=products,
77
+ product__in=products,
78
78
  ).annotate(
79
79
  fee_type=Case(
80
80
  *[When(transaction_subtype=k, then=Value(v)) for k, v in self.FEE_MAP.items()],
@@ -82,9 +82,9 @@ class MarginalityCalculator:
82
82
  )
83
83
  )
84
84
  self.df_fees = pd.DataFrame(
85
- fees.values_list("linked_product", "fee_type", "total_value", "transaction_date", "calculated"),
86
- columns=["linked_product", "fee_type", "total_value", "transaction_date", "calculated"],
87
- ).rename(columns={"linked_product": "id", "transaction_date": "date"})
85
+ fees.values_list("product", "fee_type", "total_value", "fee_date", "calculated"),
86
+ columns=["product", "fee_type", "total_value", "fee_date", "calculated"],
87
+ ).rename(columns={"product": "id", "fee_date": "date"})
88
88
  self.df_fees["date"] = pd.to_datetime(self.df_fees["date"])
89
89
 
90
90
  self.df_fees = (
@@ -31,13 +31,13 @@ class AccountRebateManager:
31
31
  # get the fees as a multi-index matrix
32
32
  self.df_fees = pd.DataFrame(
33
33
  Fees.valid_objects.filter(
34
- linked_product__in=claim_products,
34
+ product__in=claim_products,
35
35
  transaction_subtype__in=self.FEE_MAP[self.commission_type_key],
36
- ).values("linked_product", "transaction_date", "total_value")
36
+ ).values("product", "fee_date", "total_value")
37
37
  )
38
38
  if not self.df_fees.empty:
39
39
  self.df_fees = (
40
- self.df_fees.rename(columns={"linked_product": "product", "transaction_date": "date"})
40
+ self.df_fees.rename(columns={"product": "product", "fee_date": "date"})
41
41
  .groupby(["product", "date"])
42
42
  .sum()
43
43
  .total_value.astype(float)
@@ -31,15 +31,15 @@ def post_fees_save_for_rebate_computation(sender, instance, created, **kwargs):
31
31
  # if a new commission line is created, we create a general rule
32
32
  if (
33
33
  created
34
- and (date.today() - instance.transaction_date).days
34
+ and (date.today() - instance.fee_date).days
35
35
  <= global_preferences_registry.manager()["wbcommission__days_to_recompute_rebate_from_fees_threshold"]
36
36
  ): # we make sure that the fee won't trigger rebate computation if they are created too much in the past
37
37
  for root_account in Account.objects.filter(level=0):
38
38
  if Claim.objects.filter(
39
- account__in=root_account.get_descendants(include_self=True), product=instance.linked_product
39
+ account__in=root_account.get_descendants(include_self=True), product=instance.product
40
40
  ).exists():
41
41
  manage_rebate_as_task.delay(
42
42
  root_account.id,
43
- start_date=instance.transaction_date,
44
- only_content_object_ids=[instance.linked_product.id],
43
+ start_date=instance.fee_date,
44
+ only_content_object_ids=[instance.product.id],
45
45
  )
@@ -21,14 +21,14 @@ def _create_fixture(product, val_date, net_value=100, outstanding_shares=100):
21
21
  instrument=product, net_value=net_value, outstanding_shares=outstanding_shares, calculated=False, date=val_date
22
22
  ).net_value # create a price of AUM 100*100
23
23
  management_fees_1 = FeesFactory.create(
24
- linked_product=product, transaction_date=val_date, transaction_subtype="MANAGEMENT", calculated=False
24
+ product=product, fee_date=val_date, transaction_subtype="MANAGEMENT", calculated=False
25
25
  ).total_value
26
26
  performance_fees_1 = FeesFactory.create(
27
- linked_product=product, transaction_date=val_date, transaction_subtype="PERFORMANCE", calculated=False
27
+ product=product, fee_date=val_date, transaction_subtype="PERFORMANCE", calculated=False
28
28
  ).total_value
29
29
  performance_crys_fees_1 = FeesFactory.create(
30
- linked_product=product,
31
- transaction_date=val_date,
30
+ product=product,
31
+ fee_date=val_date,
32
32
  transaction_subtype="PERFORMANCE_CRYSTALIZED",
33
33
  calculated=False,
34
34
  ).total_value
@@ -21,18 +21,18 @@ class TestAccountService(AccountManagerFixture):
21
21
  mngt_fees = fees_factory.create(transaction_subtype="MANAGEMENT")
22
22
  perf_fees = fees_factory.create( # noqa
23
23
  transaction_subtype="PERFORMANCE",
24
- transaction_date=mngt_fees.transaction_date,
25
- linked_product=mngt_fees.linked_product,
24
+ fee_date=mngt_fees.fee_date,
25
+ product=mngt_fees.product,
26
26
  ) # noqa
27
27
  claim_factory.create(
28
28
  account=management_account_manager.root_account,
29
- trade=customer_trade_factory.create(underlying_instrument=mngt_fees.linked_product),
29
+ trade=customer_trade_factory.create(underlying_instrument=mngt_fees.product),
30
30
  status="APPROVED",
31
31
  )
32
32
  management_account_manager.initialize()
33
33
 
34
34
  assert (
35
- management_account_manager.get_commission_pool(mngt_fees.linked_product, mngt_fees.transaction_date)
35
+ management_account_manager.get_commission_pool(mngt_fees.product, mngt_fees.fee_date)
36
36
  == mngt_fees.total_value
37
37
  )
38
38
 
@@ -42,24 +42,24 @@ class TestAccountService(AccountManagerFixture):
42
42
  mngt_fees = fees_factory.create(transaction_subtype="MANAGEMENT")
43
43
  perf_fees = fees_factory.create(
44
44
  transaction_subtype="PERFORMANCE",
45
- transaction_date=mngt_fees.transaction_date,
46
- linked_product=mngt_fees.linked_product,
45
+ fee_date=mngt_fees.fee_date,
46
+ product=mngt_fees.product,
47
47
  )
48
48
  perf2_fees = fees_factory.create(
49
49
  transaction_subtype="PERFORMANCE_CRYSTALIZED",
50
- transaction_date=mngt_fees.transaction_date,
51
- linked_product=mngt_fees.linked_product,
50
+ fee_date=mngt_fees.fee_date,
51
+ product=mngt_fees.product,
52
52
  )
53
53
 
54
54
  claim_factory.create(
55
55
  account=performance_account_manager.root_account,
56
- trade=customer_trade_factory.create(underlying_instrument=mngt_fees.linked_product),
56
+ trade=customer_trade_factory.create(underlying_instrument=mngt_fees.product),
57
57
  status="APPROVED",
58
58
  )
59
59
  performance_account_manager.initialize()
60
60
 
61
61
  assert (
62
- performance_account_manager.get_commission_pool(mngt_fees.linked_product, mngt_fees.transaction_date)
62
+ performance_account_manager.get_commission_pool(mngt_fees.product, mngt_fees.fee_date)
63
63
  == perf_fees.total_value + perf2_fees.total_value
64
64
  )
65
65
 
@@ -70,30 +70,25 @@ class TestAccountService(AccountManagerFixture):
70
70
  calculated_fees = fees_factory.create(calculated=True, transaction_subtype="MANAGEMENT")
71
71
  claim_factory.create(
72
72
  account=management_account_manager.root_account,
73
- trade=customer_trade_factory.create(underlying_instrument=calculated_fees.linked_product),
73
+ trade=customer_trade_factory.create(underlying_instrument=calculated_fees.product),
74
74
  status="APPROVED",
75
75
  )
76
76
  management_account_manager.initialize()
77
77
 
78
78
  assert (
79
- management_account_manager.get_commission_pool(
80
- calculated_fees.linked_product, calculated_fees.transaction_date
81
- )
79
+ management_account_manager.get_commission_pool(calculated_fees.product, calculated_fees.fee_date)
82
80
  == calculated_fees.total_value
83
81
  )
84
82
  # Check that is there is a non calculated fees, it is used instead of the calculated one
85
83
  fees = fees_factory.create(transaction_subtype=calculated_fees.transaction_subtype, calculated=False)
86
84
  claim_factory.create(
87
85
  account=management_account_manager.root_account,
88
- trade=customer_trade_factory.create(underlying_instrument=fees.linked_product),
86
+ trade=customer_trade_factory.create(underlying_instrument=fees.product),
89
87
  status="APPROVED",
90
88
  )
91
89
  management_account_manager.initialize()
92
90
 
93
- assert (
94
- management_account_manager.get_commission_pool(fees.linked_product, fees.transaction_date)
95
- == fees.total_value
96
- )
91
+ assert management_account_manager.get_commission_pool(fees.product, fees.fee_date) == fees.total_value
97
92
 
98
93
  @pytest.mark.parametrize("val_date", [fake.past_date()])
99
94
  def test_get_terminal_account_holding_ratio(
@@ -420,14 +420,10 @@ class TestCommissionType:
420
420
  ):
421
421
  val_date = (val_date + BDay(0)).date()
422
422
  val_date_1 = (val_date - BDay(1)).date()
423
- fees_factory.create(linked_product=product, transaction_date=val_date_1, transaction_subtype="PERFORMANCE")
424
- fees_factory.create(linked_product=product, transaction_date=val_date_1, transaction_subtype="MANAGEMENT")
425
- perf_fees = fees_factory.create(
426
- linked_product=product, transaction_date=val_date, transaction_subtype="PERFORMANCE"
427
- )
428
- mngt_fees = fees_factory.create(
429
- linked_product=product, transaction_date=val_date, transaction_subtype="MANAGEMENT"
430
- )
423
+ fees_factory.create(product=product, fee_date=val_date_1, transaction_subtype="PERFORMANCE")
424
+ fees_factory.create(product=product, fee_date=val_date_1, transaction_subtype="MANAGEMENT")
425
+ perf_fees = fees_factory.create(product=product, fee_date=val_date, transaction_subtype="PERFORMANCE")
426
+ mngt_fees = fees_factory.create(product=product, fee_date=val_date, transaction_subtype="MANAGEMENT")
431
427
  sub2 = customer_trade_factory.create(
432
428
  underlying_instrument=product,
433
429
  transaction_subtype=Trade.Type.SUBSCRIPTION,
@@ -43,9 +43,9 @@ class TestRebateModel(AccountManagerFixture):
43
43
  mock_fct.return_value = [
44
44
  (
45
45
  commission.account,
46
- fees.transaction_date,
46
+ fees.fee_date,
47
47
  commission,
48
- fees.linked_product,
48
+ fees.product,
49
49
  commission.crm_recipient,
50
50
  rebate_value,
51
51
  dict(),
@@ -54,8 +54,8 @@ class TestRebateModel(AccountManagerFixture):
54
54
  Rebate.manage_rebate(commission.account)
55
55
  new_rebate = Rebate.objects.get(
56
56
  commission=commission,
57
- product=fees.linked_product,
58
- date=fees.transaction_date,
57
+ product=fees.product,
58
+ date=fees.fee_date,
59
59
  recipient=commission.crm_recipient,
60
60
  )
61
61
  assert new_rebate.value == rebate_value
@@ -64,9 +64,9 @@ class TestRebateModel(AccountManagerFixture):
64
64
  mock_fct.return_value = [
65
65
  (
66
66
  commission.account,
67
- fees.transaction_date,
67
+ fees.fee_date,
68
68
  commission,
69
- fees.linked_product,
69
+ fees.product,
70
70
  commission.crm_recipient,
71
71
  rebate_value * 2,
72
72
  dict(),
@@ -81,9 +81,9 @@ class TestRebateModel(AccountManagerFixture):
81
81
  mock_fct.return_value = [
82
82
  (
83
83
  commission.account,
84
- fees.transaction_date,
84
+ fees.fee_date,
85
85
  new_commission,
86
- fees.linked_product,
86
+ fees.product,
87
87
  new_commission.crm_recipient,
88
88
  rebate_value,
89
89
  dict(),
@@ -95,8 +95,8 @@ class TestRebateModel(AccountManagerFixture):
95
95
  assert (
96
96
  Rebate.objects.get(
97
97
  commission=new_commission,
98
- product=fees.linked_product,
99
- date=fees.transaction_date,
98
+ product=fees.product,
99
+ date=fees.fee_date,
100
100
  recipient=new_commission.crm_recipient,
101
101
  ).value
102
102
  == rebate_value