Merge branch 'version-13-hotfix' of https://github.com/frappe/erpnext into tds_advance_payment_v13
This commit is contained in:
commit
758db793be
@ -1019,6 +1019,7 @@
|
|||||||
"show_seconds": 1
|
"show_seconds": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"depends_on": "eval:!doc.disable_rounded_total",
|
||||||
"fieldname": "base_rounding_adjustment",
|
"fieldname": "base_rounding_adjustment",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"label": "Rounding Adjustment (Company Currency)",
|
"label": "Rounding Adjustment (Company Currency)",
|
||||||
@ -1075,6 +1076,7 @@
|
|||||||
"show_seconds": 1
|
"show_seconds": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"depends_on": "eval:!doc.disable_rounded_total",
|
||||||
"fieldname": "rounding_adjustment",
|
"fieldname": "rounding_adjustment",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"label": "Rounding Adjustment",
|
"label": "Rounding Adjustment",
|
||||||
@ -1690,7 +1692,7 @@
|
|||||||
"idx": 204,
|
"idx": 204,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-02-28 22:33:15.728392",
|
"modified": "2021-06-09 12:30:25.632109",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Purchase Invoice",
|
"name": "Purchase Invoice",
|
||||||
|
@ -531,7 +531,7 @@ class SalesInvoice(SellingController):
|
|||||||
# set pos values in items
|
# set pos values in items
|
||||||
for item in self.get("items"):
|
for item in self.get("items"):
|
||||||
if item.get('item_code'):
|
if item.get('item_code'):
|
||||||
profile_details = get_pos_profile_item_details(pos, frappe._dict(item.as_dict()), pos)
|
profile_details = get_pos_profile_item_details(pos, frappe._dict(item.as_dict()), pos, update_data=True)
|
||||||
for fname, val in iteritems(profile_details):
|
for fname, val in iteritems(profile_details):
|
||||||
if (not for_validate) or (for_validate and not item.get(fname)):
|
if (not for_validate) or (for_validate and not item.get(fname)):
|
||||||
item.set(fname, val)
|
item.set(fname, val)
|
||||||
|
@ -921,6 +921,7 @@
|
|||||||
"show_seconds": 1
|
"show_seconds": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"depends_on": "eval:!doc.disable_rounded_total",
|
||||||
"fieldname": "base_rounding_adjustment",
|
"fieldname": "base_rounding_adjustment",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"label": "Rounding Adjustment (Company Currency)",
|
"label": "Rounding Adjustment (Company Currency)",
|
||||||
@ -976,6 +977,7 @@
|
|||||||
"show_seconds": 1
|
"show_seconds": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"depends_on": "eval:!doc.disable_rounded_total",
|
||||||
"fieldname": "rounding_adjustment",
|
"fieldname": "rounding_adjustment",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"label": "Rounding Adjustment",
|
"label": "Rounding Adjustment",
|
||||||
@ -1375,7 +1377,7 @@
|
|||||||
"idx": 105,
|
"idx": 105,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-02-27 22:07:23.487138",
|
"modified": "2021-04-19 00:55:30.781375",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Buying",
|
"module": "Buying",
|
||||||
"name": "Purchase Order",
|
"name": "Purchase Order",
|
||||||
|
@ -576,6 +576,7 @@
|
|||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"depends_on": "eval:!doc.disable_rounded_total",
|
||||||
"fieldname": "base_rounding_adjustment",
|
"fieldname": "base_rounding_adjustment",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"label": "Rounding Adjustment (Company Currency",
|
"label": "Rounding Adjustment (Company Currency",
|
||||||
@ -620,6 +621,7 @@
|
|||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"depends_on": "eval:!doc.disable_rounded_total",
|
||||||
"fieldname": "rounding_adjustment",
|
"fieldname": "rounding_adjustment",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"label": "Rounding Adjustment",
|
"label": "Rounding Adjustment",
|
||||||
@ -802,7 +804,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2020-12-03 15:18:29.073368",
|
"modified": "2021-04-19 00:58:20.995491",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Buying",
|
"module": "Buying",
|
||||||
"name": "Supplier Quotation",
|
"name": "Supplier Quotation",
|
||||||
|
@ -219,7 +219,6 @@ def get_quiz(quiz_name, course):
|
|||||||
try:
|
try:
|
||||||
quiz = frappe.get_doc("Quiz", quiz_name)
|
quiz = frappe.get_doc("Quiz", quiz_name)
|
||||||
questions = quiz.get_questions()
|
questions = quiz.get_questions()
|
||||||
duration = quiz.duration
|
|
||||||
except:
|
except:
|
||||||
frappe.throw(_("Quiz {0} does not exist").format(quiz_name), frappe.DoesNotExistError)
|
frappe.throw(_("Quiz {0} does not exist").format(quiz_name), frappe.DoesNotExistError)
|
||||||
return None
|
return None
|
||||||
@ -236,15 +235,17 @@ def get_quiz(quiz_name, course):
|
|||||||
return {
|
return {
|
||||||
'questions': questions,
|
'questions': questions,
|
||||||
'activity': None,
|
'activity': None,
|
||||||
'duration':duration
|
'is_time_bound': quiz.is_time_bound,
|
||||||
|
'duration': quiz.duration
|
||||||
}
|
}
|
||||||
|
|
||||||
student = get_current_student()
|
student = get_current_student()
|
||||||
course_enrollment = get_enrollment("course", course, student.name)
|
course_enrollment = get_enrollment("course", course, student.name)
|
||||||
status, score, result, time_taken = check_quiz_completion(quiz, course_enrollment)
|
status, score, result, time_taken = check_quiz_completion(quiz, course_enrollment)
|
||||||
return {
|
return {
|
||||||
'questions': questions,
|
'questions': questions,
|
||||||
'activity': {'is_complete': status, 'score': score, 'result': result, 'time_taken': time_taken},
|
'activity': {'is_complete': status, 'score': score, 'result': result, 'time_taken': time_taken},
|
||||||
|
'is_time_bound': quiz.is_time_bound,
|
||||||
'duration': quiz.duration
|
'duration': quiz.duration
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,9 +373,9 @@ def check_content_completion(content_name, content_type, enrollment_name):
|
|||||||
def check_quiz_completion(quiz, enrollment_name):
|
def check_quiz_completion(quiz, enrollment_name):
|
||||||
attempts = frappe.get_all("Quiz Activity",
|
attempts = frappe.get_all("Quiz Activity",
|
||||||
filters={
|
filters={
|
||||||
'enrollment': enrollment_name,
|
'enrollment': enrollment_name,
|
||||||
'quiz': quiz.name
|
'quiz': quiz.name
|
||||||
},
|
},
|
||||||
fields=["name", "activity_date", "score", "status", "time_taken"]
|
fields=["name", "activity_date", "score", "status", "time_taken"]
|
||||||
)
|
)
|
||||||
status = False if quiz.max_attempts == 0 else bool(len(attempts) >= quiz.max_attempts)
|
status = False if quiz.max_attempts == 0 else bool(len(attempts) >= quiz.max_attempts)
|
||||||
@ -389,4 +390,4 @@ def check_quiz_completion(quiz, enrollment_name):
|
|||||||
time_taken = attempts[0]['time_taken']
|
time_taken = attempts[0]['time_taken']
|
||||||
if result == 'Pass':
|
if result == 'Pass':
|
||||||
status = True
|
status = True
|
||||||
return status, score, result, time_taken
|
return status, score, result, time_taken
|
||||||
|
@ -433,7 +433,8 @@ def make_material_request(source_name, target_doc=None):
|
|||||||
def make_stock_entry(source_name, target_doc=None):
|
def make_stock_entry(source_name, target_doc=None):
|
||||||
def update_item(obj, target, source_parent):
|
def update_item(obj, target, source_parent):
|
||||||
target.t_warehouse = source_parent.wip_warehouse
|
target.t_warehouse = source_parent.wip_warehouse
|
||||||
target.conversion_factor = 1
|
if not target.conversion_factor:
|
||||||
|
target.conversion_factor = 1
|
||||||
|
|
||||||
def set_missing_values(source, target):
|
def set_missing_values(source, target):
|
||||||
target.purpose = "Material Transfer for Manufacture"
|
target.purpose = "Material Transfer for Manufacture"
|
||||||
|
@ -115,10 +115,23 @@ class SalarySlip(TransactionBase):
|
|||||||
status = "Cancelled"
|
status = "Cancelled"
|
||||||
return status
|
return status
|
||||||
|
|
||||||
def validate_dates(self):
|
def validate_dates(self, joining_date=None, relieving_date=None):
|
||||||
if date_diff(self.end_date, self.start_date) < 0:
|
if date_diff(self.end_date, self.start_date) < 0:
|
||||||
frappe.throw(_("To date cannot be before From date"))
|
frappe.throw(_("To date cannot be before From date"))
|
||||||
|
|
||||||
|
if not joining_date:
|
||||||
|
joining_date, relieving_date = frappe.get_cached_value(
|
||||||
|
"Employee",
|
||||||
|
self.employee,
|
||||||
|
("date_of_joining", "relieving_date")
|
||||||
|
)
|
||||||
|
|
||||||
|
if date_diff(self.end_date, joining_date) < 0:
|
||||||
|
frappe.throw(_("Cannot create Salary Slip for Employee joining after Payroll Period"))
|
||||||
|
|
||||||
|
if relieving_date and date_diff(relieving_date, self.start_date) < 0:
|
||||||
|
frappe.throw(_("Cannot create Salary Slip for Employee who has left before Payroll Period"))
|
||||||
|
|
||||||
def is_rounding_total_disabled(self):
|
def is_rounding_total_disabled(self):
|
||||||
return cint(frappe.db.get_single_value("Payroll Settings", "disable_rounded_total"))
|
return cint(frappe.db.get_single_value("Payroll Settings", "disable_rounded_total"))
|
||||||
|
|
||||||
@ -154,9 +167,14 @@ class SalarySlip(TransactionBase):
|
|||||||
|
|
||||||
if not self.salary_slip_based_on_timesheet:
|
if not self.salary_slip_based_on_timesheet:
|
||||||
self.get_date_details()
|
self.get_date_details()
|
||||||
self.validate_dates()
|
|
||||||
joining_date, relieving_date = frappe.get_cached_value("Employee", self.employee,
|
joining_date, relieving_date = frappe.get_cached_value(
|
||||||
["date_of_joining", "relieving_date"])
|
"Employee",
|
||||||
|
self.employee,
|
||||||
|
("date_of_joining", "relieving_date")
|
||||||
|
)
|
||||||
|
|
||||||
|
self.validate_dates(joining_date, relieving_date)
|
||||||
|
|
||||||
#getin leave details
|
#getin leave details
|
||||||
self.get_working_days_details(joining_date, relieving_date)
|
self.get_working_days_details(joining_date, relieving_date)
|
||||||
@ -492,11 +510,39 @@ class SalarySlip(TransactionBase):
|
|||||||
def get_data_for_eval(self):
|
def get_data_for_eval(self):
|
||||||
'''Returns data for evaluating formula'''
|
'''Returns data for evaluating formula'''
|
||||||
data = frappe._dict()
|
data = frappe._dict()
|
||||||
|
employee = frappe.get_doc("Employee", self.employee).as_dict()
|
||||||
|
|
||||||
data.update(frappe.get_doc("Salary Structure Assignment",
|
start_date = getdate(self.start_date)
|
||||||
{"employee": self.employee, "salary_structure": self.salary_structure}).as_dict())
|
date_to_validate = (
|
||||||
|
employee.date_of_joining
|
||||||
|
if employee.date_of_joining > start_date
|
||||||
|
else start_date
|
||||||
|
)
|
||||||
|
|
||||||
data.update(frappe.get_doc("Employee", self.employee).as_dict())
|
salary_structure_assignment = frappe.get_value(
|
||||||
|
"Salary Structure Assignment",
|
||||||
|
{
|
||||||
|
"employee": self.employee,
|
||||||
|
"salary_structure": self.salary_structure,
|
||||||
|
"from_date": ("<=", date_to_validate),
|
||||||
|
"docstatus": 1,
|
||||||
|
},
|
||||||
|
"*",
|
||||||
|
order_by="from_date desc",
|
||||||
|
as_dict=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
if not salary_structure_assignment:
|
||||||
|
frappe.throw(
|
||||||
|
_("Please assign a Salary Structure for Employee {0} "
|
||||||
|
"applicable from or before {1} first").format(
|
||||||
|
frappe.bold(self.employee_name),
|
||||||
|
frappe.bold(formatdate(date_to_validate)),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
data.update(salary_structure_assignment)
|
||||||
|
data.update(employee)
|
||||||
data.update(self.as_dict())
|
data.update(self.as_dict())
|
||||||
|
|
||||||
# set values for components
|
# set values for components
|
||||||
|
@ -8,7 +8,6 @@ import erpnext
|
|||||||
import calendar
|
import calendar
|
||||||
import random
|
import random
|
||||||
from erpnext.accounts.utils import get_fiscal_year
|
from erpnext.accounts.utils import get_fiscal_year
|
||||||
from frappe.utils.make_random import get_random
|
|
||||||
from frappe.utils import getdate, nowdate, add_days, add_months, flt, get_first_day, get_last_day, cstr
|
from frappe.utils import getdate, nowdate, add_days, add_months, flt, get_first_day, get_last_day, cstr
|
||||||
from erpnext.payroll.doctype.salary_structure.salary_structure import make_salary_slip
|
from erpnext.payroll.doctype.salary_structure.salary_structure import make_salary_slip
|
||||||
from erpnext.payroll.doctype.payroll_entry.payroll_entry import get_month_details
|
from erpnext.payroll.doctype.payroll_entry.payroll_entry import get_month_details
|
||||||
@ -155,12 +154,14 @@ class TestSalarySlip(unittest.TestCase):
|
|||||||
self.assertEqual(ss.gross_pay, 78000)
|
self.assertEqual(ss.gross_pay, 78000)
|
||||||
|
|
||||||
def test_payment_days(self):
|
def test_payment_days(self):
|
||||||
|
from erpnext.payroll.doctype.salary_structure.test_salary_structure import create_salary_structure_assignment
|
||||||
|
|
||||||
no_of_days = self.get_no_of_days()
|
no_of_days = self.get_no_of_days()
|
||||||
# Holidays not included in working days
|
# Holidays not included in working days
|
||||||
frappe.db.set_value("Payroll Settings", None, "include_holidays_in_total_working_days", 1)
|
frappe.db.set_value("Payroll Settings", None, "include_holidays_in_total_working_days", 1)
|
||||||
|
|
||||||
# set joinng date in the same month
|
# set joinng date in the same month
|
||||||
make_employee("test_payment_days@salary.com")
|
employee = make_employee("test_payment_days@salary.com")
|
||||||
if getdate(nowdate()).day >= 15:
|
if getdate(nowdate()).day >= 15:
|
||||||
relieving_date = getdate(add_days(nowdate(),-10))
|
relieving_date = getdate(add_days(nowdate(),-10))
|
||||||
date_of_joining = getdate(add_days(nowdate(),-10))
|
date_of_joining = getdate(add_days(nowdate(),-10))
|
||||||
@ -174,25 +175,30 @@ class TestSalarySlip(unittest.TestCase):
|
|||||||
date_of_joining = getdate(nowdate())
|
date_of_joining = getdate(nowdate())
|
||||||
relieving_date = getdate(nowdate())
|
relieving_date = getdate(nowdate())
|
||||||
|
|
||||||
frappe.db.set_value("Employee", frappe.get_value("Employee",
|
frappe.db.set_value("Employee", employee, {
|
||||||
{"employee_name":"test_payment_days@salary.com"}, "name"), "date_of_joining", date_of_joining)
|
"date_of_joining": date_of_joining,
|
||||||
frappe.db.set_value("Employee", frappe.get_value("Employee",
|
"relieving_date": None,
|
||||||
{"employee_name":"test_payment_days@salary.com"}, "name"), "relieving_date", None)
|
"status": "Active"
|
||||||
frappe.db.set_value("Employee", frappe.get_value("Employee",
|
})
|
||||||
{"employee_name":"test_payment_days@salary.com"}, "name"), "status", "Active")
|
|
||||||
|
|
||||||
ss = make_employee_salary_slip("test_payment_days@salary.com", "Monthly", "Test Payment Days")
|
salary_structure = "Test Payment Days"
|
||||||
|
ss = make_employee_salary_slip("test_payment_days@salary.com", "Monthly", salary_structure)
|
||||||
|
|
||||||
self.assertEqual(ss.total_working_days, no_of_days[0])
|
self.assertEqual(ss.total_working_days, no_of_days[0])
|
||||||
self.assertEqual(ss.payment_days, (no_of_days[0] - getdate(date_of_joining).day + 1))
|
self.assertEqual(ss.payment_days, (no_of_days[0] - getdate(date_of_joining).day + 1))
|
||||||
|
|
||||||
# set relieving date in the same month
|
# set relieving date in the same month
|
||||||
frappe.db.set_value("Employee",frappe.get_value("Employee",
|
frappe.db.set_value("Employee", employee, {
|
||||||
{"employee_name":"test_payment_days@salary.com"}, "name"), "date_of_joining", (add_days(nowdate(),-60)))
|
"date_of_joining": add_days(nowdate(),-60),
|
||||||
frappe.db.set_value("Employee", frappe.get_value("Employee",
|
"relieving_date": relieving_date,
|
||||||
{"employee_name":"test_payment_days@salary.com"}, "name"), "relieving_date", relieving_date)
|
"status": "Left"
|
||||||
frappe.db.set_value("Employee", frappe.get_value("Employee",
|
})
|
||||||
{"employee_name":"test_payment_days@salary.com"}, "name"), "status", "Left")
|
|
||||||
|
if date_of_joining.day > 1:
|
||||||
|
self.assertRaises(frappe.ValidationError, ss.save)
|
||||||
|
|
||||||
|
create_salary_structure_assignment(employee, salary_structure)
|
||||||
|
ss.reload()
|
||||||
ss.save()
|
ss.save()
|
||||||
|
|
||||||
self.assertEqual(ss.total_working_days, no_of_days[0])
|
self.assertEqual(ss.total_working_days, no_of_days[0])
|
||||||
@ -285,6 +291,7 @@ class TestSalarySlip(unittest.TestCase):
|
|||||||
|
|
||||||
def test_multi_currency_salary_slip(self):
|
def test_multi_currency_salary_slip(self):
|
||||||
from erpnext.payroll.doctype.salary_structure.test_salary_structure import make_salary_structure
|
from erpnext.payroll.doctype.salary_structure.test_salary_structure import make_salary_structure
|
||||||
|
|
||||||
applicant = make_employee("test_multi_currency_salary_slip@salary.com", company="_Test Company")
|
applicant = make_employee("test_multi_currency_salary_slip@salary.com", company="_Test Company")
|
||||||
frappe.db.sql("""delete from `tabSalary Structure` where name='Test Multi Currency Salary Slip'""")
|
frappe.db.sql("""delete from `tabSalary Structure` where name='Test Multi Currency Salary Slip'""")
|
||||||
salary_structure = make_salary_structure("Test Multi Currency Salary Slip", "Monthly", employee=applicant, company="_Test Company", currency='USD')
|
salary_structure = make_salary_structure("Test Multi Currency Salary Slip", "Monthly", employee=applicant, company="_Test Company", currency='USD')
|
||||||
@ -325,7 +332,8 @@ class TestSalarySlip(unittest.TestCase):
|
|||||||
def test_component_wise_year_to_date_computation(self):
|
def test_component_wise_year_to_date_computation(self):
|
||||||
from erpnext.payroll.doctype.salary_structure.test_salary_structure import make_salary_structure
|
from erpnext.payroll.doctype.salary_structure.test_salary_structure import make_salary_structure
|
||||||
|
|
||||||
applicant = make_employee("test_ytd@salary.com", company="_Test Company")
|
employee_name = "test_component_wise_ytd@salary.com"
|
||||||
|
applicant = make_employee(employee_name, company="_Test Company")
|
||||||
|
|
||||||
payroll_period = create_payroll_period(name="_Test Payroll Period 1", company="_Test Company")
|
payroll_period = create_payroll_period(name="_Test Payroll Period 1", company="_Test Company")
|
||||||
|
|
||||||
@ -336,13 +344,13 @@ class TestSalarySlip(unittest.TestCase):
|
|||||||
"Monthly", employee=applicant, company="_Test Company", currency="INR", payroll_period=payroll_period)
|
"Monthly", employee=applicant, company="_Test Company", currency="INR", payroll_period=payroll_period)
|
||||||
|
|
||||||
# clear salary slip for this employee
|
# clear salary slip for this employee
|
||||||
frappe.db.sql("DELETE FROM `tabSalary Slip` where employee_name = 'test_ytd@salary.com'")
|
frappe.db.sql("DELETE FROM `tabSalary Slip` where employee_name = '%s'" % employee_name)
|
||||||
|
|
||||||
create_salary_slips_for_payroll_period(applicant, salary_structure.name,
|
create_salary_slips_for_payroll_period(applicant, salary_structure.name,
|
||||||
payroll_period, deduct_random=False, num=3)
|
payroll_period, deduct_random=False, num=3)
|
||||||
|
|
||||||
salary_slips = frappe.get_all("Salary Slip", fields=["name"], filters={"employee_name":
|
salary_slips = frappe.get_all("Salary Slip", fields=["name"], filters={"employee_name":
|
||||||
"test_ytd@salary.com"}, order_by = "posting_date")
|
employee_name}, order_by="posting_date")
|
||||||
|
|
||||||
year_to_date = dict()
|
year_to_date = dict()
|
||||||
for slip in salary_slips:
|
for slip in salary_slips:
|
||||||
@ -380,10 +388,10 @@ class TestSalarySlip(unittest.TestCase):
|
|||||||
|
|
||||||
from erpnext.payroll.doctype.salary_structure.test_salary_structure import \
|
from erpnext.payroll.doctype.salary_structure.test_salary_structure import \
|
||||||
make_salary_structure, create_salary_structure_assignment
|
make_salary_structure, create_salary_structure_assignment
|
||||||
|
|
||||||
salary_structure = make_salary_structure("Stucture to test tax", "Monthly",
|
salary_structure = make_salary_structure("Stucture to test tax", "Monthly",
|
||||||
other_details={"max_benefits": 100000}, test_tax=True)
|
other_details={"max_benefits": 100000}, test_tax=True,
|
||||||
create_salary_structure_assignment(employee, salary_structure.name,
|
employee=employee, payroll_period=payroll_period)
|
||||||
payroll_period.start_date)
|
|
||||||
|
|
||||||
# create salary slip for whole period deducting tax only on last period
|
# create salary slip for whole period deducting tax only on last period
|
||||||
# to find the total tax amount paid
|
# to find the total tax amount paid
|
||||||
@ -469,6 +477,7 @@ class TestSalarySlip(unittest.TestCase):
|
|||||||
|
|
||||||
def make_employee_salary_slip(user, payroll_frequency, salary_structure=None):
|
def make_employee_salary_slip(user, payroll_frequency, salary_structure=None):
|
||||||
from erpnext.payroll.doctype.salary_structure.test_salary_structure import make_salary_structure
|
from erpnext.payroll.doctype.salary_structure.test_salary_structure import make_salary_structure
|
||||||
|
|
||||||
if not salary_structure:
|
if not salary_structure:
|
||||||
salary_structure = payroll_frequency + " Salary Structure Test for Salary Slip"
|
salary_structure = payroll_frequency + " Salary Structure Test for Salary Slip"
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import frappe
|
|||||||
import unittest
|
import unittest
|
||||||
import erpnext
|
import erpnext
|
||||||
from frappe.utils.make_random import get_random
|
from frappe.utils.make_random import get_random
|
||||||
from frappe.utils import nowdate, add_days, add_years, getdate, add_months
|
from frappe.utils import nowdate, add_years, get_first_day, date_diff
|
||||||
from erpnext.payroll.doctype.salary_structure.salary_structure import make_salary_slip
|
from erpnext.payroll.doctype.salary_structure.salary_structure import make_salary_slip
|
||||||
from erpnext.payroll.doctype.salary_slip.test_salary_slip import make_earning_salary_component,\
|
from erpnext.payroll.doctype.salary_slip.test_salary_slip import make_earning_salary_component,\
|
||||||
make_deduction_salary_component, make_employee_salary_slip, create_tax_slab
|
make_deduction_salary_component, make_employee_salary_slip, create_tax_slab
|
||||||
@ -113,8 +113,9 @@ class TestSalaryStructure(unittest.TestCase):
|
|||||||
sal_struct = make_salary_structure("Salary Structure Multi Currency", "Monthly", currency='USD')
|
sal_struct = make_salary_structure("Salary Structure Multi Currency", "Monthly", currency='USD')
|
||||||
self.assertEqual(sal_struct.currency, 'USD')
|
self.assertEqual(sal_struct.currency, 'USD')
|
||||||
|
|
||||||
def make_salary_structure(salary_structure, payroll_frequency, employee=None, dont_submit=False, other_details=None,
|
def make_salary_structure(salary_structure, payroll_frequency, employee=None,
|
||||||
test_tax=False, company=None, currency=erpnext.get_default_currency(), payroll_period=None):
|
from_date=None, dont_submit=False, other_details=None,test_tax=False,
|
||||||
|
company=None, currency=erpnext.get_default_currency(), payroll_period=None):
|
||||||
if test_tax:
|
if test_tax:
|
||||||
frappe.db.sql("""delete from `tabSalary Structure` where name=%s""",(salary_structure))
|
frappe.db.sql("""delete from `tabSalary Structure` where name=%s""",(salary_structure))
|
||||||
|
|
||||||
@ -139,10 +140,23 @@ def make_salary_structure(salary_structure, payroll_frequency, employee=None, do
|
|||||||
else:
|
else:
|
||||||
salary_structure_doc = frappe.get_doc("Salary Structure", salary_structure)
|
salary_structure_doc = frappe.get_doc("Salary Structure", salary_structure)
|
||||||
|
|
||||||
|
filters = {'employee':employee, 'docstatus': 1}
|
||||||
|
if not from_date and payroll_period:
|
||||||
|
from_date = payroll_period.start_date
|
||||||
|
|
||||||
|
if from_date:
|
||||||
|
filters['from_date'] = from_date
|
||||||
|
|
||||||
if employee and not frappe.db.get_value("Salary Structure Assignment",
|
if employee and not frappe.db.get_value("Salary Structure Assignment",
|
||||||
{'employee':employee, 'docstatus': 1}) and salary_structure_doc.docstatus==1:
|
filters) and salary_structure_doc.docstatus==1:
|
||||||
create_salary_structure_assignment(employee, salary_structure, company=company, currency=currency,
|
create_salary_structure_assignment(
|
||||||
payroll_period=payroll_period)
|
employee,
|
||||||
|
salary_structure,
|
||||||
|
from_date=from_date,
|
||||||
|
company=company,
|
||||||
|
currency=currency,
|
||||||
|
payroll_period=payroll_period
|
||||||
|
)
|
||||||
|
|
||||||
return salary_structure_doc
|
return salary_structure_doc
|
||||||
|
|
||||||
@ -165,12 +179,13 @@ def create_salary_structure_assignment(employee, salary_structure, from_date=Non
|
|||||||
salary_structure_assignment.base = 50000
|
salary_structure_assignment.base = 50000
|
||||||
salary_structure_assignment.variable = 5000
|
salary_structure_assignment.variable = 5000
|
||||||
|
|
||||||
if getdate(nowdate()).day == 1:
|
if not from_date:
|
||||||
date = from_date or nowdate()
|
from_date = get_first_day(nowdate())
|
||||||
else:
|
joining_date = frappe.get_cached_value("Employee", employee, "date_of_joining")
|
||||||
date = from_date or add_days(nowdate(), -1)
|
if date_diff(joining_date, from_date) > 0:
|
||||||
|
from_date = joining_date
|
||||||
|
|
||||||
salary_structure_assignment.from_date = date
|
salary_structure_assignment.from_date = from_date
|
||||||
salary_structure_assignment.salary_structure = salary_structure
|
salary_structure_assignment.salary_structure = salary_structure
|
||||||
salary_structure_assignment.currency = currency
|
salary_structure_assignment.currency = currency
|
||||||
salary_structure_assignment.payroll_payable_account = get_payable_account(company)
|
salary_structure_assignment.payroll_payable_account = get_payable_account(company)
|
||||||
@ -183,4 +198,4 @@ def create_salary_structure_assignment(employee, salary_structure, from_date=Non
|
|||||||
def get_payable_account(company=None):
|
def get_payable_account(company=None):
|
||||||
if not company:
|
if not company:
|
||||||
company = erpnext.get_default_company()
|
company = erpnext.get_default_company()
|
||||||
return frappe.db.get_value("Company", company, "default_payroll_payable_account")
|
return frappe.db.get_value("Company", company, "default_payroll_payable_account")
|
||||||
|
@ -20,10 +20,8 @@ class Quiz {
|
|||||||
}
|
}
|
||||||
|
|
||||||
make(data) {
|
make(data) {
|
||||||
if (data.duration) {
|
if (data.is_time_bound) {
|
||||||
const timer_display = document.createElement("div");
|
$(".lms-timer").removeClass("hide");
|
||||||
timer_display.classList.add("lms-timer", "float-right", "font-weight-bold");
|
|
||||||
document.getElementsByClassName("lms-title")[0].appendChild(timer_display);
|
|
||||||
if (!data.activity || (data.activity && !data.activity.is_complete)) {
|
if (!data.activity || (data.activity && !data.activity.is_complete)) {
|
||||||
this.initialiseTimer(data.duration);
|
this.initialiseTimer(data.duration);
|
||||||
this.is_time_bound = true;
|
this.is_time_bound = true;
|
||||||
@ -118,7 +116,7 @@ class Quiz {
|
|||||||
quiz_response: this.get_selected(),
|
quiz_response: this.get_selected(),
|
||||||
course: this.course,
|
course: this.course,
|
||||||
program: this.program,
|
program: this.program,
|
||||||
time_taken: this.is_time_bound ? this.time_taken : ""
|
time_taken: this.is_time_bound ? this.time_taken : 0
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.submit_btn.remove()
|
this.submit_btn.remove()
|
||||||
if (!res.message) {
|
if (!res.message) {
|
||||||
@ -237,4 +235,4 @@ class Question {
|
|||||||
this.options = option_list
|
this.options = option_list
|
||||||
this.wrapper.appendChild(options_wrapper)
|
this.wrapper.appendChild(options_wrapper)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -199,7 +199,7 @@ def get_item_list(invoice):
|
|||||||
|
|
||||||
item.batch_expiry_date = frappe.db.get_value('Batch', d.batch_no, 'expiry_date') if d.batch_no else None
|
item.batch_expiry_date = frappe.db.get_value('Batch', d.batch_no, 'expiry_date') if d.batch_no else None
|
||||||
item.batch_expiry_date = format_date(item.batch_expiry_date, 'dd/mm/yyyy') if item.batch_expiry_date else None
|
item.batch_expiry_date = format_date(item.batch_expiry_date, 'dd/mm/yyyy') if item.batch_expiry_date else None
|
||||||
item.is_service_item = 'N' if frappe.db.get_value('Item', d.item_code, 'is_stock_item') else 'Y'
|
item.is_service_item = 'Y' if item.gst_hsn_code[:2] == "99" else 'N'
|
||||||
item.serial_no = ""
|
item.serial_no = ""
|
||||||
|
|
||||||
item = update_item_taxes(invoice, item)
|
item = update_item_taxes(invoice, item)
|
||||||
|
@ -147,6 +147,13 @@ class Gstr1Report(object):
|
|||||||
def get_invoice_data(self):
|
def get_invoice_data(self):
|
||||||
self.invoices = frappe._dict()
|
self.invoices = frappe._dict()
|
||||||
conditions = self.get_conditions()
|
conditions = self.get_conditions()
|
||||||
|
|
||||||
|
company_gstins = get_company_gstin_number(self.filters.get('company'), all_gstins=True)
|
||||||
|
|
||||||
|
self.filters.update({
|
||||||
|
'company_gstins': company_gstins
|
||||||
|
})
|
||||||
|
|
||||||
invoice_data = frappe.db.sql("""
|
invoice_data = frappe.db.sql("""
|
||||||
select
|
select
|
||||||
{select_columns}
|
{select_columns}
|
||||||
@ -193,6 +200,9 @@ class Gstr1Report(object):
|
|||||||
|
|
||||||
elif self.filters.get("type_of_business") == "EXPORT":
|
elif self.filters.get("type_of_business") == "EXPORT":
|
||||||
conditions += """ AND is_return !=1 and gst_category = 'Overseas' """
|
conditions += """ AND is_return !=1 and gst_category = 'Overseas' """
|
||||||
|
|
||||||
|
conditions += " AND billing_address_gstin NOT IN %(company_gstins)s"
|
||||||
|
|
||||||
return conditions
|
return conditions
|
||||||
|
|
||||||
def get_invoice_items(self):
|
def get_invoice_items(self):
|
||||||
@ -810,7 +820,8 @@ def get_rate_and_tax_details(row, gstin):
|
|||||||
|
|
||||||
return {"num": int(num), "itm_det": itm_det}
|
return {"num": int(num), "itm_det": itm_det}
|
||||||
|
|
||||||
def get_company_gstin_number(company, address=None):
|
def get_company_gstin_number(company, address=None, all_gstins=False):
|
||||||
|
gstin = ''
|
||||||
if address:
|
if address:
|
||||||
gstin = frappe.db.get_value("Address", address, "gstin")
|
gstin = frappe.db.get_value("Address", address, "gstin")
|
||||||
|
|
||||||
@ -822,9 +833,9 @@ def get_company_gstin_number(company, address=None):
|
|||||||
["Dynamic Link", "parenttype", "=", "Address"],
|
["Dynamic Link", "parenttype", "=", "Address"],
|
||||||
]
|
]
|
||||||
gstin = frappe.get_all("Address", filters=filters, pluck="gstin")
|
gstin = frappe.get_all("Address", filters=filters, pluck="gstin")
|
||||||
if gstin:
|
if gstin and not all_gstins:
|
||||||
gstin[0]
|
gstin = gstin[0]
|
||||||
|
|
||||||
if not gstin:
|
if not gstin:
|
||||||
address = frappe.bold(address) if address else ""
|
address = frappe.bold(address) if address else ""
|
||||||
frappe.throw(_("Please set valid GSTIN No. in Company Address {} for company {}").format(
|
frappe.throw(_("Please set valid GSTIN No. in Company Address {} for company {}").format(
|
||||||
|
@ -12,10 +12,6 @@ from frappe.desk.notifications import clear_notifications
|
|||||||
class TransactionDeletionRecord(Document):
|
class TransactionDeletionRecord(Document):
|
||||||
def validate(self):
|
def validate(self):
|
||||||
frappe.only_for('System Manager')
|
frappe.only_for('System Manager')
|
||||||
company_obj = frappe.get_doc('Company', self.company)
|
|
||||||
if frappe.session.user != company_obj.owner and frappe.session.user != 'Administrator':
|
|
||||||
frappe.throw(_('Transactions can only be deleted by the creator of the Company or the Administrator.'),
|
|
||||||
frappe.PermissionError)
|
|
||||||
doctypes_to_be_ignored_list = get_doctypes_to_be_ignored()
|
doctypes_to_be_ignored_list = get_doctypes_to_be_ignored()
|
||||||
for doctype in self.doctypes_to_be_ignored:
|
for doctype in self.doctypes_to_be_ignored:
|
||||||
if doctype.doctype_name not in doctypes_to_be_ignored_list:
|
if doctype.doctype_name not in doctypes_to_be_ignored_list:
|
||||||
|
@ -481,37 +481,42 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"Germany": {
|
"Germany": {
|
||||||
|
"tax_categories": [
|
||||||
|
"Umsatzsteuer",
|
||||||
|
"Vorsteuer"
|
||||||
|
],
|
||||||
"chart_of_accounts": {
|
"chart_of_accounts": {
|
||||||
"SKR04 mit Kontonummern": {
|
"SKR04 mit Kontonummern": {
|
||||||
"sales_tax_templates": [
|
"sales_tax_templates": [
|
||||||
{
|
{
|
||||||
"title": "Umsatzsteuer 19%",
|
"title": "Umsatzsteuer",
|
||||||
|
"tax_category": "Umsatzsteuer",
|
||||||
|
"is_default": 1,
|
||||||
"taxes": [
|
"taxes": [
|
||||||
{
|
{
|
||||||
"account_head": {
|
"account_head": {
|
||||||
"account_name": "Umsatzsteuer 19%",
|
"account_name": "Umsatzsteuer 19%",
|
||||||
"account_number": "3806",
|
"account_number": "3806",
|
||||||
"tax_rate": 19.00
|
"tax_rate": 19.00
|
||||||
}
|
},
|
||||||
}
|
"rate": 0.00
|
||||||
]
|
},
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Umsatzsteuer 7%",
|
|
||||||
"taxes": [
|
|
||||||
{
|
{
|
||||||
"account_head": {
|
"account_head": {
|
||||||
"account_name": "Umsatzsteuer 7%",
|
"account_name": "Umsatzsteuer 7%",
|
||||||
"account_number": "3801",
|
"account_number": "3801",
|
||||||
"tax_rate": 7.00
|
"tax_rate": 7.00
|
||||||
}
|
},
|
||||||
|
"rate": 0.00
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"purchase_tax_templates": [
|
"purchase_tax_templates": [
|
||||||
{
|
{
|
||||||
"title": "Abziehbare Vorsteuer 19%",
|
"title": "Vorsteuer",
|
||||||
|
"tax_category": "Vorsteuer",
|
||||||
|
"is_default": 1,
|
||||||
"taxes": [
|
"taxes": [
|
||||||
{
|
{
|
||||||
"account_head": {
|
"account_head": {
|
||||||
@ -519,20 +524,17 @@
|
|||||||
"account_number": "1406",
|
"account_number": "1406",
|
||||||
"root_type": "Asset",
|
"root_type": "Asset",
|
||||||
"tax_rate": 19.00
|
"tax_rate": 19.00
|
||||||
}
|
},
|
||||||
}
|
"rate": 0.00
|
||||||
]
|
},
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Abziehbare Vorsteuer 7%",
|
|
||||||
"taxes": [
|
|
||||||
{
|
{
|
||||||
"account_head": {
|
"account_head": {
|
||||||
"account_name": "Abziehbare Vorsteuer 7%",
|
"account_name": "Abziehbare Vorsteuer 7%",
|
||||||
"account_number": "1401",
|
"account_number": "1401",
|
||||||
"root_type": "Asset",
|
"root_type": "Asset",
|
||||||
"tax_rate": 7.00
|
"tax_rate": 7.00
|
||||||
}
|
},
|
||||||
|
"rate": 0.00
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -559,38 +561,129 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
},
|
"item_tax_templates": [
|
||||||
"SKR03 mit Kontonummern": {
|
|
||||||
"sales_tax_templates": [
|
|
||||||
{
|
{
|
||||||
"title": "Umsatzsteuer 19%",
|
"title": "Umsatzsteuer 19%",
|
||||||
"taxes": [
|
"taxes": [
|
||||||
{
|
{
|
||||||
"account_head": {
|
"tax_type": {
|
||||||
"account_name": "Umsatzsteuer 19%",
|
"account_name": "Umsatzsteuer 19%",
|
||||||
"account_number": "1776",
|
"account_number": "3806",
|
||||||
"tax_rate": 19.00
|
"tax_rate": 19.00
|
||||||
}
|
},
|
||||||
|
"tax_rate": 19.00
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tax_type": {
|
||||||
|
"account_name": "Umsatzsteuer 7%",
|
||||||
|
"account_number": "3801",
|
||||||
|
"tax_rate": 7.00
|
||||||
|
},
|
||||||
|
"tax_rate": 0.00
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "Umsatzsteuer 7%",
|
"title": "Umsatzsteuer 7%",
|
||||||
"taxes": [
|
"taxes": [
|
||||||
|
{
|
||||||
|
"tax_type": {
|
||||||
|
"account_name": "Umsatzsteuer 19%",
|
||||||
|
"account_number": "3806",
|
||||||
|
"tax_rate": 19.00
|
||||||
|
},
|
||||||
|
"tax_rate": 0.00
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tax_type": {
|
||||||
|
"account_name": "Umsatzsteuer 7%",
|
||||||
|
"account_number": "3801",
|
||||||
|
"tax_rate": 7.00
|
||||||
|
},
|
||||||
|
"tax_rate": 7.00
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Vorsteuer 19%",
|
||||||
|
"taxes": [
|
||||||
|
{
|
||||||
|
"tax_type": {
|
||||||
|
"account_name": "Abziehbare Vorsteuer 19%",
|
||||||
|
"account_number": "1406",
|
||||||
|
"root_type": "Asset",
|
||||||
|
"tax_rate": 19.00
|
||||||
|
},
|
||||||
|
"tax_rate": 19.00
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tax_type": {
|
||||||
|
"account_name": "Abziehbare Vorsteuer 7%",
|
||||||
|
"account_number": "1401",
|
||||||
|
"root_type": "Asset",
|
||||||
|
"tax_rate": 7.00
|
||||||
|
},
|
||||||
|
"tax_rate": 0.00
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Vorsteuer 7%",
|
||||||
|
"taxes": [
|
||||||
|
{
|
||||||
|
"tax_type": {
|
||||||
|
"account_name": "Abziehbare Vorsteuer 19%",
|
||||||
|
"account_number": "1406",
|
||||||
|
"root_type": "Asset",
|
||||||
|
"tax_rate": 19.00
|
||||||
|
},
|
||||||
|
"tax_rate": 0.00
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tax_type": {
|
||||||
|
"account_name": "Abziehbare Vorsteuer 7%",
|
||||||
|
"account_number": "1401",
|
||||||
|
"root_type": "Asset",
|
||||||
|
"tax_rate": 7.00
|
||||||
|
},
|
||||||
|
"tax_rate": 7.00
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"SKR03 mit Kontonummern": {
|
||||||
|
"sales_tax_templates": [
|
||||||
|
{
|
||||||
|
"title": "Umsatzsteuer",
|
||||||
|
"tax_category": "Umsatzsteuer",
|
||||||
|
"is_default": 1,
|
||||||
|
"taxes": [
|
||||||
|
{
|
||||||
|
"account_head": {
|
||||||
|
"account_name": "Umsatzsteuer 19%",
|
||||||
|
"account_number": "1776",
|
||||||
|
"tax_rate": 19.00
|
||||||
|
},
|
||||||
|
"rate": 0.00
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"account_head": {
|
"account_head": {
|
||||||
"account_name": "Umsatzsteuer 7%",
|
"account_name": "Umsatzsteuer 7%",
|
||||||
"account_number": "1771",
|
"account_number": "1771",
|
||||||
"tax_rate": 7.00
|
"tax_rate": 7.00
|
||||||
}
|
},
|
||||||
|
"rate": 0.00
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"purchase_tax_templates": [
|
"purchase_tax_templates": [
|
||||||
{
|
{
|
||||||
"title": "Abziehbare Vorsteuer 19%",
|
"title": "Vorsteuer",
|
||||||
|
"tax_category": "Vorsteuer",
|
||||||
|
"is_default": 1,
|
||||||
"taxes": [
|
"taxes": [
|
||||||
{
|
{
|
||||||
"account_head": {
|
"account_head": {
|
||||||
@ -598,20 +691,107 @@
|
|||||||
"account_number": "1576",
|
"account_number": "1576",
|
||||||
"root_type": "Asset",
|
"root_type": "Asset",
|
||||||
"tax_rate": 19.00
|
"tax_rate": 19.00
|
||||||
}
|
},
|
||||||
}
|
"rate": 0.00
|
||||||
]
|
},
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Abziehbare Vorsteuer 7%",
|
|
||||||
"taxes": [
|
|
||||||
{
|
{
|
||||||
"account_head": {
|
"account_head": {
|
||||||
"account_name": "Abziehbare Vorsteuer 7%",
|
"account_name": "Abziehbare Vorsteuer 7%",
|
||||||
"account_number": "1571",
|
"account_number": "1571",
|
||||||
"root_type": "Asset",
|
"root_type": "Asset",
|
||||||
"tax_rate": 7.00
|
"tax_rate": 7.00
|
||||||
}
|
},
|
||||||
|
"rate": 0.00
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"item_tax_templates": [
|
||||||
|
{
|
||||||
|
"title": "Umsatzsteuer 19%",
|
||||||
|
"taxes": [
|
||||||
|
{
|
||||||
|
"tax_type": {
|
||||||
|
"account_name": "Umsatzsteuer 19%",
|
||||||
|
"account_number": "1776",
|
||||||
|
"tax_rate": 19.00
|
||||||
|
},
|
||||||
|
"tax_rate": 19.00
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tax_type": {
|
||||||
|
"account_name": "Umsatzsteuer 7%",
|
||||||
|
"account_number": "1771",
|
||||||
|
"tax_rate": 7.00
|
||||||
|
},
|
||||||
|
"tax_rate": 0.00
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Umsatzsteuer 7%",
|
||||||
|
"taxes": [
|
||||||
|
{
|
||||||
|
"tax_type": {
|
||||||
|
"account_name": "Umsatzsteuer 19%",
|
||||||
|
"account_number": "1776",
|
||||||
|
"tax_rate": 19.00
|
||||||
|
},
|
||||||
|
"tax_rate": 0.00
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tax_type": {
|
||||||
|
"account_name": "Umsatzsteuer 7%",
|
||||||
|
"account_number": "1771",
|
||||||
|
"tax_rate": 7.00
|
||||||
|
},
|
||||||
|
"tax_rate": 7.00
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Vorsteuer 19%",
|
||||||
|
"taxes": [
|
||||||
|
{
|
||||||
|
"tax_type": {
|
||||||
|
"account_name": "Abziehbare Vorsteuer 19%",
|
||||||
|
"account_number": "1576",
|
||||||
|
"root_type": "Asset",
|
||||||
|
"tax_rate": 19.00
|
||||||
|
},
|
||||||
|
"tax_rate": 19.00
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tax_type": {
|
||||||
|
"account_name": "Abziehbare Vorsteuer 7%",
|
||||||
|
"account_number": "1571",
|
||||||
|
"root_type": "Asset",
|
||||||
|
"tax_rate": 7.00
|
||||||
|
},
|
||||||
|
"tax_rate": 0.00
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Vorsteuer 7%",
|
||||||
|
"taxes": [
|
||||||
|
{
|
||||||
|
"tax_type": {
|
||||||
|
"account_name": "Abziehbare Vorsteuer 19%",
|
||||||
|
"account_number": "1576",
|
||||||
|
"root_type": "Asset",
|
||||||
|
"tax_rate": 19.00
|
||||||
|
},
|
||||||
|
"tax_rate": 0.00
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tax_type": {
|
||||||
|
"account_name": "Abziehbare Vorsteuer 7%",
|
||||||
|
"account_number": "1571",
|
||||||
|
"root_type": "Asset",
|
||||||
|
"tax_rate": 7.00
|
||||||
|
},
|
||||||
|
"tax_rate": 7.00
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -620,33 +800,34 @@
|
|||||||
"Standard with Numbers": {
|
"Standard with Numbers": {
|
||||||
"sales_tax_templates": [
|
"sales_tax_templates": [
|
||||||
{
|
{
|
||||||
"title": "Umsatzsteuer 19%",
|
"title": "Umsatzsteuer",
|
||||||
|
"tax_category": "Umsatzsteuer",
|
||||||
|
"is_default": 1,
|
||||||
"taxes": [
|
"taxes": [
|
||||||
{
|
{
|
||||||
"account_head": {
|
"account_head": {
|
||||||
"account_name": "Umsatzsteuer 19%",
|
"account_name": "Umsatzsteuer 19%",
|
||||||
"account_number": "2301",
|
"account_number": "2301",
|
||||||
"tax_rate": 19.00
|
"tax_rate": 19.00
|
||||||
}
|
},
|
||||||
}
|
"rate": 0.00
|
||||||
]
|
},
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Umsatzsteuer 7%",
|
|
||||||
"taxes": [
|
|
||||||
{
|
{
|
||||||
"account_head": {
|
"account_head": {
|
||||||
"account_name": "Umsatzsteuer 7%",
|
"account_name": "Umsatzsteuer 7%",
|
||||||
"account_number": "2302",
|
"account_number": "2302",
|
||||||
"tax_rate": 7.00
|
"tax_rate": 7.00
|
||||||
}
|
},
|
||||||
|
"rate": 0.00
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"purchase_tax_templates": [
|
"purchase_tax_templates": [
|
||||||
{
|
{
|
||||||
"title": "Abziehbare Vorsteuer 19%",
|
"title": "Vorsteuer",
|
||||||
|
"tax_category": "Vorsteuer",
|
||||||
|
"is_default": 1,
|
||||||
"taxes": [
|
"taxes": [
|
||||||
{
|
{
|
||||||
"account_head": {
|
"account_head": {
|
||||||
@ -654,20 +835,107 @@
|
|||||||
"account_number": "1501",
|
"account_number": "1501",
|
||||||
"root_type": "Asset",
|
"root_type": "Asset",
|
||||||
"tax_rate": 19.00
|
"tax_rate": 19.00
|
||||||
}
|
},
|
||||||
}
|
"rate": 0.00
|
||||||
]
|
},
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Abziehbare Vorsteuer 7%",
|
|
||||||
"taxes": [
|
|
||||||
{
|
{
|
||||||
"account_head": {
|
"account_head": {
|
||||||
"account_name": "Abziehbare Vorsteuer 7%",
|
"account_name": "Abziehbare Vorsteuer 7%",
|
||||||
"account_number": "1502",
|
"account_number": "1502",
|
||||||
"root_type": "Asset",
|
"root_type": "Asset",
|
||||||
"tax_rate": 7.00
|
"tax_rate": 7.00
|
||||||
}
|
},
|
||||||
|
"rate": 0.00
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"item_tax_templates": [
|
||||||
|
{
|
||||||
|
"title": "Umsatzsteuer 19%",
|
||||||
|
"taxes": [
|
||||||
|
{
|
||||||
|
"tax_type": {
|
||||||
|
"account_name": "Umsatzsteuer 19%",
|
||||||
|
"account_number": "2301",
|
||||||
|
"tax_rate": 19.00
|
||||||
|
},
|
||||||
|
"tax_rate": 19.00
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tax_type": {
|
||||||
|
"account_name": "Umsatzsteuer 7%",
|
||||||
|
"account_number": "2302",
|
||||||
|
"tax_rate": 7.00
|
||||||
|
},
|
||||||
|
"tax_rate": 0.00
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Umsatzsteuer 7%",
|
||||||
|
"taxes": [
|
||||||
|
{
|
||||||
|
"tax_type": {
|
||||||
|
"account_name": "Umsatzsteuer 19%",
|
||||||
|
"account_number": "2301",
|
||||||
|
"tax_rate": 19.00
|
||||||
|
},
|
||||||
|
"tax_rate": 0.00
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tax_type": {
|
||||||
|
"account_name": "Umsatzsteuer 7%",
|
||||||
|
"account_number": "2302",
|
||||||
|
"tax_rate": 7.00
|
||||||
|
},
|
||||||
|
"tax_rate": 7.00
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Vorsteuer 19%",
|
||||||
|
"taxes": [
|
||||||
|
{
|
||||||
|
"tax_type": {
|
||||||
|
"account_name": "Abziehbare Vorsteuer 19%",
|
||||||
|
"account_number": "1501",
|
||||||
|
"root_type": "Asset",
|
||||||
|
"tax_rate": 19.00
|
||||||
|
},
|
||||||
|
"tax_rate": 19.00
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tax_type": {
|
||||||
|
"account_name": "Abziehbare Vorsteuer 7%",
|
||||||
|
"account_number": "1502",
|
||||||
|
"root_type": "Asset",
|
||||||
|
"tax_rate": 7.00
|
||||||
|
},
|
||||||
|
"tax_rate": 0.00
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Vorsteuer 7%",
|
||||||
|
"taxes": [
|
||||||
|
{
|
||||||
|
"tax_type": {
|
||||||
|
"account_name": "Abziehbare Vorsteuer 19%",
|
||||||
|
"account_number": "1501",
|
||||||
|
"root_type": "Asset",
|
||||||
|
"tax_rate": 19.00
|
||||||
|
},
|
||||||
|
"tax_rate": 0.00
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tax_type": {
|
||||||
|
"account_name": "Abziehbare Vorsteuer 7%",
|
||||||
|
"account_number": "1502",
|
||||||
|
"root_type": "Asset",
|
||||||
|
"tax_rate": 7.00
|
||||||
|
},
|
||||||
|
"tax_rate": 7.00
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -676,13 +944,69 @@
|
|||||||
"*": {
|
"*": {
|
||||||
"sales_tax_templates": [
|
"sales_tax_templates": [
|
||||||
{
|
{
|
||||||
"title": "Umsatzsteuer 19%",
|
"title": "Umsatzsteuer",
|
||||||
|
"tax_category": "Umsatzsteuer",
|
||||||
|
"is_default": 1,
|
||||||
"taxes": [
|
"taxes": [
|
||||||
{
|
{
|
||||||
"account_head": {
|
"account_head": {
|
||||||
"account_name": "Umsatzsteuer 19%",
|
"account_name": "Umsatzsteuer 19%",
|
||||||
"tax_rate": 19.00
|
"tax_rate": 19.00
|
||||||
}
|
},
|
||||||
|
"rate": 0.00
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"account_head": {
|
||||||
|
"account_name": "Umsatzsteuer 7%",
|
||||||
|
"tax_rate": 7.00
|
||||||
|
},
|
||||||
|
"rate": 0.00
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"purchase_tax_templates": [
|
||||||
|
{
|
||||||
|
"title": "Vorsteuer 19%",
|
||||||
|
"tax_category": "Vorsteuer",
|
||||||
|
"is_default": 1,
|
||||||
|
"taxes": [
|
||||||
|
{
|
||||||
|
"account_head": {
|
||||||
|
"account_name": "Abziehbare Vorsteuer 19%",
|
||||||
|
"tax_rate": 19.00,
|
||||||
|
"root_type": "Asset"
|
||||||
|
},
|
||||||
|
"rate": 0.00
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"account_head": {
|
||||||
|
"account_name": "Abziehbare Vorsteuer 7%",
|
||||||
|
"root_type": "Asset",
|
||||||
|
"tax_rate": 7.00
|
||||||
|
},
|
||||||
|
"rate": 0.00
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"item_tax_templates": [
|
||||||
|
{
|
||||||
|
"title": "Umsatzsteuer 19%",
|
||||||
|
"taxes": [
|
||||||
|
{
|
||||||
|
"tax_type": {
|
||||||
|
"account_name": "Umsatzsteuer 19%",
|
||||||
|
"tax_rate": 19.00
|
||||||
|
},
|
||||||
|
"tax_rate": 19.00
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tax_type": {
|
||||||
|
"account_name": "Umsatzsteuer 7%",
|
||||||
|
"tax_rate": 7.00
|
||||||
|
},
|
||||||
|
"tax_rate": 0.00
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -690,36 +1014,60 @@
|
|||||||
"title": "Umsatzsteuer 7%",
|
"title": "Umsatzsteuer 7%",
|
||||||
"taxes": [
|
"taxes": [
|
||||||
{
|
{
|
||||||
"account_head": {
|
"tax_type": {
|
||||||
|
"account_name": "Umsatzsteuer 19%",
|
||||||
|
"tax_rate": 19.00
|
||||||
|
},
|
||||||
|
"tax_rate": 0.00
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tax_type": {
|
||||||
"account_name": "Umsatzsteuer 7%",
|
"account_name": "Umsatzsteuer 7%",
|
||||||
"tax_rate": 7.00
|
"tax_rate": 7.00
|
||||||
}
|
},
|
||||||
}
|
"tax_rate": 7.00
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"purchase_tax_templates": [
|
|
||||||
{
|
|
||||||
"title": "Abziehbare Vorsteuer 19%",
|
|
||||||
"taxes": [
|
|
||||||
{
|
|
||||||
"account_head": {
|
|
||||||
"account_name": "Abziehbare Vorsteuer 19%",
|
|
||||||
"tax_rate": 19.00,
|
|
||||||
"root_type": "Asset"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "Abziehbare Vorsteuer 7%",
|
"title": "Vorsteuer 19%",
|
||||||
"taxes": [
|
"taxes": [
|
||||||
{
|
{
|
||||||
"account_head": {
|
"tax_type": {
|
||||||
|
"account_name": "Abziehbare Vorsteuer 19%",
|
||||||
|
"root_type": "Asset",
|
||||||
|
"tax_rate": 19.00
|
||||||
|
},
|
||||||
|
"tax_rate": 19.00
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tax_type": {
|
||||||
"account_name": "Abziehbare Vorsteuer 7%",
|
"account_name": "Abziehbare Vorsteuer 7%",
|
||||||
"root_type": "Asset",
|
"root_type": "Asset",
|
||||||
"tax_rate": 7.00
|
"tax_rate": 7.00
|
||||||
}
|
},
|
||||||
|
"tax_rate": 0.00
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Vorsteuer 7%",
|
||||||
|
"taxes": [
|
||||||
|
{
|
||||||
|
"tax_type": {
|
||||||
|
"account_name": "Abziehbare Vorsteuer 19%",
|
||||||
|
"root_type": "Asset",
|
||||||
|
"tax_rate": 19.00
|
||||||
|
},
|
||||||
|
"tax_rate": 0.00
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tax_type": {
|
||||||
|
"account_name": "Abziehbare Vorsteuer 7%",
|
||||||
|
"root_type": "Asset",
|
||||||
|
"tax_rate": 7.00
|
||||||
|
},
|
||||||
|
"tax_rate": 7.00
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,9 @@ from frappe import _
|
|||||||
|
|
||||||
|
|
||||||
def setup_taxes_and_charges(company_name: str, country: str):
|
def setup_taxes_and_charges(company_name: str, country: str):
|
||||||
|
if not frappe.db.exists('Company', company_name):
|
||||||
|
frappe.throw(_('Company {} does not exist yet. Taxes setup aborted.').format(company_name))
|
||||||
|
|
||||||
file_path = os.path.join(os.path.dirname(__file__), '..', 'data', 'country_wise_tax.json')
|
file_path = os.path.join(os.path.dirname(__file__), '..', 'data', 'country_wise_tax.json')
|
||||||
with open(file_path, 'r') as json_file:
|
with open(file_path, 'r') as json_file:
|
||||||
tax_data = json.load(json_file)
|
tax_data = json.load(json_file)
|
||||||
@ -23,7 +26,7 @@ def setup_taxes_and_charges(company_name: str, country: str):
|
|||||||
if 'chart_of_accounts' not in country_wise_tax:
|
if 'chart_of_accounts' not in country_wise_tax:
|
||||||
country_wise_tax = simple_to_detailed(country_wise_tax)
|
country_wise_tax = simple_to_detailed(country_wise_tax)
|
||||||
|
|
||||||
from_detailed_data(company_name, country_wise_tax.get('chart_of_accounts'))
|
from_detailed_data(company_name, country_wise_tax)
|
||||||
|
|
||||||
|
|
||||||
def simple_to_detailed(templates):
|
def simple_to_detailed(templates):
|
||||||
@ -74,10 +77,16 @@ def simple_to_detailed(templates):
|
|||||||
def from_detailed_data(company_name, data):
|
def from_detailed_data(company_name, data):
|
||||||
"""Create Taxes and Charges Templates from detailed data."""
|
"""Create Taxes and Charges Templates from detailed data."""
|
||||||
coa_name = frappe.db.get_value('Company', company_name, 'chart_of_accounts')
|
coa_name = frappe.db.get_value('Company', company_name, 'chart_of_accounts')
|
||||||
tax_templates = data.get(coa_name) or data.get('*')
|
coa_data = data.get('chart_of_accounts', {})
|
||||||
sales_tax_templates = tax_templates.get('sales_tax_templates') or tax_templates.get('*')
|
tax_templates = coa_data.get(coa_name) or coa_data.get('*', {})
|
||||||
purchase_tax_templates = tax_templates.get('purchase_tax_templates') or tax_templates.get('*')
|
tax_categories = data.get('tax_categories')
|
||||||
item_tax_templates = tax_templates.get('item_tax_templates') or tax_templates.get('*')
|
sales_tax_templates = tax_templates.get('sales_tax_templates') or tax_templates.get('*', {})
|
||||||
|
purchase_tax_templates = tax_templates.get('purchase_tax_templates') or tax_templates.get('*', {})
|
||||||
|
item_tax_templates = tax_templates.get('item_tax_templates') or tax_templates.get('*', {})
|
||||||
|
|
||||||
|
if tax_categories:
|
||||||
|
for tax_category in tax_categories:
|
||||||
|
make_tax_catgory(tax_category)
|
||||||
|
|
||||||
if sales_tax_templates:
|
if sales_tax_templates:
|
||||||
for template in sales_tax_templates:
|
for template in sales_tax_templates:
|
||||||
@ -233,3 +242,14 @@ def get_or_create_tax_group(company_name, root_type):
|
|||||||
tax_group_name = tax_group_account.name
|
tax_group_name = tax_group_account.name
|
||||||
|
|
||||||
return tax_group_name
|
return tax_group_name
|
||||||
|
|
||||||
|
|
||||||
|
def make_tax_catgory(tax_category):
|
||||||
|
doctype = 'Tax Category'
|
||||||
|
if isinstance(tax_category, str):
|
||||||
|
tax_category = {'title': tax_category}
|
||||||
|
|
||||||
|
tax_category['doctype'] = doctype
|
||||||
|
if not frappe.db.exists(doctype, tax_category['title']):
|
||||||
|
doc = frappe.get_doc(tax_category)
|
||||||
|
doc.insert(ignore_permissions=True)
|
||||||
|
@ -762,6 +762,7 @@
|
|||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"depends_on": "eval:!doc.disable_rounded_total",
|
||||||
"fieldname": "base_rounding_adjustment",
|
"fieldname": "base_rounding_adjustment",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"label": "Rounding Adjustment (Company Currency)",
|
"label": "Rounding Adjustment (Company Currency)",
|
||||||
@ -805,6 +806,7 @@
|
|||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"depends_on": "eval:!doc.disable_rounded_total",
|
||||||
"fieldname": "rounding_adjustment",
|
"fieldname": "rounding_adjustment",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"label": "Rounding Adjustment",
|
"label": "Rounding Adjustment",
|
||||||
@ -1147,7 +1149,7 @@
|
|||||||
"idx": 261,
|
"idx": 261,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2020-12-26 20:49:39.106049",
|
"modified": "2021-04-19 01:01:00.754119",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Purchase Receipt",
|
"name": "Purchase Receipt",
|
||||||
|
@ -64,6 +64,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="lms-title">
|
<div class="lms-title">
|
||||||
<h2>{{ content.name }} <span class="small text-muted">({{ position + 1 }}/{{length}})</span></h2>
|
<h2>{{ content.name }} <span class="small text-muted">({{ position + 1 }}/{{length}})</span></h2>
|
||||||
|
<div class="lms-timer float-right fond-weight-bold hide"></div>
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user