@@ -34,20 +34,39 @@ def loanprep_quantity_must_be_lte_availability(ipreparation):
34
34
quantity = ipreparation .quantity or 0
35
35
quantityresolved = ipreparation .quantityresolved or 0
36
36
if available < (quantity - quantityresolved ):
37
- raise BusinessRuleException (f"loan preparation quantity exceeds availability ({ ipreparation .id } : { quantity - quantityresolved } { available } )" )
37
+ raise BusinessRuleException (
38
+ f"loan preparation quantity exceeds availability ({ ipreparation .id } : { quantity - quantityresolved } { available } )" ,
39
+ {"table" : "LoanPreparation" ,
40
+ "fieldName" : "quantity" ,
41
+ "preparationid" : ipreparation .id ,
42
+ "quantity" : quantity ,
43
+ "quantityresolved" : quantityresolved ,
44
+ "available" : available })
38
45
39
46
@orm_signal_handler ('pre_save' , 'Giftpreparation' )
40
47
def giftprep_quantity_must_be_lte_availability (ipreparation ):
41
48
if ipreparation .preparation is not None :
42
49
available = get_availability (ipreparation .preparation , ipreparation .id , "giftpreparationid" ) or 0
43
50
quantity = ipreparation .quantity or 0
44
51
if available < quantity :
45
- raise BusinessRuleException (f"gift preparation quantity exceeds availability ({ ipreparation .id } : { quantity } { available } )" )
52
+ raise BusinessRuleException (
53
+ f"gift preparation quantity exceeds availability ({ ipreparation .id } : { quantity } { available } )" ,
54
+ {"table" : "GiftPreparation" ,
55
+ "fieldName" : "quantity" ,
56
+ "preparationid" : ipreparation .id ,
57
+ "quantity" : quantity ,
58
+ "available" : available })
46
59
47
60
@orm_signal_handler ('pre_save' , 'Exchangeoutprep' )
48
61
def exchangeoutprep_quantity_must_be_lte_availability (ipreparation ):
49
62
if ipreparation .preparation is not None :
50
63
available = get_availability (ipreparation .preparation , ipreparation .id , "exchangeoutprepid" ) or 0
51
64
quantity = ipreparation .quantity or 0
52
65
if available < quantity :
53
- raise BusinessRuleException ("exchangeout preparation quantity exceeds availability ({ipreparation.id}: {quantity} {available})" )
66
+ raise BusinessRuleException (
67
+ "exchangeout preparation quantity exceeds availability ({ipreparation.id}: {quantity} {available})" ,
68
+ {"table" : "ExchangeOutPrep" ,
69
+ "fieldName" : "quantity" ,
70
+ "preparationid" : ipreparation .id ,
71
+ "quantity" : quantity ,
72
+ "available" : available })
0 commit comments