Odoo Help


Odoo Dymanically Inheriting Product From View

Ashish Singh
on 6/6/15, 12:50 AM 1,226 views

Hello Guys

I want to add new Page tab in Product Form View Dynamically With the help of field_view_get() Method

class product_product(osv.osv):
_inherit = 'product.product'
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False,submenu=False):
Changes the view dynamically
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return: New arch of view.
ret_val = super(product_product, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar,submenu)
if view_type == 'form':
#doc = etree.XML(res['arch'])
doc = etree.XML(ret_val['arch'], parser=None, base_url=None)
_moves_arch_lst = """
<page string='Feature'>
first_node = doc.xpath("//page[@string='Sales']")
            if first_node and len(first_node)>0: 
              #<What Code should I have to write so My Page tab will appear in Product From View>         ret_val['arch'] = etree.tostring(doc, encoding="utf-8")
        return ret_val


Axel Mendoza

--Axel Mendoza--
| 7 8 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full-time employee trying to understand what to do and how

Reach me at aekroft@gmail.com

Axel Mendoza
On 9/3/15, 8:41 PM

You need to attach your new page node to the first_node that you found like:

#supposing that the page feature is the one you need to attach to the notebook
feature_page = etree.XML(_moves_arch_lst)
Adnier Rosello
On 9/3/15, 6:26 PM

Hello, I need to do exactly the same for personalize a module, you have the solution to this post, thanks

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


Asked: 6/6/15, 12:50 AM
Seen: 1226 times
Last updated: 9/7/15, 2:40 PM