Skip to content

Commit

Permalink
Merge pull request #2296 from resilient-tech/version-15-hotfix
Browse files Browse the repository at this point in the history
chore: release v15
  • Loading branch information
ljain112 authored Jun 24, 2024
2 parents 424e5c3 + 22d5370 commit 2ddb1bf
Show file tree
Hide file tree
Showing 62 changed files with 1,333 additions and 832 deletions.
3 changes: 2 additions & 1 deletion india_compliance/gst_india/api_classes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import frappe
from frappe import _
from frappe.utils import sbool
from frappe.utils.scheduler import is_scheduler_disabled

from india_compliance.exceptions import GatewayTimeoutError, GSPServerError
from india_compliance.gst_india.utils import is_api_enabled
Expand Down Expand Up @@ -290,7 +291,7 @@ def check_scheduler_status():
if frappe.flags.in_test or frappe.conf.developer_mode:
return

if frappe.utils.scheduler.is_scheduler_disabled():
if is_scheduler_disabled():
frappe.throw(
_(
"The Scheduler is currently disabled, which needs to be enabled to use e-Invoicing and e-Waybill features. "
Expand Down
17 changes: 17 additions & 0 deletions india_compliance/gst_india/client_scripts/company.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ set_gstin_options_and_status(DOCTYPE);

frappe.ui.form.off(DOCTYPE, "make_default_tax_template");
frappe.ui.form.on(DOCTYPE, {
onload(frm){
frm.fields_dict.bank_details_for_printing.grid.fields_map.autofield.ignore_validation = 1
frm.fields_dict.registration_details_for_printing.grid.fields_map.autofield.ignore_validation = 1
},
setup(frm) {
erpnext.company.set_custom_query(frm, [
"default_customs_expense_account",
Expand All @@ -19,6 +23,19 @@ frappe.ui.form.on(DOCTYPE, {
"default_customs_payable_account",
{ root_type: "Liability" },
]);

frm.set_query("autofield", "bank_details_for_printing", (_, cdt, cdn) => {
return {
query: "india_compliance.gst_india.overrides.company.get_default_print_options",
params : {for_bank : 1}
}
});
frm.set_query("autofield", "registration_details_for_printing", (_, cdt, cdn) => {
return {
query: "india_compliance.gst_india.overrides.company.get_default_print_options",
params : {for_bank : 0}
}
});
},

make_default_tax_template: function (frm) {
Expand Down
14 changes: 6 additions & 8 deletions india_compliance/gst_india/client_scripts/e_waybill_actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ function show_generate_e_waybill_dialog(frm) {
);

d.show();
set_gst_transporter_id_status(d);
validate_gst_transporter_id(d);

//Alert if E-waybill cannot be generated using api
if (!is_e_waybill_generatable(frm)) {
Expand Down Expand Up @@ -374,7 +374,7 @@ function get_generate_e_waybill_dialog(opts, frm) {
frm.doc.gst_transporter_id?.length == 15
? frm.doc.gst_transporter_id
: "",
onchange: () => set_gst_transporter_id_status(d),
onchange: () => validate_gst_transporter_id(d),

},
// Sub Supply Type will be visible here for Delivery Note
Expand Down Expand Up @@ -814,7 +814,7 @@ function show_update_transporter_dialog(frm) {
frm.doc.gst_transporter_id.length == 15
? frm.doc.gst_transporter_id
: "",
onchange: () => set_gst_transporter_id_status(d),
onchange: () => validate_gst_transporter_id(d),
},
{
label: "Update e-Waybill Print/Data",
Expand All @@ -841,7 +841,7 @@ function show_update_transporter_dialog(frm) {
// To prevent triggering of change event on input twice
frappe.ui.form.ControlData.trigger_change_on_input_event = true;
d.show();
set_gst_transporter_id_status(d);
validate_gst_transporter_id(d);
}

async function show_extend_validity_dialog(frm) {
Expand Down Expand Up @@ -1161,10 +1161,8 @@ async function update_gst_tranporter_id(dialog) {
dialog.set_value("gst_transporter_id", response.gst_transporter_id);
}

function set_gst_transporter_id_status(dialog) {
const gst_transporter_id_field = dialog.get_field("gst_transporter_id");

india_compliance.set_gstin_status(gst_transporter_id_field);
function validate_gst_transporter_id(dialog) {
india_compliance.validate_gst_transporter_id(dialog.get_value("gst_transporter_id"));
}

function update_generation_dialog(dialog, doc) {
Expand Down
9 changes: 1 addition & 8 deletions india_compliance/gst_india/client_scripts/supplier.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ frappe.ui.form.on(DOCTYPE, {
},

gst_transporter_id(frm) {
if (
!frm.doc.gst_transporter_id ||
frm.doc.gst_transporter_id.length < 15
)
return;

gst_transporter_id_field = frm.get_field("gst_transporter_id");
india_compliance.set_gstin_status(gst_transporter_id_field);
india_compliance.validate_gst_transporter_id(frm.doc.gst_transporter_id);
},
});
4 changes: 4 additions & 0 deletions india_compliance/gst_india/constants/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@

GST_TAX_TYPES = tuple(field[:-8] for field in GST_ACCOUNT_FIELDS)

GST_RCM_TAX_TYPES = tuple(tax_type + "_rcm" for tax_type in GST_TAX_TYPES)

TAX_TYPES = (*GST_TAX_TYPES, *GST_RCM_TAX_TYPES)

GST_PARTY_TYPES = ("Customer", "Supplier", "Company")

# Map for e-Invoice Supply Type
Expand Down
59 changes: 59 additions & 0 deletions india_compliance/gst_india/constants/custom_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,39 @@
"options": "Account",
"insert_after": "default_customs_expense_account",
},
{
"fieldname": "print_options",
"label": "Print Options",
"fieldtype": "Tab Break",
"insert_after": "dashboard_tab",
},
{
"label": "Enable Physical Signature",
"fieldname": "show_physical_signature",
"insert_after": "print_options",
"fieldtype": "Check",
},
{
"label": "Company Logo",
"fieldname": "logo_for_printing",
"insert_after": "show_physical_signature",
"fieldtype": "Attach",
"translatable": 0,
},
{
"label": "Bank Details",
"fieldname": "bank_details_for_printing",
"insert_after": "logo_for_printing",
"fieldtype": "Table",
"options": "Company Print Options",
},
{
"label": "Registration Details",
"fieldname": "registration_details_for_printing",
"insert_after": "bank_details_for_printing",
"fieldtype": "Table",
"options": "Company Print Options",
},
],
("Customer", "Supplier"): party_fields,
# Purchase Fields
Expand Down Expand Up @@ -188,10 +221,22 @@
"label": "E-commerce GSTIN",
"length": 15,
"fieldtype": "Data",
"depends_on": "eval:gst_settings.enable_sales_through_ecommerce_operators",
"insert_after": "gst_section",
"print_hide": 1,
"translatable": 0,
},
{
"fieldname": "ecommerce_supply_type",
"label": "E-commerce Supply Type",
"fieldtype": "Data",
"depends_on": "eval:gst_settings.enable_sales_through_ecommerce_operators && doc.ecommerce_gstin",
"insert_after": "ecommerce_gstin",
"print_hide": 1,
"translatable": 0,
"is_virtual": 1,
"read_only": 1,
},
{
"fieldname": "gst_col_break",
"fieldtype": "Column Break",
Expand Down Expand Up @@ -547,6 +592,20 @@
"translatable": 0,
},
],
(
"Sales Taxes and Charges",
"Purchase Taxes and Charges",
"Advance Taxes and Charges",
): [
{
"fieldname": "gst_tax_type",
"label": "GST Tax Type",
"fieldtype": "Data",
"insert_after": "rate",
"read_only": 1,
"translatable": 0,
},
],
"Purchase Invoice": [
{
"fieldname": "gst_section",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from erpnext.controllers.accounts_controller import AccountsController
from erpnext.controllers.taxes_and_totals import get_round_off_applicable_accounts

from india_compliance.gst_india.constants import GST_TAX_TYPES
from india_compliance.gst_india.overrides.ineligible_itc import (
update_landed_cost_voucher_for_gst_expense,
update_regional_gl_entries,
Expand All @@ -21,6 +22,7 @@
from india_compliance.gst_india.overrides.transaction import (
ItemGSTDetails,
ItemGSTTreatment,
set_gst_tax_type,
validate_charge_type_for_cess_non_advol_accounts,
)
from india_compliance.gst_india.utils import get_gst_accounts_by_type
Expand All @@ -41,12 +43,11 @@ def set_item_wise_tax_details(self):
if (
not row.tax_amount
or not row.item_wise_tax_rates
or row.account_head not in self.gst_account_map
or row.gst_tax_type not in GST_TAX_TYPES
):
continue

account_type = self.gst_account_map[row.account_head]
tax = account_type[:-8]
tax = row.gst_tax_type
tax_rate_field = f"{tax}_rate"
tax_amount_field = f"{tax}_amount"

Expand Down Expand Up @@ -113,6 +114,7 @@ def onload(self):

def before_validate(self):
self.set_taxes_and_totals()
set_gst_tax_type(self)

def before_save(self):
update_gst_details(self)
Expand Down Expand Up @@ -287,9 +289,7 @@ def validate_taxes(self):
).format(tax.idx)
)

validate_charge_type_for_cess_non_advol_accounts(
[input_accounts.cess_non_advol_account], tax
)
validate_charge_type_for_cess_non_advol_accounts(tax)

if tax.charge_type != "Actual":
continue
Expand All @@ -306,9 +306,7 @@ def validate_taxes(self):

# validating total tax
total_tax = 0
is_non_cess_advol = (
tax.account_head == input_accounts.cess_non_advol_account
)
is_non_cess_advol = tax.gst_tax_type == "cess_non_advol"

for item, rate in item_wise_tax_rates.items():
multiplier = (
Expand Down Expand Up @@ -516,6 +514,7 @@ def set_missing_values(source, target):
"charge_type": "On Net Total",
"account_head": input_igst_account,
"rate": rate,
"gst_tax_type": "igst",
"description": description,
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"account_head",
"section_break_10",
"rate",
"gst_tax_type",
"column_break_pipk",
"tax_amount",
"total",
Expand Down Expand Up @@ -89,11 +90,17 @@
"fieldtype": "Code",
"hidden": 1,
"label": "Item Wise Tax Rates"
},
{
"fieldname": "gst_tax_type",
"fieldtype": "Data",
"label": "GST Tax Type",
"read_only": 1
}
],
"istable": 1,
"links": [],
"modified": "2024-03-19 19:21:46.068235",
"modified": "2024-06-12 18:03:36.955731",
"modified_by": "Administrator",
"module": "GST India",
"name": "Bill of Entry Taxes",
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"actions": [],
"allow_rename": 1,
"creation": "2024-05-24 10:38:39.591721",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"autofield",
"autofield_value"
],
"fields": [
{
"allow_in_quick_entry": 1,
"columns": 2,
"fieldname": "autofield",
"fieldtype": "Autocomplete",
"in_list_view": 1,
"search_index": 1
},
{
"columns": 2,
"fieldname": "autofield_value",
"fieldtype": "Data",
"in_list_view": 1
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2024-06-05 14:29:47.327389",
"modified_by": "Administrator",
"module": "GST India",
"name": "Company Print Options",
"owner": "Administrator",
"permissions": [],
"sort_field": "creation",
"sort_order": "DESC",
"states": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2024, Resilient Tech and contributors
# For license information, please see license.txt

# import frappe
from frappe.model.document import Document


class CompanyPrintOptions(Document):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"hsn_wise_tax_breakup",
"enable_reverse_charge_in_sales",
"enable_overseas_transactions",
"enable_sales_through_ecommerce_operators",
"round_off_gst_values",
"require_supplier_invoice_no",
"column_break_4",
Expand Down Expand Up @@ -567,6 +568,12 @@
"hidden": 1,
"label": "Is Retry e-Invoice/e-Waybill Pending"
},
{
"default": "0",
"fieldname": "enable_sales_through_ecommerce_operators",
"fieldtype": "Check",
"label": "Enable Sales through E-commerce Operators"
},
{
"fieldname": "gstr_1_section_break",
"fieldtype": "Section Break",
Expand Down Expand Up @@ -609,7 +616,7 @@
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2024-06-09 17:27:54.720233",
"modified": "2024-06-09 17:28:54.720233",
"modified_by": "Administrator",
"module": "GST India",
"name": "GST Settings",
Expand All @@ -635,7 +642,7 @@
}
],
"quick_entry": 1,
"sort_field": "modified",
"sort_field": "creation",
"sort_order": "DESC",
"states": [],
"track_changes": 1
Expand Down
Loading

0 comments on commit 2ddb1bf

Please sign in to comment.