Skip to content

Commit

Permalink
fix: Merge remote-tracking branch 'upstream' into quartely_in_gstr_1_…
Browse files Browse the repository at this point in the history
…beta
  • Loading branch information
Sanket322 committed Dec 30, 2024
2 parents 6b39d0a + cdd0d2b commit dbe34d2
Show file tree
Hide file tree
Showing 56 changed files with 1,053 additions and 219 deletions.
1 change: 1 addition & 0 deletions india_compliance/gst_india/api_classes/taxpayer_returns.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class ReturnsAPI(TaxpayerBaseAPI):
IGNORED_ERROR_CODES = {
**TaxpayerBaseAPI.IGNORED_ERROR_CODES,
"RET11416": "no_docs_found",
"RET12501": "no_docs_found", # random `system failure` for CDNR
"RET13508": "no_docs_found",
"RET13509": "no_docs_found",
"RET13510": "no_docs_found",
Expand Down
11 changes: 9 additions & 2 deletions india_compliance/gst_india/client_scripts/e_invoice_actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ frappe.ui.form.on("Sales Invoice", {
)
return;

if(frm.doc.docstatus === 2) return;
if (frm.doc.docstatus === 2) return;

const is_einv_generatable = is_e_invoice_generatable(frm, true);

Expand Down Expand Up @@ -144,6 +144,10 @@ frappe.ui.form.on("Sales Invoice", {
return;
}

if (gst_settings.auto_cancel_e_invoice === 1) {
continueCancellation();
return;
}
return show_cancel_e_invoice_dialog(frm, continueCancellation);
});
},
Expand Down Expand Up @@ -281,7 +285,10 @@ function get_cancel_e_invoice_dialog_fields(frm, manual_cancel = false) {
fieldname: "reason",
fieldtype: "Select",
reqd: 1,
default: manual_cancel ? "Others" : "Data Entry Mistake",
default: manual_cancel
? "Others"
: gst_settings.reason_for_e_invoice_cancellation ||
"Data Entry Mistake",
options: ["Duplicate", "Data Entry Mistake", "Order Cancelled", "Others"],
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,11 @@ function setup_e_waybill_actions(doctype) {
return;
}

if (gst_settings.auto_cancel_e_waybill === 1) {
continueCancellation();
return;
}

return show_cancel_e_waybill_dialog(frm, continueCancellation);
});
},
Expand Down Expand Up @@ -758,7 +763,8 @@ function get_cancel_e_waybill_dialog_fields(frm) {
fieldname: "reason",
fieldtype: "Select",
reqd: 1,
default: "Data Entry Mistake",
default:
gst_settings.reason_for_e_waybill_cancellation || "Data Entry Mistake",
options: ["Duplicate", "Order Cancelled", "Data Entry Mistake", "Others"],
},
{
Expand Down
5 changes: 0 additions & 5 deletions india_compliance/gst_india/client_scripts/stock_entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ frappe.ui.form.on(DOCTYPE, {
"supplier_address",
...get_field_and_label(frm, "party_field")
);

frm.get_docfield("taxes", "charge_type").options = [
"On Net Total",
"On Item Quantity",
];
},

refresh(frm) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ frappe.ui.form.on("Subcontracting Order", {
frm.taxes_controller = new india_compliance.taxes_controller(frm, {
total_taxable_value: "total",
});

frm.get_docfield("taxes", "charge_type").options = [
"On Net Total",
"On Item Quantity",
];
},

taxes_and_charges(frm) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,21 @@ frappe.ui.form.on(DOCTYPE, {
...filters,
supplied_items: get_supplied_items(doc),
},
}

};
else if (row.link_doctype == "Subcontracting Receipt")
return {
query: "india_compliance.gst_india.overrides.subcontracting_transaction.get_subcontracting_receipt_references",
filters: {
...filters,
received_items: get_received_items(doc),
}
}

},
};
});
},
onload(frm) {
frm.taxes_controller = new india_compliance.taxes_controller(frm, {
total_taxable_value: "total",
});

frm.get_docfield("taxes", "charge_type").options = [
"On Net Total",
"On Item Quantity",
];
},

refresh() {
Expand Down
18 changes: 13 additions & 5 deletions india_compliance/gst_india/constants/custom_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"fieldtype": "Section Break",
"insert_after": "total",
"hide_border": 1,
"depends_on": "eval: doc.purchase_order && india_compliance.is_e_waybill_generatable_for_subcontracting(doc)",
"depends_on": "eval: doc.purchase_order && india_compliance.is_e_waybill_applicable_for_subcontracting(doc)",
},
],
"Subcontracting Receipt": [
Expand All @@ -66,7 +66,7 @@
"fieldtype": "Section Break",
"insert_after": "total",
"hide_border": 1,
"depends_on": "eval: india_compliance.is_e_waybill_generatable_for_subcontracting(doc)",
"depends_on": "eval: india_compliance.is_e_waybill_applicable_for_subcontracting(doc)",
},
{
"fieldname": "section_break_ref_doc",
Expand Down Expand Up @@ -134,11 +134,19 @@
},
],
("Subcontracting Order", "Subcontracting Receipt", "Stock Entry"): [
{
"fieldname": "tax_category",
"label": "Tax Category",
"fieldtype": "Link",
"insert_after": "section_break_taxes",
"options": "Tax Category",
"print_hide": 1,
},
{
"fieldname": "taxes_and_charges",
"label": "Taxes and Charges Template",
"fieldtype": "Link",
"insert_after": "section_break_taxes",
"insert_after": "tax_category",
"options": "Sales Taxes and Charges Template",
"print_hide": 1,
},
Expand Down Expand Up @@ -182,14 +190,14 @@
"label": "Taxes",
"fieldtype": "Section Break",
"insert_after": "get_stock_and_rate",
"depends_on": "eval: india_compliance.is_e_waybill_generatable_for_subcontracting(doc)",
"depends_on": "eval: india_compliance.is_e_waybill_applicable_for_subcontracting(doc)",
},
{
"label": "E-Waybill Info",
"fieldname": "tab_break_ewaybill",
"fieldtype": "Tab Break",
"insert_after": "address_display",
"depends_on": "eval: india_compliance.is_e_waybill_generatable_for_subcontracting(doc)",
"depends_on": "eval: india_compliance.is_e_waybill_applicable_for_subcontracting(doc)",
},
{
"label": "e-Waybill Address",
Expand Down
9 changes: 0 additions & 9 deletions india_compliance/gst_india/data/test_e_invoice.json
Original file line number Diff line number Diff line change
Expand Up @@ -664,15 +664,6 @@
"Stcd": "02",
"TrdNm": "_Test Indian Registered Company"
},
"ShipDtls": {
"Gstin": "URP",
"LglNm": "Test Indian Unregistered Company",
"TrdNm": "Test Indian Unregistered Company",
"Addr1": "Test Address - 2",
"Loc": "Test City",
"Pin": 380015,
"Stcd": "24"
},
"TranDtls": {
"RegRev": "N",
"SupTyp": "EXPWOP",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"column_break_wxlx",
"total_taxable_value",
"section_break_biay",
"tax_category",
"taxes",
"section_break_zcnz",
"total_customs_duty",
Expand Down Expand Up @@ -279,6 +280,13 @@
"options": "\nNot Applicable\nReconciled\nUnreconciled\nIgnored",
"print_hide": 1,
"read_only": 1
},
{
"fieldname": "tax_category",
"fieldtype": "Link",
"label": "Tax Category",
"options": "Tax Category",
"print_hide": 1
}
],
"in_create": 1,
Expand All @@ -297,7 +305,7 @@
"link_fieldname": "link_name"
}
],
"modified": "2024-08-12 15:48:43.769450",
"modified": "2024-12-20 15:17:36.898844",
"modified_by": "Administrator",
"module": "GST India",
"name": "Bill of Entry",
Expand Down
43 changes: 43 additions & 0 deletions india_compliance/gst_india/doctype/bill_of_entry/bill_of_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import erpnext
from erpnext.accounts.general_ledger import make_gl_entries, make_reverse_gl_entries
from erpnext.controllers.accounts_controller import AccountsController
from erpnext.stock.get_item_details import ItemDetailsCtx, _get_item_tax_template

from india_compliance.gst_india.overrides.ineligible_itc import (
update_landed_cost_voucher_for_gst_expense,
Expand Down Expand Up @@ -114,6 +115,7 @@ def set_default_accounts(self):
self.customs_payable_account = company.default_customs_payable_account

def set_taxes_and_totals(self):
self.validate_item_tax_template()
self.taxes_controller = CustomTaxController(self)

self.taxes_controller.set_item_wise_tax_rates()
Expand Down Expand Up @@ -234,6 +236,47 @@ def validate_taxes(self):
).format(row.idx, tax.tax_amount, column)
)

def validate_item_tax_template(self):
for item in self.items:
if item.item_code and item.get("item_tax_template"):
item_doc = frappe.get_cached_doc("Item", item.item_code)
item_details = ItemDetailsCtx(
{
"net_rate": item.get("taxable_value"),
"base_net_rate": item.get("taxable_value"),
"tax_category": self.get("tax_category"),
"bill_date": self.bill_of_entry_date,
"company": self.get("company"),
}
)

item_group = item_doc.item_group
item_group_taxes = []

while item_group:
item_group_doc = frappe.get_cached_doc("Item Group", item_group)
item_group_taxes += item_group_doc.taxes or []
item_group = item_group_doc.parent_item_group

item_taxes = item_doc.taxes or []

if not item_group_taxes and (not item_taxes):
# No validation if no taxes in item or item group
continue

taxes = _get_item_tax_template(
item_details, item_taxes + item_group_taxes, for_validate=True
)

if taxes:
if item.item_tax_template not in taxes:
item.item_tax_template = taxes[0]
frappe.msgprint(
_(
"Row {0}: Item Tax template updated as per validity and rate applied"
).format(item.idx, frappe.bold(item.item_code))
)

def get_gl_entries(self):
# company_currency is required by get_gl_dict
# nosemgrep
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) 2022, Resilient Tech and contributors
// For license information, please see license.txt

frappe.ui.form.on('e-Invoice Log', {
// refresh: function(frm) {
// frappe.ui.form.on('e-Invoice Log', {
// refresh: function(frm) {

// }
});
// }
// });
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (c) 2024, Resilient Tech and contributors
// For license information, please see license.txt

frappe.listview_settings["e-Invoice Log"] = {
hide_name_column: true,

button: {
show: function (doc) {
return doc.reference_name;
},

get_label: function () {
return __("Open Reference");
},

get_description: function (doc) {
return __("Open {0}", [
`${__(doc.reference_doctype)}: ${doc.reference_name}`,
]);
},

action: function (doc) {
frappe.set_route("Form", doc.reference_doctype, doc.reference_name);
},
},
};
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) 2022, Resilient Tech and contributors
// For license information, please see license.txt

frappe.ui.form.on('e-Waybill Log', {
// frappe.ui.form.on('e-Waybill Log', {
// refresh: function(frm) {

// }
});
// });
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
{
"fieldname": "reference_doctype",
"fieldtype": "Link",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Reference Document Type",
"options": "DocType",
Expand Down Expand Up @@ -177,7 +178,7 @@
"link_fieldname": "ewaybill"
}
],
"modified": "2024-07-17 12:26:38.069883",
"modified": "2024-12-05 09:50:37.014667",
"modified_by": "Administrator",
"module": "GST India",
"name": "e-Waybill Log",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (c) 2024, Resilient Tech and contributors
// For license information, please see license.txt

frappe.listview_settings["e-Waybill Log"] = {
hide_name_column: true,

button: {
show: function (doc) {
return doc.reference_name;
},

get_label: function () {
return __("Open Reference");
},

get_description: function (doc) {
return __("Open {0}", [
`${__(doc.reference_doctype)}: ${doc.reference_name}`,
]);
},

action: function (doc) {
frappe.set_route("Form", doc.reference_doctype, doc.reference_name);
},
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ frappe.ui.form.on('GST HSN Code', {
method: 'india_compliance.gst_india.doctype.gst_hsn_code.gst_hsn_code.update_taxes_in_item_master',
callback: function(r) {
if(r.message){
frappe.show_alert(__('Item taxes updated'));
frappe.show_alert(__('Items with this HSN code will be updated shortly'));
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def update_item_document(taxes, hsn_code):
"item_tax_template": tax.item_tax_template,
"tax_category": tax.tax_category,
"valid_from": tax.valid_from,
"minimum_net_rate": tax.minimum_net_rate,
"maximum_net_rate": tax.maximum_net_rate,
},
)

Expand Down
Loading

0 comments on commit dbe34d2

Please sign in to comment.