Fix India payroll structure inheritance
This commit is contained in:
parent
c3318f6161
commit
3ba6725c04
@ -51,23 +51,16 @@ class PayrollSetup:
|
|||||||
|
|
||||||
def _ensure_base_structure(self, company, categories):
|
def _ensure_base_structure(self, company, categories):
|
||||||
base = self.Structure.search([("code", "=", "BASE"), ("company_id", "=", company.id)], limit=1)
|
base = self.Structure.search([("code", "=", "BASE"), ("company_id", "=", company.id)], limit=1)
|
||||||
if not base:
|
values = {
|
||||||
base = self.Structure.create({
|
|
||||||
"name": "Base Payroll Structure",
|
"name": "Base Payroll Structure",
|
||||||
"code": "BASE",
|
"code": "BASE",
|
||||||
"company_id": company.id,
|
"company_id": company.id,
|
||||||
"rule_ids": [(6, 0, [
|
"rule_ids": [(6, 0, [])],
|
||||||
self._rule(company, "Base Basic Salary", "BASE_BASIC", 10, categories["BASIC"], """
|
}
|
||||||
result = contract.wage
|
if not base:
|
||||||
""").id,
|
base = self.Structure.create(values)
|
||||||
self._rule(company, "Base Gross", "BASE_GROSS", 100, categories["GROSS"], """
|
else:
|
||||||
result = categories.BASIC + categories.ALW
|
base.write(values)
|
||||||
""").id,
|
|
||||||
self._rule(company, "Base Net Salary", "BASE_NET", 300, categories["NET"], """
|
|
||||||
result = categories.BASIC + categories.ALW + categories.DED
|
|
||||||
""").id,
|
|
||||||
])],
|
|
||||||
})
|
|
||||||
return base
|
return base
|
||||||
|
|
||||||
def _rule(self, company, name, code, sequence, category, python, register=False):
|
def _rule(self, company, name, code, sequence, category, python, register=False):
|
||||||
@ -127,7 +120,7 @@ result = contract.wage * 0.50
|
|||||||
result = contract.wage * 0.20
|
result = contract.wage * 0.20
|
||||||
"""),
|
"""),
|
||||||
self._rule(company, "Special Allowance", "ALLOW", 30, categories["ALW"], """
|
self._rule(company, "Special Allowance", "ALLOW", 30, categories["ALW"], """
|
||||||
result = contract.wage - categories.BASIC - categories.ALW
|
result = contract.wage * 0.30
|
||||||
"""),
|
"""),
|
||||||
self._rule(company, "Gross", "GROSS", 100, categories["GROSS"], """
|
self._rule(company, "Gross", "GROSS", 100, categories["GROSS"], """
|
||||||
result = categories.BASIC + categories.ALW
|
result = categories.BASIC + categories.ALW
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user