[wip] GST for India. Pending reports
This commit is contained in:
parent
2cb598f644
commit
b3c8f44b3e
@ -7,10 +7,13 @@ from frappe.utils import flt
|
||||
from frappe import msgprint, _
|
||||
|
||||
def execute(filters=None):
|
||||
return _execute(filters)
|
||||
|
||||
def _execute(filters, additional_table_columns=None, additional_query_columns=None):
|
||||
if not filters: filters = frappe._dict({})
|
||||
|
||||
invoice_list = get_invoices(filters)
|
||||
columns, income_accounts, tax_accounts = get_columns(invoice_list)
|
||||
columns, income_accounts, tax_accounts = get_columns(invoice_list, additional_table_columns)
|
||||
|
||||
if not invoice_list:
|
||||
msgprint(_("No record found"))
|
||||
@ -21,7 +24,8 @@ def execute(filters=None):
|
||||
invoice_income_map, income_accounts)
|
||||
|
||||
invoice_so_dn_map = get_invoice_so_dn_map(invoice_list)
|
||||
customer_map = get_customer_details(invoice_list)
|
||||
customers = list(set([inv.customer for inv in invoice_list]))
|
||||
customer_map = get_customer_details(customers)
|
||||
company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
|
||||
mode_of_payments = get_mode_of_payments([inv.name for inv in invoice_list])
|
||||
|
||||
@ -31,12 +35,16 @@ def execute(filters=None):
|
||||
sales_order = list(set(invoice_so_dn_map.get(inv.name, {}).get("sales_order", [])))
|
||||
delivery_note = list(set(invoice_so_dn_map.get(inv.name, {}).get("delivery_note", [])))
|
||||
|
||||
row = [inv.name, inv.posting_date, inv.customer, inv.customer_name,
|
||||
customer_map.get(inv.customer, {}).get("customer_group"),
|
||||
customer_map.get(inv.customer, {}).get("territory"),
|
||||
inv.debit_to, ", ".join(mode_of_payments.get(inv.name, [])), inv.project, inv.remarks,
|
||||
", ".join(sales_order), ", ".join(delivery_note), company_currency]
|
||||
|
||||
customer_details = customer_map.get(inv.customer, {})
|
||||
row = [
|
||||
inv.name, inv.posting_date, inv.customer, inv.customer_name,
|
||||
inv.customer_gstin, customer_details.get("tax_id"), inv.company_gstin,
|
||||
customer_details.get("customer_group"),
|
||||
customer_details.get("territory"),
|
||||
inv.debit_to, ", ".join(mode_of_payments.get(inv.name, [])),
|
||||
inv.project, inv.remarks,
|
||||
", ".join(sales_order), ", ".join(delivery_note), company_currency
|
||||
]
|
||||
# map income values
|
||||
base_net_total = 0
|
||||
for income_acc in income_accounts:
|
||||
@ -62,12 +70,17 @@ def execute(filters=None):
|
||||
|
||||
return columns, data
|
||||
|
||||
|
||||
def get_columns(invoice_list):
|
||||
def get_columns(invoice_list, additional_table_columns):
|
||||
"""return columns based on filters"""
|
||||
columns = [
|
||||
_("Invoice") + ":Link/Sales Invoice:120", _("Posting Date") + ":Date:80",
|
||||
_("Customer Id") + "::120", _("Customer Name") + "::120",
|
||||
_("Customer") + ":Link/Customer:120", _("Customer Name") + "::120"
|
||||
]
|
||||
|
||||
if additional_table_columns:
|
||||
columns += additional_table_columns
|
||||
|
||||
columns +=[
|
||||
_("Customer Group") + ":Link/Customer Group:120", _("Territory") + ":Link/Territory:80",
|
||||
_("Receivable Account") + ":Link/Account:120", _("Mode of Payment") + "::120",
|
||||
_("Project") +":Link/Project:80", _("Remarks") + "::150",
|
||||
|
@ -160,6 +160,9 @@ doc_events = {
|
||||
},
|
||||
"Payment Entry": {
|
||||
"on_submit": "erpnext.accounts.doctype.payment_request.payment_request.make_status_as_paid"
|
||||
},
|
||||
'Address': {
|
||||
'validate': 'erpnext.regional.india.utils.validate_gstin_for_india'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,3 +14,4 @@ Hub Node
|
||||
Portal
|
||||
Maintenance
|
||||
Schools
|
||||
Regional
|
@ -104,7 +104,7 @@ body[data-route="pos"] .pos-payment-row {
|
||||
}
|
||||
body[data-route="pos"] .pos-payment-row:hover,
|
||||
body[data-route="pos"] .pos-keyboard-key:hover {
|
||||
background-color: #FAFBFC;
|
||||
background-color: #fafbfc;
|
||||
cursor: pointer;
|
||||
}
|
||||
body[data-route="pos"] .pos-keyboard-key,
|
||||
@ -214,7 +214,7 @@ body[data-route="pos"] .amount-label {
|
||||
font-size: 16px;
|
||||
}
|
||||
body[data-route="pos"] .selected-payment-mode {
|
||||
background-color: #FAFBFC;
|
||||
background-color: #fafbfc;
|
||||
cursor: pointer;
|
||||
}
|
||||
body[data-route="pos"] .pos-invoice-list {
|
||||
|
@ -1,6 +1,6 @@
|
||||
<p><button class="btn btn-xs btn-default btn-address">{{ __("New Address") }}</button></p>
|
||||
<div class="clearfix"></div>
|
||||
{% for(var i=0, l=addr_list.length; i<l; i++) { %}
|
||||
<div class="address-box">
|
||||
<p class="h6">
|
||||
{%= i+1 %}. {%= addr_list[i].address_type!="Other" ? __(addr_list[i].address_type) : addr_list[i].address_title %}
|
||||
{% if(addr_list[i].is_primary_address) { %}
|
||||
@ -9,14 +9,15 @@
|
||||
<span class="text-muted">({%= __("Shipping") %})</span>{% } %}
|
||||
|
||||
<a href="#Form/Address/{%= encodeURIComponent(addr_list[i].name) %}"
|
||||
class="btn btn-default btn-xs pull-right">
|
||||
class="btn btn-default btn-xs pull-right"
|
||||
style="margin-top:-3px; margin-right: -5px;">
|
||||
{%= __("Edit") %}</a>
|
||||
</p>
|
||||
<div style="padding-left: 15px;">
|
||||
<p style="margin-top: 5px; font-size: 12px;">
|
||||
{%= addr_list[i].display %}</p>
|
||||
<p>{%= addr_list[i].display %}</p>
|
||||
</div>
|
||||
{% } %}
|
||||
{% if(!addr_list.length) { %}
|
||||
<p class="text-muted">{%= __("No address added yet.") %}</p>
|
||||
<p class="text-muted small">{%= __("No address added yet.") %}</p>
|
||||
{% } %}
|
||||
<p><button class="btn btn-xs btn-default btn-address">{{ __("New Address") }}</button></p>
|
||||
|
||||
|
@ -1,10 +1,7 @@
|
||||
<p><button class="btn btn-xs btn-default btn-contact">
|
||||
{{ __("New Contact") }}</button></p>
|
||||
<div class="clearfix"></div>
|
||||
<ol>
|
||||
{% for(var i=0, l=contact_list.length; i<l; i++) { %}
|
||||
<div class="address-box">
|
||||
<p class="h6">
|
||||
<li>
|
||||
{%= contact_list[i].first_name %} {%= contact_list[i].last_name %}
|
||||
{% if(contact_list[i].is_primary_contact) { %}
|
||||
<span class="text-muted">({%= __("Primary") %})</span>
|
||||
@ -13,13 +10,13 @@
|
||||
<span class="text-muted">– {%= contact_list[i].designation %}</span>
|
||||
{% } %}
|
||||
<a href="#Form/Contact/{%= encodeURIComponent(contact_list[i].name) %}"
|
||||
class="btn btn-xs btn-default pull-right">
|
||||
class="btn btn-xs btn-default pull-right"
|
||||
style="margin-top:-3px; margin-right: -5px;">
|
||||
{%= __("Edit") %}</a>
|
||||
</li>
|
||||
</p>
|
||||
|
||||
<div style="padding-left: 15px;">
|
||||
<p style="padding-top: 5px; font-size: 12px;">
|
||||
{% if (contact_list[i].phone || contact_list[i].mobile_no ||
|
||||
contact_list[i].email_id) { %}
|
||||
<p>
|
||||
{% if(contact_list[i].phone) { %}
|
||||
{%= __("Phone") %}: {%= contact_list[i].phone %}<br>
|
||||
{% } %}
|
||||
@ -30,9 +27,12 @@
|
||||
{%= __("Email Address") %}: {%= contact_list[i].email_id %}
|
||||
{% } %}
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% } %}
|
||||
</ol>
|
||||
{% if(!contact_list.length) { %}
|
||||
<p class="text-muted">{%= __("No contacts added yet.") %}</p>
|
||||
<p class="text-muted small">{%= __("No contacts added yet.") %}</p>
|
||||
{% } %}
|
||||
<p><button class="btn btn-xs btn-default btn-contact">
|
||||
{{ __("New Contact") }}</button>
|
||||
</p>
|
@ -126,7 +126,7 @@ body[data-route="pos"] {
|
||||
}
|
||||
|
||||
.pos-payment-row {
|
||||
border-bottom:1px solid #d1d8dd;
|
||||
border-bottom:1px solid @border-color;
|
||||
margin: 2px 0px 5px 0px;
|
||||
height: 60px;
|
||||
margin-top: 0px;
|
||||
@ -134,12 +134,12 @@ body[data-route="pos"] {
|
||||
}
|
||||
|
||||
.pos-payment-row:hover, .pos-keyboard-key:hover{
|
||||
background-color: #FAFBFC;
|
||||
background-color: @light-bg;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.pos-keyboard-key, .delete-btn {
|
||||
border: 1px solid #d1d8dd;
|
||||
border: 1px solid @border-color;
|
||||
height:85px;
|
||||
width:85px;
|
||||
margin:10px 10px;
|
||||
@ -150,7 +150,7 @@ body[data-route="pos"] {
|
||||
}
|
||||
|
||||
.numeric-keypad {
|
||||
border: 1px solid #d1d8dd;
|
||||
border: 1px solid @border-color;
|
||||
height:69px;
|
||||
width:69px;
|
||||
font-size:20px;
|
||||
@ -256,7 +256,7 @@ body[data-route="pos"] {
|
||||
}
|
||||
|
||||
.selected-payment-mode {
|
||||
background-color: #FAFBFC;
|
||||
background-color: @light-bg;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
0
erpnext/regional/__init__.py
Normal file
0
erpnext/regional/__init__.py
Normal file
0
erpnext/regional/doctype/__init__.py
Normal file
0
erpnext/regional/doctype/__init__.py
Normal file
0
erpnext/regional/doctype/gst_hsn_code/__init__.py
Normal file
0
erpnext/regional/doctype/gst_hsn_code/__init__.py
Normal file
8
erpnext/regional/doctype/gst_hsn_code/gst_hsn_code.js
Normal file
8
erpnext/regional/doctype/gst_hsn_code/gst_hsn_code.js
Normal file
@ -0,0 +1,8 @@
|
||||
// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('GST HSN Code', {
|
||||
refresh: function(frm) {
|
||||
|
||||
}
|
||||
});
|
103
erpnext/regional/doctype/gst_hsn_code/gst_hsn_code.json
Normal file
103
erpnext/regional/doctype/gst_hsn_code/gst_hsn_code.json
Normal file
@ -0,0 +1,103 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"autoname": "fieldname:hsn_code",
|
||||
"beta": 0,
|
||||
"creation": "2017-06-21 10:48:56.422086",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "hsn_code",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "HSN Code",
|
||||
"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": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Description",
|
||||
"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,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"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": "2017-06-21 13:27:59.149202",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Regional",
|
||||
"name": "GST HSN Code",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"search_fields": "description",
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1,
|
||||
"track_seen": 0
|
||||
}
|
10
erpnext/regional/doctype/gst_hsn_code/gst_hsn_code.py
Normal file
10
erpnext/regional/doctype/gst_hsn_code/gst_hsn_code.py
Normal file
@ -0,0 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
class GSTHSNCode(Document):
|
||||
pass
|
10
erpnext/regional/doctype/gst_hsn_code/test_gst_hsn_code.py
Normal file
10
erpnext/regional/doctype/gst_hsn_code/test_gst_hsn_code.py
Normal file
@ -0,0 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
class TestGSTHSNCode(unittest.TestCase):
|
||||
pass
|
76
erpnext/regional/india/__init__.py
Normal file
76
erpnext/regional/india/__init__.py
Normal file
@ -0,0 +1,76 @@
|
||||
states = [
|
||||
'',
|
||||
'Andhra Pradesh',
|
||||
'Arunachal Pradesh',
|
||||
'Assam',
|
||||
'Bihar',
|
||||
'Chandigarh',
|
||||
'Chattisgarh',
|
||||
'Dadra and Nagar Haveli',
|
||||
'Daman and Diu',
|
||||
'Delhi',
|
||||
'Goa',
|
||||
'Gujarat',
|
||||
'Haryana',
|
||||
'Himachal Pradesh',
|
||||
'Jammu and Kashmir',
|
||||
'Jharkhand',
|
||||
'Karnataka',
|
||||
'Kerala',
|
||||
'Lakshadweep Islands',
|
||||
'Madhya Pradesh',
|
||||
'Maharashtra',
|
||||
'Manipur',
|
||||
'Meghalaya',
|
||||
'Mizoram',
|
||||
'Nagaland',
|
||||
'Odisha',
|
||||
'Pondicherry',
|
||||
'Punjab',
|
||||
'Rajasthan',
|
||||
'Sikkim',
|
||||
'Tamil Nadu',
|
||||
'Telangana',
|
||||
'Tripura',
|
||||
'Uttar Pradesh',
|
||||
'Uttarakhand',
|
||||
'West Bengal',
|
||||
]
|
||||
|
||||
state_numbers = {
|
||||
"Andhra Pradesh": "37",
|
||||
"Arunachal Pradesh": "12",
|
||||
"Assam": "18",
|
||||
"Bihar": "10",
|
||||
"Chandigarh": "04",
|
||||
"Chattisgarh": "22",
|
||||
"Dadra and Nagar Haveli": "26",
|
||||
"Daman and Diu": "25",
|
||||
"Delhi": "07",
|
||||
"Goa": "30",
|
||||
"Gujarat": "24",
|
||||
"Haryana": "06",
|
||||
"Himachal Pradesh": "02",
|
||||
"Jammu and Kashmir": "01",
|
||||
"Jharkhand": "20",
|
||||
"Karnataka": "29",
|
||||
"Kerala": "32",
|
||||
"Lakshadweep Islands": "31",
|
||||
"Madhya Pradesh": "23",
|
||||
"Maharashtra": "27",
|
||||
"Manipur": "14",
|
||||
"Meghalaya": "17",
|
||||
"Mizoram": "15",
|
||||
"Nagaland": "13",
|
||||
"Odisha": "21",
|
||||
"Pondicherry": "34",
|
||||
"Punjab": "03",
|
||||
"Rajasthan": "08",
|
||||
"Sikkim": "11",
|
||||
"Tamil Nadu": "33",
|
||||
"Telangana": "36",
|
||||
"Tripura": "16",
|
||||
"Uttar Pradesh": "35",
|
||||
"Uttarakhand": "36",
|
||||
"West Bengal": "37"
|
||||
}
|
177
erpnext/regional/india/gst_state_code_data.json
Normal file
177
erpnext/regional/india/gst_state_code_data.json
Normal file
@ -0,0 +1,177 @@
|
||||
[
|
||||
{
|
||||
"state_number": "33",
|
||||
"state_code": "TN",
|
||||
"state_name": "Tamil Nadu"
|
||||
},
|
||||
{
|
||||
"state_number": "35",
|
||||
"state_code": "UP",
|
||||
"state_name": "Uttar Pradesh"
|
||||
},
|
||||
{
|
||||
"state_number": "36",
|
||||
"state_code": "UT",
|
||||
"state_name": "Uttarakhand"
|
||||
},
|
||||
{
|
||||
"state_number": "37",
|
||||
"state_code": "WB",
|
||||
"state_name": "West Bengal"
|
||||
},
|
||||
{
|
||||
"state_number": "16",
|
||||
"state_code": "TR",
|
||||
"state_name": "Tripura"
|
||||
},
|
||||
{
|
||||
"state_number": "36",
|
||||
"state_code": "TS",
|
||||
"state_name": "Telangana"
|
||||
},
|
||||
{
|
||||
"state_number": "11",
|
||||
"state_code": "SK",
|
||||
"state_name": "Sikkim"
|
||||
},
|
||||
{
|
||||
"state_number": "08",
|
||||
"state_code": "RJ",
|
||||
"state_name": "Rajasthan"
|
||||
},
|
||||
{
|
||||
"state_number": "03",
|
||||
"state_code": "PB",
|
||||
"state_name": "Punjab"
|
||||
},
|
||||
{
|
||||
"state_number": "34",
|
||||
"state_code": "PY",
|
||||
"state_name": "Pondicherry"
|
||||
},
|
||||
{
|
||||
"state_number": "21",
|
||||
"state_code": "OR",
|
||||
"state_name": "Odisha"
|
||||
},
|
||||
{
|
||||
"state_number": "13",
|
||||
"state_code": "NL",
|
||||
"state_name": "Nagaland"
|
||||
},
|
||||
{
|
||||
"state_number": "15",
|
||||
"state_code": "MI",
|
||||
"state_name": "Mizoram"
|
||||
},
|
||||
{
|
||||
"state_number": "17",
|
||||
"state_code": "ME",
|
||||
"state_name": "Meghalaya"
|
||||
},
|
||||
{
|
||||
"state_number": "14",
|
||||
"state_code": "MN",
|
||||
"state_name": "Manipur"
|
||||
},
|
||||
{
|
||||
"state_number": "27",
|
||||
"state_code": "MH",
|
||||
"state_name": "Maharashtra"
|
||||
},
|
||||
{
|
||||
"state_number": "23",
|
||||
"state_code": "MP",
|
||||
"state_name": "Madhya Pradesh"
|
||||
},
|
||||
{
|
||||
"state_number": "31",
|
||||
"state_code": "LD",
|
||||
"state_name": "Lakshadweep Islands"
|
||||
},
|
||||
{
|
||||
"state_number": "32",
|
||||
"state_code": "KL",
|
||||
"state_name": "Kerala"
|
||||
},
|
||||
{
|
||||
"state_number": "29",
|
||||
"state_code": "KA",
|
||||
"state_name": "Karnataka"
|
||||
},
|
||||
{
|
||||
"state_number": "20",
|
||||
"state_code": "JH",
|
||||
"state_name": "Jharkhand"
|
||||
},
|
||||
{
|
||||
"state_number": "01",
|
||||
"state_code": "JK",
|
||||
"state_name": "Jammu and Kashmir"
|
||||
},
|
||||
{
|
||||
"state_number": "02",
|
||||
"state_code": "HP",
|
||||
"state_name": "Himachal Pradesh"
|
||||
},
|
||||
{
|
||||
"state_number": "06",
|
||||
"state_code": "HR",
|
||||
"state_name": "Haryana"
|
||||
},
|
||||
{
|
||||
"state_number": "24",
|
||||
"state_code": "GJ",
|
||||
"state_name": "Gujarat"
|
||||
},
|
||||
{
|
||||
"state_number": "30",
|
||||
"state_code": "GA",
|
||||
"state_name": "Goa"
|
||||
},
|
||||
{
|
||||
"state_number": "07",
|
||||
"state_code": "DL",
|
||||
"state_name": "Delhi"
|
||||
},
|
||||
{
|
||||
"state_number": "25",
|
||||
"state_code": "DD",
|
||||
"state_name": "Daman and Diu"
|
||||
},
|
||||
{
|
||||
"state_number": "26",
|
||||
"state_code": "DN",
|
||||
"state_name": "Dadra and Nagar Haveli"
|
||||
},
|
||||
{
|
||||
"state_number": "22",
|
||||
"state_code": "CT",
|
||||
"state_name": "Chattisgarh"
|
||||
},
|
||||
{
|
||||
"state_number": "04",
|
||||
"state_code": "CH",
|
||||
"state_name": "Chandigarh"
|
||||
},
|
||||
{
|
||||
"state_number": "10",
|
||||
"state_code": "BH",
|
||||
"state_name": "Bihar"
|
||||
},
|
||||
{
|
||||
"state_number": "18",
|
||||
"state_code": "AS",
|
||||
"state_name": "Assam"
|
||||
},
|
||||
{
|
||||
"state_number": "12",
|
||||
"state_code": "AR",
|
||||
"state_name": "Arunachal Pradesh"
|
||||
},
|
||||
{
|
||||
"state_number": "37",
|
||||
"state_code": "AD",
|
||||
"state_name": "Andhra Pradesh (New)"
|
||||
}
|
||||
]
|
50418
erpnext/regional/india/hsn_code_data.json
Normal file
50418
erpnext/regional/india/hsn_code_data.json
Normal file
File diff suppressed because it is too large
Load Diff
89
erpnext/regional/india/install.py
Normal file
89
erpnext/regional/india/install.py
Normal file
@ -0,0 +1,89 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe, os, json
|
||||
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
|
||||
from frappe.permissions import add_permission
|
||||
from erpnext.regional.india import states
|
||||
|
||||
def install(company):
|
||||
make_custom_fields()
|
||||
make_fixtures()
|
||||
add_permissions()
|
||||
add_hsn_codes()
|
||||
|
||||
def add_hsn_codes():
|
||||
with open(os.path.join(os.path.dirname(__file__), 'hsn_code_data.json'), 'r') as f:
|
||||
hsn_codes = json.loads(f.read())
|
||||
|
||||
frappe.db.sql('truncate `tabGST HSN Code`')
|
||||
|
||||
for d in hsn_codes:
|
||||
hsn_code = frappe.new_doc('GST HSN Code')
|
||||
hsn_code.update(d)
|
||||
hsn_code.name = hsn_code.hsn_code
|
||||
hsn_code.db_insert()
|
||||
|
||||
def add_permissions():
|
||||
for doctype in ('GST HSN Code',):
|
||||
add_permission(doctype, 'Accounts Manager', 0)
|
||||
add_permission(doctype, 'All', 0)
|
||||
|
||||
def make_custom_fields():
|
||||
custom_fields = {
|
||||
'Address': [
|
||||
dict(fieldname='gstin', label='Party GSTIN', fieldtype='Data', insert_after='fax'),
|
||||
dict(fieldname='gst_state', label='GST State', fieldtype='Select',
|
||||
options='\n'.join(states), insert_after='gstin')
|
||||
],
|
||||
'Purchase Invoice': [
|
||||
dict(fieldname='supplier_gstin', label='Supplier GSTIN',
|
||||
fieldtype='Data', insert_after='supplier_address', options='supplier_address.gstin'),
|
||||
dict(fieldname='company_gstin', label='Company GSTIN',
|
||||
fieldtype='Data', insert_after='fax', options='shipping_address.gstin'),
|
||||
],
|
||||
'Sales Invoice': [
|
||||
dict(fieldname='customer_gstin', label='Customer GSTIN',
|
||||
fieldtype='Data', insert_after='shipping_address', options='shipping_address.gstin'),
|
||||
dict(fieldname='company_address', label='Company Address',
|
||||
fieldtype='Link', insert_after='shipping_address', options='Address'),
|
||||
dict(fieldname='company_gstin', label='Company GSTIN',
|
||||
fieldtype='Data', insert_after='fax', options='company_address.gstin'),
|
||||
],
|
||||
'Item': [
|
||||
dict(fieldname='gst_hsn_code', label='GST HSN Code',
|
||||
fieldtype='Link', options='GST HSN Code', insert_after='item_group'),
|
||||
],
|
||||
'Sales Invoice Item': [
|
||||
dict(fieldname='gst_hsn_code', label='GST HSN Code',
|
||||
fieldtype='Data', options='item_code.gst_hsn_code', insert_after='income_account'),
|
||||
],
|
||||
'Purchase Invoice Item': [
|
||||
dict(fieldname='gst_hsn_code', label='GST HSN Code',
|
||||
fieldtype='Data', options='item_code.gst_hsn_code', insert_after='expense_account'),
|
||||
]
|
||||
}
|
||||
|
||||
for doctype, fields in custom_fields.items():
|
||||
for df in fields:
|
||||
create_custom_field(doctype, df)
|
||||
|
||||
def make_fixtures():
|
||||
docs = [
|
||||
{'doctype': 'Salary Component', 'salary_component': 'Professional Tax', 'description': 'Professional Tax', 'type': 'Deduction'},
|
||||
{'doctype': 'Salary Component', 'salary_component': 'Provident Fund', 'description': 'Provident fund', 'type': 'Deduction'},
|
||||
{'doctype': 'Salary Component', 'salary_component': 'House Rent Allowance', 'description': 'House Rent Allowance', 'type': 'Earning'},
|
||||
{'doctype': 'Salary Component', 'salary_component': 'Basic', 'description': 'Basic', 'type': 'Earning'},
|
||||
{'doctype': 'Salary Component', 'salary_component': 'Arrear', 'description': 'Arrear', 'type': 'Earning'},
|
||||
{'doctype': 'Salary Component', 'salary_component': 'Leave Encashment', 'description': 'Leave Encashment', 'type': 'Earning'}
|
||||
]
|
||||
|
||||
for d in docs:
|
||||
try:
|
||||
doc = frappe.get_doc(d)
|
||||
doc.flags.ignore_permissions = True
|
||||
doc.insert()
|
||||
except frappe.NameError:
|
||||
pass
|
21
erpnext/regional/india/utils.py
Normal file
21
erpnext/regional/india/utils.py
Normal file
@ -0,0 +1,21 @@
|
||||
import frappe, re
|
||||
from frappe import _
|
||||
from erpnext.regional.india import states, state_numbers
|
||||
|
||||
def validate_gstin_for_india(doc, method):
|
||||
if not hasattr(doc, 'gstin'):
|
||||
return
|
||||
|
||||
if doc.gstin:
|
||||
p = re.compile("[0-9]{2}[a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}[1-9A-Za-z]{1}[Z]{1}[0-9a-zA-Z]{1}")
|
||||
if not p.match(doc.gstin):
|
||||
frappe.throw(_("Invalid GSTIN"))
|
||||
|
||||
if not doc.gst_state:
|
||||
if doc.state in states:
|
||||
doc.gst_state = doc.state
|
||||
|
||||
if doc.gst_state:
|
||||
state_number = state_numbers[doc.gst_state]
|
||||
if state_number != doc.gstin[:2]:
|
||||
frappe.throw(_("First 2 digits of GSTIN should match with State number {0}").format(state_number))
|
0
erpnext/regional/report/__init__.py
Normal file
0
erpnext/regional/report/__init__.py
Normal file
@ -0,0 +1,9 @@
|
||||
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
/* eslint-disable */
|
||||
|
||||
frappe.query_reports["GST Sales Register"] = {
|
||||
"filters": [
|
||||
|
||||
]
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
{
|
||||
"add_total_row": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"creation": "2017-06-21 16:44:41.621260",
|
||||
"disabled": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "Report",
|
||||
"idx": 0,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2017-06-21 16:45:53.253322",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Regional",
|
||||
"name": "GST Sales Register",
|
||||
"owner": "Administrator",
|
||||
"ref_doctype": "Sales Invoice",
|
||||
"report_name": "GST Sales Register",
|
||||
"report_type": "Script Report",
|
||||
"roles": []
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute(filters=None):
|
||||
columns, data = [], []
|
||||
return columns, data
|
@ -17,6 +17,8 @@ frappe.ui.form.on("Company", {
|
||||
if(!frm.doc.__islocal) {
|
||||
frappe.contacts.render_address_and_contact(frm);
|
||||
|
||||
frappe.dynamic_link = {doc: frm.doc, fieldname: 'name', doctype: 'Company'}
|
||||
|
||||
frm.toggle_enable("default_currency", (frm.doc.__onload &&
|
||||
!frm.doc.__onload.transactions_exist));
|
||||
|
||||
|
@ -96,9 +96,9 @@ class Company(Document):
|
||||
frappe.clear_cache()
|
||||
|
||||
def install_country_fixtures(self):
|
||||
path = os.path.join(os.path.dirname(__file__), "fixtures", self.country.lower())
|
||||
path = frappe.get_app_path('erpnext', 'regional', frappe.scrub(self.country))
|
||||
if os.path.exists(path.encode("utf-8")):
|
||||
frappe.get_attr("erpnext.setup.doctype.company.fixtures.{0}.install"
|
||||
frappe.get_attr("erpnext.regional.{0}.install.install"
|
||||
.format(self.country.lower()))(self)
|
||||
|
||||
def create_default_warehouses(self):
|
||||
|
@ -1,24 +0,0 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
|
||||
def install(company):
|
||||
docs = [
|
||||
{'doctype': 'Salary Component', 'salary_component': 'Professional Tax', 'description': 'Professional Tax', 'type': 'Deduction'},
|
||||
{'doctype': 'Salary Component', 'salary_component': 'Provident Fund', 'description': 'Provident fund', 'type': 'Deduction'},
|
||||
{'doctype': 'Salary Component', 'salary_component': 'House Rent Allowance', 'description': 'House Rent Allowance', 'type': 'Earning'},
|
||||
{'doctype': 'Salary Component', 'salary_component': 'Basic', 'description': 'Basic', 'type': 'Earning'},
|
||||
{'doctype': 'Salary Component', 'salary_component': 'Arrear', 'description': 'Arrear', 'type': 'Earning'},
|
||||
{'doctype': 'Salary Component', 'salary_component': 'Leave Encashment', 'description': 'Leave Encashment', 'type': 'Earning'}
|
||||
]
|
||||
|
||||
for d in docs:
|
||||
try:
|
||||
doc = frappe.get_doc(d)
|
||||
doc.flags.ignore_permissions = True
|
||||
doc.insert()
|
||||
except frappe.NameError:
|
||||
pass
|
Loading…
Reference in New Issue
Block a user