diff --git a/india_compliance/gst_india/client_scripts/e_waybill_actions.js b/india_compliance/gst_india/client_scripts/e_waybill_actions.js index 6beac8d68..c3ac7b7f5 100644 --- a/india_compliance/gst_india/client_scripts/e_waybill_actions.js +++ b/india_compliance/gst_india/client_scripts/e_waybill_actions.js @@ -535,6 +535,29 @@ function get_sub_suppy_type_options(frm) { sub_supply_type = ["Job Work", "SKD/CKD", "Others"]; } } + } else if (frm.doctype === "Stock Entry") { + document_type = "Delivery Challan"; + + if (frm.doc.purpose === "Send to Subcontractor") { + supply_type = "Outward"; + sub_supply_type = ["Job Work"]; + } else if (["Material Transfer", "Material Issue"].includes(frm.doc.purpose)) { + const same_gstin = frm.doc.bill_from_gstin === frm.doc.bill_to_gstin; + + if (frm.doc.is_return) { + supply_type = "Inward"; + sub_supply_type = ["Job Work Returns"]; + } else if (same_gstin) { + supply_type = "Outward"; + sub_supply_type = [ + "For Own Use", + "Exhibition or Fairs", + "Line Sales", + "Recipient Not Known", + "Others", + ]; + } + } } else { const key = `${frm.doctype}_${frm.doc.is_return || 0}`; const default_supply_types = { @@ -570,11 +593,6 @@ function get_sub_suppy_type_options(frm) { sub_supply_desc: "Purchase Return", document_type: "Delivery Challan", }, - "Stock Entry_0": { - supply_type: "Outward", - sub_supply_type: ["Job Work"], - document_type: "Delivery Challan", - }, "Subcontracting Receipt_0": { supply_type: "Inward", sub_supply_type: ["Job Work Returns"], @@ -587,7 +605,7 @@ function get_sub_suppy_type_options(frm) { }, }; - return default_supply_types[key] + return default_supply_types[key]; } return { supply_type, sub_supply_type, sub_supply_desc, document_type }; diff --git a/india_compliance/gst_india/client_scripts/e_waybill_applicability.js b/india_compliance/gst_india/client_scripts/e_waybill_applicability.js index 467e1b166..cda18bb84 100644 --- a/india_compliance/gst_india/client_scripts/e_waybill_applicability.js +++ b/india_compliance/gst_india/client_scripts/e_waybill_applicability.js @@ -243,7 +243,9 @@ class StockEntryEwaybill extends EwaybillApplicability { if ( !gst_settings.enable_e_waybill || !gst_settings.enable_e_waybill_for_sc || - this.frm.doc.purpose !== "Send to Subcontractor" + !["Material Transfer", "Material Issue", "Send to Subcontractor"].includes( + this.frm.doc.purpose + ) ) return false; @@ -282,17 +284,32 @@ class StockEntryEwaybill extends EwaybillApplicability { let is_ewb_generatable = this.is_e_waybill_applicable(show_message); let message_list = []; + const same_gstin = this.frm.doc.bill_from_gstin === this.frm.doc.bill_to_gstin; if (!this.frm.doc.bill_to_address) { is_ewb_generatable = false; message_list.push("Bill To address is mandatory to generate e-Waybill."); } - if (this.frm.doc.bill_from_gstin === this.frm.doc.bill_to_gstin) { + if ( + (this.frm.doc.purpose === "Send to Subcontractor" || + (this.frm.doc.purpose === "Material Transfer" && + this.frm.doc.is_return)) && + same_gstin + ) { is_ewb_generatable = false; message_list.push("Bill From GSTIN and Bill To GSTIN are same."); } + if ( + ["Material Transfer", "Material Issue"].includes(this.frm.doc.purpose) && + !this.frm.doc.is_return && + !same_gstin + ) { + is_ewb_generatable = false; + message_list.push("Bill From GSTIN and Bill To GSTIN are different."); + } + if (show_message) { this.frm._ewb_message += message_list .map(message => `
  • ${message}
  • `) @@ -304,7 +321,9 @@ class StockEntryEwaybill extends EwaybillApplicability { is_e_waybill_api_enabled() { return ( - this.frm.doc.purpose == "Send to Subcontractor" && + ["Material Transfer", "Material Issue", "Send to Subcontractor"].includes( + this.frm.doc.purpose + ) && super.is_e_waybill_api_enabled() && gst_settings.enable_e_waybill_for_sc ); diff --git a/india_compliance/gst_india/client_scripts/stock_entry.js b/india_compliance/gst_india/client_scripts/stock_entry.js index 5c64619f0..c3a050bb3 100644 --- a/india_compliance/gst_india/client_scripts/stock_entry.js +++ b/india_compliance/gst_india/client_scripts/stock_entry.js @@ -34,6 +34,11 @@ frappe.ui.form.on(DOCTYPE, { filters: get_filters_for_relevant_stock_entries(doc), }; }); + + // No event trigger are called when form is new + if (frm.is_new()) { + frm.trigger("bill_to_address"); + } }, onload(frm) { @@ -44,8 +49,7 @@ frappe.ui.form.on(DOCTYPE, { on_change_set_address( frm, "supplier_address", - "bill_to_address", - __("Bill To (same as Supplier Address)"), + ...get_field_and_label(frm, "party_field"), __("Bill To") ); }, @@ -72,8 +76,7 @@ frappe.ui.form.on(DOCTYPE, { on_change_set_address( frm, "supplier_address", - "bill_to_address", - __("Bill To (same as Supplier Address)"), + ...get_field_and_label(frm, "party_field"), __("Bill To") ); }, @@ -107,7 +110,10 @@ frappe.ui.form.on(DOCTYPE, { name: frm.doc.company, }, callback(r) { - frm.set_value("bill_from_address", r.message); + frm.set_value( + get_field_and_label(frm, "company_field")[0], + r.message + ); }, }); } @@ -190,3 +196,24 @@ function get_filters_for_relevant_stock_entries(doc) { function get_items(doc) { return Array.from(new Set(doc.items.map(row => row.item_code))); } + +function get_field_and_label(frm, field) { + let field_label_dict = {}; + + if (frm.doc.purpose === "Material Transfer" && frm.doc.is_return) { + field_label_dict = { + party_field: [ + "bill_from_address", + __("Bill From (same as Supplier Address)"), + ], + company_field: ["bill_to_address", __("Bill To")], + }; + } else { + field_label_dict = { + party_field: ["bill_to_address", __("Bill To (same as Supplier Address)")], + company_field: ["bill_from_address", __("Bill From")], + }; + } + + return field_label_dict[field]; +} diff --git a/india_compliance/gst_india/constants/custom_fields.py b/india_compliance/gst_india/constants/custom_fields.py index 4b418a17e..ce80919da 100644 --- a/india_compliance/gst_india/constants/custom_fields.py +++ b/india_compliance/gst_india/constants/custom_fields.py @@ -181,14 +181,14 @@ "label": "Taxes", "fieldtype": "Section Break", "insert_after": "get_stock_and_rate", - "depends_on": "eval:doc.subcontracting_order", + "depends_on": "eval: india_compliance.is_e_waybill_generatable_for_subcontracting(doc)", }, { "label": "E-Waybill Info", "fieldname": "tab_break_ewaybill", "fieldtype": "Tab Break", "insert_after": "address_display", - "depends_on": "eval:doc.purpose === 'Send to Subcontractor'", + "depends_on": "eval: india_compliance.is_e_waybill_generatable_for_subcontracting(doc)", }, { "label": "e-Waybill Address", diff --git a/india_compliance/gst_india/data/test_e_waybill.json b/india_compliance/gst_india/data/test_e_waybill.json index 82ddb123b..784e3d416 100644 --- a/india_compliance/gst_india/data/test_e_waybill.json +++ b/india_compliance/gst_india/data/test_e_waybill.json @@ -1164,5 +1164,93 @@ }, "success": true } + }, + "stock_entry_with_same_gstin": { + "kwargs": { + "stock_entry_type": "Material Transfer", + "purpose": "Material Transfer", + "bill_from_address": "_Test Indian Registered Company-Billing", + "bill_to_address": "_Test Indian Registered Company-Billing", + "items": + [{ + "item_code": "_Test Trading Goods 1", + "qty": 1, + "gst_hsn_code": "61149090", + "s_warehouse": "Finished Goods - _TIRC", + "t_warehouse": "Goods In Transit - _TIRC", + "amount": 100, + "taxable_value": 100 + }], + "company": "_Test Indian Registered Company", + "base_grand_total": 100 + }, + "values": { + "distance": 0.0, + "mode_of_transport": "Road", + "vehicle_no": "GJ07DL9009", + "sub_supply_type": "Job Work" + }, + "request_data": { + "userGstin": "05AAACG2115R1ZN", + "supplyType": "O", + "subSupplyType": 4, + "docType": "CHL", + "docNo": "test_invoice_no", + "docDate": "19/07/2024", + "transactionType": 1, + "fromTrdName": "_Test Indian Registered Company", + "fromGstin": "05AAACG2115R1ZN", + "fromAddr1": "Test Address - 1", + "fromPlace": "Test City", + "fromPincode": 380015, + "fromStateCode": 24, + "actFromStateCode": 24, + "itemList": [ + { + "itemNo": 1, + "productDesc": "Test Trading Goods 1", + "hsnCode": "61149090", + "qtyUnit": "NOS", + "quantity": 1.0, + "taxableAmount": 100.0, + "sgstRate": 0.0, + "cgstRate": 0.0, + "igstRate": 0.0, + "cessRate": 0.0, + "cessNonAdvol": 0.0 + } + ], + "totalValue": 100.0, + "cgstValue": 0, + "sgstValue": 0, + "igstValue": 0, + "cessValue": 0, + "cessNonAdvolValue": 0, + "otherValue": 0.0, + "totInvValue": 100.0, + "toTrdName": "Test Indian Registered Company", + "toGstin": "05AAACG2115R1ZN", + "toAddr1": "Test Address - 1", + "toPlace": "Test City", + "toPincode": 380015, + "toStateCode": 24, + "actToStateCode": 24, + "transMode": 1, + "transDistance": 1, + "vehicleNo": "GJ07DL9009", + "mainHsnCode": "61149090", + "vehicleType": "R" + }, + "params": "action=GENEWAYBILL", + "response_data": { + "message": "E-Way Bill is generated successfully", + "result": { + "alert": "", + "ewayBillDate": "08/08/2023 03:30:00 PM", + "ewayBillNo": 341003383265, + "validUpto": "09/08/2023 11:59:00 PM" + }, + "success": true + } } } diff --git a/india_compliance/gst_india/overrides/subcontracting_transaction.py b/india_compliance/gst_india/overrides/subcontracting_transaction.py index 108d797ef..842e4ae5b 100644 --- a/india_compliance/gst_india/overrides/subcontracting_transaction.py +++ b/india_compliance/gst_india/overrides/subcontracting_transaction.py @@ -23,7 +23,11 @@ validate_mandatory_fields, validate_place_of_supply, ) -from india_compliance.gst_india.utils import get_gst_accounts_by_type, is_api_enabled +from india_compliance.gst_india.utils import ( + get_gst_accounts_by_type, + is_api_enabled, + is_outward_material_transfer, +) from india_compliance.gst_india.utils.e_waybill import get_e_waybill_info from india_compliance.gst_india.utils.taxes_controller import ( CustomTaxController, @@ -69,11 +73,18 @@ def after_mapping_subcontracting_order(doc, method, source_doc): def after_mapping_stock_entry(doc, method, source_doc): - if source_doc.doctype == "Subcontracting Order": + if source_doc.doctype != "Subcontracting Order": + doc.taxes_and_charges = "" + doc.taxes = [] + + if doc.purpose != "Material Transfer" or not doc.is_return: return - doc.taxes_and_charges = "" - doc.taxes = [] + doc.bill_to_address = source_doc.billing_address + doc.bill_from_address = source_doc.supplier_address + doc.bill_to_gstin = source_doc.company_gstin + doc.bill_from_gstin = source_doc.supplier_gstin + set_address_display(doc) def before_mapping_subcontracting_receipt(doc, method, source_doc, table_maps): @@ -165,7 +176,7 @@ def onload(doc, method=None): def validate(doc, method=None): - if ignore_gst_validation_for_subcontracting(doc): + if cannot_generate_ewaybill(doc): return if doc.doctype == "Stock Entry" and doc.purpose != "Send to Subcontractor": @@ -192,16 +203,18 @@ def before_submit(doc, method=None): if ignore_gst_validation_for_subcontracting(doc): return - if (doc.doctype == "Stock Entry" and doc.purpose == "Material Transfer") or ( - 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 doc.doctype == "Stock Entry" and doc.purpose != "Material Transfer": + return + if doc.doctype == "Subcontracting Receipt" and doc.is_return: + return + + if not doc.doc_references: + frappe.throw( + _("Please Select Original Document Reference for ITC-04 Reporting"), + title=_("Mandatory Field"), + ) + else: + remove_duplicates(doc) def validate_transaction(doc, method=None): @@ -290,8 +303,11 @@ def validate(self, doc, is_sales_transaction=False): self.validate_for_charge_type() def validate_for_same_party_gstin(self): - company_gstin = self.doc.get("company_gstin") or self.doc.get("bill_from_gstin") - party_gstin = self.doc.get("supplier_gstin") or self.doc.get("bill_to_gstin") + if is_outward_material_transfer(self.doc): + return + + company_gstin = self.doc.get("company_gstin") or self.doc.bill_from_gstin + party_gstin = self.doc.get("supplier_gstin") or self.doc.bill_to_gstin if not party_gstin or company_gstin != party_gstin: return @@ -392,3 +408,20 @@ def remove_duplicates(doc): doc.doc_references = [] for row in references: doc.append("doc_references", dict(link_doctype=row[0], link_name=row[1])) + + +def cannot_generate_ewaybill(doc): + if ( + doc.doctype == "Stock Entry" + and doc.purpose == "Send to Subcontractor" + and not doc.subcontracting_order + ): + return True + if doc.doctype == "Stock Entry" and doc.purpose not in [ + "Material Transfer", + "Material Issue", + "Send to Subcontractor", + ]: + return True + + return ignore_gst_validations(doc) diff --git a/india_compliance/gst_india/overrides/transaction.py b/india_compliance/gst_india/overrides/transaction.py index bc96e87aa..0e27a11aa 100644 --- a/india_compliance/gst_india/overrides/transaction.py +++ b/india_compliance/gst_india/overrides/transaction.py @@ -62,7 +62,6 @@ def set_gst_breakup(doc): def update_taxable_values(doc): - if doc.doctype not in DOCTYPES_WITH_GST_DETAIL: return @@ -787,9 +786,15 @@ def update_party_details(party_details, doctype, company): def get_party_details_for_subcontracting(party_details, doctype, company): party_details = frappe.parse_json(party_details) - party_address_field = ( - "supplier_address" if doctype != "Stock Entry" else "bill_to_address" - ) + if doctype == "Stock Entry": + party_address_field = ( + "bill_from_address" + if party_details.get("is_inward_material_transfer") + else "bill_to_address" + ) + else: + party_address_field = "supplier_address" + party_details[party_address_field] = get_default_address( "Supplier", party_details.supplier ) @@ -819,11 +824,14 @@ def get_gst_details(party_details, doctype, company, *, update_place_of_supply=F - tax template - taxes in the tax template """ - is_sales_transaction = doctype in SALES_DOCTYPES or doctype == "Payment Entry" party_details = frappe.parse_json(party_details) gst_details = frappe._dict() + allow_same_gstin = False + if party_details.get("is_outward_material_transfer_or_issue"): + allow_same_gstin = True + # Party/Address Defaults if is_sales_transaction: company_gstin_field = "company_gstin" @@ -832,10 +840,16 @@ def get_gst_details(party_details, doctype, company, *, update_place_of_supply=F gst_category_field = "gst_category" elif doctype == "Stock Entry": - company_gstin_field = "bill_from_gstin" - party_gstin_field = "bill_to_gstin" - party_address_field = "bill_to_address" - gst_category_field = "bill_to_gst_category" + if party_details.get("is_inward_material_transfer"): + company_gstin_field = "bill_to_gstin" + party_gstin_field = "bill_from_gstin" + party_address_field = "bill_from_address" + gst_category_field = "bill_from_gst_category" + else: + company_gstin_field = "bill_from_gstin" + party_gstin_field = "bill_to_gstin" + party_address_field = "bill_to_address" + gst_category_field = "bill_to_gst_category" else: company_gstin_field = "company_gstin" @@ -879,10 +893,13 @@ def get_gst_details(party_details, doctype, company, *, update_place_of_supply=F # Taxes Not Applicable if ( ( - party_details.get(company_gstin_field) - and party_details.get(company_gstin_field) - == party_details.get(party_gstin_field) - ) # Internal transfer + not allow_same_gstin + and ( + party_details.get(company_gstin_field) + and party_details.get(company_gstin_field) + == party_details.get(party_gstin_field) + ) # Internal transfer + ) or (is_sales_transaction and is_export_without_payment_of_gst(party_details)) or ( not is_sales_transaction @@ -1524,7 +1541,6 @@ def before_print(doc, method=None, print_settings=None): def onload(doc, method=None): - if ignore_gst_validations(doc) or not doc.place_of_supply or not doc.company_gstin: return diff --git a/india_compliance/gst_india/utils/__init__.py b/india_compliance/gst_india/utils/__init__.py index 554485ff1..44913e17e 100644 --- a/india_compliance/gst_india/utils/__init__.py +++ b/india_compliance/gst_india/utils/__init__.py @@ -995,3 +995,12 @@ def get_period(month_or_quarter, year=None): return str(month_or_quarter_no[1]).zfill(2) + str(year) return month_or_quarter_no + + +def is_outward_material_transfer(doc): + if ( + doc.doctype == "Stock Entry" + and doc.purpose in ["Material Transfer", "Material Issue"] + and not doc.is_return + ): + return True diff --git a/india_compliance/gst_india/utils/e_waybill.py b/india_compliance/gst_india/utils/e_waybill.py index 604967e1b..c1432575b 100644 --- a/india_compliance/gst_india/utils/e_waybill.py +++ b/india_compliance/gst_india/utils/e_waybill.py @@ -38,6 +38,7 @@ from india_compliance.gst_india.utils import ( handle_server_errors, is_foreign_doc, + is_outward_material_transfer, load_doc, parse_datetime, send_updated_doc, @@ -1210,7 +1211,6 @@ def get_extend_validity_data(self, values): return extension_details def validate_transaction(self): - super().validate_transaction() if self.doc.ewaybill: @@ -1267,6 +1267,9 @@ def validate_same_gstin(self): if self.doc.doctype == "Delivery Note": return + if is_outward_material_transfer(self.doc): + return + party_gstin_fieldname = ( "billing_address_gstin" if self.doc.doctype in SALES_DOCTYPES @@ -1488,6 +1491,11 @@ def update_transaction_details(self): "sub_supply_type": doc.get("_sub_supply_type", ""), "document_type": "CHL", }, + ("Stock Entry", 1): { + "supply_type": "I", + "sub_supply_type": doc.get("_sub_supply_type", ""), + "document_type": "CHL", + }, ("Subcontracting Receipt", 0): { "supply_type": "I", "sub_supply_type": doc.get("_sub_supply_type", ""), @@ -1634,6 +1642,7 @@ def get_transaction_data(self): ("Delivery Note", 0): (REGISTERED_GSTIN, OTHER_GSTIN), ("Delivery Note", 1): (OTHER_GSTIN, REGISTERED_GSTIN), ("Stock Entry", 0): (REGISTERED_GSTIN, OTHER_GSTIN), + ("Stock Entry", 1): (OTHER_GSTIN, REGISTERED_GSTIN), ("Subcontracting Receipt", 0): (OTHER_GSTIN, REGISTERED_GSTIN), ("Subcontracting Receipt", 1): (REGISTERED_GSTIN, OTHER_GSTIN), } @@ -1643,6 +1652,7 @@ def get_transaction_data(self): { ("Delivery Note", 0): (REGISTERED_GSTIN, REGISTERED_GSTIN), ("Delivery Note", 1): (REGISTERED_GSTIN, REGISTERED_GSTIN), + ("Stock Entry", 0): (REGISTERED_GSTIN, REGISTERED_GSTIN), } ) diff --git a/india_compliance/gst_india/utils/test_e_waybill.py b/india_compliance/gst_india/utils/test_e_waybill.py index 09187fd1d..f00851fc7 100644 --- a/india_compliance/gst_india/utils/test_e_waybill.py +++ b/india_compliance/gst_india/utils/test_e_waybill.py @@ -1050,6 +1050,21 @@ def test_e_waybill_for_stock_entry(self): frappe.get_doc("e-Waybill Log", {"reference_name": stock_entry.name}), ) + @change_settings("GST Settings", {"enable_e_waybill_for_sc": 1}) + @responses.activate + def test_e_waybill_for_stock_entry_same_gstin(self): + """Test to generate e-waybill for Stock Entry with same gstin""" + se_data = self.e_waybill_test_data.get("stock_entry_with_same_gstin") + + stock_entry = self._create_stock_entry("stock_entry_with_same_gstin") + + self._generate_e_waybill(stock_entry.name, "Stock Entry", se_data) + + self.assertDocumentEqual( + {"name": se_data.get("response_data").get("result").get("ewayBillNo")}, + frappe.get_doc("e-Waybill Log", {"reference_name": stock_entry.name}), + ) + def update_dates_for_test_data(test_data): """Update dates in test data""" diff --git a/india_compliance/public/js/taxes_controller.js b/india_compliance/public/js/taxes_controller.js index 6c6717ed0..f0e9d31f7 100644 --- a/india_compliance/public/js/taxes_controller.js +++ b/india_compliance/public/js/taxes_controller.js @@ -193,13 +193,13 @@ india_compliance.taxes_controller = class TaxesController { return ( total + multiplier * (item_wise_tax_rates[item.name] || tax_row.rate) ); - }, 0); + }, 0) || 0; } calculate_total_taxable_value() { return this.frm.doc.items.reduce((total, item) => { return total + item.taxable_value; - }, 0); + }, 0) || 0; } get_value(field, doc, default_value) { diff --git a/india_compliance/public/js/transaction.js b/india_compliance/public/js/transaction.js index 17dd377ea..939ae7bb7 100644 --- a/india_compliance/public/js/transaction.js +++ b/india_compliance/public/js/transaction.js @@ -53,7 +53,7 @@ function fetch_gst_details(doctype) { "is_export_with_gst" ); } else if (doctype === "Stock Entry") { - event_fields.push("bill_from_gstin", "bill_to_address"); + event_fields.push("bill_from_address", "bill_to_address"); } else if (["Subcontracting Order", "Subcontracting Receipt"].includes(doctype)) { event_fields.push("supplier_gstin"); } else { @@ -79,7 +79,13 @@ async function update_gst_details(frm, event) { const party_type = india_compliance.get_party_type(frm.doc.doctype).toLowerCase(); const party_fieldname = frm.doc.doctype === "Quotation" ? "party_name" : party_type; const party = frm.doc[party_fieldname]; - if (!party) return; + + const is_outward_material_transfer_or_issue = + frm.doc.doctype === "Stock Entry" && + ["Material Transfer", "Material Issue"].includes(frm.doc.purpose) && + !frm.doc.is_return; + + if (!party && !is_outward_material_transfer_or_issue) return; if ( [ @@ -136,7 +142,17 @@ async function update_gst_details(frm, event) { "is_export_with_gst" ); } else if (frm.doc.doctype === "Stock Entry") { - fieldnames_to_set.push("bill_from_gstin", "bill_to_gstin", "bill_to_address"); + fieldnames_to_set.push( + "bill_from_gstin", + "bill_to_gstin", + "bill_from_address", + "bill_to_address" + ); + + party_details["is_outward_material_transfer_or_issue"] = + is_outward_material_transfer_or_issue; + party_details["is_inward_material_transfer"] = + frm.doc.purpose === "Material Transfer" && frm.doc.is_return; } else { fieldnames_to_set.push("supplier_address", "supplier_gstin"); } @@ -370,6 +386,7 @@ function _set_e_commerce_ecommerce_supply_type(frm) { function fetch_party_details(doctype) { let company_gstin_field = "company_gstin"; + let is_inward_material_transfer = false; if (doctype === "Stock Entry") { company_gstin_field = "bill_from_gstin"; @@ -377,10 +394,20 @@ function fetch_party_details(doctype) { frappe.ui.form.on(doctype, { supplier(frm) { + if ( + frm.doc.doctype === "Stock Entry" && + frm.doc.purpose === "Material Transfer" && + frm.doc.is_return + ) { + company_gstin_field = "bill_to_gstin"; + is_inward_material_transfer = true; + } + setTimeout(() => { const party_details = { [company_gstin_field]: frm.doc[company_gstin_field], supplier: frm.doc.supplier, + is_inward_material_transfer, }; const args = { party_details: JSON.stringify(party_details), diff --git a/india_compliance/public/js/utils.js b/india_compliance/public/js/utils.js index a889da558..c85cf1e60 100644 --- a/india_compliance/public/js/utils.js +++ b/india_compliance/public/js/utils.js @@ -354,12 +354,10 @@ Object.assign(india_compliance, { return position === "start" ? `${current_year - 1}-03-01` : `${current_year - 1}-09-30`; - } else if (current_month <= 9) { return position === "start" ? `${current_year - 1}-10-01` : `${current_year}-03-31`; - } else { return position === "start" ? `${current_year}-04-01` @@ -415,6 +413,18 @@ Object.assign(india_compliance, { return alert; }, + + is_e_waybill_generatable_for_subcontracting(doc) { + if (doc.purpose == "Send to Subcontractor" && doc.subcontracting_order) { + return true; + } + + if (["Material Transfer", "Material Issue"].includes(doc.purpose)) { + return true; + } + + return false + }, }); function is_gstin_check_digit_valid(gstin) {