From 7602f35c9f53877cb5566f0c66457331eed5f73d Mon Sep 17 00:00:00 2001 From: Smit Vora Date: Fri, 18 Oct 2024 15:49:43 +0530 Subject: [PATCH] fix: only show unregistered RCM invoices in doc issued summary --- .../gst_india/report/gstr_1/gstr_1.py | 1 + .../gst_india/report/gstr_1/test_gstr_1.py | 36 ++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/india_compliance/gst_india/report/gstr_1/gstr_1.py b/india_compliance/gst_india/report/gstr_1/gstr_1.py index 769a8df8f..ed2aff533 100644 --- a/india_compliance/gst_india/report/gstr_1/gstr_1.py +++ b/india_compliance/gst_india/report/gstr_1/gstr_1.py @@ -1460,6 +1460,7 @@ def get_query_for_purchase_invoice(self): additional_conditions = [ self.purchase_invoice.is_reverse_charge == 1, + IfNull(self.purchase_invoice.supplier_gstin, "") == "", ] return self.build_query( doctype=self.purchase_invoice, diff --git a/india_compliance/gst_india/report/gstr_1/test_gstr_1.py b/india_compliance/gst_india/report/gstr_1/test_gstr_1.py index c5abc3d3c..e864b4c13 100644 --- a/india_compliance/gst_india/report/gstr_1/test_gstr_1.py +++ b/india_compliance/gst_india/report/gstr_1/test_gstr_1.py @@ -8,7 +8,10 @@ format_data_to_dict, get_json, ) -from india_compliance.gst_india.utils.tests import create_sales_invoice +from india_compliance.gst_india.utils.tests import ( + create_purchase_invoice, + create_sales_invoice, +) JSON_OUTPUT = { "doc_det": [ @@ -27,6 +30,11 @@ "doc_typ": "Credit Note", "docs": [], }, + { + "doc_num": 2, + "doc_typ": "Invoices for inward supply from unregistered person", + "docs": [], + }, ] } @@ -80,6 +88,7 @@ def create_test_items(): invoices_for_outward_supply = JSON_OUTPUT["doc_det"][0]["docs"] debit_notes = JSON_OUTPUT["doc_det"][1]["docs"] credit_notes = JSON_OUTPUT["doc_det"][2]["docs"] + purchase_rcm = JSON_OUTPUT["doc_det"][3]["docs"] # Sales Invoices sales_invoices = create_sales_invoices(3) @@ -169,12 +178,37 @@ def create_test_items(): } ) + # Purchase Invoices (RCM) + + # Registered RCM + create_purchase_invoices(5) + + # Unregistered RCM + purchases = create_purchase_invoices(5, supplier="_Test Unregistered Supplier") + purchase_rcm.append( + { + "num": 1, + "to": purchases[-1].name, + "from": purchases[0].name, + "totnum": 5, + "cancel": 0, + "net_issue": 5, + } + ) + def create_sales_invoices(count, **kwargs): """Create a list of sales invoices.""" return [create_sales_invoice(**kwargs) for _ in range(count)] +def create_purchase_invoices(count, **kwargs): + """Create a list of purchase invoices.""" + return [ + create_purchase_invoice(**kwargs, is_reverse_charge=True) for _ in range(count) + ] + + def create_opening_entry(): sales_invoice = frappe.new_doc("Sales Invoice") sales_invoice.update(