-
-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "Payroll Rule History", | ||
"version": "18.0.1.0.0", | ||
"category": "Payroll", | ||
"website": "https://github.com/OCA/payroll", | ||
"license": "LGPL-3", | ||
"author": "Daniel Reis, Odoo Community Association (OCA)", | ||
"depends": ["payroll"], | ||
"data": ["views/hr_salary_rule_views.xml"], | ||
"maintainers": ["dreispt"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import hr_salary_rule | ||
from . import hr_salary_structure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from odoo import fields, models | ||
|
||
|
||
class HrSalaryRule(models.Model): | ||
_inherit = "hr.salary.rule" | ||
|
||
date_start = fields.Date(string="Start Date") | ||
date_end = fields.Date(string="End Date") | ||
|
||
# TODO: remove from "payroll" as not used anymore | ||
# def _recursive_search_of_rules(self): | ||
|
||
def _get_all_rules_and_childs(self): | ||
""" | ||
Lists all rules and their childs at a provided date. | ||
Used by the Payslip computation to find the applicable rules. | ||
""" | ||
rules = self | ||
active_date = self.env.context.get("active_date") | ||
if active_date: | ||
rules = rules.filtered( | ||
lambda x: (x.date_start <= active_date or not x.date_start) | ||
and (active_date <= x.date_end or not x.date_end) | ||
) | ||
if rules.child_ids: | ||
rules |= self.child_ids._get_all_rules_and_childs() | ||
return rules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from odoo import models | ||
|
||
|
||
def HrPayrollStructure(model): | ||
_inherit = "hr.payroll.structure" | ||
|
||
def get_all_rules(self): | ||
""" | ||
@return: returns a list of tuple (id, sequence) of rules that are maybe | ||
to apply | ||
""" | ||
# TODO: move to main "payroll module | ||
# all_rules = [] | ||
# for struct in self: | ||
# all_rules += struct.rule_ids._recursive_search_of_rules() | ||
# return all_rules | ||
rules = self.rule_ids._get_all_rules_and_childs() | ||
return [(x.id, x.sequence) for x in rules] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[build-system] | ||
requires = ["whool"] | ||
build-backend = "whool.buildapi" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<odoo> | ||
|
||
<record model="ir.ui.view" id="hr_salary_rule_history_view"> | ||
<field name="model">hr.salary.rule</field> | ||
<field name="inherit_id" ref="payroll.hr_salary_rule_view_tree_children" /> | ||
<field name="arch" type="xml"> | ||
|
||
<field name="category_id" position="after"> | ||
<field name="date_start" /> | ||
<field name="date_end" /> | ||
</field> | ||
|
||
</field> | ||
</record> | ||
|
||
<record model="ir.ui.view" id="hr_salary_rule_view_form"> | ||
<field name="model">hr.salary.rule</field> | ||
<field name="inherit_id" ref="payroll.hr_salary_rule_view_form" /> | ||
<field name="arch" type="xml"> | ||
|
||
<field name="active" position="before"> | ||
<field name="date_start" /> | ||
<field name="date_end" /> | ||
</field> | ||
|
||
</field> | ||
</record> | ||
|
||
<record model="ir.ui.view" id="hr_payroll_structure_view_form"> | ||
<field name="model">hr.payroll.structure</field> | ||
<field name="inherit_id" ref="payroll.hr_payroll_structure_view_form" /> | ||
<field name="arch" type="xml"> | ||
|
||
<field name="sequence" position="after"> | ||
<field name="date_start" /> | ||
<field name="date_end" /> | ||
</field> | ||
|
||
</field> | ||
</record> | ||
|
||
</odoo> |