[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, _
|
from frappe import msgprint, _
|
||||||
|
|
||||||
def execute(filters=None):
|
def execute(filters=None):
|
||||||
|
return _execute(filters)
|
||||||
|
|
||||||
|
def _execute(filters, additional_table_columns=None, additional_query_columns=None):
|
||||||
if not filters: filters = frappe._dict({})
|
if not filters: filters = frappe._dict({})
|
||||||
|
|
||||||
invoice_list = get_invoices(filters)
|
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:
|
if not invoice_list:
|
||||||
msgprint(_("No record found"))
|
msgprint(_("No record found"))
|
||||||
@ -21,7 +24,8 @@ def execute(filters=None):
|
|||||||
invoice_income_map, income_accounts)
|
invoice_income_map, income_accounts)
|
||||||
|
|
||||||
invoice_so_dn_map = get_invoice_so_dn_map(invoice_list)
|
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")
|
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])
|
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", [])))
|
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", [])))
|
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_details = customer_map.get(inv.customer, {})
|
||||||
customer_map.get(inv.customer, {}).get("customer_group"),
|
row = [
|
||||||
customer_map.get(inv.customer, {}).get("territory"),
|
inv.name, inv.posting_date, inv.customer, inv.customer_name,
|
||||||
inv.debit_to, ", ".join(mode_of_payments.get(inv.name, [])), inv.project, inv.remarks,
|
inv.customer_gstin, customer_details.get("tax_id"), inv.company_gstin,
|
||||||
", ".join(sales_order), ", ".join(delivery_note), company_currency]
|
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
|
# map income values
|
||||||
base_net_total = 0
|
base_net_total = 0
|
||||||
for income_acc in income_accounts:
|
for income_acc in income_accounts:
|
||||||
@ -62,15 +70,20 @@ def execute(filters=None):
|
|||||||
|
|
||||||
return columns, data
|
return columns, data
|
||||||
|
|
||||||
|
def get_columns(invoice_list, additional_table_columns):
|
||||||
def get_columns(invoice_list):
|
|
||||||
"""return columns based on filters"""
|
"""return columns based on filters"""
|
||||||
columns = [
|
columns = [
|
||||||
_("Invoice") + ":Link/Sales Invoice:120", _("Posting Date") + ":Date:80",
|
_("Invoice") + ":Link/Sales Invoice:120", _("Posting Date") + ":Date:80",
|
||||||
_("Customer Id") + "::120", _("Customer Name") + "::120",
|
_("Customer") + ":Link/Customer:120", _("Customer Name") + "::120"
|
||||||
_("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",
|
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",
|
||||||
_("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100",
|
_("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100",
|
||||||
{
|
{
|
||||||
"fieldname": "currency",
|
"fieldname": "currency",
|
||||||
@ -113,17 +126,17 @@ def get_conditions(filters):
|
|||||||
|
|
||||||
if filters.get("from_date"): conditions += " and posting_date >= %(from_date)s"
|
if filters.get("from_date"): conditions += " and posting_date >= %(from_date)s"
|
||||||
if filters.get("to_date"): conditions += " and posting_date <= %(to_date)s"
|
if filters.get("to_date"): conditions += " and posting_date <= %(to_date)s"
|
||||||
|
|
||||||
if filters.get("mode_of_payment"):
|
if filters.get("mode_of_payment"):
|
||||||
conditions += """ and exists(select name from `tabSales Invoice Payment`
|
conditions += """ and exists(select name from `tabSales Invoice Payment`
|
||||||
where parent=`tabSales Invoice`.name
|
where parent=`tabSales Invoice`.name
|
||||||
and ifnull(`tabSales Invoice Payment`.mode_of_payment, '') = %(mode_of_payment)s)"""
|
and ifnull(`tabSales Invoice Payment`.mode_of_payment, '') = %(mode_of_payment)s)"""
|
||||||
|
|
||||||
return conditions
|
return conditions
|
||||||
|
|
||||||
def get_invoices(filters):
|
def get_invoices(filters):
|
||||||
conditions = get_conditions(filters)
|
conditions = get_conditions(filters)
|
||||||
return frappe.db.sql("""select name, posting_date, debit_to, project, customer, customer_name, remarks,
|
return frappe.db.sql("""select name, posting_date, debit_to, project, customer, customer_name, remarks,
|
||||||
base_net_total, base_grand_total, base_rounded_total, outstanding_amount
|
base_net_total, base_grand_total, base_rounded_total, outstanding_amount
|
||||||
from `tabSales Invoice`
|
from `tabSales Invoice`
|
||||||
where docstatus = 1 %s order by posting_date desc, name desc""" %
|
where docstatus = 1 %s order by posting_date desc, name desc""" %
|
||||||
|
@ -160,6 +160,9 @@ doc_events = {
|
|||||||
},
|
},
|
||||||
"Payment Entry": {
|
"Payment Entry": {
|
||||||
"on_submit": "erpnext.accounts.doctype.payment_request.payment_request.make_status_as_paid"
|
"on_submit": "erpnext.accounts.doctype.payment_request.payment_request.make_status_as_paid"
|
||||||
|
},
|
||||||
|
'Address': {
|
||||||
|
'validate': 'erpnext.regional.india.utils.validate_gstin_for_india'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,4 +13,5 @@ Shopping Cart
|
|||||||
Hub Node
|
Hub Node
|
||||||
Portal
|
Portal
|
||||||
Maintenance
|
Maintenance
|
||||||
Schools
|
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-payment-row:hover,
|
||||||
body[data-route="pos"] .pos-keyboard-key:hover {
|
body[data-route="pos"] .pos-keyboard-key:hover {
|
||||||
background-color: #FAFBFC;
|
background-color: #fafbfc;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
body[data-route="pos"] .pos-keyboard-key,
|
body[data-route="pos"] .pos-keyboard-key,
|
||||||
@ -214,7 +214,7 @@ body[data-route="pos"] .amount-label {
|
|||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
body[data-route="pos"] .selected-payment-mode {
|
body[data-route="pos"] .selected-payment-mode {
|
||||||
background-color: #FAFBFC;
|
background-color: #fafbfc;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
body[data-route="pos"] .pos-invoice-list {
|
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>
|
<div class="clearfix"></div>
|
||||||
{% for(var i=0, l=addr_list.length; i<l; i++) { %}
|
{% for(var i=0, l=addr_list.length; i<l; i++) { %}
|
||||||
|
<div class="address-box">
|
||||||
<p class="h6">
|
<p class="h6">
|
||||||
{%= i+1 %}. {%= addr_list[i].address_type!="Other" ? __(addr_list[i].address_type) : addr_list[i].address_title %}
|
{%= 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) { %}
|
{% if(addr_list[i].is_primary_address) { %}
|
||||||
@ -9,14 +9,15 @@
|
|||||||
<span class="text-muted">({%= __("Shipping") %})</span>{% } %}
|
<span class="text-muted">({%= __("Shipping") %})</span>{% } %}
|
||||||
|
|
||||||
<a href="#Form/Address/{%= encodeURIComponent(addr_list[i].name) %}"
|
<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>
|
{%= __("Edit") %}</a>
|
||||||
</p>
|
</p>
|
||||||
<div style="padding-left: 15px;">
|
<p>{%= addr_list[i].display %}</p>
|
||||||
<p style="margin-top: 5px; font-size: 12px;">
|
|
||||||
{%= addr_list[i].display %}</p>
|
|
||||||
</div>
|
</div>
|
||||||
{% } %}
|
{% } %}
|
||||||
{% if(!addr_list.length) { %}
|
{% 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,38 +1,38 @@
|
|||||||
<p><button class="btn btn-xs btn-default btn-contact">
|
<div class="clearfix"></div>
|
||||||
{{ __("New Contact") }}</button></p>
|
|
||||||
<div class="clearfix"></div>
|
|
||||||
<ol>
|
|
||||||
{% for(var i=0, l=contact_list.length; i<l; i++) { %}
|
{% for(var i=0, l=contact_list.length; i<l; i++) { %}
|
||||||
<p class="h6">
|
<div class="address-box">
|
||||||
<li>
|
<p class="h6">
|
||||||
{%= contact_list[i].first_name %} {%= contact_list[i].last_name %}
|
{%= contact_list[i].first_name %} {%= contact_list[i].last_name %}
|
||||||
{% if(contact_list[i].is_primary_contact) { %}
|
{% if(contact_list[i].is_primary_contact) { %}
|
||||||
<span class="text-muted">({%= __("Primary") %})</span>
|
<span class="text-muted">({%= __("Primary") %})</span>
|
||||||
{% } %}
|
{% } %}
|
||||||
{% if(contact_list[i].designation){ %}
|
{% if(contact_list[i].designation){ %}
|
||||||
<span class="text-muted">– {%= contact_list[i].designation %}</span>
|
<span class="text-muted">– {%= contact_list[i].designation %}</span>
|
||||||
{% } %}
|
{% } %}
|
||||||
<a href="#Form/Contact/{%= encodeURIComponent(contact_list[i].name) %}"
|
<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"
|
||||||
{%= __("Edit") %}</a>
|
style="margin-top:-3px; margin-right: -5px;">
|
||||||
</li>
|
{%= __("Edit") %}</a>
|
||||||
</p>
|
</p>
|
||||||
|
{% if (contact_list[i].phone || contact_list[i].mobile_no ||
|
||||||
<div style="padding-left: 15px;">
|
contact_list[i].email_id) { %}
|
||||||
<p style="padding-top: 5px; font-size: 12px;">
|
<p>
|
||||||
{% if(contact_list[i].phone) { %}
|
{% if(contact_list[i].phone) { %}
|
||||||
{%= __("Phone") %}: {%= contact_list[i].phone %}<br>
|
{%= __("Phone") %}: {%= contact_list[i].phone %}<br>
|
||||||
{% } %}
|
{% } %}
|
||||||
{% if(contact_list[i].mobile_no) { %}
|
{% if(contact_list[i].mobile_no) { %}
|
||||||
{%= __("Mobile No.") %}: {%= contact_list[i].mobile_no %}<br>
|
{%= __("Mobile No.") %}: {%= contact_list[i].mobile_no %}<br>
|
||||||
{% } %}
|
{% } %}
|
||||||
{% if(contact_list[i].email_id) { %}
|
{% if(contact_list[i].email_id) { %}
|
||||||
{%= __("Email Address") %}: {%= contact_list[i].email_id %}
|
{%= __("Email Address") %}: {%= contact_list[i].email_id %}
|
||||||
{% } %}
|
{% } %}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
{% endif %}
|
||||||
|
</div>
|
||||||
{% } %}
|
{% } %}
|
||||||
</ol>
|
|
||||||
{% if(!contact_list.length) { %}
|
{% 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 {
|
.pos-payment-row {
|
||||||
border-bottom:1px solid #d1d8dd;
|
border-bottom:1px solid @border-color;
|
||||||
margin: 2px 0px 5px 0px;
|
margin: 2px 0px 5px 0px;
|
||||||
height: 60px;
|
height: 60px;
|
||||||
margin-top: 0px;
|
margin-top: 0px;
|
||||||
@ -134,12 +134,12 @@ body[data-route="pos"] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.pos-payment-row:hover, .pos-keyboard-key:hover{
|
.pos-payment-row:hover, .pos-keyboard-key:hover{
|
||||||
background-color: #FAFBFC;
|
background-color: @light-bg;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pos-keyboard-key, .delete-btn {
|
.pos-keyboard-key, .delete-btn {
|
||||||
border: 1px solid #d1d8dd;
|
border: 1px solid @border-color;
|
||||||
height:85px;
|
height:85px;
|
||||||
width:85px;
|
width:85px;
|
||||||
margin:10px 10px;
|
margin:10px 10px;
|
||||||
@ -150,7 +150,7 @@ body[data-route="pos"] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.numeric-keypad {
|
.numeric-keypad {
|
||||||
border: 1px solid #d1d8dd;
|
border: 1px solid @border-color;
|
||||||
height:69px;
|
height:69px;
|
||||||
width:69px;
|
width:69px;
|
||||||
font-size:20px;
|
font-size:20px;
|
||||||
@ -256,7 +256,7 @@ body[data-route="pos"] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.selected-payment-mode {
|
.selected-payment-mode {
|
||||||
background-color: #FAFBFC;
|
background-color: @light-bg;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,7 +355,7 @@ body[data-route="pos"] {
|
|||||||
|
|
||||||
.image-field {
|
.image-field {
|
||||||
height: 140px;
|
height: 140px;
|
||||||
|
|
||||||
.placeholder-text {
|
.placeholder-text {
|
||||||
font-size: 50px;
|
font-size: 50px;
|
||||||
}
|
}
|
||||||
|
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) {
|
if(!frm.doc.__islocal) {
|
||||||
frappe.contacts.render_address_and_contact(frm);
|
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.toggle_enable("default_currency", (frm.doc.__onload &&
|
||||||
!frm.doc.__onload.transactions_exist));
|
!frm.doc.__onload.transactions_exist));
|
||||||
|
|
||||||
@ -34,7 +36,7 @@ frappe.ui.form.on("Company", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
onload_post_render: function(frm) {
|
onload_post_render: function(frm) {
|
||||||
if(frm.get_field("delete_company_transactions").$input)
|
if(frm.get_field("delete_company_transactions").$input)
|
||||||
frm.get_field("delete_company_transactions").$input.addClass("btn-danger");
|
frm.get_field("delete_company_transactions").$input.addClass("btn-danger");
|
||||||
},
|
},
|
||||||
country: function(frm) {
|
country: function(frm) {
|
||||||
@ -144,7 +146,7 @@ erpnext.company.setup_queries = function(frm) {
|
|||||||
["round_off_account", {"root_type": "Expense"}],
|
["round_off_account", {"root_type": "Expense"}],
|
||||||
["write_off_account", {"root_type": "Expense"}],
|
["write_off_account", {"root_type": "Expense"}],
|
||||||
["exchange_gain_loss_account", {"root_type": "Expense"}],
|
["exchange_gain_loss_account", {"root_type": "Expense"}],
|
||||||
["accumulated_depreciation_account",
|
["accumulated_depreciation_account",
|
||||||
{"root_type": "Asset", "account_type": "Accumulated Depreciation"}],
|
{"root_type": "Asset", "account_type": "Accumulated Depreciation"}],
|
||||||
["depreciation_expense_account", {"root_type": "Expense", "account_type": "Depreciation"}],
|
["depreciation_expense_account", {"root_type": "Expense", "account_type": "Depreciation"}],
|
||||||
["disposal_account", {"report_type": "Profit and Loss"}],
|
["disposal_account", {"report_type": "Profit and Loss"}],
|
||||||
@ -158,11 +160,11 @@ erpnext.company.setup_queries = function(frm) {
|
|||||||
|
|
||||||
if (frm.doc.enable_perpetual_inventory) {
|
if (frm.doc.enable_perpetual_inventory) {
|
||||||
$.each([
|
$.each([
|
||||||
["stock_adjustment_account",
|
["stock_adjustment_account",
|
||||||
{"root_type": "Expense", "account_type": "Stock Adjustment"}],
|
{"root_type": "Expense", "account_type": "Stock Adjustment"}],
|
||||||
["expenses_included_in_valuation",
|
["expenses_included_in_valuation",
|
||||||
{"root_type": "Expense", "account_type": "Expenses Included in Valuation"}],
|
{"root_type": "Expense", "account_type": "Expenses Included in Valuation"}],
|
||||||
["stock_received_but_not_billed",
|
["stock_received_but_not_billed",
|
||||||
{"root_type": "Liability", "account_type": "Stock Received But Not Billed"}]
|
{"root_type": "Liability", "account_type": "Stock Received But Not Billed"}]
|
||||||
], function(i, v) {
|
], function(i, v) {
|
||||||
erpnext.company.set_custom_query(frm, v);
|
erpnext.company.set_custom_query(frm, v);
|
||||||
|
@ -51,10 +51,10 @@ class Company(Document):
|
|||||||
frappe.throw(_("Abbreviation already used for another company"))
|
frappe.throw(_("Abbreviation already used for another company"))
|
||||||
|
|
||||||
def validate_default_accounts(self):
|
def validate_default_accounts(self):
|
||||||
for field in ["default_bank_account", "default_cash_account",
|
for field in ["default_bank_account", "default_cash_account",
|
||||||
"default_receivable_account", "default_payable_account",
|
"default_receivable_account", "default_payable_account",
|
||||||
"default_expense_account", "default_income_account",
|
"default_expense_account", "default_income_account",
|
||||||
"stock_received_but_not_billed", "stock_adjustment_account",
|
"stock_received_but_not_billed", "stock_adjustment_account",
|
||||||
"expenses_included_in_valuation", "default_payroll_payable_account"]:
|
"expenses_included_in_valuation", "default_payroll_payable_account"]:
|
||||||
if self.get(field):
|
if self.get(field):
|
||||||
for_company = frappe.db.get_value("Account", self.get(field), "company")
|
for_company = frappe.db.get_value("Account", self.get(field), "company")
|
||||||
@ -96,9 +96,9 @@ class Company(Document):
|
|||||||
frappe.clear_cache()
|
frappe.clear_cache()
|
||||||
|
|
||||||
def install_country_fixtures(self):
|
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")):
|
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)
|
.format(self.country.lower()))(self)
|
||||||
|
|
||||||
def create_default_warehouses(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