[print] Disable rounded total
This commit is contained in:
parent
0e93352c8d
commit
bc708ee4c2
@ -73,3 +73,4 @@ execute:frappe.delete_doc("DocType", "Payment to Invoice Matching Tool") # 29-07
|
||||
execute:frappe.delete_doc("DocType", "Payment to Invoice Matching Tool Detail") # 29-07-2014
|
||||
execute:frappe.delete_doc("Page", "trial-balance") #2014-07-22
|
||||
erpnext.patches.v4_2.delete_old_print_formats #2014-07-29
|
||||
erpnext.patches.v4_2.toggle_rounded_total
|
||||
|
9
erpnext/patches/v4_2/toggle_rounded_total.py
Normal file
9
erpnext/patches/v4_2/toggle_rounded_total.py
Normal file
@ -0,0 +1,9 @@
|
||||
# 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():
|
||||
global_defaults = frappe.get_doc("Global Defaults", "Global Defaults")
|
||||
global_defaults.toggle_rounded_total()
|
@ -16,7 +16,6 @@ frappe.require("assets/erpnext/js/transaction.js");
|
||||
erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
onload: function() {
|
||||
this._super();
|
||||
this.toggle_rounded_total();
|
||||
this.setup_queries();
|
||||
this.toggle_editable_price_list_rate();
|
||||
},
|
||||
@ -229,16 +228,6 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
}
|
||||
},
|
||||
|
||||
toggle_rounded_total: function() {
|
||||
var me = this;
|
||||
if(cint(frappe.defaults.get_global_default("disable_rounded_total"))) {
|
||||
$.each(["rounded_total", "rounded_total_export"], function(i, fieldname) {
|
||||
me.frm.set_df_property(fieldname, "print_hide", 1);
|
||||
me.frm.toggle_display(fieldname, false);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
toggle_editable_price_list_rate: function() {
|
||||
var df = frappe.meta.get_docfield(this.tname, "price_list_rate", this.frm.doc.name);
|
||||
var editable_price_list_rate = cint(frappe.defaults.get_default("editable_price_list_rate"));
|
||||
|
@ -5,6 +5,8 @@ from __future__ import unicode_literals
|
||||
"""Global Defaults"""
|
||||
import frappe
|
||||
import frappe.defaults
|
||||
from frappe.utils import cint
|
||||
from frappe.core.doctype.property_setter.property_setter import make_property_setter
|
||||
|
||||
keydict = {
|
||||
# "key in defaults": "key in Global Defaults"
|
||||
@ -42,8 +44,19 @@ class GlobalDefaults(Document):
|
||||
if self.default_currency:
|
||||
frappe.db.set_value("Currency", self.default_currency, "enabled", 1)
|
||||
|
||||
self.toggle_rounded_total()
|
||||
|
||||
# clear cache
|
||||
frappe.clear_cache()
|
||||
|
||||
def get_defaults(self):
|
||||
return frappe.defaults.get_defaults()
|
||||
|
||||
def toggle_rounded_total(self):
|
||||
self.disable_rounded_total = cint(self.disable_rounded_total)
|
||||
|
||||
# Make property setters to hide rounded total fields
|
||||
for doctype in ("Quotation", "Sales Order", "Sales Invoice", "Delivery Note"):
|
||||
for fieldname in ("rounded_total", "rounded_total_export"):
|
||||
make_property_setter(doctype, fieldname, "hidden", self.disable_rounded_total, "Check")
|
||||
make_property_setter(doctype, fieldname, "print_hide", self.disable_rounded_total, "Check")
|
||||
|
Loading…
x
Reference in New Issue
Block a user