title: Print a PDF report from Javascript Odoo 12
body: <p>I am trying to print barcode labels for attachments. I added a new button in kanban view of documents page. I trying to print PDF report for selected documents.
   Here is the code.</p>
  
  <p><strong>*.js</strong></p>
  
  <pre><code>odoo.define('documents.DocumentsInspector.inherit', function (require) 
  {
  "use strict";
  
  var model = require('documents.DocumentsInspector');
  var core = require('web.core');
  var _t = core._t;
  var qweb = core.qweb;
  var BaseImport = require('base_import.import')
  var rpc = require('web.rpc')
  
  model.include({
  
   events: {
    'click .o_inspector_archive': '_onArchive',
    'click .o_inspector_delete': '_onDelete',
    'click .o_inspector_download': '_onDownload',
    'click .o_inspector_replace': '_onReplace',
    'click .o_inspector_lock': '_onLock',
    'click .o_inspector_share': '_onShare',
    'click .o_inspector_open_chatter': '_onOpenChatter',
    'click .o_inspector_tag_add': '_onTagInputClicked',
    'click .o_inspector_tag_remove': '_onRemoveTag',
    'click .o_inspector_trigger_rule': '_onTriggerRule',
    'click .o_inspector_object_name': '_onOpenResource',
    'click .o_preview_available': '_onOpenPreview',
    'click .o_document_pdf': '_onOpenPDF',
    'mouseover .o_inspector_trigger_hover': '_onMouseoverRule',
    'mouseout .o_inspector_trigger_hover': '_onMouseoutRule',
    'click .o_inspector_print': '_onBarcodePrint',
  },
  
  
  /**
   * @private
   */
  _onBarcodePrint: function (ev) {
  
   var attachment_ids = [];
  _.each(this.records,function(data){
    // console.log('data',data);
    attachment_ids.push(data.res_id)
  }),
  
  rpc.query({model: 'ir.attachment', method: 'print_barcode',args:[attachment_ids]})
   },
   });
  
  
  
  });
  </code></pre>
  
  <p><strong>report.AbstractModel</strong></p>
  
  <pre><code> class PrintDocumentBarcode(models.AbstractModel):
  _name = 'report.ean13_attachment.report_documentbarcode'
  _description = 'Document Barcodes'
  
  @api.model
  def _get_report_values(self, docids, data=None):
  
      if data.get('atids'):
          doc = self.env['ir.attachment'].browse(data.get('atids'))
      else:
          doc = self.env['ir.attachment'].browse(docids)
  
      return {
          'doc_ids': docids,
          'doc_model': self.env['ir.attachment'],
          'docs': doc,
  
      }
  </code></pre>
  
  <p><strong>ir.attachment</strong></p>
  
  <pre><code>def print_barcode(self):
      data = {}
      data['atids']=self.ids
      return self.env.ref('ean13_attachment.action_report_documentbarcode').with_context(landscape=True).report_action(self, data=data)
  </code></pre>
  
  <p>The function <code>print_barcode</code> executes successfully, but <code>_get_report_values</code> not.</p>
  
  <p>How can i achieve this?</p>