Can't enable Print to PDF in custom entity

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • telecastg
    commented on 's reply
    You're welcome, of course yuri solution is the correct one, or at least a lot less complicated

  • denis.yougang
    commented on 's reply
    Thanks telecastg for the explanations, i will try this.

  • denis.yougang
    commented on 's reply
    Thanks yuri i removed the template and it's working fine

  • yuri
    replied
    If you remove PDF Template record for Sales Order (there is a default one), then 'Print to PDF' action should be automatically removed.

    Leave a comment:


  • telecastg
    replied
    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');
    
        }
    
      });
    });
    modified file: custom/Espo/Custom/Resources/metadata/ServiceTicket/clientDefs.json
    Code:
    {
      "recordViews": {
        "detail" : "custom:views/service-ticket/record/detail"
        }
    }
    After the changes, flush the cache and rebuild.

    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.

    Leave a comment:


  • denis.yougang
    replied
    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???

    Leave a comment:


  • telecastg
    replied
    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.

    Leave a comment:


  • sujithraalink
    started a topic Can't enable Print to PDF in custom entity

    Can't enable Print to PDF in custom entity

    I have created a custom entity, I need to enable print to PDF from there. Please help how it can be enabled.
Working...