Skip to content

Commit

Permalink
feat: make purchase invoice from irn
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanket322 committed Sep 20, 2024
1 parent 589b19c commit fcbaa8d
Show file tree
Hide file tree
Showing 9 changed files with 434 additions and 2 deletions.
46 changes: 45 additions & 1 deletion india_compliance/gst_india/client_scripts/purchase_invoice.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,16 @@ frappe.ui.form.on(DOCTYPE, {
});
},

onload: toggle_reverse_charge,
onload: function(frm) {
toggle_reverse_charge(frm);

if (frm.is_new()) {
frm.add_custom_button(
__("Create Purchase Invoice"),
() => get_irn_dialog(frm),
);
}
},

gst_category(frm) {
validate_gst_hsn_code(frm);
Expand Down Expand Up @@ -103,6 +112,41 @@ frappe.ui.form.on("Purchase Invoice Item", {
gst_hsn_code: validate_gst_hsn_code,
});


function get_irn_dialog(frm) {
const dialog = new frappe.ui.Dialog({
title: __("Create Purchase Invoice"),
fields: [
{
label: "IRN",
fieldname: "irn",
fieldtype: "Data",
reqd: 1,
},
{
label: "Company GSTIN",
fieldname: "gstin",
fieldtype: "Data",
reqd: 1,
}
],
primary_action(values) {
taxpayer_api.call(
method ="india_compliance.gst_india.overrides.purchase_invoice.create_purchase_invoice_from_irn",
args= {
company_gstin: values.gstin,
irn: values.irn,
},
function (r){
dialog.hide();
frappe.set_route("purchase-invoice", r.message);
},
);
},
});
dialog.show();
}

function toggle_reverse_charge(frm) {
let is_read_only = 0;
if (frm.doc.gst_category !== "Overseas") is_read_only = 0;
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) 2024, Resilient Tech and contributors
// For license information, please see license.txt

// frappe.ui.form.on("e-Invoice Mapping", {
// refresh(frm) {

// },
// });
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"actions": [],
"allow_rename": 1,
"creation": "2024-09-20 15:05:52.401445",
"doctype": "DocType",
"engine": "InnoDB",
"field_order": [
"party_type",
"party",
"erpnext_fieldname",
"erpnext_value",
"log_value"
],
"fields": [
{
"fieldname": "party_type",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Party Type",
"options": "DocType"
},
{
"fieldname": "party",
"fieldtype": "Dynamic Link",
"in_list_view": 1,
"label": "Party",
"options": "party_type"
},
{
"fieldname": "erpnext_fieldname",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Erpnext Fieldname"
},
{
"fieldname": "erpnext_value",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Erpnext Value"
},
{
"fieldname": "log_value",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Log Value"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2024-09-20 15:09:27.296167",
"modified_by": "Administrator",
"module": "GST India",
"name": "e-Invoice Mapping",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"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 eInvoiceMapping(Document):
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2024, Resilient Tech and Contributors
# See license.txt

# import frappe
from frappe.tests.utils import FrappeTestCase


class TesteInvoiceMapping(FrappeTestCase):
pass
Loading

0 comments on commit fcbaa8d

Please sign in to comment.