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

I like to extend the main buttons only in some modules and using the t-if  but the button is added to all views.


I have tried multible positions and expessions like widget.model, widget.modelName, context,...


but the extenden is allways on all views. The strange part is that if the condissions are wrong the extend shouldnt happen anywhere not allways


<?xml version="1.0" encoding="UTF-8"?>

<template xml:space="preserve">

<t t-if="context['active_model'] === 'metallbook.delivery_note' or context['active_model'] === 'metallbook.credit_note'" t-extend="ListView.buttons">

<t t-jquery="button.o_list_button_add" t-operation="after">

<button type="button" class="btn btn-secondary o_button_importpdf" accesskey="p">
Import Pdf
</button>
<input type="file" class="o_file_importpdf" style="display:none" accept=".pdf" multiple="true" />
</t>

</t>

<t t-if="context['active_model'] === 'metallbook.delivery_note' or context['active_model'] === 'metallbook.credit_note'" t-extend="FormView.buttons">

<t t-jquery="button.o_list_button_add" t-operation="after">

<button type="button" class="btn btn-secondary o_button_importpdf" accesskey="p">
Import Pdf
</button>
<input type="file" class="o_file_importpdf" style="display:none" accept=".pdf" multiple="true" />
</t>

</t>

<t t-if="widget.modelName == 'account.move'" t-extend = "BillsListView.buttons">

<t t-jquery="button.o_list_button_add" t-operation="after">

<button type="button" class="btn btn-secondary o_button_importpdf" accesskey="p">
Import Pdf
</button>
<input type="file" class="o_file_importpdf" style="display:none" accept=".pdf" multiple="true" />
</t>

</t>

</template>



Ảnh đại diện
Huỷ bỏ