Skip to content

Commit

Permalink
fix: only show unregistered RCM invoices in doc issued summary
Browse files Browse the repository at this point in the history
  • Loading branch information
vorasmit committed Oct 18, 2024
1 parent 4bb9af2 commit 7602f35
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
1 change: 1 addition & 0 deletions india_compliance/gst_india/report/gstr_1/gstr_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
36 changes: 35 additions & 1 deletion india_compliance/gst_india/report/gstr_1/test_gstr_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -27,6 +30,11 @@
"doc_typ": "Credit Note",
"docs": [],
},
{
"doc_num": 2,
"doc_typ": "Invoices for inward supply from unregistered person",
"docs": [],
},
]
}

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 7602f35

Please sign in to comment.