Merge pull request #25052 from deepeshgarg007/gst_rounding_v13_beta
feat: Normal rounding for GST Taxes
This commit is contained in:
commit
6be78db62c
@ -109,7 +109,7 @@ def get_region(company=None):
|
|||||||
'''
|
'''
|
||||||
if company or frappe.flags.company:
|
if company or frappe.flags.company:
|
||||||
return frappe.get_cached_value('Company',
|
return frappe.get_cached_value('Company',
|
||||||
company or frappe.flags.company, 'country')
|
company or frappe.flags.company, 'country')
|
||||||
elif frappe.flags.country:
|
elif frappe.flags.country:
|
||||||
return frappe.flags.country
|
return frappe.flags.country
|
||||||
else:
|
else:
|
||||||
|
@ -15,6 +15,8 @@ from erpnext.accounts.doctype.journal_entry.journal_entry import get_exchange_ra
|
|||||||
class calculate_taxes_and_totals(object):
|
class calculate_taxes_and_totals(object):
|
||||||
def __init__(self, doc):
|
def __init__(self, doc):
|
||||||
self.doc = doc
|
self.doc = doc
|
||||||
|
frappe.flags.round_off_applicable_accounts = []
|
||||||
|
get_round_off_applicable_accounts(self.doc.company, frappe.flags.round_off_applicable_accounts)
|
||||||
self.calculate()
|
self.calculate()
|
||||||
|
|
||||||
def calculate(self):
|
def calculate(self):
|
||||||
@ -340,10 +342,18 @@ class calculate_taxes_and_totals(object):
|
|||||||
elif tax.charge_type == "On Item Quantity":
|
elif tax.charge_type == "On Item Quantity":
|
||||||
current_tax_amount = tax_rate * item.qty
|
current_tax_amount = tax_rate * item.qty
|
||||||
|
|
||||||
|
current_tax_amount = self.get_final_current_tax_amount(tax, current_tax_amount)
|
||||||
self.set_item_wise_tax(item, tax, tax_rate, current_tax_amount)
|
self.set_item_wise_tax(item, tax, tax_rate, current_tax_amount)
|
||||||
|
|
||||||
return current_tax_amount
|
return current_tax_amount
|
||||||
|
|
||||||
|
def get_final_current_tax_amount(self, tax, current_tax_amount):
|
||||||
|
# Some countries need individual tax components to be rounded
|
||||||
|
# Handeled via regional doctypess
|
||||||
|
if tax.account_head in frappe.flags.round_off_applicable_accounts:
|
||||||
|
current_tax_amount = round(current_tax_amount, 0)
|
||||||
|
return current_tax_amount
|
||||||
|
|
||||||
def set_item_wise_tax(self, item, tax, tax_rate, current_tax_amount):
|
def set_item_wise_tax(self, item, tax, tax_rate, current_tax_amount):
|
||||||
# store tax breakup for each item
|
# store tax breakup for each item
|
||||||
key = item.item_code or item.item_name
|
key = item.item_code or item.item_name
|
||||||
@ -701,6 +711,15 @@ def get_itemised_tax_breakup_html(doc):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def get_round_off_applicable_accounts(company, account_list):
|
||||||
|
account_list = get_regional_round_off_accounts(company, account_list)
|
||||||
|
|
||||||
|
return account_list
|
||||||
|
|
||||||
|
@erpnext.allow_regional
|
||||||
|
def get_regional_round_off_accounts(company, account_list):
|
||||||
|
pass
|
||||||
|
|
||||||
@erpnext.allow_regional
|
@erpnext.allow_regional
|
||||||
def update_itemised_tax_data(doc):
|
def update_itemised_tax_data(doc):
|
||||||
|
@ -402,6 +402,7 @@ regional_overrides = {
|
|||||||
'erpnext.controllers.taxes_and_totals.get_itemised_tax_breakup_header': 'erpnext.regional.india.utils.get_itemised_tax_breakup_header',
|
'erpnext.controllers.taxes_and_totals.get_itemised_tax_breakup_header': 'erpnext.regional.india.utils.get_itemised_tax_breakup_header',
|
||||||
'erpnext.controllers.taxes_and_totals.get_itemised_tax_breakup_data': 'erpnext.regional.india.utils.get_itemised_tax_breakup_data',
|
'erpnext.controllers.taxes_and_totals.get_itemised_tax_breakup_data': 'erpnext.regional.india.utils.get_itemised_tax_breakup_data',
|
||||||
'erpnext.accounts.party.get_regional_address_details': 'erpnext.regional.india.utils.get_regional_address_details',
|
'erpnext.accounts.party.get_regional_address_details': 'erpnext.regional.india.utils.get_regional_address_details',
|
||||||
|
'erpnext.controllers.taxes_and_totals.get_regional_round_off_accounts': 'erpnext.regional.india.utils.get_regional_round_off_accounts',
|
||||||
'erpnext.hr.utils.calculate_annual_eligible_hra_exemption': 'erpnext.regional.india.utils.calculate_annual_eligible_hra_exemption',
|
'erpnext.hr.utils.calculate_annual_eligible_hra_exemption': 'erpnext.regional.india.utils.calculate_annual_eligible_hra_exemption',
|
||||||
'erpnext.hr.utils.calculate_hra_exemption_for_period': 'erpnext.regional.india.utils.calculate_hra_exemption_for_period',
|
'erpnext.hr.utils.calculate_hra_exemption_for_period': 'erpnext.regional.india.utils.calculate_hra_exemption_for_period',
|
||||||
'erpnext.accounts.doctype.purchase_invoice.purchase_invoice.make_regional_gl_entries': 'erpnext.regional.india.utils.make_regional_gl_entries',
|
'erpnext.accounts.doctype.purchase_invoice.purchase_invoice.make_regional_gl_entries': 'erpnext.regional.india.utils.make_regional_gl_entries',
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
// License: GNU General Public License v3. See license.txt
|
// License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
erpnext.taxes_and_totals = erpnext.payments.extend({
|
erpnext.taxes_and_totals = erpnext.payments.extend({
|
||||||
setup: function() {},
|
setup: function() {
|
||||||
|
this.fetch_round_off_accounts();
|
||||||
|
},
|
||||||
|
|
||||||
apply_pricing_rule_on_item: function(item){
|
apply_pricing_rule_on_item: function(item){
|
||||||
let effective_item_rate = item.price_list_rate;
|
let effective_item_rate = item.price_list_rate;
|
||||||
@ -151,6 +153,22 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
fetch_round_off_accounts: function() {
|
||||||
|
let me = this;
|
||||||
|
frappe.flags.round_off_applicable_accounts = [];
|
||||||
|
|
||||||
|
return frappe.call({
|
||||||
|
"method": "erpnext.controllers.taxes_and_totals.get_round_off_applicable_accounts",
|
||||||
|
"args": {
|
||||||
|
"company": me.frm.doc.company,
|
||||||
|
"account_list": frappe.flags.round_off_applicable_accounts
|
||||||
|
},
|
||||||
|
callback: function(r) {
|
||||||
|
frappe.flags.round_off_applicable_accounts.push(...r.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
determine_exclusive_rate: function() {
|
determine_exclusive_rate: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
@ -371,11 +389,21 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
|
|||||||
} else if (tax.charge_type == "On Item Quantity") {
|
} else if (tax.charge_type == "On Item Quantity") {
|
||||||
current_tax_amount = tax_rate * item.qty;
|
current_tax_amount = tax_rate * item.qty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
current_tax_amount = this.get_final_tax_amount(tax, current_tax_amount);
|
||||||
this.set_item_wise_tax(item, tax, tax_rate, current_tax_amount);
|
this.set_item_wise_tax(item, tax, tax_rate, current_tax_amount);
|
||||||
|
|
||||||
return current_tax_amount;
|
return current_tax_amount;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
get_final_tax_amount: function(tax, current_tax_amount) {
|
||||||
|
if (frappe.flags.round_off_applicable_accounts.includes(tax.account_head)) {
|
||||||
|
current_tax_amount = Math.round(current_tax_amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
return current_tax_amount;
|
||||||
|
},
|
||||||
|
|
||||||
set_item_wise_tax: function(item, tax, tax_rate, current_tax_amount) {
|
set_item_wise_tax: function(item, tax, tax_rate, current_tax_amount) {
|
||||||
// store tax breakup for each item
|
// store tax breakup for each item
|
||||||
let tax_detail = tax.item_wise_tax_detail;
|
let tax_detail = tax.item_wise_tax_detail;
|
||||||
|
@ -1,222 +1,86 @@
|
|||||||
{
|
{
|
||||||
"allow_copy": 0,
|
"actions": [],
|
||||||
"allow_guest_to_view": 0,
|
"creation": "2017-06-27 15:09:01.318003",
|
||||||
"allow_import": 0,
|
"doctype": "DocType",
|
||||||
"allow_rename": 0,
|
"editable_grid": 1,
|
||||||
"beta": 0,
|
"engine": "InnoDB",
|
||||||
"creation": "2017-06-27 15:09:01.318003",
|
"field_order": [
|
||||||
"custom": 0,
|
"gst_summary",
|
||||||
"docstatus": 0,
|
"column_break_2",
|
||||||
"doctype": "DocType",
|
"round_off_gst_values",
|
||||||
"document_type": "",
|
"gstin_email_sent_on",
|
||||||
"editable_grid": 1,
|
"section_break_4",
|
||||||
"engine": "InnoDB",
|
"gst_accounts",
|
||||||
|
"b2c_limit"
|
||||||
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "gst_summary",
|
||||||
"allow_on_submit": 0,
|
"fieldtype": "HTML",
|
||||||
"bold": 0,
|
"label": "GST Summary",
|
||||||
"collapsible": 0,
|
"show_days": 1,
|
||||||
"columns": 0,
|
"show_seconds": 1
|
||||||
"fieldname": "gst_summary",
|
},
|
||||||
"fieldtype": "HTML",
|
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "GST Summary",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "column_break_2",
|
||||||
"allow_on_submit": 0,
|
"fieldtype": "Column Break",
|
||||||
"bold": 0,
|
"show_days": 1,
|
||||||
"collapsible": 0,
|
"show_seconds": 1
|
||||||
"columns": 0,
|
},
|
||||||
"fieldname": "column_break_2",
|
|
||||||
"fieldtype": "Column Break",
|
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "gstin_email_sent_on",
|
||||||
"allow_on_submit": 0,
|
"fieldtype": "Date",
|
||||||
"bold": 0,
|
"label": "GSTIN Email Sent On",
|
||||||
"collapsible": 0,
|
"read_only": 1,
|
||||||
"columns": 0,
|
"show_days": 1,
|
||||||
"fieldname": "gstin_email_sent_on",
|
"show_seconds": 1
|
||||||
"fieldtype": "Date",
|
},
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "GSTIN Email Sent On",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 1,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "section_break_4",
|
||||||
"allow_on_submit": 0,
|
"fieldtype": "Section Break",
|
||||||
"bold": 0,
|
"show_days": 1,
|
||||||
"collapsible": 0,
|
"show_seconds": 1
|
||||||
"columns": 0,
|
},
|
||||||
"fieldname": "section_break_4",
|
|
||||||
"fieldtype": "Section Break",
|
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "gst_accounts",
|
||||||
"allow_on_submit": 0,
|
"fieldtype": "Table",
|
||||||
"bold": 0,
|
"label": "GST Accounts",
|
||||||
"collapsible": 0,
|
"options": "GST Account",
|
||||||
"columns": 0,
|
"show_days": 1,
|
||||||
"fieldname": "gst_accounts",
|
"show_seconds": 1
|
||||||
"fieldtype": "Table",
|
},
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "GST Accounts",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"options": "GST Account",
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"default": "250000",
|
||||||
"allow_on_submit": 0,
|
"description": "Set Invoice Value for B2C. B2CL and B2CS calculated based on this invoice value.",
|
||||||
"bold": 0,
|
"fieldname": "b2c_limit",
|
||||||
"collapsible": 0,
|
"fieldtype": "Data",
|
||||||
"columns": 0,
|
"in_list_view": 1,
|
||||||
"default": "250000",
|
"label": "B2C Limit",
|
||||||
"description": "Set Invoice Value for B2C. B2CL and B2CS calculated based on this invoice value.",
|
"reqd": 1,
|
||||||
"fieldname": "b2c_limit",
|
"show_days": 1,
|
||||||
"fieldtype": "Data",
|
"show_seconds": 1
|
||||||
"hidden": 0,
|
},
|
||||||
"ignore_user_permissions": 0,
|
{
|
||||||
"ignore_xss_filter": 0,
|
"default": "0",
|
||||||
"in_filter": 0,
|
"description": "Enabling this option will round off individual GST components in all the Invoices",
|
||||||
"in_global_search": 0,
|
"fieldname": "round_off_gst_values",
|
||||||
"in_list_view": 1,
|
"fieldtype": "Check",
|
||||||
"in_standard_filter": 0,
|
"label": "Round Off GST Values",
|
||||||
"label": "B2C Limit",
|
"show_days": 1,
|
||||||
"length": 0,
|
"show_seconds": 1
|
||||||
"no_copy": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 1,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"unique": 0
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"has_web_view": 0,
|
"index_web_pages_for_search": 1,
|
||||||
"hide_heading": 0,
|
"issingle": 1,
|
||||||
"hide_toolbar": 0,
|
"links": [],
|
||||||
"idx": 0,
|
"modified": "2021-01-28 17:19:47.969260",
|
||||||
"image_view": 0,
|
"modified_by": "Administrator",
|
||||||
"in_create": 0,
|
"module": "Regional",
|
||||||
"is_submittable": 0,
|
"name": "GST Settings",
|
||||||
"issingle": 1,
|
"owner": "Administrator",
|
||||||
"istable": 0,
|
"permissions": [],
|
||||||
"max_attachments": 0,
|
"quick_entry": 1,
|
||||||
"modified": "2018-02-14 08:14:15.375181",
|
"sort_field": "modified",
|
||||||
"modified_by": "Administrator",
|
"sort_order": "DESC",
|
||||||
"module": "Regional",
|
"track_changes": 1
|
||||||
"name": "GST Settings",
|
}
|
||||||
"name_case": "",
|
|
||||||
"owner": "Administrator",
|
|
||||||
"permissions": [],
|
|
||||||
"quick_entry": 1,
|
|
||||||
"read_only": 0,
|
|
||||||
"read_only_onload": 0,
|
|
||||||
"show_name_in_global_search": 0,
|
|
||||||
"sort_field": "modified",
|
|
||||||
"sort_order": "DESC",
|
|
||||||
"track_changes": 1,
|
|
||||||
"track_seen": 0
|
|
||||||
}
|
|
@ -14,8 +14,20 @@ import json
|
|||||||
test_dependencies = ["Territory", "Customer Group", "Supplier Group", "Item"]
|
test_dependencies = ["Territory", "Customer Group", "Supplier Group", "Item"]
|
||||||
|
|
||||||
class TestGSTR3BReport(unittest.TestCase):
|
class TestGSTR3BReport(unittest.TestCase):
|
||||||
def test_gstr_3b_report(self):
|
def setUp(self):
|
||||||
|
frappe.set_user("Administrator")
|
||||||
|
|
||||||
|
frappe.db.sql("delete from `tabSales Invoice` where company='_Test Company GST'")
|
||||||
|
frappe.db.sql("delete from `tabPurchase Invoice` where company='_Test Company GST'")
|
||||||
|
frappe.db.sql("delete from `tabGSTR 3B Report` where company='_Test Company GST'")
|
||||||
|
|
||||||
|
make_company()
|
||||||
|
make_item("Milk", properties = {"is_nil_exempt": 1, "standard_rate": 0.000000})
|
||||||
|
set_account_heads()
|
||||||
|
make_customers()
|
||||||
|
make_suppliers()
|
||||||
|
|
||||||
|
def test_gstr_3b_report(self):
|
||||||
month_number_mapping = {
|
month_number_mapping = {
|
||||||
1: "January",
|
1: "January",
|
||||||
2: "February",
|
2: "February",
|
||||||
@ -31,17 +43,6 @@ class TestGSTR3BReport(unittest.TestCase):
|
|||||||
12: "December"
|
12: "December"
|
||||||
}
|
}
|
||||||
|
|
||||||
frappe.set_user("Administrator")
|
|
||||||
|
|
||||||
frappe.db.sql("delete from `tabSales Invoice` where company='_Test Company GST'")
|
|
||||||
frappe.db.sql("delete from `tabPurchase Invoice` where company='_Test Company GST'")
|
|
||||||
frappe.db.sql("delete from `tabGSTR 3B Report` where company='_Test Company GST'")
|
|
||||||
|
|
||||||
make_company()
|
|
||||||
make_item("Milk", properties = {"is_nil_exempt": 1, "standard_rate": 0.000000})
|
|
||||||
set_account_heads()
|
|
||||||
make_customers()
|
|
||||||
make_suppliers()
|
|
||||||
make_sales_invoice()
|
make_sales_invoice()
|
||||||
create_purchase_invoices()
|
create_purchase_invoices()
|
||||||
|
|
||||||
@ -67,6 +68,42 @@ class TestGSTR3BReport(unittest.TestCase):
|
|||||||
self.assertEqual(output["itc_elg"]["itc_avl"][4]["samt"], 22.50)
|
self.assertEqual(output["itc_elg"]["itc_avl"][4]["samt"], 22.50)
|
||||||
self.assertEqual(output["itc_elg"]["itc_avl"][4]["camt"], 22.50)
|
self.assertEqual(output["itc_elg"]["itc_avl"][4]["camt"], 22.50)
|
||||||
|
|
||||||
|
def test_gst_rounding(self):
|
||||||
|
gst_settings = frappe.get_doc('GST Settings')
|
||||||
|
gst_settings.round_off_gst_values = 1
|
||||||
|
gst_settings.save()
|
||||||
|
|
||||||
|
current_country = frappe.flags.country
|
||||||
|
frappe.flags.country = 'India'
|
||||||
|
|
||||||
|
si = create_sales_invoice(company="_Test Company GST",
|
||||||
|
customer = '_Test GST Customer',
|
||||||
|
currency = 'INR',
|
||||||
|
warehouse = 'Finished Goods - _GST',
|
||||||
|
debit_to = 'Debtors - _GST',
|
||||||
|
income_account = 'Sales - _GST',
|
||||||
|
expense_account = 'Cost of Goods Sold - _GST',
|
||||||
|
cost_center = 'Main - _GST',
|
||||||
|
rate=216,
|
||||||
|
do_not_save=1
|
||||||
|
)
|
||||||
|
|
||||||
|
si.append("taxes", {
|
||||||
|
"charge_type": "On Net Total",
|
||||||
|
"account_head": "IGST - _GST",
|
||||||
|
"cost_center": "Main - _GST",
|
||||||
|
"description": "IGST @ 18.0",
|
||||||
|
"rate": 18
|
||||||
|
})
|
||||||
|
|
||||||
|
si.save()
|
||||||
|
# Check for 39 instead of 38.88
|
||||||
|
self.assertEqual(si.taxes[0].base_tax_amount_after_discount_amount, 39)
|
||||||
|
|
||||||
|
frappe.flags.country = current_country
|
||||||
|
gst_settings.round_off_gst_values = 1
|
||||||
|
gst_settings.save()
|
||||||
|
|
||||||
def make_sales_invoice():
|
def make_sales_invoice():
|
||||||
si = create_sales_invoice(company="_Test Company GST",
|
si = create_sales_invoice(company="_Test Company GST",
|
||||||
customer = '_Test GST Customer',
|
customer = '_Test GST Customer',
|
||||||
@ -145,7 +182,6 @@ def make_sales_invoice():
|
|||||||
si3.submit()
|
si3.submit()
|
||||||
|
|
||||||
def create_purchase_invoices():
|
def create_purchase_invoices():
|
||||||
|
|
||||||
pi = make_purchase_invoice(
|
pi = make_purchase_invoice(
|
||||||
company="_Test Company GST",
|
company="_Test Company GST",
|
||||||
supplier = '_Test Registered Supplier',
|
supplier = '_Test Registered Supplier',
|
||||||
@ -193,7 +229,6 @@ def create_purchase_invoices():
|
|||||||
pi1.submit()
|
pi1.submit()
|
||||||
|
|
||||||
def make_suppliers():
|
def make_suppliers():
|
||||||
|
|
||||||
if not frappe.db.exists("Supplier", "_Test Registered Supplier"):
|
if not frappe.db.exists("Supplier", "_Test Registered Supplier"):
|
||||||
frappe.get_doc({
|
frappe.get_doc({
|
||||||
"supplier_group": "_Test Supplier Group",
|
"supplier_group": "_Test Supplier Group",
|
||||||
@ -257,7 +292,6 @@ def make_suppliers():
|
|||||||
address.save()
|
address.save()
|
||||||
|
|
||||||
def make_customers():
|
def make_customers():
|
||||||
|
|
||||||
if not frappe.db.exists("Customer", "_Test GST Customer"):
|
if not frappe.db.exists("Customer", "_Test GST Customer"):
|
||||||
frappe.get_doc({
|
frappe.get_doc({
|
||||||
"customer_group": "_Test Customer Group",
|
"customer_group": "_Test Customer Group",
|
||||||
@ -354,9 +388,9 @@ def make_customers():
|
|||||||
address.save()
|
address.save()
|
||||||
|
|
||||||
def make_company():
|
def make_company():
|
||||||
|
|
||||||
if frappe.db.exists("Company", "_Test Company GST"):
|
if frappe.db.exists("Company", "_Test Company GST"):
|
||||||
return
|
return
|
||||||
|
|
||||||
company = frappe.new_doc("Company")
|
company = frappe.new_doc("Company")
|
||||||
company.company_name = "_Test Company GST"
|
company.company_name = "_Test Company GST"
|
||||||
company.abbr = "_GST"
|
company.abbr = "_GST"
|
||||||
@ -388,7 +422,6 @@ def make_company():
|
|||||||
address.save()
|
address.save()
|
||||||
|
|
||||||
def set_account_heads():
|
def set_account_heads():
|
||||||
|
|
||||||
gst_settings = frappe.get_doc("GST Settings")
|
gst_settings = frappe.get_doc("GST Settings")
|
||||||
|
|
||||||
gst_account = frappe.get_all(
|
gst_account = frappe.get_all(
|
||||||
|
Loading…
Reference in New Issue
Block a user