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, |
|||
"allow_import": 0, |
|||
"allow_rename": 0, |
|||
"actions": [], |
|||
"autoname": "hash", |
|||
"beta": 0, |
|||
"creation": "2013-04-08 13:10:16", |
|||
"custom": 0, |
|||
"docstatus": 0, |
|||
"doctype": "DocType", |
|||
"document_type": "Document", |
|||
"editable_grid": 1, |
|||
"engine": "InnoDB", |
|||
"field_order": [ |
|||
"item_code", |
|||
"column_break_2", |
|||
"item_name", |
|||
"batch_no", |
|||
"desc_section", |
|||
"description", |
|||
"quantity_section", |
|||
"qty", |
|||
"net_weight", |
|||
"column_break_10", |
|||
"stock_uom", |
|||
"weight_uom", |
|||
"page_break", |
|||
"dn_detail" |
|||
], |
|||
"fields": [ |
|||
{ |
|||
"allow_on_submit": 0, |
|||
"bold": 0, |
|||
"collapsible": 0, |
|||
"columns": 0, |
|||
"fieldname": "item_code", |
|||
"fieldtype": "Link", |
|||
"hidden": 0, |
|||
"ignore_user_permissions": 0, |
|||
"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" |
|||
}, |
|||
{ |
|||
"allow_on_submit": 0, |
|||
"bold": 0, |
|||
"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 |
|||
"fieldtype": "Column Break" |
|||
}, |
|||
{ |
|||
"allow_on_submit": 0, |
|||
"bold": 0, |
|||
"collapsible": 0, |
|||
"columns": 0, |
|||
"fetch_from": "item_code.item_name", |
|||
"fieldname": "item_name", |
|||
"fieldtype": "Data", |
|||
"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": "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" |
|||
}, |
|||
{ |
|||
"allow_on_submit": 0, |
|||
"bold": 0, |
|||
"collapsible": 0, |
|||
"columns": 0, |
|||
"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 |
|||
"options": "Batch" |
|||
}, |
|||
{ |
|||
"allow_on_submit": 0, |
|||
"bold": 0, |
|||
"collapsible": 1, |
|||
"columns": 0, |
|||
"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 |
|||
"label": "Description" |
|||
}, |
|||
{ |
|||
"allow_on_submit": 0, |
|||
"bold": 0, |
|||
"collapsible": 0, |
|||
"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 |
|||
"label": "Description" |
|||
}, |
|||
{ |
|||
"allow_on_submit": 0, |
|||
"bold": 0, |
|||
"collapsible": 0, |
|||
"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 |
|||
"label": "Quantity" |
|||
}, |
|||
{ |
|||
"allow_on_submit": 0, |
|||
"bold": 0, |
|||
"collapsible": 0, |
|||
"columns": 0, |
|||
"fieldname": "qty", |
|||
"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": "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" |
|||
}, |
|||
{ |
|||
"allow_on_submit": 0, |
|||
"bold": 0, |
|||
"collapsible": 0, |
|||
"columns": 0, |
|||
"fieldname": "net_weight", |
|||
"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" |
|||
}, |
|||
{ |
|||
"allow_on_submit": 0, |
|||
"bold": 0, |
|||
"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 |
|||
"fieldtype": "Column Break" |
|||
}, |
|||
{ |
|||
"allow_on_submit": 0, |
|||
"bold": 0, |
|||
"collapsible": 0, |
|||
"columns": 0, |
|||
"fieldname": "stock_uom", |
|||
"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": "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" |
|||
}, |
|||
{ |
|||
"allow_on_submit": 0, |
|||
"bold": 0, |
|||
"collapsible": 0, |
|||
"columns": 0, |
|||
"fieldname": "weight_uom", |
|||
"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" |
|||
}, |
|||
{ |
|||
"allow_on_submit": 1, |
|||
"bold": 0, |
|||
"collapsible": 0, |
|||
"columns": 0, |
|||
"default": "0", |
|||
"fieldname": "page_break", |
|||
"fieldtype": "Check", |
|||
"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 |
|||
"label": "Page Break" |
|||
}, |
|||
{ |
|||
"allow_on_submit": 0, |
|||
"bold": 0, |
|||
"collapsible": 0, |
|||
"columns": 0, |
|||
"fieldname": "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 |
|||
"label": "DN Detail" |
|||
} |
|||
], |
|||
"hide_heading": 0, |
|||
"hide_toolbar": 0, |
|||
"idx": 1, |
|||
"image_view": 0, |
|||
"in_create": 0, |
|||
|
|||
"is_submittable": 0, |
|||
"issingle": 0, |
|||
"istable": 1, |
|||
"max_attachments": 0, |
|||
"modified": "2018-06-01 07:21:58.220980", |
|||
"links": [], |
|||
"modified": "2021-12-14 01:22:00.715935", |
|||
"modified_by": "Administrator", |
|||
"module": "Stock", |
|||
"name": "Packing Slip Item", |
|||
"naming_rule": "Random", |
|||
"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 |
|||
"sort_field": "modified", |
|||
"sort_order": "DESC", |
|||
"track_changes": 1 |
|||
} |
Loading…
Reference in new issue