Przeglądaj źródła

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

version-14
Sagar Vora 4 lat temu
committed by Suraj Shetty
rodzic
commit
bc1b928d73
3 zmienionych plików z 10 dodań i 9 usunięć
  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 Wyświetl plik

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


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

+ 8
- 5
frappe/public/js/frappe/views/communication.js Wyświetl plik

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

this.make(); this.make();
} }


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


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


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


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


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


if (!form_values.recipients) { if (!form_values.recipients) {
frappe.msgprint(__("Enter Email Recipient(s)")); 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")); frappe.msgprint(__("You are not allowed to send emails related to this document"));
return; return;
} }


+ 1
- 3
frappe/public/js/frappe/views/inbox/inbox_view.js Wyświetl plik

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

Ładowanie…
Anuluj
Zapisz