Gstr reports (#12940)

* GSTR1 for B2B (#12296)

* [minor] Modified GSTR1 report to identify missing GST Account in GST Settings (#12426)

* [minor] Modified GSTR1 report to identify missing GST Account in GST Settings

* Update gstr_1.py

* GSTR1 for B2B, B2CL and B2CS (#12459)

* [Report] GSTR - 1 CDNR Report (#12554)

* [wip] cdnr

* [WIP] cdnr with optional data

* [wip] Export GSTR-1

* [minor] Minor changes in export

* [new] Custom field added for GST

* [fix] Minor changes in GSTR1 Report

* [minor] Minor changes in gstr1

* [fix] Codacy Fixed

* Update setup.py

* [wip] Gstr2

* [fix] Fetch correct Tax Details

* [minor] ITC data append to row

* [fix] CDNR negative value

* Cleanup and fixes on GSTR-2

* Minor fixes in gstr reports (#12848)

* [new] B2C limit fetch from GST Settings (#12905)

* [new] b2c limit fetch from gst setting

* [fix] Patch Added for b2c limit

* Update gstr_1.py

* Update utils.py

* Cusotm fields related GSTR2

* minor fixes

* minor fixes

* some more fixes

* Added duplicate patch and some tests as not required on develop
This commit is contained in:
Nabin Hait
2018-02-16 13:19:04 +05:30
committed by GitHub
parent cc98d40ff7
commit b95ecd7fcd
22 changed files with 1328 additions and 63 deletions

View File

@@ -87,23 +87,27 @@ def make_custom_fields():
allow_on_submit=1, print_hide=1)
invoice_gst_fields = [
dict(fieldname='gst_section', label='GST Details', fieldtype='Section Break',
insert_after='select_print_heading', print_hide=1, collapsible=1),
insert_after='language', print_hide=1, collapsible=1),
dict(fieldname='invoice_copy', label='Invoice Copy',
fieldtype='Select', insert_after='gst_section', print_hide=1, allow_on_submit=1,
options='Original for Recipient\nDuplicate for Transporter\nDuplicate for Supplier\nTriplicate for Supplier'),
dict(fieldname='reverse_charge', label='Reverse Charge',
fieldtype='Select', insert_after='invoice_copy', print_hide=1,
options='Y\nN', default='N'),
dict(fieldname='gst_col_break', fieldtype='Column Break', insert_after='reverse_charge'),
dict(fieldname='invoice_type', label='Invoice Type',
fieldtype='Select', insert_after='reverse_charge', print_hide=1,
fieldtype='Select', insert_after='invoice_copy', print_hide=1,
options='Regular\nSEZ\nExport\nDeemed Export', default='Regular'),
dict(fieldname='export_type', label='Export Type',
fieldtype='Select', insert_after='invoice_type', print_hide=1,
depends_on='eval:in_list(["SEZ", "Export", "Deemed Export"], doc.invoice_type)',
options='\nWith Payment of Tax\nWithout Payment of Tax'),
dict(fieldname='ecommerce_gstin', label='E-commerce GSTIN',
fieldtype='Data', insert_after='export_type', print_hide=1)
fieldtype='Data', insert_after='export_type', print_hide=1),
dict(fieldname='gst_col_break', fieldtype='Column Break', insert_after='ecommerce_gstin'),
dict(fieldname='reason_for_issuing_document', label='Reason For Issuing document',
fieldtype='Select', insert_after='gst_col_break', print_hide=1,
depends_on='eval:doc.is_return==1',
options='\n01-Sales Return\n02-Post Sale Discount\n03-Deficiency in services\n04-Correction in Invoice\n05-Change in POS\n06-Finalization of Provisional assessment\n07-Others')
]
purchase_invoice_gst_fields = [
@@ -112,7 +116,21 @@ def make_custom_fields():
options='supplier_address.gstin', print_hide=1),
dict(fieldname='company_gstin', label='Company GSTIN',
fieldtype='Data', insert_after='shipping_address',
options='shipping_address.gstin', print_hide=1)
options='shipping_address.gstin', print_hide=1),
dict(fieldname='place_of_supply', label='Place of Supply',
fieldtype='Data', insert_after='shipping_address',
print_hide=1, read_only=0),
dict(fieldname='eligibility_for_itc', label='Eligibility For ITC',
fieldtype='Select', insert_after='reason_for_issuing_document', print_hide=1,
options='input\ninput service\ncapital goods\nineligible', default="ineligible"),
dict(fieldname='itc_integrated_tax', label='Availed ITC Integrated Tax',
fieldtype='Data', insert_after='eligibility_for_itc', print_hide=1),
dict(fieldname='itc_central_tax', label='Availed ITC Central Tax',
fieldtype='Data', insert_after='itc_integrated_tax', print_hide=1),
dict(fieldname='itc_state_tax', label='Availed ITC State/UT Tax',
fieldtype='Data', insert_after='itc_central_tax', print_hide=1),
dict(fieldname='itc_cess_amount', label='Availed ITC Cess',
fieldtype='Data', insert_after='itc_state_tax', print_hide=1),
]
sales_invoice_gst_fields = [
@@ -123,11 +141,20 @@ def make_custom_fields():
fieldtype='Data', insert_after='shipping_address',
options='shipping_address_name.gstin', print_hide=1),
dict(fieldname='place_of_supply', label='Place of Supply',
fieldtype='Data', insert_after='customer_gstin', print_hide=1,
options='shipping_address_name.gst_state_number', read_only=0),
fieldtype='Data', insert_after='customer_gstin',
print_hide=1, read_only=0),
dict(fieldname='company_gstin', label='Company GSTIN',
fieldtype='Data', insert_after='company_address',
options='company_address.gstin', print_hide=1)
options='company_address.gstin', print_hide=1),
dict(fieldname='port_code', label='Port Code',
fieldtype='Data', insert_after='reason_for_issuing_document', print_hide=1,
depends_on="eval:doc.invoice_type=='Export' "),
dict(fieldname='shipping_bill_number', label=' Shipping Bill Number',
fieldtype='Data', insert_after='port_code', print_hide=1,
depends_on="eval:doc.invoice_type=='Export' "),
dict(fieldname='shipping_bill_date', label='Shipping Bill Date',
fieldtype='Date', insert_after='shipping_bill_number', print_hide=1,
depends_on="eval:doc.invoice_type=='Export' ")
]
custom_fields = {
@@ -139,8 +166,8 @@ def make_custom_fields():
dict(fieldname='gst_state_number', label='GST State Number',
fieldtype='Int', insert_after='gst_state', read_only=1),
],
'Purchase Invoice': purchase_invoice_gst_fields + invoice_gst_fields,
'Sales Invoice': sales_invoice_gst_fields + invoice_gst_fields,
'Purchase Invoice': invoice_gst_fields + purchase_invoice_gst_fields,
'Sales Invoice': invoice_gst_fields + sales_invoice_gst_fields,
"Delivery Note": sales_invoice_gst_fields,
'Item': [
dict(fieldname='gst_hsn_code', label='HSN/SAC',

View File

@@ -1,5 +1,6 @@
import frappe, re
from frappe import _
from frappe.utils import cstr
from erpnext.regional.india import states, state_numbers
from erpnext.controllers.taxes_and_totals import get_itemised_tax, get_itemised_taxable_amount
@@ -29,12 +30,12 @@ def get_itemised_tax_breakup_header(item_doctype, tax_accounts):
return [_("HSN/SAC"), _("Taxable Amount")] + tax_accounts
else:
return [_("Item"), _("Taxable Amount")] + tax_accounts
def get_itemised_tax_breakup_data(doc):
itemised_tax = get_itemised_tax(doc.taxes)
itemised_taxable_amount = get_itemised_taxable_amount(doc.items)
if not frappe.get_meta(doc.doctype + " Item").has_field('gst_hsn_code'):
return itemised_tax, itemised_taxable_amount
@@ -60,7 +61,19 @@ def get_itemised_tax_breakup_data(doc):
return hsn_tax, hsn_taxable_amount
def set_place_of_supply(doc, method):
if not frappe.get_meta('Address').has_field('gst_state'): return
if doc.doctype == "Sales Invoice":
address_name = doc.shipping_address_name or doc.customer_address
elif doc.doctype == "Purchase Invoice":
address_name = doc.shipping_address or doc.supplier_address
if address_name:
address = frappe.db.get_value("Address", address_name, ["gst_state", "gst_state_number"], as_dict=1)
doc.place_of_supply = cstr(address.gst_state_number) + "-" + cstr(address.gst_state)
# don't remove this function it is used in tests
def test_method():
'''test function'''
return 'overridden'
return 'overridden'