Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: release v15 #2677

Merged
merged 21 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
9536376
fix: only show warning for subcontracting receipt (#2652)
Ninad1306 Oct 14, 2024
10dcb49
fix: resolved conflicts
Ninad1306 Oct 14, 2024
c2531ca
Merge pull request #2664 from resilient-tech/mergify/bp/version-15-ho…
mergify[bot] Oct 14, 2024
4021e06
fix: apply css to specific fields
Ninad1306 Oct 14, 2024
05a0282
Merge pull request #2667 from resilient-tech/mergify/bp/version-15-ho…
mergify[bot] Oct 16, 2024
5c70350
fix: connection for e-Invoice log in purchase invoice
Sanket322 Oct 15, 2024
c886931
fix: changing the sequence as per sales invoice
Sanket322 Oct 16, 2024
f6a4a9c
fix: pos based on account settings (#2647)
Sanket322 Oct 18, 2024
943b0c7
fix: changes for test case
Oct 21, 2024
112d625
Merge pull request #2679 from Sanket322/test_cases
Sanket322 Oct 21, 2024
fb1cfac
fix: resolve merge conflict
Oct 21, 2024
5b61364
Merge pull request #2676 from resilient-tech/mergify/bp/version-15-ho…
mergify[bot] Oct 21, 2024
3d19343
Merge branch 'version-15-hotfix' into mergify/bp/version-15-hotfix/pr…
Sanket322 Oct 21, 2024
ebcafbb
Merge pull request #2674 from resilient-tech/mergify/bp/version-15-ho…
mergify[bot] Oct 21, 2024
49bf757
fix: add comment in gst return log for backdated transactions (#2656)
Sanket322 Oct 22, 2024
62912b6
fix: filter for invalid invoice number in document issue summary (#2641)
Sanket322 Oct 22, 2024
28155b0
Merge pull request #2683 from resilient-tech/mergify/bp/version-15-ho…
mergify[bot] Oct 22, 2024
c457198
fix: resolve merge conflict
Oct 22, 2024
d292b7f
Merge pull request #2682 from resilient-tech/mergify/bp/version-15-ho…
mergify[bot] Oct 22, 2024
36180f5
fix: update bill_from_address when required
Ninad1306 Oct 22, 2024
26e397a
Merge pull request #2684 from resilient-tech/mergify/bp/version-15-ho…
vorasmit Oct 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/server-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jobs:
BRANCH_TO_CLONE: ${{ env.BRANCH }}

- name: Run Tests
run: cd ~/frappe-bench/ && bench --site test_site run-tests --app ${{ env.APP_NAME }} --coverage
run: cd ~/frappe-bench/ && bench --site test_site run-parallel-tests --app ${{ env.APP_NAME }} --with-coverage
env:
TYPE: server

Expand Down
11 changes: 9 additions & 2 deletions india_compliance/gst_india/client_scripts/stock_entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,14 @@ frappe.ui.form.on(DOCTYPE, {
);
},

refresh() {
refresh(frm) {
frm.get_field("bill_to_address_display")
.$wrapper.find(".ql-editor")
.css("white-space", "normal");
frm.get_field("bill_from_address_display")
.$wrapper.find(".ql-editor")
.css("white-space", "normal");

if (!gst_settings.enable_e_waybill || !gst_settings.enable_e_waybill_for_sc)
return;

Expand Down Expand Up @@ -99,7 +106,7 @@ frappe.ui.form.on(DOCTYPE, {
},

company(frm) {
if (frm.doc.company) {
if (frm.doc.company && doc.purpose === "Send to Subcontractor") {
frappe.call({
method: "frappe.contacts.doctype.address.address.get_default_address",
args: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,21 @@
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import get_datetime, get_datetime_str, get_last_day, getdate
from frappe.utils import (
get_datetime,
get_datetime_str,
get_last_day,
get_link_to_form,
getdate,
)

from india_compliance.gst_india.doctype.gst_return_log.generate_gstr_1 import (
GenerateGSTR1,
)
from india_compliance.gst_india.utils import is_production_api_enabled

DOCTYPE = "GST Return Log"


class GSTReturnLog(GenerateGSTR1, Document):
@property
Expand Down Expand Up @@ -199,7 +207,7 @@ def process_gstr_1_returns_info(company, gstin, response):
# existing logs
gstr1_logs = frappe._dict(
frappe.get_all(
"GST Return Log",
DOCTYPE,
filters={"name": ("in", list(return_info.keys()))},
fields=["name", "acknowledgement_number"],
as_list=1,
Expand Down Expand Up @@ -234,15 +242,15 @@ def _update_gstr_1_filed_upto(filing_date):

if key in gstr1_logs:
if gstr1_logs[key] != info["arn"]:
frappe.db.set_value("GST Return Log", key, filing_details)
frappe.db.set_value(DOCTYPE, key, filing_details)
_update_gstr_1_filed_upto(filed_upto)

# No updates if status is same
continue

frappe.get_doc(
{
"doctype": "GST Return Log",
"doctype": DOCTYPE,
"company": company,
"gstin": gstin,
"return_period": info["ret_prd"],
Expand All @@ -252,6 +260,36 @@ def _update_gstr_1_filed_upto(filing_date):
_update_gstr_1_filed_upto(filed_upto)


def get_gst_return_log(posting_date, company_gstin):
period = getdate(posting_date).strftime("%m%Y")
if name := frappe.db.exists(DOCTYPE, f"GSTR1-{period}-{company_gstin}"):
return frappe.get_doc(DOCTYPE, name)


def add_comment_to_gst_return_log(doc, action):
if not (log := get_gst_return_log(doc.posting_date, doc.company_gstin)):
return

log.add_comment(
"Comment",
f"{doc.doctype} : {get_link_to_form(doc.doctype, doc.name)} has been {action} by {frappe.session.user}",
)


def update_is_not_latest_gstr1_data(posting_date, company_gstin):
period = posting_date.strftime("%m%Y")

frappe.db.set_value(
"GST Return Log", f"GSTR1-{period}-{company_gstin}", "is_latest_data", 0
)

frappe.publish_realtime(
"is_not_latest_data",
message={"filters": {"company_gstin": company_gstin, "period": period}},
doctype="GSTR-1 Beta",
)


def get_file_doc(doctype, docname, attached_to_field):
try:
return frappe.get_doc(
Expand Down
30 changes: 11 additions & 19 deletions india_compliance/gst_india/doctype/gst_settings/gst_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
E_WAYBILL_FIELDS,
SALES_REVERSE_CHARGE_FIELDS,
)
from india_compliance.gst_india.doctype.gst_return_log.gst_return_log import (
add_comment_to_gst_return_log,
update_is_not_latest_gstr1_data,
)
from india_compliance.gst_india.doctype.gstin.gstin import get_gstr_1_filed_upto
from india_compliance.gst_india.page.india_compliance_account import (
_disable_api_promo,
Expand Down Expand Up @@ -496,12 +500,12 @@ def update_not_applicable_status(e_invoice_applicability_date=None, company=None
query.run()


def restrict_gstr_1_transaction_for(posting_date, company_gstin, gst_settings=None):
def restrict_gstr_1_transaction_for(doc, gst_settings=None, action="submit"):
"""
Check if the user is allowed to modify transactions before the GSTR-1 filing date
Additionally, update the `is_not_latest_gstr1_data` field in the GST Return Log
"""
posting_date = getdate(posting_date)
posting_date = getdate(doc.posting_date)

if not gst_settings:
gst_settings = frappe.get_cached_doc("GST Settings")
Expand All @@ -511,7 +515,7 @@ def restrict_gstr_1_transaction_for(posting_date, company_gstin, gst_settings=No
if not gst_settings.restrict_changes_after_gstr_1:
restrict = False

gstr_1_filed_upto = get_gstr_1_filed_upto(company_gstin)
gstr_1_filed_upto = get_gstr_1_filed_upto(doc.company_gstin)

if not gstr_1_filed_upto:
restrict = False
Expand All @@ -528,20 +532,8 @@ def restrict_gstr_1_transaction_for(posting_date, company_gstin, gst_settings=No
if restrict:
return gstr_1_filed_upto

update_is_not_latest_gstr1_data(posting_date, company_gstin)

return None


def update_is_not_latest_gstr1_data(posting_date, company_gstin):
period = posting_date.strftime("%m%Y")
# postprocess
update_is_not_latest_gstr1_data(posting_date, doc.company_gstin)

frappe.db.set_value(
"GST Return Log", f"GSTR1-{period}-{company_gstin}", "is_latest_data", 0
)

frappe.publish_realtime(
"is_not_latest_data",
message={"filters": {"company_gstin": company_gstin, "period": period}},
doctype="GSTR-1 Beta",
)
if posting_date <= getdate(gstr_1_filed_upto):
add_comment_to_gst_return_log(doc, action)
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,13 @@ def process_doc_issue_data(self, data):
"""
Add draft count to cancelled count for DOC_ISSUE category
"""
for doc in data:
for doc in data.copy():
if doc.get(GSTR1_DataField.DOC_TYPE.value).startswith(
"Excluded from Report"
):
data.remove(doc)
continue

doc[GSTR1_DataField.CANCELLED_COUNT.value] += doc.get(
GSTR1_DataField.DRAFT_COUNT.value, 0
)
Expand Down
7 changes: 4 additions & 3 deletions india_compliance/gst_india/overrides/payment_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ def validate(doc, method=None):
return

if doc.party_type == "Customer":
validate_backdated_transaction(doc)

# Presume is export with GST if GST accounts are present
doc.is_export_with_gst = 1
validate_transaction_for_advance_payment(doc, method)
Expand All @@ -98,6 +96,9 @@ def validate(doc, method=None):


def on_submit(doc, method=None):
if doc.party_type == "Customer":
validate_backdated_transaction(doc)

make_gst_revesal_entry_from_advance_payment(doc)


Expand All @@ -112,7 +113,7 @@ def before_cancel(doc, method=None):
validate_backdated_transaction(doc, action="cancel")


def validate_backdated_transaction(doc, action="create"):
def validate_backdated_transaction(doc, action="submit"):
for row in doc.taxes:
if row.gst_tax_type in TAX_TYPES and row.tax_amount != 0:
_validate_backdated_transaction(doc, action=action)
Expand Down
1 change: 1 addition & 0 deletions india_compliance/gst_india/overrides/purchase_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def get_dashboard_data(data):
"Purchase Invoice",
data,
"e-Waybill Log",
"e-Invoice Log",
"Integration Request",
"GST Inward Supply",
)
Expand Down
3 changes: 2 additions & 1 deletion india_compliance/gst_india/overrides/sales_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def validate(doc, method=None):

gst_settings = frappe.get_cached_doc("GST Settings")

validate_backdated_transaction(doc, gst_settings)
validate_invoice_number(doc)
validate_credit_debit_note(doc)
validate_fields_and_set_status_for_e_invoice(doc, gst_settings)
Expand Down Expand Up @@ -139,6 +138,8 @@ def is_shipping_address_in_india(doc):


def on_submit(doc, method=None):
validate_backdated_transaction(doc)

if getattr(doc, "_submitted_from_ui", None) or validate_transaction(doc) is False:
return

Expand Down
36 changes: 27 additions & 9 deletions india_compliance/gst_india/overrides/subcontracting_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,21 +186,39 @@ def validate(doc, method=None):
update_gst_details(doc)


def before_save(doc, method=None):
if ignore_gst_validations(doc):
return

validate_doc_references(doc)


def before_submit(doc, method=None):
# Stock Entries with Subcontracting Order should only be considered
if ignore_gst_validation_for_subcontracting(doc):
return

if (doc.doctype == "Stock Entry" and doc.purpose == "Material Transfer") or (
validate_doc_references(doc)


def validate_doc_references(doc):
is_stock_entry = doc.doctype == "Stock Entry" and doc.purpose == "Material Transfer"
is_subcontracting_receipt = (
doc.doctype == "Subcontracting Receipt" and not doc.is_return
):
if not doc.doc_references:
frappe.throw(
_("Please Select Original Document Reference for ITC-04 Reporting"),
title=_("Mandatory Field"),
)
else:
remove_duplicates(doc)
)

if not (is_stock_entry or is_subcontracting_receipt):
return

if doc.doc_references:
remove_duplicates(doc)
return

error_msg = _("Please Select Original Document Reference for ITC-04 Reporting")
if is_stock_entry:
frappe.throw(error_msg, title=_("Mandatory Field"))
else:
frappe.msgprint(error_msg, alert=True, indicator="yellow")


def validate_transaction(doc, method=None):
Expand Down
Loading