fix(reports): Made gstr1 ready for govt portal
This commit is contained in:
parent
1b49f3a4e7
commit
a2a6568b7e
@ -15,6 +15,7 @@
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@ -47,11 +48,12 @@
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 2,
|
||||
"fetch_from": "payment_term.description",
|
||||
"fetch_from": "",
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 0,
|
||||
@ -80,6 +82,7 @@
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@ -112,11 +115,12 @@
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 2,
|
||||
"fetch_from": "payment_term.invoice_portion",
|
||||
"fetch_from": "",
|
||||
"fieldname": "invoice_portion",
|
||||
"fieldtype": "Percent",
|
||||
"hidden": 0,
|
||||
@ -145,6 +149,7 @@
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@ -177,6 +182,7 @@
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@ -218,7 +224,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2018-05-25 22:43:31.890251",
|
||||
"modified": "2018-09-06 17:35:44.580209",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Payment Schedule",
|
||||
@ -232,5 +238,6 @@
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1,
|
||||
"track_seen": 0
|
||||
"track_seen": 0,
|
||||
"track_views": 0
|
||||
}
|
@ -6,7 +6,6 @@ cur_frm.pformat.print_heading = 'Invoice';
|
||||
|
||||
{% include 'erpnext/selling/sales_common.js' %};
|
||||
|
||||
cur_frm.add_fetch('customer', 'tax_id', 'tax_id');
|
||||
|
||||
frappe.provide("erpnext.accounts");
|
||||
erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.extend({
|
||||
@ -544,6 +543,9 @@ cur_frm.set_query("asset", "items", function(doc, cdt, cdn) {
|
||||
|
||||
frappe.ui.form.on('Sales Invoice', {
|
||||
setup: function(frm){
|
||||
frm.add_fetch('customer', 'tax_id', 'tax_id');
|
||||
frm.add_fetch('payment_term', 'invoice_portion', 'invoice_portion');
|
||||
frm.add_fetch('payment_term', 'description', 'description');
|
||||
|
||||
frm.custom_make_buttons = {
|
||||
'Delivery Note': 'Delivery',
|
||||
|
@ -4,8 +4,9 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe, json
|
||||
from frappe import _
|
||||
from frappe.utils import flt
|
||||
from frappe.utils import flt, formatdate
|
||||
from datetime import date
|
||||
from six import iteritems
|
||||
|
||||
def execute(filters=None):
|
||||
return Gstr1Report(filters).run()
|
||||
@ -73,12 +74,17 @@ class Gstr1Report(object):
|
||||
row.append(abs(invoice_details.base_rounded_total) or abs(invoice_details.base_grand_total))
|
||||
elif fieldname == "invoice_value":
|
||||
row.append(invoice_details.base_rounded_total or invoice_details.base_grand_total)
|
||||
elif fieldname in ('posting_date', 'shipping_bill_date'):
|
||||
row.append(formatdate(invoice_details.get(fieldname), 'dd-MMM-YY'))
|
||||
elif fieldname == "export_type":
|
||||
export_type = "WPAY" if invoice_details.get(fieldname)=="With Payment of Tax" else "WOPAY"
|
||||
row.append(export_type)
|
||||
else:
|
||||
row.append(invoice_details.get(fieldname))
|
||||
|
||||
taxable_value = sum([abs(net_amount)
|
||||
for item_code, net_amount in self.invoice_items.get(invoice).items() if item_code in items])
|
||||
row += [tax_rate, taxable_value]
|
||||
row += [tax_rate or 0, taxable_value]
|
||||
|
||||
return row, taxable_value
|
||||
|
||||
@ -195,6 +201,12 @@ class Gstr1Report(object):
|
||||
if unidentified_gst_accounts:
|
||||
frappe.msgprint(_("Following accounts might be selected in GST Settings:")
|
||||
+ "<br>" + "<br>".join(unidentified_gst_accounts), alert=True)
|
||||
|
||||
# Build itemised tax for export invoices where tax table is blank
|
||||
for invoice, items in iteritems(self.invoice_items):
|
||||
if invoice not in self.items_based_on_tax_rate \
|
||||
and frappe.db.get_value(self.doctype, invoice, "export_type") == "Without Payment of Tax":
|
||||
self.items_based_on_tax_rate.setdefault(invoice, {}).setdefault(0, items.keys())
|
||||
|
||||
def get_gst_accounts(self):
|
||||
self.gst_accounts = frappe._dict()
|
||||
@ -250,7 +262,7 @@ class Gstr1Report(object):
|
||||
{
|
||||
"fieldname": "posting_date",
|
||||
"label": "Invoice date",
|
||||
"fieldtype": "Date",
|
||||
"fieldtype": "Data",
|
||||
"width":80
|
||||
},
|
||||
{
|
||||
@ -261,7 +273,7 @@ class Gstr1Report(object):
|
||||
},
|
||||
{
|
||||
"fieldname": "place_of_supply",
|
||||
"label": "Place of Supply",
|
||||
"label": "Place Of Supply",
|
||||
"fieldtype": "Data",
|
||||
"width":100
|
||||
},
|
||||
@ -303,7 +315,7 @@ class Gstr1Report(object):
|
||||
{
|
||||
"fieldname": "posting_date",
|
||||
"label": "Invoice date",
|
||||
"fieldtype": "Date",
|
||||
"fieldtype": "Data",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
@ -314,7 +326,7 @@ class Gstr1Report(object):
|
||||
},
|
||||
{
|
||||
"fieldname": "place_of_supply",
|
||||
"label": "Place of Supply",
|
||||
"label": "Place Of Supply",
|
||||
"fieldtype": "Data",
|
||||
"width": 120
|
||||
},
|
||||
@ -357,7 +369,7 @@ class Gstr1Report(object):
|
||||
{
|
||||
"fieldname": "posting_date",
|
||||
"label": "Invoice/Advance Receipt date",
|
||||
"fieldtype": "Date",
|
||||
"fieldtype": "Data",
|
||||
"width": 120
|
||||
},
|
||||
{
|
||||
@ -367,12 +379,6 @@ class Gstr1Report(object):
|
||||
"options": "Sales Invoice",
|
||||
"width":120
|
||||
},
|
||||
{
|
||||
"fieldname": "posting_date",
|
||||
"label": "Invoice/Advance Receipt date",
|
||||
"fieldtype": "Date",
|
||||
"width": 120
|
||||
},
|
||||
{
|
||||
"fieldname": "reason_for_issuing_document",
|
||||
"label": "Reason For Issuing document",
|
||||
@ -381,7 +387,7 @@ class Gstr1Report(object):
|
||||
},
|
||||
{
|
||||
"fieldname": "place_of_supply",
|
||||
"label": "Place of Supply",
|
||||
"label": "Place Of Supply",
|
||||
"fieldtype": "Data",
|
||||
"width": 120
|
||||
},
|
||||
@ -416,7 +422,7 @@ class Gstr1Report(object):
|
||||
self.invoice_columns = [
|
||||
{
|
||||
"fieldname": "place_of_supply",
|
||||
"label": "Place of Supply",
|
||||
"label": "Place Of Supply",
|
||||
"fieldtype": "Data",
|
||||
"width": 120
|
||||
},
|
||||
@ -459,7 +465,7 @@ class Gstr1Report(object):
|
||||
{
|
||||
"fieldname": "posting_date",
|
||||
"label": "Invoice date",
|
||||
"fieldtype": "Date",
|
||||
"fieldtype": "Data",
|
||||
"width": 120
|
||||
},
|
||||
{
|
||||
@ -483,7 +489,7 @@ class Gstr1Report(object):
|
||||
{
|
||||
"fieldname": "shipping_bill_date",
|
||||
"label": "Shipping Bill Date",
|
||||
"fieldtype": "Date",
|
||||
"fieldtype": "Data",
|
||||
"width": 120
|
||||
}
|
||||
]
|
||||
|
@ -1,17 +1,17 @@
|
||||
{
|
||||
"add_total_row": 1,
|
||||
"apply_user_permissions": 1,
|
||||
"creation": "2014-10-10 17:58:11.577901",
|
||||
"disabled": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "Report",
|
||||
"idx": 2,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2017-02-24 20:10:13.764665",
|
||||
"modified": "2018-08-14 15:24:41.395557",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Stock Balance",
|
||||
"owner": "Administrator",
|
||||
"prepared_report": 1,
|
||||
"ref_doctype": "Stock Ledger Entry",
|
||||
"report_name": "Stock Balance",
|
||||
"report_type": "Script Report",
|
||||
|
Loading…
x
Reference in New Issue
Block a user