wbcommission 1.52.1__py2.py3-none-any.whl → 1.52.2rc0__py2.py3-none-any.whl

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.

@@ -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
@@ -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.*
@@ -8,7 +8,7 @@ wbcommission/admin/accounts.py,sha256=M43ovnEH9XYBmXLzA10LmbKkn4uq62HYNIauaoThno
8
8
  wbcommission/admin/commission.py,sha256=TBbiuV1inS365WlNyUQBJDO31YQZZwxad0KW0H-8mP4,2078
9
9
  wbcommission/admin/rebate.py,sha256=XoDyGl1MoUAiUrm-GL5wlHvCzASgZqmGWvfMVOm2rJA,230
10
10
  wbcommission/analytics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- wbcommission/analytics/marginality.py,sha256=AnhtJVQKGelImkRMBGChMROCa3_qsyKx86dulSF2eF4,8976
11
+ wbcommission/analytics/marginality.py,sha256=EVmTe9IILzeyUEz6cJrC7UqshiueMKR7ecGhYw9mn7g,8908
12
12
  wbcommission/factories/__init__.py,sha256=3EdqwSHMqJIa5C_yH15M75u_frkLEno151aFoxrOLN0,249
13
13
  wbcommission/factories/commission.py,sha256=omIpgTsXAa4bmVZ1349luhAuTEOzeurSpL6IHpl2VgU,3021
14
14
  wbcommission/factories/rebate.py,sha256=JzbHV7stofk1F3aaQPEV3rEBc_0uwphpG_hea144utc,683
@@ -33,10 +33,10 @@ wbcommission/migrations/0007_remove_commission_unique_crm_recipient_account_and_
33
33
  wbcommission/migrations/0008_alter_commission_options_alter_commission_order.py,sha256=iNwNF1QcmVoj5Eu2yPJEHfI7bIA3e4WZMILjCfBVEx0,830
34
34
  wbcommission/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
35
  wbcommission/models/__init__.py,sha256=BJyah0_zKssfU2ohvu4qcQSHAT1ovcZ_go2-sLEagyw,183
36
- wbcommission/models/account_service.py,sha256=EOyh1wlmCjg-qp2sV-aoO9wUemELbNdYpTJ4S-uaTNk,10653
36
+ wbcommission/models/account_service.py,sha256=gvnxv_TUfeoBjOKeUBu1MectwpsA54syIkQrhYFzQyA,10616
37
37
  wbcommission/models/commission.py,sha256=5Hp2EbmPo9H7L2lM7K8eVOhmZPmEYC6avOQSR_y3U18,29899
38
38
  wbcommission/models/rebate.py,sha256=GtR3G5TqmDdlcefF678Z9D993glddAormoWnYzYzQLg,12795
39
- wbcommission/models/signals.py,sha256=d-123hxTlbp2A9AwUOE_E90jrDN1e3_r7d8aGq7SmiY,2270
39
+ wbcommission/models/signals.py,sha256=RplhwccwDlEYGfw-lpcXpHPxfmeyKohdz-rKGll-NtU,2240
40
40
  wbcommission/reports/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
41
  wbcommission/reports/audit_report.py,sha256=uzzTqYbvfen3AgXHM3mF77R_vDU3o02AVrjNwFXXH0k,2178
42
42
  wbcommission/reports/customer_report.py,sha256=S6mdVA4FTU4amyvV1xjKLsBr_PlG1GDUHDRm75V5WP0,14246
@@ -50,12 +50,12 @@ wbcommission/tests/conftest.py,sha256=bdCEr9KUYxraSgsqZLP_f6SEVF9V5QJi3BnXHxksPf
50
50
  wbcommission/tests/signals.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
51
51
  wbcommission/tests/test_permissions.py,sha256=A9OO88jky1F3x7tFaYkiC9CJioSM1t6if6K4Yjt37lQ,2538
52
52
  wbcommission/tests/analytics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
53
- wbcommission/tests/analytics/test_marginality.py,sha256=GvLQ4SxmABQdkN7GKPwqDOr-7mk1Z9C0fr6w8vhO0Pk,11747
53
+ wbcommission/tests/analytics/test_marginality.py,sha256=1a2b8PEV0kLlL8NSwPnDs0DEdxgzjI3wU1imTOloBVU,11702
54
54
  wbcommission/tests/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
55
55
  wbcommission/tests/models/mixins.py,sha256=gnsd0GCCdWcR8EYSh9ff-gY1l6dLPeU-LQYynngj9nw,818
56
- wbcommission/tests/models/test_account_service.py,sha256=Hl6ei_yYIfstNRzGHdLg98G9W4ZelDypq_sNOGyHQEs,13491
57
- wbcommission/tests/models/test_commission.py,sha256=uFzUClZpPQy2CiL0b4YXW5ISA1Xpm42ipi8D3PQ0Rl0,28065
58
- wbcommission/tests/models/test_rebate.py,sha256=9awvutOlPVo8tngtjLdtFxGhxmTC7Vkf5dMBcS60-YA,5746
56
+ wbcommission/tests/models/test_account_service.py,sha256=_S2qWSJQB2WyF7v1HWrpdMMHEBvuHJA5CHz3GZEto68,13247
57
+ wbcommission/tests/models/test_commission.py,sha256=dzITyJVMu3d5qLc475Sw8AYpbKjq1MMDhFoUFjYdH4Q,27961
58
+ wbcommission/tests/models/test_rebate.py,sha256=wnq4fJkcTj2PTrwW3He65kRqGE0F2C-vYwafcjVSqVg,5671
59
59
  wbcommission/tests/viewsets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
60
  wbcommission/tests/viewsets/test_rebate.py,sha256=TM_-E1PGFui8JBQpeFLdDdVPyqz5FSn-cnoPHq1JzEQ,3262
61
61
  wbcommission/viewsets/__init__.py,sha256=iuWo3Y9t8XxPgRG5DIURBk0J8hDoK2oTmMhv9hiAUcU,232
@@ -77,6 +77,6 @@ wbcommission/viewsets/menu/rebate.py,sha256=Qzhwr2xG3_j7frxs3eWLZuMoUzT2nCBrWmEY
77
77
  wbcommission/viewsets/titles/__init__.py,sha256=Sg64aMWm_OD4-P57YoaN6Mqv6NRVU5m7ii_WvaWuTsY,85
78
78
  wbcommission/viewsets/titles/commissions.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
79
79
  wbcommission/viewsets/titles/rebate.py,sha256=VTSHJW3voqCMVhDZ_zVeVmZid_WY3P4X9k11VdJM_GQ,301
80
- wbcommission-1.52.1.dist-info/METADATA,sha256=6dZKW_pRJiaxJfF9wec1MAt3mHm2-BSEtWUCenQUnpo,323
81
- wbcommission-1.52.1.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
82
- wbcommission-1.52.1.dist-info/RECORD,,
80
+ wbcommission-1.52.2rc0.dist-info/METADATA,sha256=h6vwqxkdB5j2tmw9BeE59hv6LwKMVsGBrcUlyaBXVW8,326
81
+ wbcommission-1.52.2rc0.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
82
+ wbcommission-1.52.2rc0.dist-info/RECORD,,