Skip to Content
Menu
This question has been flagged
2 Replies
2071 Views

Hello everyone Im working in Odoo 14 while taking and adapting to the new version an Odoo development course for Odoo 9.

At the moment im stuck at finding the field name of the Sales Tab inside Sales>Products>Products form view. ( I want to add a new Tab after it). Developer mode doesnt show me a name since it only show me fields but not the page tabs info.

Here is my 2 ways of trying this and both ways mark an error of not finding the element or tell me I cant use string as selector.

TLDR: I can't find the name of Sales>Products>Products form view "Sales" Tab since developer mode only shows fields.

Edit: Code was not visible and format.

--------------------Option 1------------------------------

Code:


               
               

Error:

Element '' cannot be located in parent view

View name: product.template tree
Error context:
 view: ir.ui.view(923,)
 xmlid: dietfacts_product_template_tree_view
 view.model: product.template
 view.parent: ir.ui.view(466,)
 file: /home/perezalvarezhi/odoo-14.0/customaddons/dietfacts/views/dietfacts_view.xml


--------------------Option 2------------------------------

Code:


               
               

                       

Note: I used @string and @name with lower and upper case and all failed.

Error:

View inheritance may not use attribute 'string' as a selector.

View name: product.template tree
Error context:
 view: ir.ui.view(923,)
 xmlid: dietfacts_product_template_tree_view
 view.model: product.template
 view.parent: ir.ui.view(466,)
 file: /home/perezalvarezhi/odoo-14.0/customaddons/dietfacts/views/dietfacts_view.xml
Avatar
Discard
Author

Hi Niyas thank you for your answer! It looks like my code always end up not showing but that is what I was doing I just had the name wrong, it was indeed sales but with lower case thank you!

Also my question is more regarding on ways to easily get the name of a page tab and not having to ask in a forum every time.  For example on fields I can just hover over the label of the field and in developer mode it tells me all about that field from ID, name, model etc. This doesn't happen to elements of a page and I cant find a way to find its name for sure. 

Using string sounded like a good idea but found out that you are right, it doesn't work anymore.


Thank you for the tutorials I have seen this channel before but at the moment the tutorials from Udemy Im taking have given me more tools to actually do exactly what I want to do, the fact it is Odoo 9 is not a problem.




You can simply look at the XML code of the original QWeb view, you want to inherit from. This way you don't need to ask the forum :-)

Best Answer

Hi,

The name of the page Sales in the product form view is sales, so you can use this name inside the xpath, not sure whether you already tried this or not. If not, try with page[@name="sales"] and see whether it works.


In addition in latest versions we cannot use the string as selector in the xpath.

Also if you are looking for development tutorials, have a look at this: https://www.youtube.com/watch?v=I8FNdellz3Y&list=PLqRRLx0cl0homY1elJbSoWfeQbRKJ-oPO&index=2

Thanks

Avatar
Discard
Author Best Answer

Hi Ermin thx for your answer this is what I ended up doing, it took me some time since this form is used in many view files inherited but finally found the base one in addons>product>views>product_views. 
Tried to get it from the GUI on the developer menu and edit form view but this didn't work since it was showing me an inherited view which didn't include the I was looking for.

I was hopping there was a faster way like just hoovering over the element like any other field, at the end if that is the way it is I now know how to.


Thank you all for your help.

Avatar
Discard