@@ -6,19 +6,19 @@ class HrContract(models.Model):
6
6
7
7
l10n_in_basic_salary = fields .Monetary (string = "Basic Salary" , help = "Basic salary calculated from the wage" , compute = "_compute_l10n_in_basic_salary" , inverse = "_inverse_l10n_in_basic_salary" , currency_field = "currency_id" )
8
8
l10n_in_house_rent_allowance = fields .Monetary (string = "House Rent Allowance" , compute = "_compute_l10n_in_house_rent_allowance" , inverse = "_inverse_l10n_in_house_rent_allowance" , currency_field = "currency_id" )
9
- l10n_in_standard_allowance = fields .Monetary (string = "Standard Allowance" , default = 4167 , currency_field = "currency_id" )
9
+ l10n_in_standard_allowance = fields .Monetary (string = "Standard Allowance" , default = lambda self : self . env . company . l10n_in_standard_allowance , currency_field = "currency_id" )
10
10
l10n_in_performance_bonus = fields .Monetary (string = "Performance Bonus" , compute = "_compute_l10n_in_performance_bonus" , inverse = "_inverse_l10n_in_performance_bonus" , currency_field = "currency_id" )
11
11
l10n_in_leave_travel_allowance = fields .Monetary (string = "Leave Travel Allowance" , compute = "_compute_l10n_in_leave_travel_allowance" , inverse = "_inverse_l10n_in_leave_travel_allowance" , currency_field = "currency_id" )
12
12
l10n_in_leave_allowance = fields .Monetary (string = "Leave Allowance" , compute = "_compute_leave_allowance" , inverse = "_inverse_leave_allowance" , currency_field = "currency_id" )
13
- l10n_in_leave_days = fields .Float (string = "Leave Days" , default = 1 )
14
- l10n_in_gratuity = fields .Monetary (string = "Gratuity" , currency_field = "currency_id" )
15
- l10n_in_supplementary_allowance = fields .Monetary (string = "Supplementary Allowance" , compute = "_compute_l10n_in_supplementary_allowance" , inverse = "_inverse_l10n_in_supplementary_allowance" , currency_field = "currency_id" )
13
+ l10n_in_leave_days = fields .Float (string = "Leave Days" , default = lambda self : self . env . company . l10n_in_leave_days )
14
+ l10n_in_gratuity = fields .Monetary (string = "Gratuity" , currency_field = "currency_id" , default = lambda self : self . env . company . l10n_in_gratuity )
15
+ l10n_in_supplementary_allowance = fields .Monetary (string = "Supplementary Allowance" , compute = "_compute_l10n_in_supplementary_allowance" , inverse = "_inverse_l10n_in_supplementary_allowance" , currency_field = "currency_id" , default = lambda self : self . env . company . l10n_in_supplementary_allowance )
16
16
17
- l10n_in_basic_salary_percent = fields .Float (string = "Basic Salary Percentage" , help = "basic salary percentage of wage" , default = 50 )
18
- l10n_in_house_rent_allowance_percent = fields .Float (string = "House Rent Allowance Percentage" , help = "this is the percentage of basic salary" , default = 50 )
17
+ l10n_in_basic_salary_percent = fields .Float (string = "Basic Salary Percentage" , help = "basic salary percentage of wage" , default = lambda self : self . env . company . l10n_in_basic_salary_percent )
18
+ l10n_in_house_rent_allowance_percent = fields .Float (string = "House Rent Allowance Percentage" , help = "this is the percentage of basic salary" , default = lambda self : self . env . company . l10n_in_house_rent_allowance_percent )
19
19
l10n_in_standard_allowance_percent = fields .Float (string = "Standard Allowance Percentage" , compute = "_compute_l10n_in_standard_allowance_percent" , inverse = "_inverse_l10n_in_standard_allowance_percent" )
20
- l10n_in_performance_bonus_percent = fields .Float (string = "Performance Bonus Percentage" , default = 20 )
21
- l10n_in_leave_travel_allowance_percent = fields .Float (string = "Leave Travel Allowance Percentage" , default = 20 )
20
+ l10n_in_performance_bonus_percent = fields .Float (string = "Performance Bonus Percentage" , default = lambda self : self . env . company . l10n_in_performance_bonus_percent )
21
+ l10n_in_leave_travel_allowance_percent = fields .Float (string = "Leave Travel Allowance Percentage" , default = lambda self : self . env . company . l10n_in_leave_travel_allowance_percent )
22
22
l10n_in_leave_allowance_per_day_percent = fields .Float (string = "Leave allowance per day percentage" )
23
23
l10n_in_leave_allowance_percent = fields .Float (string = "Leave Allowance Percentage" )
24
24
l10n_in_gratuity_percent = fields .Float (string = "Gratuity Percentage" , compute = "_compute_l10n_in_gratuity_percent" , inverse = "_inverse_l10n_in_gratuity_percent" )
@@ -35,84 +35,84 @@ class HrContract(models.Model):
35
35
36
36
@api .depends ("l10n_in_basic_salary_percent" , "wage" )
37
37
def _compute_l10n_in_basic_salary (self ):
38
- for record in self :
39
- record .l10n_in_basic_salary = record .wage * ( record .l10n_in_basic_salary_percent / 100 )
38
+ for contract in self :
39
+ contract .l10n_in_basic_salary = contract .wage * contract .l10n_in_basic_salary_percent
40
40
41
41
def _inverse_l10n_in_basic_salary (self ):
42
- for record in self :
43
- record .l10n_in_basic_salary_percent = ( record .l10n_in_basic_salary * 100 ) / record .wage if record .wage else 0
42
+ for contract in self :
43
+ contract .l10n_in_basic_salary_percent = contract .l10n_in_basic_salary / contract .wage if contract .wage else 0
44
44
45
45
@api .depends ("l10n_in_basic_salary" , "l10n_in_house_rent_allowance_percent" )
46
46
def _compute_l10n_in_house_rent_allowance (self ):
47
- for record in self :
48
- record .l10n_in_house_rent_allowance = record .l10n_in_basic_salary * ( record .l10n_in_house_rent_allowance_percent / 100 )
47
+ for contract in self :
48
+ contract .l10n_in_house_rent_allowance = contract .l10n_in_basic_salary * contract .l10n_in_house_rent_allowance_percent
49
49
50
50
def _inverse_l10n_in_house_rent_allowance (self ):
51
- for record in self :
52
- record .l10n_in_house_rent_allowance_percent = ( record .l10n_in_house_rent_allowance * 100 ) / record .l10n_in_basic_salary if record .l10n_in_basic_salary else 0
51
+ for contract in self :
52
+ contract .l10n_in_house_rent_allowance_percent = contract .l10n_in_house_rent_allowance / contract .l10n_in_basic_salary if contract .l10n_in_basic_salary else 0
53
53
54
54
@api .depends ("l10n_in_standard_allowance" , "wage" )
55
55
def _compute_l10n_in_standard_allowance_percent (self ):
56
- for record in self :
57
- record .l10n_in_standard_allowance_percent = ( record .l10n_in_standard_allowance * 100 ) / record .wage if record .wage else 0
56
+ for contract in self :
57
+ contract .l10n_in_standard_allowance_percent = contract .l10n_in_standard_allowance / contract .wage if contract .wage else 0
58
58
59
59
def _inverse_l10n_in_standard_allowance_percent (self ):
60
- for record in self :
61
- record .l10n_in_standard_allowance = ( record .l10n_in_standard_allowance_percent * record .wage ) / 100
60
+ for contract in self :
61
+ contract .l10n_in_standard_allowance = contract .l10n_in_standard_allowance_percent * contract .wage
62
62
63
63
@api .depends ("l10n_in_performance_bonus_percent" , "l10n_in_basic_salary" )
64
64
def _compute_l10n_in_performance_bonus (self ):
65
- for record in self :
66
- record .l10n_in_performance_bonus = record .l10n_in_basic_salary * ( record .l10n_in_performance_bonus_percent / 100 )
65
+ for contract in self :
66
+ contract .l10n_in_performance_bonus = contract .l10n_in_basic_salary * contract .l10n_in_performance_bonus_percent
67
67
68
68
def _inverse_l10n_in_performance_bonus (self ):
69
- for record in self :
70
- record .l10n_in_performance_bonus_percent = ( record .l10n_in_performance_bonus * 100 ) / record .l10n_in_basic_salary if record .l10n_in_basic_salary else 0
69
+ for contract in self :
70
+ contract .l10n_in_performance_bonus_percent = contract .l10n_in_performance_bonus / contract .l10n_in_basic_salary if contract .l10n_in_basic_salary else 0
71
71
72
72
@api .depends ("l10n_in_leave_travel_allowance_percent" , "l10n_in_basic_salary" )
73
73
def _compute_l10n_in_leave_travel_allowance (self ):
74
- for record in self :
75
- record .l10n_in_leave_travel_allowance = record .l10n_in_basic_salary * ( record .l10n_in_leave_travel_allowance_percent / 100 )
74
+ for contract in self :
75
+ contract .l10n_in_leave_travel_allowance = contract .l10n_in_basic_salary * contract .l10n_in_leave_travel_allowance_percent
76
76
77
77
def _inverse_l10n_in_leave_travel_allowance (self ):
78
- for record in self :
79
- record .l10n_in_leave_travel_allowance_percent = ( record .l10n_in_leave_travel_allowance * 100 ) / record .l10n_in_basic_salary if record .l10n_in_basic_salary else 0
78
+ for contract in self :
79
+ contract .l10n_in_leave_travel_allowance_percent = contract .l10n_in_leave_travel_allowance / contract .l10n_in_basic_salary if contract .l10n_in_basic_salary else 0
80
80
81
81
@api .depends ('wage' , 'l10n_in_leave_allowance_per_day_percent' , 'l10n_in_leave_days' )
82
82
def _compute_leave_allowance (self ):
83
- for record in self :
84
- record .l10n_in_leave_allowance = ( record .wage * ( record .l10n_in_leave_allowance_per_day_percent / 100 ) * record .l10n_in_leave_days )
83
+ for contract in self :
84
+ contract .l10n_in_leave_allowance = contract .wage * contract .l10n_in_leave_allowance_per_day_percent * contract .l10n_in_leave_days
85
85
86
86
def _inverse_leave_allowance (self ):
87
- for record in self :
88
- if record .l10n_in_basic_salary and record .l10n_in_leave_days :
89
- record .l10n_in_leave_allowance_percent = record .l10n_in_leave_allowance * 100 / record .wage if record .wage else 0
90
- record .l10n_in_leave_allowance_per_day_percent = ( record .l10n_in_leave_allowance * 100 / (record .wage * record .l10n_in_leave_days )) if record .wage else 0
87
+ for contract in self :
88
+ if contract .l10n_in_basic_salary and contract .l10n_in_leave_days :
89
+ contract .l10n_in_leave_allowance_percent = contract .l10n_in_leave_allowance / contract .wage if contract .wage else 0
90
+ contract .l10n_in_leave_allowance_per_day_percent = contract .l10n_in_leave_allowance / (contract .wage * contract .l10n_in_leave_days ) if contract .wage else 0
91
91
92
92
@api .depends ("l10n_in_gratuity" , "l10n_in_basic_salary" )
93
93
def _compute_l10n_in_gratuity_percent (self ):
94
- for record in self :
95
- record .l10n_in_gratuity_percent = ( record .l10n_in_gratuity * 100 ) / record .l10n_in_basic_salary if record .l10n_in_basic_salary else 0
94
+ for contract in self :
95
+ contract .l10n_in_gratuity_percent = contract .l10n_in_gratuity / contract .l10n_in_basic_salary if contract .l10n_in_basic_salary else 0
96
96
97
97
def _inverse_l10n_in_gratuity_percent (self ):
98
- for record in self :
99
- record .l10n_in_gratuity = record .l10n_in_basic_salary * ( record .l10n_in_gratuity_percent / 100 )
98
+ for contract in self :
99
+ contract .l10n_in_gratuity = contract .l10n_in_basic_salary * contract .l10n_in_gratuity_percent
100
100
101
101
@api .depends ("wage" , "l10n_in_basic_salary" , "l10n_in_house_rent_allowance" , "l10n_in_standard_allowance" , "l10n_in_performance_bonus" , "l10n_in_leave_travel_allowance" , "l10n_in_leave_allowance" , "l10n_in_gratuity" )
102
102
def _compute_l10n_in_supplementary_allowance (self ):
103
- for record in self :
103
+ for contract in self :
104
104
total_allowance = sum ([
105
- record .l10n_in_basic_salary ,
106
- record .l10n_in_house_rent_allowance ,
107
- record .l10n_in_standard_allowance ,
108
- record .l10n_in_performance_bonus ,
109
- record .l10n_in_leave_travel_allowance ,
110
- record .l10n_in_leave_allowance ,
111
- record .l10n_in_gratuity
105
+ contract .l10n_in_basic_salary ,
106
+ contract .l10n_in_house_rent_allowance ,
107
+ contract .l10n_in_standard_allowance ,
108
+ contract .l10n_in_performance_bonus ,
109
+ contract .l10n_in_leave_travel_allowance ,
110
+ contract .l10n_in_leave_allowance ,
111
+ contract .l10n_in_gratuity
112
112
])
113
- if record .wage :
114
- record .l10n_in_supplementary_allowance = record .wage - total_allowance
113
+ if contract .wage :
114
+ contract .l10n_in_supplementary_allowance = contract .wage - total_allowance
115
115
116
116
def _inverse_l10n_in_supplementary_allowance (self ):
117
- for record in self :
118
- record .l10n_in_supplementary_allowance_percent = ( record .l10n_in_supplementary_allowance * 100 ) / record .wage if record .wage else 0
117
+ for contract in self :
118
+ contract .l10n_in_supplementary_allowance_percent = contract .l10n_in_supplementary_allowance / contract .wage if contract .wage else 0
0 commit comments