Help

2

xml condition in base.xml depends by viewed model

Avatar
LukaszK

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
2 Answers
1
Avatar
Shurshilov Artem
Best Answer

Hi,

because widget.model undefine.

use widget.field_manager.dataset._model.name

or other depending on version odoo

1 Comment
Avatar
Discard
Avatar
LukaszK
-

Hi Shurshilov,

Thx for answer but I do not understand it :(

Can you show me some sample ?

Best regards,

Lukasz

1
Avatar
LukaszK
Best Answer

Hi Shurshilov,


Thx for answer but I do not understand it :(

Can you show me some sample ?


Best regards,

Lukasz


9 Comments
Avatar
Discard
Avatar
Shurshilov Artem
-

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

Avatar
Shurshilov Artem
-

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

Avatar
LukaszK
-

@Shurshilov I use Odoo9

Avatar
LukaszK
-

to be more accurate it's 9.0c

Avatar
Shurshilov Artem
-

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

Avatar
LukaszK
-

Unfortunettly it don't work.

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

Avatar
Shurshilov Artem
-
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.

Avatar
LukaszK
-

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 ?

Avatar
LukaszK
-

Added line 174-177