Bold IN List View Odoo - customization

I am trying the below code for bolding my first record and it works fine. BUt for multiple it does not
Pls guide
Code:
<tree string="Configuration Tree" fonts="bold:task_name == 'PLANNING AND DESIGN'">
and for multiple I am trying this:
<tree string="Configuration Tree" fonts="bold:task_name == 'PLANNING AND DESIGN' bold:task_name == 'DEVELOPMENT'">
The second one is not working
Guide PLz
Thanks

You can use in to choose from multiple values:
fonts="bold:task_name in ('PLANNING AND DESIGN', 'DEVELOPMENT')"
The following alternative approaches would also work, but in this particular case using in is preferable (as it is much clearer and shorter).
Using or:
fonts="bold:task_name == 'PLANNING AND DESIGN' or task_name == 'DEVELOPMENT'"
Chaning multiple rules with ;:
fonts="bold:task_name == 'PLANNING AND DESIGN';bold:task_name == 'DEVELOPMENT'"

Related

Joining 2 Hashes/Map/Table into 1 with defined key condition in Freemarker

Good Day All,
I face some situation which i have base data like this as hashes/maps/tables
And my goal is text output like this
i've tried to have code such a
<#list Detail as d>
<#list Header as h><#if H.Hno == d.DocNo>${h.Hno};${h.Htype};</#if></#list>${d.Seq};${d.Name};<#list Header as h><#if H.Hno == d.DocNo>${h.Hcode}</#if></#list>${d.Status}
</#list>
but it said somewhat Hno evaluate null or missing.
Is there any way to solve and efficient way this ?
Appreciate you guys support

How can I create a checkbox filter on c++

I'm having a problem that seems way more easy than it is. I think its more of an algorithmic problem than a coding one.
EDIT:
Imagine you have a database with a name and N boolean parameters, like if the person is blonde or not, if the person likes baseball or not, if person have a smartphone or not etc...
How could you print the name of someone that likes baseball AND is blonde, but doesn't matter if any of the other N parameters are true of false? How can I do that without having to write a test for every single of the (N^2)-1 possibilities?
I created a dictionary that maps a string to a struct with 4 boolean variables and some strings.
I want the user to select which booleans are important to them and return only the information that is true for all variable that he chose.
Something like a checkbox which you can use to filter a column in excel.
For instance if a user chose variables 1 and 2, I would like to know if there is a better way to return the result rather than testing every one of the 16 possibilities, like:
void filter(map<string, Mystruct> Mydictionary, bool bool1, bool bool2, bool bool3, bool bool4){
if(bool1 == true && bool2 == true && bool3 == false && bool4==false){
cout << Mydictionary.bool1Info << Mydictionary.bool2Info
if(bool1 == true && bool2 == false && bool3 == false && bool4==false)
...
Even more, for me its only important to test the booleans that the user picked up, so even if he didn't choose boolean3, it's not important to test if its true or false.
Any ideas?
I would be very glad if anyone could help me with this one
I can help you with your algorithm part ,
instead of checking all 16 possibilities just check 4 conditions separately for bool1,2,3,4 and print their info if they are true.
This way you can complete your task with only 4 if statements.
Hope this answers your query.

Doctrine Query from Mysql

I want to create a Doctrine Query: (Doctrine 2.3)
SELECT * FROM `car` WHERE `plate` like '%' AND (`datetime` BETWEEN '2013-03-13 22:20:18' AND '2013-03-13 22:20:20') OR (`datetime` BETWEEN '2013-03-13 15:10:18' AND '2013-03-13 15:10:16')
I tried the following but its not working:
$qry = $this->manager()->createQueryBuilder()
->from($this->entity, 'e')
->select('e');
$qry->where('e.plate like :plate');
$qry->setParameter('plate', $plate);
$qry->andWhere(
qry->expr()->between(
'e.datetime',
':dateFrom',
':dateTo'
)
)
->setParameter('dateFrom', $fromdate)
->setParameter('dateTo', $todate);
$qry->orWhere(
$qry->expr()->between(
'e.datetime',
':dateFrom',
':dateTo'
)
)
->setParameter('dateFrom1', $fromdate1)
->setParameter('dateTo1', $todate1);
OutPut of above query:
SELECT e FROM user e WHERE (e.plate like :plate AND (e.datetime BETWEEN :dateFrom AND :dateTo)) OR (e.datetime BETWEEN :dateFrom AND :dateTo)
I want to check two dates in same column how can I check? Is the syntax correct?
Currently It is like this:
(Plate AND (Date)) OR Date)
Case 1
But it should come like the following for good output.
(Plate) AND ((Date) OR (Date))
Case 2
In other case it should come like this:
((Plate) or (Plate)) AND ((Date) OR (Date))
Can some one help me I am not an expert in Doctrine I am a learner!
After some search and advice from many individual I finally found some logic and understood the expression in Doctrine. Below I have given all the expression with an example. Code to be tested.
$ex1 = $qry->expr()->like('e.user', "'".$user."'");
$ex2 = $qry->expr()->orX(
$qry->expr()->between('e.datetime', "'".$datetimefrom."'", "'".$datetimeto."'")
);
$ex3 = $qry->expr()->in('e.country', $country);
$final_expression = $qry->expr()->andX($ex1,$ex2,$ex3);
You can also refer the below issue and solution which helped me to solve the above Question by me.
REF Multiple Query in Doctrine with NAND,NOR,NOT,AND Operators

sagemath: Convert Fractions in Dictionaries in a list to Decimals for matplotlib

eng3 = [solve(eng==(k-1)*md*Vm^2/(2*Patm*Vc*(Pc-Pc^(1/k))),Vc,solution_dict=1) for Pc in xrange(2,10)]
I'm trying to automate the process of some efficiency graphs in sage mathematics, and I've got this formula. Matplotlib.pyplot wants a list of values. I either get a dictionary in a list as described below, or a list in the form of:
List:
[[Vc == (5231100000/35166511904977)], [Vc == (111907000000/1692075843832947)], [Vc == (364112000000/8911538005781703)], [Vc == (753818000000/25992803547821049)], [Vc == (138358000000/6222694018119437)], [Vc == (659020000/36808310575981)], [Vc == (25902500000/1736640592770261)], [Vc == (59144000000/4642920082445667)]]
Dictionary:
[[{Vc: 1743700000/105499535714931}], [{Vc: 319775000/43516062236099}], [{Vc: 34670000000/7636845816518169}], [{Vc: 41083500000/12749600170083701}], [{Vc: 1703720000/689628024927753}], [{Vc: 25247000000/12691109152994019}], [{Vc: 44767000000/27012747987604137}], [{Vc: 5993300000/4234372317920577}]]
I want to take those fractions, convert them in to their numerical approximations, and create a list with those values in sage math[python]. The n() function will convert fractions to decimals, but I'm not sure how to isolate the values to feed it to n().
The list comes from solve, but the question is really a pure Python one. To get each of these, if the list is called Vlist, you could do
[v[0].rhs().n() for v in Vlist]
and for the dictionary the somewhat more cumbersome
[v[0].values()[0].n() for v in Vlist]
This construction is known as a "list comprehension". These assume that you really have single solutions to each! If the format is different (e.g., if you get something like Vc == 2*Vc^2) then you'd have to be more clever.
Background - apparently this ask.sagemath.org question is related.

Quick PlayFramework / Groovy

Why does the following code always emit 'yes' (in HTML) even when sel has a different value other than 'audio'? (I've logged the values of sel and confirmed different values.)
This is my day 1 on Play. So, I may be doing something really stupid.
${sel='audio'?'yes':'no'}
I don't know the Groovy templates that well, but I think it should be like this:
${sel=='audio'?'yes':'no'}
Your code:
${sel='audio'?'yes':'no'}
means; if 'audio' (a string that is not null will always be "true") then sel = 'yes' otherwise 'no', so it will never be 'no'.
You might want to look at the yesNo extension: http://www.playframework.org/documentation/1.2.1/javaextensions#yesNo