Odoo decorations in tree view not working? - treeview

I am trying to add decorations in an inherited tree view in odoo 13. For this I added a variable in my module
x_LCStatus = fields.Selection(selection=[('0', 'In development'),('1', 'Active'),
('2', 'Not for new developments'), ('3', 'End of life')], string='Life cycle',
default='1', store=True)
However, when I try to change the decoration in the associated tree view nothing changes from the default settings.
<xpath expr="//tree" position="attributes">
<attribute name="decoration-danger">"x_LCStatus=='3'"</attribute>
<attribute name="decoration-warning">"x_LCStatus=='2'"</attribute>
<attribute name="decoration-primary">"x_LCStatus=='1'"</attribute>
</xpath>
Any ideas what I am doing wrong?

Related

converting XML to CSV where different tags in XML and their respective sub tags become line items of the CSV

I am trying to get the attribute tags within accessory tag to be line items of a CSV file
I have tried to iterate using map function but im just getting one value at a time.What i want is there are two Accesory Type tag in this XML i want their respective attribute tags to become each line item in the CSV
<Accessory Type="Panel">
<PartNumber>9021447</PartNumber>
<Attribute Name="DescCode">Operating Panel, White/PI White, Low E SmartSun Tempered Glass</Attribute>
<Attribute Name="Mark_ID">41424</Attribute>
<Attribute Name="Order_Quantity">1</Attribute>
<Attribute Name="QUOTE_QUANTITY">1</Attribute>
<Attribute Name="Quote_Quantity_Extended">1</Attribute>
<Attribute Name="MarkName">0001</Attribute>
<Attribute Name="US_ENERGY_STAR_CLIMATE_ZONE">Northern</Attribute>
<Attribute Name="SubUnitID">1</Attribute>
<Attribute Name="AW_Control_2">47AoYY</Attribute>
<Attribute Name="ReferenceID">3</Attribute>
<Attribute Name="OrderPONum"/>
</Accessory>
<Accessory Type="Screen">
<PartNumber>2505930</PartNumber>
<Attribute Name="Total_Pre_Price_in_USD">208.70</Attribute>
<Attribute Name="Total_Price_in_USD">208.700</Attribute>
<Attribute Name="QUOTE_QUANTITY">1</Attribute>
<Attribute Name="Quote_Quantity_Extended">1</Attribute>
<Attribute Name="DescCode">Insect Screen, Gliding, White</Attribute>
<Attribute Name="Mark_ID">41424</Attribute>
<Attribute Name="Order_Quantity">1</Attribute>
</Accessory>
I have tried to make the attributes under accessory tag to become line items.
Expected output:
9021447|Operating Panel, White/PI White, Low E SmartSun Tempered Glass|41424
//and in the next line
25005930|208.70|1 //and so on
This is the code that i have tried
%dw 2.0
output application/json
---
payload.m2oFile.m2oOrder.Unit.*Accessory map (value, index) -> {
(index) : value.*Attribute filter($.#Name == "MarkID"),
(index) : value.*Attribute filter($.#Name == "PRODTYPE"),
(index) : value.*Attribute filter($.#Name == "UNIT_CODE")
}
Try with this approach..
%dw 2.0
output application/csv header=false
---
(payload.a.*Accessory map {
PN: $.PartNumber,
($.*Attribute map {
(($$) : $) if (isEmpty($) == false)
})
}
)
Should give you the output as follows:
PS: i had to add "a" as the root to the xml as otherwise the xml would not be well formed..

xsd:assert (complicated character verification)

Is there a way to verify that the template contains only those characters that are passed to #param ?
I considered options with xpath functions(fn:) but have not found a suitable option.
this is 2 valid xml for example:
<rule type="myRule" template="A-B-CB">
<attribute param="B"/>
<attribute param="A"/>
<attribute param="C"/>
</rule>
<rule type="myRule" template="A(C)-B">
<attribute param="C"/>
<attribute param="A"/>
<attribute param="B"/>
</rule>
and 2 not valid xml:
<rule type="myRule" template="AB-CD">
<attribute param="A"/>
<attribute param="B"/>
<attribute param="C"/>
</rule>
<rule type="myRule" template="AC">
<attribute param="A"/>
<attribute param="B"/>
<attribute param="C"/>
</rule>
perhaps there are ideas how to implement it using schematrone or otherwise?
So the set of letters in #template must be exactly the same as the set of letters in ./attribute/#param?
That is to say, distinct-values(string-to-codepoints(replace(#template, '\P{L}', ''))) must be the same set as distinct-values(attribute/#param/string-to-codepoints()).
So how do you assert that two sequences contain the same values, under permutation?
In XPath 3.1, deep-equal(sort($X), sort($Y))
In XPath 2.0, I can't think of anything better than
empty($X[not(.=$Y)]) and empty($Y[not(.=$X)])
I'll leave you to put this all together.

Negative numbers not indexed numbers without negative symbol in full text catalog

I store a docx file in sql server database that contains negative number like -56653.
I installed Microsoft Filter Pack 2.0 and execute this code:
EXEC sp_fulltext_service 'update_languages';
EXEC sp_fulltext_service 'load_os_resources', 1;
EXEC sp_fulltext_service 'restart_all_fdhosts';
Then rebuild the Full Text Catalog multiple time, When search 56653, the query not found any things, but when search -56653 the query work fine.
SELECT *
FROM Files
WHERE
(CONTAINS([Files].[Content], '"56653"'))
Does somebody know what is the problem?
Finally I found the problem. Full text catalog not indexed content of table which inside a paragraph!
This mean the w:tbl tag move to outside of w:p tag.
<w:p w:rsidR="00E402AA" w:rsidP="00E402AA" w:rsidRDefault="00E402AA">
<w:pPr>
<w:bidi />
<w:spacing w:after="0" w:line="240" w:lineRule="auto" />
<w:jc w:val="both" />
<w:rPr>
<w:bCs />
<w:sz w:val="24" />
</w:rPr>
</w:pPr>
<w:r>
<w:rPr>
<w:bCs />
<w:sz w:val="24" />
</w:rPr>
</w:r>
<!-- Start Table -->
<w:tbl>
<w:tblPr>
<w:tblStyle w:val="TableGrid" />
<w:tblW w:w="5000" w:type="pct" />
</w:tblPr>
<w:tr>
<w:tc>
...
</w:tc>
</w:tr>
</w:tbl>
<!-- End Table -->
</w:p>

Is there a bug in the Advanced Find in MS CRM 2015 online, when in recursive queries? Example: Find Account Branches that belong to Account Branches

No matter what I have tried, I was unsuccessful in getting the Advanced Find feature of MS CRM 2015 online to show me Active Accounts that are of type Branch that have as their parent have an Account type again of Branch.
I have checked and re-checked the data but perhaps there is something wrong with my query in the Advanced Find feature.
Or there is a bug to it.
I have run this query in SQL as well, we have a BigData db that holds our CRM data and there it reveals the correct results (of course).
Here is my query so that you can see:
--BRANCH OF A BRANCH
select [dbo].[fn_getDescFromCRMguid](a.[Parentaccountid]) as [ParentAccountName],
--[fn_getDescFromCRMguid] udf is just a look-up for descriptions and names
( select left(a3.[etf_accountlevel],6)
from [Stg_CRMAccount] a3
where a3.[accountid] = left(a.[parentaccountid],36)
) as [ParentAccountLevel],
[dbo].[fn_getDescFromCRMguid](isnull(a.[owninguser], a.[owningteam])) as [OwningEntity],
a.*
from [Stg_CRMAccount] a
where a.[statuscode] = 'Active::1'
and a.[etf_accountlevel] like 'Branch%'
and a.[Parentaccountid] is not null
and exists (
select 0
from [Stg_CRMAccount] a2
where a2.[statuscode] = 'Active::1'
and a2.[etf_accountlevel] like 'Branch%'
and left(a.[Parentaccountid],36) = a2.[accountid]
)
order by a.[Parentaccountid],
a.[name],
a.[address1_city];
I am also attaching the screenshot of my Advanced Find query and please feel free to comment or let me know of any useful thoughts.
I hope some person has any idea about this because to me it is puzzling.
I have navigated into the resulting Accounts from this and then into their parent Account and it was not a Branch.
Despite the clear (at least to me) specification of the Where clause under the use of the related Entity - Account, using the relation Parent Account.
The plot thickens even more, if you remove the Account Type = Branch for the related Entity and say change the Status = Active to Inactive then it will very correctly find and show only those Branches where their Parent is Inactive.
That leads me to suspect some kind of a recursive error with the query builder they are using.
It finds Account Type = Branch twice and erroneously does not differentiate between the first occurrence which is for the outer selection and the second occurrence which would be for the nested (in the Where clause) selection.
But all that is mere speculation.
I don't really know why it can't handle it.
It begs the question in what other scenarios it can mess up recursive query builds.
Your thoughts?
and here is my fetch XML from the Advanced Find query
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
<entity name="account">
<attribute name="etf_rating" />
<attribute name="parentaccountid" />
<attribute name="etf_lastcontact" />
<attribute name="etf_city" />
<attribute name="address1_line1" />
<attribute name="etf_accountlevel" />
<attribute name="name" />
<attribute name="ownerid" />
<attribute name="etf_segment" />
<attribute name="accountid" />
<order attribute="name" descending="false" />
<filter type="and">
<condition attribute="statecode" operator="eq" value="0" />
<condition attribute="etf_accountlevel" operator="eq" value="964850002" />
</filter>
<link-entity name="account" from="parentaccountid" to="accountid" alias="ag">
<filter type="and">
<condition attribute="statecode" operator="eq" value="0" />
<condition attribute="etf_accountlevel" operator="eq" value="964850002" />
</filter>
</link-entity>
</entity>
</fetch>

XPath results based on two nodes

I have XML that has a lot of duplicated values. I'd like to select all the rows with a specific section ("sec") and section tag ("sec_tag"), but I can't seem to get the XPath correct.
Here's a small snippet of the XML:
<root>
<record>
<sec>5</sec>
<sec_tag>919</sec_tag>
<nested_tag>
<info>Info</info>
<types>
<type>1</type>
<type>2</type>
<type>3</type>
</types>
</nested_tag>
<flags>00000000</flags>
</record>
<record>
<sec>5</sec>
<sec_tag>930</sec_tag>
<nested_tag>
<info>Info</info>
<types>
<type>1</type>
<type>2</type>
<type>3</type>
</types>
</nested_tag>
<flags>00000000</flags>
</record>
<record>
<sec>7</sec>
<sec_tag>919</sec_tag>
<nested_tag>
<info>Info</info>
<types>
<type>1</type>
<type>2</type>
<type>3</type>
</types>
</nested_tag>
<flags>00000000</flags>
</record>
</root>
I want the node that has <sec>5</sec> and <sec_tag>919</sec_tag>.
I tried something like this:
//sec[text(), "5"] and //sec_tag[text(), "919"]
Obviously that's not the correct syntax there, I just need to find the correct XPath expression.
You can use the following XPath expression to return record elements having child sec equals 5 and sec_tag equals 919 :
//record[sec = 5 and sec_tag = 919]

Resources