test: set correct DocType (#29819)
This commit is contained in:
parent
f89a64db48
commit
08a391fa88
@ -49,7 +49,7 @@ valid_scorecard = [
|
|||||||
"min_grade":0.0,"name":"Very Poor",
|
"min_grade":0.0,"name":"Very Poor",
|
||||||
"prevent_rfqs":1,
|
"prevent_rfqs":1,
|
||||||
"notify_supplier":0,
|
"notify_supplier":0,
|
||||||
"doctype":"Supplier Scorecard Standing",
|
"doctype":"Supplier Scorecard Scoring Standing",
|
||||||
"max_grade":30.0,
|
"max_grade":30.0,
|
||||||
"prevent_pos":1,
|
"prevent_pos":1,
|
||||||
"warn_pos":0,
|
"warn_pos":0,
|
||||||
@ -65,7 +65,7 @@ valid_scorecard = [
|
|||||||
"name":"Poor",
|
"name":"Poor",
|
||||||
"prevent_rfqs":1,
|
"prevent_rfqs":1,
|
||||||
"notify_supplier":0,
|
"notify_supplier":0,
|
||||||
"doctype":"Supplier Scorecard Standing",
|
"doctype":"Supplier Scorecard Scoring Standing",
|
||||||
"max_grade":50.0,
|
"max_grade":50.0,
|
||||||
"prevent_pos":0,
|
"prevent_pos":0,
|
||||||
"warn_pos":0,
|
"warn_pos":0,
|
||||||
@ -81,7 +81,7 @@ valid_scorecard = [
|
|||||||
"name":"Average",
|
"name":"Average",
|
||||||
"prevent_rfqs":0,
|
"prevent_rfqs":0,
|
||||||
"notify_supplier":0,
|
"notify_supplier":0,
|
||||||
"doctype":"Supplier Scorecard Standing",
|
"doctype":"Supplier Scorecard Scoring Standing",
|
||||||
"max_grade":80.0,
|
"max_grade":80.0,
|
||||||
"prevent_pos":0,
|
"prevent_pos":0,
|
||||||
"warn_pos":0,
|
"warn_pos":0,
|
||||||
@ -97,7 +97,7 @@ valid_scorecard = [
|
|||||||
"name":"Excellent",
|
"name":"Excellent",
|
||||||
"prevent_rfqs":0,
|
"prevent_rfqs":0,
|
||||||
"notify_supplier":0,
|
"notify_supplier":0,
|
||||||
"doctype":"Supplier Scorecard Standing",
|
"doctype":"Supplier Scorecard Scoring Standing",
|
||||||
"max_grade":100.0,
|
"max_grade":100.0,
|
||||||
"prevent_pos":0,
|
"prevent_pos":0,
|
||||||
"warn_pos":0,
|
"warn_pos":0,
|
||||||
|
@ -6,6 +6,7 @@ import random
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
|
from frappe.model.document import Document
|
||||||
from frappe.utils import (
|
from frappe.utils import (
|
||||||
add_days,
|
add_days,
|
||||||
add_months,
|
add_months,
|
||||||
@ -687,20 +688,25 @@ def make_employee_salary_slip(user, payroll_frequency, salary_structure=None):
|
|||||||
|
|
||||||
def make_salary_component(salary_components, test_tax, company_list=None):
|
def make_salary_component(salary_components, test_tax, company_list=None):
|
||||||
for salary_component in salary_components:
|
for salary_component in salary_components:
|
||||||
if not frappe.db.exists('Salary Component', salary_component["salary_component"]):
|
if frappe.db.exists('Salary Component', salary_component["salary_component"]):
|
||||||
if test_tax:
|
continue
|
||||||
if salary_component["type"] == "Earning":
|
|
||||||
salary_component["is_tax_applicable"] = 1
|
if test_tax:
|
||||||
elif salary_component["salary_component"] == "TDS":
|
if salary_component["type"] == "Earning":
|
||||||
salary_component["variable_based_on_taxable_salary"] = 1
|
salary_component["is_tax_applicable"] = 1
|
||||||
salary_component["amount_based_on_formula"] = 0
|
elif salary_component["salary_component"] == "TDS":
|
||||||
salary_component["amount"] = 0
|
salary_component["variable_based_on_taxable_salary"] = 1
|
||||||
salary_component["formula"] = ""
|
salary_component["amount_based_on_formula"] = 0
|
||||||
salary_component["condition"] = ""
|
salary_component["amount"] = 0
|
||||||
salary_component["doctype"] = "Salary Component"
|
salary_component["formula"] = ""
|
||||||
salary_component["salary_component_abbr"] = salary_component["abbr"]
|
salary_component["condition"] = ""
|
||||||
frappe.get_doc(salary_component).insert()
|
|
||||||
get_salary_component_account(salary_component["salary_component"], company_list)
|
salary_component["salary_component_abbr"] = salary_component["abbr"]
|
||||||
|
doc = frappe.new_doc("Salary Component")
|
||||||
|
doc.update(salary_component)
|
||||||
|
doc.insert()
|
||||||
|
|
||||||
|
get_salary_component_account(doc, company_list)
|
||||||
|
|
||||||
def get_salary_component_account(sal_comp, company_list=None):
|
def get_salary_component_account(sal_comp, company_list=None):
|
||||||
company = erpnext.get_default_company()
|
company = erpnext.get_default_company()
|
||||||
@ -708,7 +714,9 @@ def get_salary_component_account(sal_comp, company_list=None):
|
|||||||
if company_list and company not in company_list:
|
if company_list and company not in company_list:
|
||||||
company_list.append(company)
|
company_list.append(company)
|
||||||
|
|
||||||
sal_comp = frappe.get_doc("Salary Component", sal_comp)
|
if not isinstance(sal_comp, Document):
|
||||||
|
sal_comp = frappe.get_doc("Salary Component", sal_comp)
|
||||||
|
|
||||||
if not sal_comp.get("accounts"):
|
if not sal_comp.get("accounts"):
|
||||||
for d in company_list:
|
for d in company_list:
|
||||||
company_abbr = frappe.get_cached_value('Company', d, 'abbr')
|
company_abbr = frappe.get_cached_value('Company', d, 'abbr')
|
||||||
|
Loading…
Reference in New Issue
Block a user