浏览代码

fix: cannot read property `doc` of undefined (#12891)

version-14
Sagar Vora 4 年前
committed by Suraj Shetty
父节点
当前提交
bc1b928d73
共有 3 个文件被更改,包括 10 次插入9 次删除
  1. +1
    -1
      frappe/core/doctype/communication/communication_list.js
  2. +8
    -5
      frappe/public/js/frappe/views/communication.js
  3. +1
    -3
      frappe/public/js/frappe/views/inbox/inbox_view.js

+ 1
- 1
frappe/core/doctype/communication/communication_list.js 查看文件

@@ -20,6 +20,6 @@ frappe.listview_settings['Communication'] = {
},

primary_action: function() {
new frappe.views.CommunicationComposer({ doc: {} });
new frappe.views.CommunicationComposer();
}
};

+ 8
- 5
frappe/public/js/frappe/views/communication.js 查看文件

@@ -7,6 +7,10 @@ const separator_element = '<div>---</div>';
frappe.views.CommunicationComposer = class {
constructor(opts) {
$.extend(this, opts);
if (!this.doc) {
this.doc = this.frm && this.frm.doc || {};
}

this.make();
}

@@ -269,7 +273,7 @@ frappe.views.CommunicationComposer = class {
method: 'frappe.email.doctype.email_template.email_template.get_email_template',
args: {
template_name: email_template,
doc: me.frm.doc,
doc: me.doc,
_lang: me.dialog.get_value("language_sel")
},
callback(r) {
@@ -382,11 +386,10 @@ frappe.views.CommunicationComposer = class {
}

setup_print_language() {
const doc = this.frm && this.frm.doc;
const fields = this.dialog.fields_dict;

//Load default print language from doctype
this.lang_code = doc.language
this.lang_code = this.doc.language
|| this.get_print_format().default_print_language
|| frappe.boot.lang;

@@ -612,7 +615,7 @@ frappe.views.CommunicationComposer = class {

send_email(btn, form_values, selected_attachments, print_html, print_format) {
const me = this;
me.dialog.hide();
this.dialog.hide();

if (!form_values.recipients) {
frappe.msgprint(__("Enter Email Recipient(s)"));
@@ -625,7 +628,7 @@ frappe.views.CommunicationComposer = class {
}


if (this.frm && !frappe.model.can_email(me.doc.doctype, this.frm)) {
if (this.frm && !frappe.model.can_email(this.doc.doctype, this.frm)) {
frappe.msgprint(__("You are not allowed to send emails related to this document"));
return;
}


+ 1
- 3
frappe/public/js/frappe/views/inbox/inbox_view.js 查看文件

@@ -204,9 +204,7 @@ frappe.views.InboxView = class InboxView extends frappe.views.ListView {
};
frappe.new_doc('Email Account');
} else {
new frappe.views.CommunicationComposer({
doc: {}
});
new frappe.views.CommunicationComposer();
}
}
};

正在加载...
取消
保存