I have created a custom entity, I need to enable print to PDF from there. Please help how it can be enabled.
Announcement
Collapse
No announcement yet.
Can't enable Print to PDF in custom entity
Collapse
X
-
First you need to create a template for your custom entity:
Menu>Templates>Create Template
Select your custom entity type from the Entity Type select element
Enter your template values
The button 'Print Pdf' will be automatically added in the entity's detail upper left drop down menu.
This is executed by the 'views/record/detail.js' script when there is a Template record with the entityType value equal to the custom entity.
-
Hi everyone, I am Denis, i am new to espocrm. i am facing the issue:
I want to disbable the "print to pdf" button in sales order module. but when i comment the the print function in client/src/views/record/details.js,
it removes "print to pdf" button in (quote, invoice, salesOrder).
Can someone Help, please!
Thanks in advance
Note: i was able to hide the "duplicate" button by adding
"duplicateDisabled"=true
in custom/ressources/metadata/clientDefs/Entity.json.
Is there an attribute like "duplicateDisabled" that we can use to disable "print to pdf" button???
Comment
-
Hello, I don't believe that there is a metadata setting to remove the pdf print button.
You can do it by creating a custom view for any entity on which you want to remove the button.
We don't use the sales module our application but we have a custom entity called ServiceTicket where we wanted to remove the "print to PDF" button and it was done as follows:
created file: client/custom/src/views/service-ticket/record/detail.js
Code:Espo.define('custom:views/service-ticket/record/detail', 'views/record/detail', function (Dep) { return Dep.extend({ setupActionItems: function () { // execute the setupActionItems function from the original script Dep.prototype.setupActionItems.call(this); // remove the print to pdf button this.removeButton('printPdf'); } }); });
Code:{ "recordViews": { "detail" : "custom:views/service-ticket/record/detail" } }
As a side note, I don't recommend changing the original scripts as your modifications will be wiped out by any updates, instead always create scripts in the "Custom" namespace, just like Espo does when you create new entities or fields using the Administration GUI.Last edited by telecastg; 03-29-2020, 10:20 PM.
- Likes 1
Comment
-
If you remove PDF Template record for Sales Order (there is a default one), then 'Print to PDF' action should be automatically removed.
Comment
Comment