[form] [fix] header refresh, frappe/erpnext#2853

This commit is contained in:
Rushabh Mehta 2015-03-04 13:59:38 +05:30
parent 08d527786f
commit 2bee7124ed
4 changed files with 11 additions and 10 deletions

View file

@ -9,7 +9,6 @@ from frappe import _
from frappe.utils import now, cint
from frappe.model import no_value_fields
from frappe.model.document import Document
from frappe.model.db_schema import type_map
from frappe.custom.doctype.property_setter.property_setter import make_property_setter
from frappe.desk.notifications import delete_notification_count_for
from frappe.modules import make_boilerplate
@ -106,7 +105,7 @@ class DocType(Document):
make_module_and_roles(self)
from frappe import conf
if not (frappe.flags.in_import or frappe.flags.in_test) and conf.get('developer_mode') or 0:
if not self.custom and not (frappe.flags.in_import or frappe.flags.in_test) and conf.get('developer_mode'):
self.export_doc()
self.make_controller_template()

View file

@ -60,21 +60,21 @@ frappe.ui.form.Toolbar = Class.extend({
var docstatus = cint(this.frm.doc.docstatus);
// Print
if(!me.frm.doc.__islocal && frappe.model.can_print(null, me.frm)) {
if(frappe.model.can_print(null, me.frm)) {
this.page.add_menu_item(__("Print"), function() {
me.frm.print_doc();}, true);
this.page.add_action_icon("icon-print", function() {
this.print_icon = this.page.add_action_icon("icon-print", function() {
me.frm.print_doc();});
}
// email
if(!me.frm.doc.__islocal && frappe.model.can_email(null, me.frm)) {
if(frappe.model.can_email(null, me.frm)) {
this.page.add_menu_item(__("Email"), function() {
me.frm.email_doc();}, true);
}
// Linked With
if(!me.frm.doc.__islocal && !me.frm.meta.issingle) {
if(!me.frm.meta.issingle) {
this.page.add_menu_item(__('Links'), function() {
me.show_linked_with();
}, true)

View file

@ -168,10 +168,12 @@ frappe.ui.Page = Class.extend({
show_menu: function() {
this.menu_btn_group.removeClass("hide");
this.icon_group.removeClass("hide");
},
hide_menu: function() {
this.menu_btn_group.addClass("hide");
this.icon_group.addClass("hide");
},
//--- Actions (workflow) --//

View file

@ -404,10 +404,6 @@ _f.Frm.prototype.refresh = function(docname) {
_f.Frm.prototype.render_form = function() {
if(!this.meta.istable) {
// header
this.refresh_header();
this.sidebar.refresh();
// call trigger
this.script_manager.trigger("refresh");
@ -418,6 +414,10 @@ _f.Frm.prototype.render_form = function() {
// fields
this.refresh_fields();
// header
this.refresh_header();
this.sidebar.refresh();
// call onload post render for callbacks to be fired
if(this.cscript.is_onload) {
this.script_manager.trigger("onload_post_render");