Saqib
3 years ago
committed by
GitHub
36 changed files with 544 additions and 555 deletions
@ -0,0 +1,89 @@ |
|||||
|
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors |
||||
|
# For license information, please see license.txt |
||||
|
|
||||
|
|
||||
|
from unittest import TestCase |
||||
|
|
||||
|
import frappe |
||||
|
|
||||
|
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice |
||||
|
from erpnext.regional.doctype.gstr_3b_report.test_gstr_3b_report import ( |
||||
|
make_company as setup_company, |
||||
|
) |
||||
|
from erpnext.regional.doctype.gstr_3b_report.test_gstr_3b_report import ( |
||||
|
make_customers as setup_customers, |
||||
|
) |
||||
|
from erpnext.regional.doctype.gstr_3b_report.test_gstr_3b_report import ( |
||||
|
set_account_heads as setup_gst_settings, |
||||
|
) |
||||
|
from erpnext.regional.report.hsn_wise_summary_of_outward_supplies.hsn_wise_summary_of_outward_supplies import ( |
||||
|
execute as run_report, |
||||
|
) |
||||
|
from erpnext.stock.doctype.item.test_item import make_item |
||||
|
|
||||
|
|
||||
|
class TestHSNWiseSummaryReport(TestCase): |
||||
|
@classmethod |
||||
|
def setUpClass(cls): |
||||
|
setup_company() |
||||
|
setup_customers() |
||||
|
setup_gst_settings() |
||||
|
make_item("Golf Car", properties={ "gst_hsn_code": "999900" }) |
||||
|
|
||||
|
@classmethod |
||||
|
def tearDownClass(cls): |
||||
|
frappe.db.rollback() |
||||
|
|
||||
|
def test_hsn_summary_for_invoice_with_duplicate_items(self): |
||||
|
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", |
||||
|
do_not_save=1 |
||||
|
) |
||||
|
|
||||
|
si.items = [] |
||||
|
si.append("items", { |
||||
|
"item_code": "Golf Car", |
||||
|
"gst_hsn_code": "999900", |
||||
|
"qty": "1", |
||||
|
"rate": "120", |
||||
|
"cost_center": "Main - _GST" |
||||
|
}) |
||||
|
si.append("items", { |
||||
|
"item_code": "Golf Car", |
||||
|
"gst_hsn_code": "999900", |
||||
|
"qty": "1", |
||||
|
"rate": "140", |
||||
|
"cost_center": "Main - _GST" |
||||
|
}) |
||||
|
si.append("taxes", { |
||||
|
"charge_type": "On Net Total", |
||||
|
"account_head": "Output Tax IGST - _GST", |
||||
|
"cost_center": "Main - _GST", |
||||
|
"description": "IGST @ 18.0", |
||||
|
"rate": 18 |
||||
|
}) |
||||
|
si.posting_date = "2020-11-17" |
||||
|
si.submit() |
||||
|
si.reload() |
||||
|
|
||||
|
[columns, data] = run_report(filters=frappe._dict({ |
||||
|
"company": "_Test Company GST", |
||||
|
"gst_hsn_code": "999900", |
||||
|
"company_gstin": si.company_gstin, |
||||
|
"from_date": si.posting_date, |
||||
|
"to_date": si.posting_date |
||||
|
})) |
||||
|
|
||||
|
filtered_rows = list(filter(lambda row: row['gst_hsn_code'] == "999900", data)) |
||||
|
self.assertTrue(filtered_rows) |
||||
|
|
||||
|
hsn_row = filtered_rows[0] |
||||
|
self.assertEquals(hsn_row['stock_qty'], 2.0) |
||||
|
self.assertEquals(hsn_row['total_amount'], 306.8) |
@ -1,451 +1,140 @@ |
|||||
{ |
{ |
||||
"allow_copy": 0, |
"actions": [], |
||||
"allow_import": 0, |
"autoname": "hash", |
||||
"allow_rename": 0, |
"creation": "2013-04-08 13:10:16", |
||||
"autoname": "hash", |
"doctype": "DocType", |
||||
"beta": 0, |
"document_type": "Document", |
||||
"creation": "2013-04-08 13:10:16", |
"editable_grid": 1, |
||||
"custom": 0, |
"engine": "InnoDB", |
||||
"docstatus": 0, |
"field_order": [ |
||||
"doctype": "DocType", |
"item_code", |
||||
"document_type": "Document", |
"column_break_2", |
||||
"editable_grid": 1, |
"item_name", |
||||
"engine": "InnoDB", |
"batch_no", |
||||
|
"desc_section", |
||||
|
"description", |
||||
|
"quantity_section", |
||||
|
"qty", |
||||
|
"net_weight", |
||||
|
"column_break_10", |
||||
|
"stock_uom", |
||||
|
"weight_uom", |
||||
|
"page_break", |
||||
|
"dn_detail" |
||||
|
], |
||||
"fields": [ |
"fields": [ |
||||
{ |
{ |
||||
"allow_on_submit": 0, |
"fieldname": "item_code", |
||||
"bold": 0, |
"fieldtype": "Link", |
||||
"collapsible": 0, |
"in_global_search": 1, |
||||
"columns": 0, |
"in_list_view": 1, |
||||
"fieldname": "item_code", |
"label": "Item Code", |
||||
"fieldtype": "Link", |
"options": "Item", |
||||
"hidden": 0, |
"print_width": "100px", |
||||
"ignore_user_permissions": 0, |
"reqd": 1, |
||||
"ignore_xss_filter": 0, |
|
||||
"in_filter": 0, |
|
||||
"in_global_search": 1, |
|
||||
"in_list_view": 1, |
|
||||
"in_standard_filter": 0, |
|
||||
"label": "Item Code", |
|
||||
"length": 0, |
|
||||
"no_copy": 0, |
|
||||
"options": "Item", |
|
||||
"permlevel": 0, |
|
||||
"print_hide": 0, |
|
||||
"print_hide_if_no_value": 0, |
|
||||
"print_width": "100px", |
|
||||
"read_only": 0, |
|
||||
"remember_last_selected_value": 0, |
|
||||
"report_hide": 0, |
|
||||
"reqd": 1, |
|
||||
"search_index": 0, |
|
||||
"set_only_once": 0, |
|
||||
"unique": 0, |
|
||||
"width": "100px" |
"width": "100px" |
||||
}, |
}, |
||||
{ |
{ |
||||
"allow_on_submit": 0, |
"fieldname": "column_break_2", |
||||
"bold": 0, |
"fieldtype": "Column Break" |
||||
"collapsible": 0, |
}, |
||||
"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_on_submit": 0, |
"fetch_from": "item_code.item_name", |
||||
"bold": 0, |
"fieldname": "item_name", |
||||
"collapsible": 0, |
"fieldtype": "Data", |
||||
"columns": 0, |
"in_list_view": 1, |
||||
"fieldname": "item_name", |
"label": "Item Name", |
||||
"fieldtype": "Data", |
"print_width": "200px", |
||||
"hidden": 0, |
"read_only": 1, |
||||
"ignore_user_permissions": 0, |
|
||||
"ignore_xss_filter": 0, |
|
||||
"in_filter": 0, |
|
||||
"in_global_search": 0, |
|
||||
"in_list_view": 1, |
|
||||
"in_standard_filter": 0, |
|
||||
"label": "Item Name", |
|
||||
"length": 0, |
|
||||
"no_copy": 0, |
|
||||
"options": "item_code.item_name", |
|
||||
"permlevel": 0, |
|
||||
"print_hide": 0, |
|
||||
"print_hide_if_no_value": 0, |
|
||||
"print_width": "200px", |
|
||||
"read_only": 1, |
|
||||
"remember_last_selected_value": 0, |
|
||||
"report_hide": 0, |
|
||||
"reqd": 0, |
|
||||
"search_index": 0, |
|
||||
"set_only_once": 0, |
|
||||
"unique": 0, |
|
||||
"width": "200px" |
"width": "200px" |
||||
}, |
}, |
||||
{ |
{ |
||||
"allow_on_submit": 0, |
"fieldname": "batch_no", |
||||
"bold": 0, |
"fieldtype": "Link", |
||||
"collapsible": 0, |
"label": "Batch No", |
||||
"columns": 0, |
"options": "Batch" |
||||
"fieldname": "batch_no", |
}, |
||||
"fieldtype": "Link", |
|
||||
"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": "Batch No", |
|
||||
"length": 0, |
|
||||
"no_copy": 0, |
|
||||
"options": "Batch", |
|
||||
"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_on_submit": 0, |
"collapsible": 1, |
||||
"bold": 0, |
"fieldname": "desc_section", |
||||
"collapsible": 1, |
"fieldtype": "Section Break", |
||||
"columns": 0, |
"label": "Description" |
||||
"fieldname": "desc_section", |
}, |
||||
"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, |
|
||||
"label": "Description", |
|
||||
"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_on_submit": 0, |
"fieldname": "description", |
||||
"bold": 0, |
"fieldtype": "Text Editor", |
||||
"collapsible": 0, |
"label": "Description" |
||||
"columns": 0, |
}, |
||||
"fieldname": "description", |
|
||||
"fieldtype": "Text Editor", |
|
||||
"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": "Description", |
|
||||
"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_on_submit": 0, |
"fieldname": "quantity_section", |
||||
"bold": 0, |
"fieldtype": "Section Break", |
||||
"collapsible": 0, |
"label": "Quantity" |
||||
"columns": 0, |
}, |
||||
"fieldname": "quantity_section", |
|
||||
"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, |
|
||||
"label": "Quantity", |
|
||||
"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_on_submit": 0, |
"fieldname": "qty", |
||||
"bold": 0, |
"fieldtype": "Float", |
||||
"collapsible": 0, |
"in_list_view": 1, |
||||
"columns": 0, |
"label": "Quantity", |
||||
"fieldname": "qty", |
"print_width": "100px", |
||||
"fieldtype": "Float", |
"reqd": 1, |
||||
"hidden": 0, |
|
||||
"ignore_user_permissions": 0, |
|
||||
"ignore_xss_filter": 0, |
|
||||
"in_filter": 0, |
|
||||
"in_global_search": 0, |
|
||||
"in_list_view": 1, |
|
||||
"in_standard_filter": 0, |
|
||||
"label": "Quantity", |
|
||||
"length": 0, |
|
||||
"no_copy": 0, |
|
||||
"permlevel": 0, |
|
||||
"print_hide": 0, |
|
||||
"print_hide_if_no_value": 0, |
|
||||
"print_width": "100px", |
|
||||
"read_only": 0, |
|
||||
"remember_last_selected_value": 0, |
|
||||
"report_hide": 0, |
|
||||
"reqd": 1, |
|
||||
"search_index": 0, |
|
||||
"set_only_once": 0, |
|
||||
"unique": 0, |
|
||||
"width": "100px" |
"width": "100px" |
||||
}, |
}, |
||||
{ |
{ |
||||
"allow_on_submit": 0, |
"fieldname": "net_weight", |
||||
"bold": 0, |
"fieldtype": "Float", |
||||
"collapsible": 0, |
"in_list_view": 1, |
||||
"columns": 0, |
"label": "Net Weight", |
||||
"fieldname": "net_weight", |
"print_width": "100px", |
||||
"fieldtype": "Float", |
|
||||
"hidden": 0, |
|
||||
"ignore_user_permissions": 0, |
|
||||
"ignore_xss_filter": 0, |
|
||||
"in_filter": 0, |
|
||||
"in_global_search": 0, |
|
||||
"in_list_view": 1, |
|
||||
"in_standard_filter": 0, |
|
||||
"label": "Net Weight", |
|
||||
"length": 0, |
|
||||
"no_copy": 0, |
|
||||
"permlevel": 0, |
|
||||
"print_hide": 0, |
|
||||
"print_hide_if_no_value": 0, |
|
||||
"print_width": "100px", |
|
||||
"read_only": 0, |
|
||||
"remember_last_selected_value": 0, |
|
||||
"report_hide": 0, |
|
||||
"reqd": 0, |
|
||||
"search_index": 0, |
|
||||
"set_only_once": 0, |
|
||||
"unique": 0, |
|
||||
"width": "100px" |
"width": "100px" |
||||
}, |
}, |
||||
{ |
{ |
||||
"allow_on_submit": 0, |
"fieldname": "column_break_10", |
||||
"bold": 0, |
"fieldtype": "Column Break" |
||||
"collapsible": 0, |
}, |
||||
"columns": 0, |
|
||||
"fieldname": "column_break_10", |
|
||||
"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_on_submit": 0, |
"fieldname": "stock_uom", |
||||
"bold": 0, |
"fieldtype": "Link", |
||||
"collapsible": 0, |
"label": "UOM", |
||||
"columns": 0, |
"options": "UOM", |
||||
"fieldname": "stock_uom", |
"print_width": "100px", |
||||
"fieldtype": "Link", |
"read_only": 1, |
||||
"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": "UOM", |
|
||||
"length": 0, |
|
||||
"no_copy": 0, |
|
||||
"options": "UOM", |
|
||||
"permlevel": 0, |
|
||||
"print_hide": 0, |
|
||||
"print_hide_if_no_value": 0, |
|
||||
"print_width": "100px", |
|
||||
"read_only": 1, |
|
||||
"remember_last_selected_value": 0, |
|
||||
"report_hide": 0, |
|
||||
"reqd": 0, |
|
||||
"search_index": 0, |
|
||||
"set_only_once": 0, |
|
||||
"unique": 0, |
|
||||
"width": "100px" |
"width": "100px" |
||||
}, |
}, |
||||
{ |
{ |
||||
"allow_on_submit": 0, |
"fieldname": "weight_uom", |
||||
"bold": 0, |
"fieldtype": "Link", |
||||
"collapsible": 0, |
"label": "Weight UOM", |
||||
"columns": 0, |
"options": "UOM", |
||||
"fieldname": "weight_uom", |
"print_width": "100px", |
||||
"fieldtype": "Link", |
|
||||
"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": "Weight UOM", |
|
||||
"length": 0, |
|
||||
"no_copy": 0, |
|
||||
"options": "UOM", |
|
||||
"permlevel": 0, |
|
||||
"print_hide": 0, |
|
||||
"print_hide_if_no_value": 0, |
|
||||
"print_width": "100px", |
|
||||
"read_only": 0, |
|
||||
"remember_last_selected_value": 0, |
|
||||
"report_hide": 0, |
|
||||
"reqd": 0, |
|
||||
"search_index": 0, |
|
||||
"set_only_once": 0, |
|
||||
"unique": 0, |
|
||||
"width": "100px" |
"width": "100px" |
||||
}, |
}, |
||||
{ |
{ |
||||
"allow_on_submit": 1, |
"allow_on_submit": 1, |
||||
"bold": 0, |
"default": "0", |
||||
"collapsible": 0, |
"fieldname": "page_break", |
||||
"columns": 0, |
"fieldtype": "Check", |
||||
"fieldname": "page_break", |
"in_list_view": 1, |
||||
"fieldtype": "Check", |
"label": "Page Break" |
||||
"hidden": 0, |
}, |
||||
"ignore_user_permissions": 0, |
|
||||
"ignore_xss_filter": 0, |
|
||||
"in_filter": 0, |
|
||||
"in_global_search": 0, |
|
||||
"in_list_view": 1, |
|
||||
"in_standard_filter": 0, |
|
||||
"label": "Page Break", |
|
||||
"length": 0, |
|
||||
"no_copy": 0, |
|
||||
"permlevel": 0, |
|
||||
"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_on_submit": 0, |
"fieldname": "dn_detail", |
||||
"bold": 0, |
"fieldtype": "Data", |
||||
"collapsible": 0, |
"hidden": 1, |
||||
"columns": 0, |
"in_list_view": 1, |
||||
"fieldname": "dn_detail", |
"label": "DN Detail" |
||||
"fieldtype": "Data", |
|
||||
"hidden": 1, |
|
||||
"ignore_user_permissions": 0, |
|
||||
"ignore_xss_filter": 0, |
|
||||
"in_filter": 0, |
|
||||
"in_global_search": 0, |
|
||||
"in_list_view": 1, |
|
||||
"in_standard_filter": 0, |
|
||||
"label": "DN Detail", |
|
||||
"length": 0, |
|
||||
"no_copy": 0, |
|
||||
"permlevel": 0, |
|
||||
"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 |
|
||||
} |
} |
||||
], |
], |
||||
"hide_heading": 0, |
"idx": 1, |
||||
"hide_toolbar": 0, |
"istable": 1, |
||||
"idx": 1, |
"links": [], |
||||
"image_view": 0, |
"modified": "2021-12-14 01:22:00.715935", |
||||
"in_create": 0, |
"modified_by": "Administrator", |
||||
|
"module": "Stock", |
||||
"is_submittable": 0, |
"name": "Packing Slip Item", |
||||
"issingle": 0, |
"naming_rule": "Random", |
||||
"istable": 1, |
"owner": "Administrator", |
||||
"max_attachments": 0, |
"permissions": [], |
||||
"modified": "2018-06-01 07:21:58.220980", |
"sort_field": "modified", |
||||
"modified_by": "Administrator", |
"sort_order": "DESC", |
||||
"module": "Stock", |
"track_changes": 1 |
||||
"name": "Packing Slip Item", |
|
||||
"owner": "Administrator", |
|
||||
"permissions": [], |
|
||||
"quick_entry": 0, |
|
||||
"read_only": 0, |
|
||||
"read_only_onload": 0, |
|
||||
"show_name_in_global_search": 0, |
|
||||
"track_changes": 1, |
|
||||
"track_seen": 0 |
|
||||
} |
} |
Loading…
Reference in new issue