Filters for tax templates (#23998)

* feat: add company filter to tax templates

* fix: remove filer from PO because it is from tran

* fix: linting

* fix: solve translation string issues

* fix: remove doctype name
This commit is contained in:
Mohammad Hasnain Mohsin Rajan 2020-11-25 15:36:41 +05:30 committed by GitHub
parent 6b57cf3285
commit e15b6a91de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 11 deletions

View File

@ -35,6 +35,15 @@ frappe.ui.form.on('POS Profile', {
};
});
frm.set_query("taxes_and_charges", function() {
return {
filters: [
['Sales Taxes and Charges Template', 'company', '=', frm.doc.company],
['Sales Taxes and Charges Template', 'docstatus', '!=', 2]
]
};
});
frm.set_query('company_address', function(doc) {
if(!doc.company) {
frappe.throw(__('Please set Company'));

View File

@ -209,6 +209,17 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
});
}
if (this.frm.fields_dict.taxes_and_charges) {
this.frm.set_query("taxes_and_charges", function() {
return {
filters: [
['company', '=', me.frm.doc.company],
['docstatus', '!=', 2]
]
};
});
}
},
onload: function() {
var me = this;

View File

@ -42,16 +42,6 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
me.frm.set_query('customer_address', erpnext.queries.address_query);
me.frm.set_query('shipping_address_name', erpnext.queries.address_query);
if(this.frm.fields_dict.taxes_and_charges) {
this.frm.set_query("taxes_and_charges", function() {
return {
filters: [
['Sales Taxes and Charges Template', 'company', '=', me.frm.doc.company],
['Sales Taxes and Charges Template', 'docstatus', '!=', 2]
]
}
});
}
if(this.frm.fields_dict.selling_price_list) {
this.frm.set_query("selling_price_list", function() {
@ -479,7 +469,7 @@ frappe.ui.form.on(cur_frm.doctype,"project", function(frm) {
$.each(frm.doc["items"] || [], function(i, row) {
if(r.message) {
frappe.model.set_value(row.doctype, row.name, "cost_center", r.message);
frappe.msgprint(__("Cost Center For Item with Item Code '"+row.item_name+"' has been Changed to "+ r.message));
frappe.msgprint(__("Cost Center For Item with Item Code {0} has been Changed to {1}", [row.item_name, r.message]));
}
})
}