Skip to Content
Menu
This question has been flagged
1 Reply
9649 Views

I am trying to create a new button to process my data in my model mymodule.sales.

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

<template id="template" xml:space="preserve">      
  <t t-extend="ListView.buttons">
    <t t-jquery="button.o_list_button_add" t-operation="after">
        <button t-if="widget.model == 'mymodule.sales'" class="btn btn-primary btn-sm" type="button">Process</button>
    </t>
  </t>  
</template>

The new button is not showing but when i remove the block t-if="widget.model == 'mymodule.sales'" the button is shown. What did i miss ? How do i perform a debugging to display or log the value of widget.model ?


Avatar
Discard
Best Answer

Review:

https://www.odoo.com/documentation/11.0/reference/reports.html

From there you will read:

There are some specific variables accessible in reports, mainly:

docs
records for the current report
doc_ids
list of ids for the docs records
doc_model
model for the docs records

So that means if you want to show something ONLY when the doc_model represents an Invoice or Sale Order, you can do something like this:
<t t-if="doc_model in ['account.invoice','sale.order']">
...
</t>
Avatar
Discard
Author

I tried replacing the condition as mentioned, but it is still not working. There is also no error in odoo.log.

Related Posts Replies Views Activity
2
Jul 24
939
1
Jun 24
3560
1
Oct 23
8579
1
Oct 23
97
1
Aug 23
2192