Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
22278 มุมมอง


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 ? 
 

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
ผู้เขียน

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

ผู้เขียน

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.

คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
How to modify a qweb template? แก้ไขแล้ว
2
ธ.ค. 22
22798
Qweb Inheritance แก้ไขแล้ว
3
พ.ย. 19
7619
2
ม.ค. 24
1338
1
ก.ย. 20
7374
3
ส.ค. 20
27276