Hi , i'm blocked i need to make a verification based on the view id in my xml template to display a button
there is the code :
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hi , i'm blocked i need to make a verification based on the view id in my xml template to display a button
there is the code :
which mean you only want your button to display in a specific view id (xml id) not all view ?. please be more specific what view ?
yes exactly , i want to define a context and inside it a value to 'view_id' so in my xml template i can display the button in a specefic view and not all views , and that with t-if condition , exemple : <button class="btn btn-primary" t-on-click="display_archives" t-if="view_id == 1234">Archives</button>
Ok, so currently you want to display which kind of button in which view because i haven't seen a view_id in a normal xml qweb for form, list, etc view before ?
And is your problem like you add button in a product view example, but you only the button to be display on a specific product.product view because we all know product.product form view has several
I
Hi , so with an xml template i inherited tree view header and added a button , and i added to it a javascript function with return an action with a different domain wich allow to see archived record , the problem is that this button appears in all views of the module , but me i want that the button appears in one specefic view
A button can add directly in the tree view, you do not need js code like <button name="your action" string="Archive" invisible="1"/>
You can use condition to hidden that button
No because in this case you need to select records to see the button, if you do not select record you can't see the button , what i want is a button that is always visible like "create" button
Try use res_model condition in you xml template for the button i guest
yes but the model hasmany tree views and i want that the button be displayed in only specific one of them
use js_class attribute, search for odoo code to see
Normally, we will define a js class in js and in xml we will add js class in a tree view so that tree view will have the js code and xml template only