fix: Misleading filters on Item tax Template Link field

This commit is contained in:
marination
2020-08-05 15:04:48 +05:30
parent 271c550e96
commit c407bb2385
2 changed files with 5 additions and 3 deletions

View File

@@ -613,9 +613,12 @@ def get_tax_template(doctype, txt, searchfield, start, page_len, filters):
if not taxes: if not taxes:
return frappe.db.sql(""" SELECT name FROM `tabItem Tax Template` """) return frappe.db.sql(""" SELECT name FROM `tabItem Tax Template` """)
else: else:
valid_from = filters.get('valid_from')
valid_from = valid_from[1] if isinstance(valid_from, list) else valid_from
args = { args = {
'item_code': filters.get('item_code'), 'item_code': filters.get('item_code'),
'posting_date': filters.get('valid_from'), 'posting_date': valid_from,
'tax_category': filters.get('tax_category') 'tax_category': filters.get('tax_category')
} }

View File

@@ -1788,7 +1788,6 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
}, },
set_query_for_item_tax_template: function(doc, cdt, cdn) { set_query_for_item_tax_template: function(doc, cdt, cdn) {
var item = frappe.get_doc(cdt, cdn); var item = frappe.get_doc(cdt, cdn);
if(!item.item_code) { if(!item.item_code) {
frappe.throw(__("Please enter Item Code to get item taxes")); frappe.throw(__("Please enter Item Code to get item taxes"));
@@ -1796,7 +1795,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
let filters = { let filters = {
'item_code': item.item_code, 'item_code': item.item_code,
'valid_from': doc.transaction_date || doc.bill_date || doc.posting_date, 'valid_from': ["<=", doc.transaction_date || doc.bill_date || doc.posting_date],
'item_group': item.item_group, 'item_group': item.item_group,
} }