Merge pull request #18691 from deepeshgarg007/gstr-3b-non-gst-v12
fix: GSTR 3B report fixes
This commit is contained in:
commit
cd7a89da32
@ -39,6 +39,10 @@ frappe.ui.form.on('GSTR 3B Report', {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let current_year = new Date().getFullYear();
|
||||||
|
let options = [current_year, current_year-1, current_year-2];
|
||||||
|
frm.set_df_property('year', 'options', options);
|
||||||
},
|
},
|
||||||
|
|
||||||
setup: function(frm) {
|
setup: function(frm) {
|
||||||
|
@ -1,259 +1,73 @@
|
|||||||
{
|
{
|
||||||
"allow_copy": 0,
|
|
||||||
"allow_events_in_timeline": 0,
|
|
||||||
"allow_guest_to_view": 0,
|
|
||||||
"allow_import": 0,
|
|
||||||
"allow_rename": 0,
|
|
||||||
"autoname": "format:GSTR3B-{month}-{year}-{company_address}",
|
"autoname": "format:GSTR3B-{month}-{year}-{company_address}",
|
||||||
"beta": 0,
|
|
||||||
"creation": "2019-02-04 11:35:55.964639",
|
"creation": "2019-02-04 11:35:55.964639",
|
||||||
"custom": 0,
|
|
||||||
"docstatus": 0,
|
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"document_type": "",
|
|
||||||
"editable_grid": 1,
|
"editable_grid": 1,
|
||||||
"engine": "InnoDB",
|
"engine": "InnoDB",
|
||||||
|
"field_order": [
|
||||||
|
"company",
|
||||||
|
"company_address",
|
||||||
|
"year",
|
||||||
|
"month",
|
||||||
|
"json_output",
|
||||||
|
"missing_field_invoices"
|
||||||
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_in_quick_entry": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "company",
|
"fieldname": "company",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Company",
|
"label": "Company",
|
||||||
"length": 0,
|
"options": "Company"
|
||||||
"no_copy": 0,
|
|
||||||
"options": "Company",
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_in_quick_entry": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "company_address",
|
"fieldname": "company_address",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Company Address",
|
"label": "Company Address",
|
||||||
"length": 0,
|
"options": "Address"
|
||||||
"no_copy": 0,
|
|
||||||
"options": "Address",
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_in_quick_entry": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "year",
|
"fieldname": "year",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Select",
|
||||||
"hidden": 0,
|
"label": "Year"
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Year",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_in_quick_entry": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "month",
|
"fieldname": "month",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Month",
|
"label": "Month",
|
||||||
"length": 0,
|
"options": "January\nFebruary\nMarch\nApril\nMay\nJune\nJuly\nAugust\nSeptember\nOctober\nNovember\nDecember"
|
||||||
"no_copy": 0,
|
|
||||||
"options": "January\nFebruary\nMarch\nApril\nMay\nJune\nJuly\nAugust\nSeptember\nOctober\nNovember\nDecember",
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_in_quick_entry": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "json_output",
|
"fieldname": "json_output",
|
||||||
"fieldtype": "Code",
|
"fieldtype": "Code",
|
||||||
"hidden": 0,
|
"label": "JSON Output"
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "JSON Output",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_in_quick_entry": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "missing_field_invoices",
|
"fieldname": "missing_field_invoices",
|
||||||
"fieldtype": "Small Text",
|
"fieldtype": "Small Text",
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Invoices with no Place Of Supply",
|
"label": "Invoices with no Place Of Supply",
|
||||||
"length": 0,
|
"read_only": 1
|
||||||
"no_copy": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 1,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"has_web_view": 0,
|
"modified": "2019-08-10 22:30:26.727038",
|
||||||
"hide_heading": 0,
|
|
||||||
"hide_toolbar": 0,
|
|
||||||
"idx": 0,
|
|
||||||
"image_view": 0,
|
|
||||||
"in_create": 0,
|
|
||||||
"is_submittable": 0,
|
|
||||||
"issingle": 0,
|
|
||||||
"istable": 0,
|
|
||||||
"max_attachments": 0,
|
|
||||||
"modified": "2019-03-04 10:04:44.767655",
|
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Regional",
|
"module": "Regional",
|
||||||
"name": "GSTR 3B Report",
|
"name": "GSTR 3B Report",
|
||||||
"name_case": "",
|
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
{
|
{
|
||||||
"amend": 0,
|
|
||||||
"cancel": 0,
|
|
||||||
"create": 1,
|
"create": 1,
|
||||||
"delete": 1,
|
"delete": 1,
|
||||||
"email": 1,
|
"email": 1,
|
||||||
"export": 1,
|
"export": 1,
|
||||||
"if_owner": 0,
|
|
||||||
"import": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"print": 1,
|
"print": 1,
|
||||||
"read": 1,
|
"read": 1,
|
||||||
"report": 1,
|
"report": 1,
|
||||||
"role": "System Manager",
|
"role": "System Manager",
|
||||||
"set_user_permissions": 0,
|
|
||||||
"share": 1,
|
"share": 1,
|
||||||
"submit": 0,
|
|
||||||
"write": 1
|
"write": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"quick_entry": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"read_only_onload": 0,
|
|
||||||
"show_name_in_global_search": 0,
|
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
"sort_order": "DESC",
|
"sort_order": "DESC",
|
||||||
"track_changes": 1,
|
"track_changes": 1
|
||||||
"track_seen": 0,
|
|
||||||
"track_views": 0
|
|
||||||
}
|
}
|
@ -329,9 +329,10 @@ class GSTR3BReport(Document):
|
|||||||
d.gst_category, []
|
d.gst_category, []
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if d.place_of_supply:
|
||||||
if state_number != d.place_of_supply.split("-")[0]:
|
if state_number != d.place_of_supply.split("-")[0]:
|
||||||
inter_state_supply_details[d.gst_category].append({
|
inter_state_supply_details[d.gst_category].append({
|
||||||
"pos": d.place_of_supply,
|
"pos": d.place_of_supply.split("-")[0],
|
||||||
"txval": flt(d.total, 2),
|
"txval": flt(d.total, 2),
|
||||||
"iamt": flt(inter_state_supply_tax_mapping.get(d.place_of_supply), 2)
|
"iamt": flt(inter_state_supply_tax_mapping.get(d.place_of_supply), 2)
|
||||||
})
|
})
|
||||||
@ -345,12 +346,12 @@ class GSTR3BReport(Document):
|
|||||||
|
|
||||||
def get_inward_nil_exempt(self, state):
|
def get_inward_nil_exempt(self, state):
|
||||||
|
|
||||||
inward_nil_exempt = frappe.db.sql(""" select a.gst_state, sum(i.base_amount) as base_amount,
|
inward_nil_exempt = frappe.db.sql(""" select p.place_of_supply, sum(i.base_amount) as base_amount,
|
||||||
i.is_nil_exempt, i.is_non_gst from `tabPurchase Invoice` p , `tabPurchase Invoice Item` i, `tabAddress` a
|
i.is_nil_exempt, i.is_non_gst from `tabPurchase Invoice` p , `tabPurchase Invoice Item` i
|
||||||
where p.docstatus = 1 and p.name = i.parent and p.supplier_address = a.name
|
where p.docstatus = 1 and p.name = i.parent
|
||||||
and i.is_nil_exempt = 1 or i.is_non_gst = 1 and
|
and i.is_nil_exempt = 1 or i.is_non_gst = 1 and
|
||||||
month(p.posting_date) = %s and year(p.posting_date) = %s and p.company = %s and p.company_gstin = %s
|
month(p.posting_date) = %s and year(p.posting_date) = %s and p.company = %s and p.company_gstin = %s
|
||||||
group by a.gst_state """, (self.month_no, self.year, self.company, self.gst_details.get("gstin")), as_dict=1)
|
group by p.place_of_supply """, (self.month_no, self.year, self.company, self.gst_details.get("gstin")), as_dict=1)
|
||||||
|
|
||||||
inward_nil_exempt_details = {
|
inward_nil_exempt_details = {
|
||||||
"gst": {
|
"gst": {
|
||||||
@ -364,14 +365,15 @@ class GSTR3BReport(Document):
|
|||||||
}
|
}
|
||||||
|
|
||||||
for d in inward_nil_exempt:
|
for d in inward_nil_exempt:
|
||||||
if d.is_nil_exempt == 1 and state == d.gst_state:
|
if d.place_of_supply:
|
||||||
|
if d.is_nil_exempt == 1 and state == d.place_of_supply.split("-")[1]:
|
||||||
inward_nil_exempt_details["gst"]["intra"] += d.base_amount
|
inward_nil_exempt_details["gst"]["intra"] += d.base_amount
|
||||||
elif d.is_nil_exempt == 1 and state != d.gst_state:
|
elif d.is_nil_exempt == 1 and state != d.place_of_supply.split("-")[1]:
|
||||||
inward_nil_exempt_details["gst"]["inter"] += d.base_amount
|
inward_nil_exempt_details["gst"]["inter"] += d.base_amount
|
||||||
elif d.is_non_gst == 1 and state == d.gst_state:
|
elif d.is_non_gst == 1 and state == d.place_of_supply.split("-")[1]:
|
||||||
inward_nil_exempt_details["non_gst"]["inter"] += d.base_amount
|
|
||||||
elif d.is_non_gst == 1 and state != d.gst_state:
|
|
||||||
inward_nil_exempt_details["non_gst"]["intra"] += d.base_amount
|
inward_nil_exempt_details["non_gst"]["intra"] += d.base_amount
|
||||||
|
elif d.is_non_gst == 1 and state != d.place_of_supply.split("-")[1]:
|
||||||
|
inward_nil_exempt_details["non_gst"]["inter"] += d.base_amount
|
||||||
|
|
||||||
return inward_nil_exempt_details
|
return inward_nil_exempt_details
|
||||||
|
|
||||||
|
@ -176,6 +176,9 @@ def create_purchase_invoices():
|
|||||||
do_not_save=1
|
do_not_save=1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
pi1.shipping_address = "_Test Supplier GST-1-Billing"
|
||||||
|
pi1.save()
|
||||||
|
|
||||||
pi1.submit()
|
pi1.submit()
|
||||||
|
|
||||||
def make_suppliers():
|
def make_suppliers():
|
||||||
@ -218,6 +221,7 @@ def make_suppliers():
|
|||||||
"link_name": "_Test Registered Supplier"
|
"link_name": "_Test Registered Supplier"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
address.is_shipping_address = 1
|
||||||
address.save()
|
address.save()
|
||||||
|
|
||||||
if not frappe.db.exists('Address', '_Test Supplier GST-2-Billing'):
|
if not frappe.db.exists('Address', '_Test Supplier GST-2-Billing'):
|
||||||
|
Loading…
Reference in New Issue
Block a user