Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
22268 Lượt xem


I'm working on the survey module, especially on the survey_result.xml file containing all the templates results. I want to change the whole result_matrix template code (the result displayed for all matrix question type) using inheritance. 

So I used :
 

<template name="matrix_result_extended" inherit_id="survey.result_ matrix">
<xpath expr="." position="replace">
<!-- custom code here to replace all template code -->
</xpath>
</template>


But it seems that it doesn't work, because the parent result_matrix is not recognized by the qweb engine anymore when trying to render the survey results.

Is there a clean way to replace all code template by a completely new one ? 
 

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

You redefine the full template with the same id="survey.result_matrix" and without inherit_id  (and with depends in __openerp__.py)

Ảnh đại diện
Huỷ bỏ
Tác giả

And I do this redefinition on the survey module, not on a custom module ?

Tác giả

I think you mean redefine on a custom module "survey_extension" for example, with the same id="survey.result_matrix", and on the survey module __openerp__.py file add "survey_extension" on depends option. Is that correct ?

Yes, I mean custom module.

Câu trả lời hay nhất

This works, but it's distructive.

If you will uninstall your custom module, the default report will remain the one you've changed, and this is not ok in all scenarios

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 12 22
22776
Qweb Inheritance Đã xử lý
3
thg 11 19
7608
2
thg 1 24
1338
1
thg 9 20
7369
3
thg 8 20
27253