Announcement
Collapse
No announcement yet.
Opportunities Template > PDF
Collapse
X
-
It seems that the json syntax in clientDefs file is valid.
In the data/cache/application/metadata.php, I can find :
Code:(...) 'Client' => array ( 'controller' => 'controllers/record', 'views' => array ( 'detail' => 'custom:views/client/detail', ), (...)
Code:Uncaught TypeError: Cannot read property 'push' of undefined at child.setup (eval at _execute (espo.min.js?r=1527897572:17), <anonymous>:35:35) at child.initialize (espo.min.js?r=1527897572:16) at child.Backbone.View (espo.min.js?r=1527897572:6) at child [as constructor] (espo.min.js?r=1527897572:6) at child [as constructor] (espo.min.js?r=1527897572:6) at child [as constructor] (espo.min.js?r=1527897572:6) at child [as constructor] (espo.min.js?r=1527897572:6) at new child (espo.min.js?r=1527897572:6) at Bull.Factory.<anonymous> (espo.min.js?r=1527897572:16) at Bull.Factory._getViewClass (espo.min.js?r=1527897572:16)
Thanks
-
did you set this view in custom clientDefs?
-
tanya Thanks a lot for the reply. Actually, I used "myCustomEntity" in my question post as a placeholder.
The actual name of my custom entity is "client" so the detail.js is located here :
/client/custom/src/views/client/detail.js
and its first line is :
Espo.define('custom:views/client/detail', 'views/detail', function (Dep) {
Thanks again for the support.
-
Hi,
I am trying to replicate what's explained in this topic to add the action "Email PDF" in the detail view. I must be missing something because I can't make it work. The button is not showing at all.
It is for a custom entity for which I have created PDF template (that I can generate without problem). I have the latest version of espoCRM and I have Advanced Pack as well. I would like to add the option to Email the PDF just as it is natively possible with Quote entity but for my custom entity.
I created the a file /client/custom/src/views/myCustomEntity/detail.js with the same code as above except that I have replace "opportunity" by "myCustomEntity"
Any idea what I am missing out ? What are the files that I have to create/update to make this work ?
Any help would be highly appreaciated
Thanks a lot in advance
Leave a comment:
-
Hello,
did you override Opportunity clientDefs?
Did you rebuild Espo? (Administration > Rebuild)
Did you refresh the page?
Leave a comment:
-
Hello,
To add my button, I created a file detail.js in the following folder:
/client/custom/src/views/opportunity/detail.js
This file contains the following code:
Code:Espo.define('custom:views/opportunity/detail', 'views/detail', function (Dep) { return Dep.extend({ setup: function () { Dep.prototype.setup.call(this); this.dropdownItemList.push({ name: 'printPdf', label: 'Print to PDF' }); this.dropdownItemList.push({ name: 'composeEmail', label: 'Email PDF' }); if (this.getAcl().checkModel(this.model, 'edit')) { this.dropdownItemList.push({ 'label': 'Duplicate', 'name': 'duplicate' }); } }, actionPrintPdf: function () { this.createView('pdfTemplate', 'Modals.SelectTemplate', { entityType: this.model.name }, function (view) { view.render(); this.listenToOnce(view, 'select', function (model) { window.open('?entryPoint=pdf&entityType='+this.model.name+'&entityId='+this.model.id+'&templateId=' + model.id, '_blank'); }, this); }.bind(this)); }, actionComposeEmail: function () { this.createView('pdfTemplate', 'views/modals/select-template', { entityType: this.model.name }, function (view) { view.render(); this.listenToOnce(view, 'select', function (model) { this.notify('Loading...'); this.ajaxPostRequest('Quote/action/getAttributesForEmail', { quoteId: this.model.id, templateId: model.id }).done(function (attributes) { var viewName = this.getMetadata().get('clientDefs.Email.modalViews.compose') || 'views/modals/compose-email'; this.createView('composeEmail', viewName, { attributes: attributes, keepAttachmentsOnSelectTemplate: true }, function (view) { view.render(); this.notify(false); }, this); }.bind(this)); }, this); }, this); } }); });
I don't know what my error is.
I consulted all the links given by Tanya , thank you very much, but I'm not good enough to succeed without your help...
Thank you
Leave a comment:
-
Good morning. Hello,
I looked at the link, thank you.
I understand the principle but I'm looking for the file to modify. Can you tell me what his path is, please?
Thank you
Leave a comment:
-
Opportunities Template > PDF
Hello,
I created a template for opportunities (from https://url/#Template).
Now, I want to be able to print an opportunity (or create a PDF) as defined in the template... but I don't know how to do it. There is no button to create a PDF when I list opportunities or edit an opportunity.
I searched the forum, but I can't find an answer (or I don't understand ).
Can you help me, please?
Thank you very much!
Tags: None
Leave a comment: