Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: option to disable Item Tax Template and Tax Category #29349

Merged
merged 3 commits into from
Feb 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
"actions": [],
"allow_import": 1,
"allow_rename": 1,
"creation": "2018-11-22 22:45:00.370913",
"creation": "2022-01-19 01:09:13.297137",
"doctype": "DocType",
"document_type": "Setup",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"title",
"company",
"column_break_3",
"disabled",
"section_break_5",
"taxes"
],
"fields": [
Expand All @@ -36,10 +39,24 @@
"label": "Company",
"options": "Company",
"reqd": 1
},
{
"fieldname": "column_break_3",
"fieldtype": "Column Break"
},
{
"default": "0",
"fieldname": "disabled",
"fieldtype": "Check",
"label": "Disabled"
},
{
"fieldname": "section_break_5",
"fieldtype": "Section Break"
}
],
"links": [],
"modified": "2021-03-08 19:50:21.416513",
"modified": "2022-01-18 21:11:23.105589",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Item Tax Template",
Expand Down Expand Up @@ -82,6 +99,7 @@
"show_name_in_global_search": 1,
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"title_field": "title",
"track_changes": 1
}
15 changes: 12 additions & 3 deletions erpnext/accounts/doctype/tax_category/tax_category.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
"actions": [],
"allow_rename": 1,
"autoname": "field:title",
"creation": "2018-11-22 23:38:39.668804",
"creation": "2022-01-19 01:09:28.920486",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"title"
"title",
"disabled"
],
"fields": [
{
Expand All @@ -18,14 +19,21 @@
"label": "Title",
"reqd": 1,
"unique": 1
},
{
"default": "0",
"fieldname": "disabled",
"fieldtype": "Check",
"label": "Disabled"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2021-03-03 11:50:38.748872",
"modified": "2022-01-18 21:13:41.161017",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Tax Category",
"naming_rule": "By fieldname",
"owner": "Administrator",
"permissions": [
{
Expand Down Expand Up @@ -65,5 +73,6 @@
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"track_changes": 1
}
5 changes: 3 additions & 2 deletions erpnext/controllers/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,7 @@ def get_tax_template(doctype, txt, searchfield, start, page_len, filters):

item_doc = frappe.get_cached_doc('Item', filters.get('item_code'))
item_group = filters.get('item_group')
company = filters.get('company')
taxes = item_doc.taxes or []

while item_group:
Expand All @@ -718,7 +719,7 @@ def get_tax_template(doctype, txt, searchfield, start, page_len, filters):
item_group = item_group_doc.parent_item_group

if not taxes:
return frappe.db.sql(""" SELECT name FROM `tabItem Tax Template` """)
return frappe.get_all('Item Tax Template', filters={'disabled': 0, 'company': company}, as_list=True)
else:
valid_from = filters.get('valid_from')
valid_from = valid_from[1] if isinstance(valid_from, list) else valid_from
Expand All @@ -727,7 +728,7 @@ def get_tax_template(doctype, txt, searchfield, start, page_len, filters):
'item_code': filters.get('item_code'),
'posting_date': valid_from,
'tax_category': filters.get('tax_category'),
'company': filters.get('company')
'company': company
}

taxes = _get_item_tax_template(args, taxes, for_validate=True)
Expand Down