I'm trying to create a Qweb report into Odoo Version 10, My requirement is to Print the for-each values in two columns in row,
<t t-call="report.html_container">
<t t-foreach="docs" t-as="doc">
<!-- Here i need to print the doc data in two columns , then proceed to next row -->
</t>
</t>
Please anybody help me to print the data in two columns and then proceed to row
Try This
In your report template, add this code
<div class="row">
<div class="col-xs-6">
<p t-field="enter your name"/>
</div>
<div class="col-xs-6" >
<p t-field="enter your name"/>
</div>
</div>
Related
I have a label which display a given text coming from a String variable.
This variable can have two different values and for each value I have a translated version from english to my native language stored in a property file.
I have the following code:
add(new Label("fruit", new PropertyModel(getModelObject(), "fruit.name")));
and HTML:
<wicket:panel xmlns:wicket="http://wicket.apache.org/">
<div>
<div class="row">
<div class="col-sm-6">
<div class="row">
<div class="col-sm-5">
<wicket:message key="myBasket.fruit">
</wicket:message>
</div>
<div class="col-sm-7">
<span wicket:id="fruit"></span>
</div>
</div>
</div>
</div>
</div>
</wicket:panel>
This fruit can be either apple or pear.
In my property file I have a translation for both values:
apple=Apfel
pear=Birne
When I run my code, the content of my label displays in English.
How can I set the value coming from the property file based on the value of the variable?
Thank you!
take a look at class StringResourceModel. You should use it as model for your Label. See user guide.
I have HTML organized like below.
<div class="statement">
</div>
<div class="reply">
</div>
<div class="statement">
</div>
<div class="statement">
</div>
<div class="reply">
</div>
<div class="statement">
</div>
<div class="statement">
</div>
<div class="reply">
</div>
It's random whether there is a reply div or not next to statement div.
What i want is to select the reply div class while knowing which nth statement it is. I thought to iterate every statement (by iterate variable, ofc), and in this case:
(//div[#class="statement"])[1]/following-sibling::div[#class="reply"]
i end up got all following replies.
So, how to get exactly one next following sibling?
This will get the first following div that has #class='reply'
following-sibling::div[#class="reply"][1]
This will get the first following div provided that it has #class='reply'
following-sibling::div[1][#class="reply"]
I wasn't quite sure which of these you wanted.
I have an arraylist from which I need to get values where isActive = true, and to display the data in a <div> tag with the use of ng-repeat.
My problem is that I don't want to keep using ng-repeat every time, while fetching values in each <div> tag.
Is there any generic solution which will iterate only once, and I can see the value in <div>, side by side. Please see this attempt:
enter link description here
I want to see a result like this:
You can write your ng-repeat like below.
Whenever it get isActive true, it will create the div section for this.
<body ng-controller="MainCtrl">
<div ng-repeat="tempData in data">
<div ng-if="tempData.isActive == true" >
<div class="col-xs-12" >
<div class="col-xs-4">Plan Type:</div>
<div class="col-xs-8">{{tempData.plantype}}</div>
</div>
<div class="col-xs-12">
<div class="col-xs-4">Term:</div>
<div class="col-xs-8">{{tempData.term}}</div>
</div>
<div class="col-xs-12">
<div class="col-xs-4">Rate:</div>
<div class="col-xs-8">{{tempData.rate}}</div>
</div>
</div>
</div>
</body>
I want to append div using xpath inheriting a parent template.
for ex.
this is parent template
<template id="parent_id">
<div id="header">
<div class="container">
<h1> HEADER </h1>
</div>
</div>
<div id="product">
<div class="container">
<!-- THERE IS SOME CONTENT -->
</div>
</div>
</template>
i want to change like this,
<template id="parent_id">
<div id="product">
<div class="inner">
<div class="container">
<!-- THERE IS SOME CONTENT -->
</div>
</div>
</div>
</template>
i try this,
<template id="product_custom" inherit_id="parent_id">
<xpath expr="//div[#id='product']" position="after">
<div class="inner">
</xpath>
</template>
while replace all content is easy or copy all content to custom template, but it not proper way. i want to wrap a div on content.
I think you cannot do that, because you are going either to override the content or to place your <div/> before, after on inside the selected element.
A simple solution will be to give the id="product" div the class inner by using position="attributes". Or if you really need this, a possible solution is:
replace id="product" with class="inner" with one override using attributes position
define your own template in a second override and call the original one inside it
You will end up with something like this:
<template id="my_parent" inherit_id="foo.parent_id">
<div id="product">
<t t-call="foo.parent_id" />
</div>
</template>
plus the override of the attributes. Never done something like this and the code above is not tested but it could work ;)
When I set columns of an element within another column, it uses the total number of columns not the number of columns in the parent. e.g.
<div class="therow">
<div class="acolumn">
<div class="achildcolumn">
<!-- my content goes here -->
</div>
</div>
</div>
$total-columns: 12 ;
.therow {
#include grid-row();
.acolumn {
#include grid-column(9);
.achildcolumn {
#include grid-column(7);
}
}
}
So I want .achildcolumn to take up 7/9 columns, but it seems to be 7/12.
This is the expected result. Each sub-grid also uses $total-columns. This prevents you from having to add up columns as you nest them.
<div class="row">
<div class="small-12 columns">
<div class="row">
<div class="small-6 columns">
50% width
</div>
<div class="small-6 columns">
50% width
</div>
</div>
</div>
</div>
If you want to get more granular with your nested columns one option would be to change $total-columns to 24, or even 36. Then you would have ultra-fine control over sub-columns.