This question has been flagged
2 Replies
22834 Views

Hello,


I want to add condition to base.xml that if i'm view some model then show me this code.

So i add t-if but it don't work:

my code add to base.xml :


<t t-if="widget.model == 'hr.recruitment.agency.skills'"> 

<div class="row">
   <div class="col-md-6">
       <h2>Test</h2>
       <p>Test Test Test Test Test Test </p>
   </div>    
</div>
      </t>


in


<t t-name="ControlPanel">
    <div class="oe-control-panel">
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-6 oe-cp-title">
                    <ol class="oe-view-title breadcrumb">
                    </ol>
                </div>
                <div class="oe-cp-search-view col-md-6" />
            </div>
            <div class="row">
                <div class="col-md-6 oe-button-column">
                    <div class="oe-cp-buttons"></div>
                    <div class="oe-cp-sidebar"></div>
     
                </div>
                <div class="col-md-6">
                    <div class="oe-search-options btn-group"/>
                    <div class="oe-right-toolbar">
                        <div class="oe-cp-pager"></div>
                        <div class="oe-cp-switch-buttons btn-group btn-group-sm"></div>
                    </div>
                </div>
    
            </div>
   
           <t t-if="widget.model == 'hr.recruitment.agency.skills'"> 

<div class="row">
   <div class="col-md-6">
       <h2>Test</h2>
       <p>Test Test Test Test Test Test </p>
   </div>    
</div>
      </t>  

        </div>
    </div>
</t>


but this depends <t t-if="widget.model == 'hr.recruitment.agency.skills'">

don't work.


Any idea ?



Avatar
Discard
Best Answer

Hi,

because widget.model undefine.

use widget.field_manager.dataset._model.name

or other depending on version odoo

Avatar
Discard
Author

Hi Shurshilov,

Thx for answer but I do not understand it :(

Can you show me some sample ?

Best regards,

Lukasz

Author Best Answer

Hi Shurshilov,


Thx for answer but I do not understand it :(

Can you show me some sample ?


Best regards,

Lukasz


Avatar
Discard

<t t-if="widget.field_manager.dataset._model.name == 'hr.recruitment.agency.skills'">

say the version of the ode, this may depend on the code

Author

@Shurshilov I use Odoo9

Author

to be more accurate it's 9.0c

use <t t-if="widget.field_manager.dataset._model.name == 'hr.recruitment.agency.skills'">

Author

Unfortunettly it don't work.

Page stuck on load: http://scr.hu/0e1mq/x9n8w

hmm, screenshot console onload page pls


24.11.2017, 17:01, "LukaszK" <lukaszkaptur.glosema@gmail.com>:

Unfortunettly it don't work.

Page stuck on load: http://scr.hu/0e1mq/x9n8w

--
LukaszK


Sent by Odoo S.A. using Odoo.

Author

Hi @Shurshilov

Sorry for not response i was on holiday without access to internet.

So, it stuck like that: https://scr.hu/0e1mq/x9n8w

I upload my whole base.xml: https://www.pastiebin.com/5a2e610da3f06

Can you look for that ?

Author

Added line 174-177