Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
4645 Переглядів

Hi,

Even with many tries, actually having issue to generate a block of HTML from a report when a button in the view is clicked.

On the Javascript side :

var rpc = require('web.rpc');
Var FormController = require('web.FormController');
FormController.include({
     _gen_html: function() {
        this._rpc({
            model: "product.template",
            method: 'my_method',
        }).then(function(result){
            // Things to do with response ...
        });


On the Python side :

class MyClass(models.Model):

@api.model
 def my_method(self):
        docargs = {
            "id": self.id,
        }
        #self.ensure_one()
        template = self.env['ir.actions.report'].search([('report_name', '=', "test_report")], limit=1).render_qweb_html(self, docargs)
        return template


The intention is to get a report from a specific view, a product or user or customer, don't care from which model it is because this button can be placed everywhere. Then it must generate an HTML block , like a report from an existing report with the information on the actual element based on the ID. The report itself is correct when seeing it with a standard method, but in this test the only response received by the RPC query is a minimal page with header / footer / body, but nothing in the page content.


@


Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
серп. 23
384
0
бер. 23
1784
2
січ. 23
5273
0
лют. 21
3412
0
бер. 15
552