[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
This commit is contained in:
parent
0bf19a1ac5
commit
bd59a53173
@ -494,4 +494,5 @@ erpnext.patches.v10_0.set_default_payment_terms_based_on_company
|
||||
erpnext.patches.v10_0.update_sales_order_link_to_purchase_order
|
||||
erpnext.patches.v10_0.added_extra_gst_custom_field_in_gstr2 #2018-02-13
|
||||
erpnext.patches.v10_0.item_barcode_childtable_migrate
|
||||
erpnext.patches.v10_0.update_translatable_fields
|
||||
erpnext.patches.v10_0.set_b2c_limit
|
||||
erpnext.patches.v10_0.update_translatable_fields
|
||||
|
11
erpnext/patches/v10_0/set_b2c_limit.py
Normal file
11
erpnext/patches/v10_0/set_b2c_limit.py
Normal file
@ -0,0 +1,11 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("regional", "doctype", "gst_settings")
|
||||
gst_settings = frappe.get_doc("GST Settings")
|
||||
gst_settings.b2c_limit = 250000
|
||||
gst_settings.save()
|
@ -160,6 +160,38 @@
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "250000",
|
||||
"description": "Set Invoice Value for B2C. B2CL and B2CS calculated based on this invoice value.",
|
||||
"fieldname": "b2c_limit",
|
||||
"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": "B2C Limit",
|
||||
"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
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
@ -172,7 +204,7 @@
|
||||
"issingle": 1,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2018-01-02 15:53:13.489144",
|
||||
"modified": "2018-02-14 08:14:15.375181",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Regional",
|
||||
"name": "GST Settings",
|
||||
|
@ -111,16 +111,21 @@ class Gstr1Report(object):
|
||||
conditions += " and invoice_type != 'Export' and is_return != 1 and customer in ('{0}')".\
|
||||
format("', '".join([frappe.db.escape(c.name) for c in customers]))
|
||||
|
||||
if self.filters.get("type_of_business") in ("B2C Large", "B2C Small"):
|
||||
b2c_limit = frappe.db.get_single_value('GSt Settings', 'b2c_limit')
|
||||
if not b2c_limit:
|
||||
frappe.throw(_("Please set B2C Limit in GST Settings."))
|
||||
|
||||
if self.filters.get("type_of_business") == "B2C Large":
|
||||
conditions += """ and SUBSTR(place_of_supply, 1, 2) != SUBSTR(company_gstin, 1, 2)
|
||||
and grand_total > 250000 and is_return != 1 and customer in ('{0}')""".\
|
||||
format("', '".join([frappe.db.escape(c.name) for c in customers]))
|
||||
|
||||
and grand_total > {0} and is_return != 1 and customer in ('{1}')""".\
|
||||
format((flt(b2c_limit), "', '".join([frappe.db.escape(c.name) for c in customers]) )
|
||||
|
||||
elif self.filters.get("type_of_business") == "B2C Small":
|
||||
conditions += """ and (
|
||||
SUBSTR(place_of_supply, 1, 2) = SUBSTR(company_gstin, 1, 2)
|
||||
or grand_total <= 250000 ) and is_return != 1 and customer in ('{0}')""".\
|
||||
format("', '".join([frappe.db.escape(c.name) for c in customers]))
|
||||
or grand_total <= {0}) and is_return != 1 and customer in ('{1}')""".\
|
||||
format(flt(b2c_limit), "', '".join([frappe.db.escape(c.name) for c in customers]))
|
||||
|
||||
elif self.filters.get("type_of_business") == "CDNR":
|
||||
conditions += """ and is_return = 1 """
|
||||
|
Loading…
x
Reference in New Issue
Block a user