Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
4 Odpowiedzi
6081 Widoki

Hello, 


I'm trying to hide the "New quotation" button on crm leads. I can't figure out how to select it in my xml view. We're on version 12.


The button is created by the sale_crm module using the action identifier : 

<button string="New Quotation" name="%(sale_action_quotations_new)d" type="action" class="oe_highlight" .../>

There's no id defined on the button, and I'm not allowed to use the string property as a selector. How can I target that button using xpath ?

Thanks !

Awatar
Odrzuć
Autor

Thanks for the answers. 

@Chris : I can use the name and just hardcode the id of the action in my view. Unfortunately, IDs change between instances, so that is not a robust solution. 

@Ray : I would need to know the exact position of the button in the view when the module is installed. So your solution would break if another module added a button to the view before mine, correct ?

In your example it looks as if the name is action_sale_quotations_new so that should work, shouldn't it? I agree that Action ID does seem to vary by instance, so that it's not a portable solution but it won't change once you have installed the modules.

Najlepsza odpowiedź

I think you can use the name:

In my Odoo 12 EE database the button name is the ID of the Windows Action so it's like this:

<data>
  <xpath expr="//button[@name='425']" position="replace"/>
</data>

Note: as pointed out by Thomas you'd need to check the ID for your Odoo database (as per this other answer). 

In Odoo 13 the name is similar to what you have (maybe a typo):

<data>
  <xpath expr="//button[@name='action_sale_quotations_new']" position="replace"/>
</data>
Awatar
Odrzuć
Najlepsza odpowiedź
<xpath expr="//button[1]" ...
<xpath expr="//button[2]" ...
<xpath expr="//button[3]" ...
Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
maj 24
2855
0
sie 21
3356
4
sie 21
66991
0
maj 24
6897
1
lis 24
1596