[minor] [for territory] auto add default For Territory in a new Tax Master, Shipping Rule and Price List
This commit is contained in:
parent
4563ef3aea
commit
1ffc5b576c
@ -16,7 +16,8 @@
|
||||
|
||||
//--------- ONLOAD -------------
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
//
|
||||
if(doc.doctype === "Sales Taxes and Charges Master")
|
||||
erpnext.add_for_territory();
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
|
5
accounts/doctype/shipping_rule/shipping_rule.js
Normal file
5
accounts/doctype/shipping_rule/shipping_rule.js
Normal file
@ -0,0 +1,5 @@
|
||||
$.extend(cur_frm.cscript, {
|
||||
onload: function() {
|
||||
erpnext.add_for_territory();
|
||||
}
|
||||
});
|
@ -39,5 +39,14 @@ $.extend(erpnext, {
|
||||
cur_frm.toggle_display("company", false);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
add_for_territory: function() {
|
||||
if(cur_frm.doc.__islocal &&
|
||||
wn.model.get_doclist(cur_frm.doc.doctype, cur_frm.doc.name).length === 1) {
|
||||
var territory = wn.model.add_child(cur_frm.doc, "For Territory",
|
||||
"valid_for_territories");
|
||||
territory.territory = wn.defaults.get_default("territory");
|
||||
}
|
||||
},
|
||||
});
|
@ -14,11 +14,13 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
cur_frm.cscript.onload = function() {
|
||||
$.extend(cur_frm.cscript, {
|
||||
onload: function() {
|
||||
cur_frm.cscript.show_item_prices();
|
||||
}
|
||||
erpnext.add_for_territory();
|
||||
},
|
||||
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
refresh: function(doc) {
|
||||
cur_frm.set_intro("");
|
||||
if(doc.__islocal) {
|
||||
cur_frm.toggle_display("item_prices_section", false);
|
||||
@ -27,9 +29,9 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
} else {
|
||||
cur_frm.cscript.show_item_prices();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
cur_frm.cscript.show_item_prices = function() {
|
||||
show_item_prices: function() {
|
||||
var item_price = wn.model.get("Item Price", {price_list_name: cur_frm.doc.name});
|
||||
|
||||
var show = item_price && item_price.length;
|
||||
@ -54,3 +56,4 @@ cur_frm.cscript.show_item_prices = function() {
|
||||
</table>';
|
||||
$(out).appendTo($(cur_frm.fields_dict.item_prices.wrapper));
|
||||
}
|
||||
});
|
Loading…
Reference in New Issue
Block a user