콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다

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.


@


아바타
취소
관련 게시물 답글 화면 활동
1
8월 23
384
0
3월 23
1792
2
1월 23
5277
0
2월 21
3418
0
3월 15
555