python - odoo 8 multiple page navigation controller -


i have created module in odoo 8. purpose of module create page link page. mean @ first main template rendered , there link sub page. works fine till main page. have controllers.py, models.py, views(default.xml). in openerp.py value of 'data' : 'views/default.xml'. controller :

@http.route('/test/', auth='public') def index(self, **kw):     return http.request.render('test.main',{ 'root':'/test' })  @http.route('/test/sub', auth='public') def sub(self, **kw):     return http.request.render('test.sub',{ 'root':'/test' }) 

in template, u have 2 ids ( namely main , sub )

<openerp>   <data>        <template id='main'>            <div class='body'>                  test body                   click go next page : <a t-attr-href = "#{ root }/sub">next page</a>            </div>            <div class='footer'>                  test footer             </div>        </template>         <template id='sub' inherit_id="main">            <xpath expr="//div[@class='body']" position="replace">            <div class="page">                replaced data            </div>            </xpath>        </template>   </data> </openerp> 

now when run code, seeing main page replaced not link. body replaced default. want body should replaced when clicked on link sub page.

i novice in odoo, don't know it.

xpath work after updation of module( not @ time of rending template )

just use t-if in case,like:

< t t-if ="not show_tab"> // original data </t>   < t t-if ="show_tab"> // replaced data </t> 

render keyword:show_tab controllers.

one more thing it's personal suggestion ,don't create 2 controller replacing tab.

a single controller can handle multiple route in odoo .please try follow concept of dry.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -