fixed merge conflict
This commit is contained in:
commit
6d04afc19d
@ -2,7 +2,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
|
|
||||||
__version__ = '7.1.12'
|
__version__ = '7.1.13'
|
||||||
|
|
||||||
def get_default_company(user=None):
|
def get_default_company(user=None):
|
||||||
'''Get default company for user'''
|
'''Get default company for user'''
|
||||||
|
@ -63,7 +63,7 @@
|
|||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"remember_last_selected_value": 0,
|
"remember_last_selected_value": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 0,
|
"reqd": 1,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0,
|
"unique": 0,
|
||||||
@ -194,7 +194,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2016-11-07 05:58:21.478256",
|
"modified": "2016-11-16 12:44:37.733773",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Salary Component",
|
"name": "Salary Component",
|
||||||
|
@ -10,7 +10,6 @@ from frappe import _
|
|||||||
class SalaryComponent(Document):
|
class SalaryComponent(Document):
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.validate_abbr()
|
self.validate_abbr()
|
||||||
|
|
||||||
|
|
||||||
def validate_abbr(self):
|
def validate_abbr(self):
|
||||||
if not self.salary_component_abbr:
|
if not self.salary_component_abbr:
|
||||||
@ -21,8 +20,5 @@ class SalaryComponent(Document):
|
|||||||
if self.get('__islocal') and len(self.salary_component_abbr) > 5:
|
if self.get('__islocal') and len(self.salary_component_abbr) > 5:
|
||||||
frappe.throw(_("Abbreviation cannot have more than 5 characters"))
|
frappe.throw(_("Abbreviation cannot have more than 5 characters"))
|
||||||
|
|
||||||
if not self.salary_component_abbr.strip():
|
|
||||||
frappe.throw(_("Abbreviation is mandatory"))
|
|
||||||
|
|
||||||
if frappe.db.sql("select salary_component_abbr from `tabSalary Component` where name!=%s and salary_component_abbr=%s", (self.name, self.salary_component_abbr)):
|
if frappe.db.sql("select salary_component_abbr from `tabSalary Component` where name!=%s and salary_component_abbr=%s", (self.name, self.salary_component_abbr)):
|
||||||
frappe.throw(_("Abbreviation already used for another salary component"))
|
frappe.throw(_("Abbreviation already used for another salary component"))
|
@ -1,6 +1,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
|
from frappe.utils import cstr
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Some components do not have type set, try and guess whether they turn up in
|
Some components do not have type set, try and guess whether they turn up in
|
||||||
@ -8,18 +9,38 @@ earnings or deductions in existing salary slips
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
for s in frappe.db.sql('select name from `tabSalary Component` where ifnull(type, "")=""'):
|
for s in frappe.db.sql('''select name, type, salary_component_abbr from `tabSalary Component`
|
||||||
compontent = frappe.get_doc('Salary Component', s[0])
|
where ifnull(type, "")="" or ifnull(salary_component_abbr, "") = ""''', as_dict=1):
|
||||||
|
|
||||||
|
component = frappe.get_doc('Salary Component', s.name)
|
||||||
|
|
||||||
# guess
|
# guess
|
||||||
guess = frappe.db.sql('''select
|
if not s.type:
|
||||||
parentfield from `tabSalary Detail`
|
guess = frappe.db.sql('''select
|
||||||
where salary_component=%s limit 1''', s[0])
|
parentfield from `tabSalary Detail`
|
||||||
|
where salary_component=%s limit 1''', s.name)
|
||||||
|
|
||||||
if guess:
|
if guess:
|
||||||
compontent.type = 'Earning' if guess[0][0]=='earnings' else 'Deduction'
|
component.type = 'Earning' if guess[0][0]=='earnings' else 'Deduction'
|
||||||
|
|
||||||
else:
|
else:
|
||||||
compontent.type = 'Deduction'
|
component.type = 'Deduction'
|
||||||
|
|
||||||
compontent.save()
|
if not s.salary_component_abbr:
|
||||||
|
abbr = ''.join([c[0] for c in component.salary_component.split()]).upper()
|
||||||
|
|
||||||
|
abbr_count = frappe.db.sql("""
|
||||||
|
select
|
||||||
|
count(name)
|
||||||
|
from
|
||||||
|
`tabSalary Component`
|
||||||
|
where
|
||||||
|
salary_component_abbr = %s or salary_component_abbr like %s
|
||||||
|
""", (abbr, abbr + "-%%"))
|
||||||
|
|
||||||
|
if abbr_count and abbr_count[0][0] > 0:
|
||||||
|
abbr = abbr + "-" + cstr(abbr_count[0][0])
|
||||||
|
|
||||||
|
component.salary_component_abbr = abbr
|
||||||
|
|
||||||
|
component.save()
|
Loading…
x
Reference in New Issue
Block a user