'request.website_multilang' causes AttributeError in Odoo 11 - python-3.x

I'm migrating Odoo module from version 10 to version 11. I have website template with following code:
<ul class="dropdown-menu js_language_selector" t-if="(request and request.website_multilang and len(languages) > 1) or (website and (editable or translatable))">
It raises AttributeError: 'HttpRequest' object has no attribute 'website_multilang'. I can't find documentation on how to adapt this Odoo 10 code to v11?

You can try following :
<ul class="dropdown-menu js_language_selector" t-if="(request and request.is_frontend_multilang and len(languages) > 1) or (website and (editable or translatable))">
I have just analysed that in v11 it needs to be "is_frontend_multilang" instead of "website_multilang".
Hope it works.
Regards

Related

Timber twig function output is different on different servers

I am running Timber framework on a Wordpress site and in my twig file I have the following code:
<div {{ fn('post_class', ['cell', 'small-12', 'medium-6', 'large-' ~ productTabW, 'xlarge-' ~ productW] ) }}>
On one server it outputs the correct:
<div class="cell small-12 medium-6 large-8 xlarge-6 post-66840 product type-product status-publish has-post-thumbnail product_cat-... ">
On another server I get this:
<divclass="cell small-12="" medium-6="" large-8="" xlarge-6="" post-66835="" product="" type-product="" status-publish="" has-post-thumbnail="" product_cat-....>
You will note the space is removed between the div and class and it looks like the array is expecting key value. The code is the same so I am wondering what php configuration would make Timber output this behaviour.
This was a problem with an outdated Timber installation for PHP 7.4. Updating Timber through composer solved the issue.

Add class to out of stock variant

I need to add a CSS class to a variant which is out of stock, that way I would know, before hand, which variant has or has not stock available.
I have been checking the detail page (specifically the buy_container.tpl file) to see if there's a clue in there. I used var dump to check the $sArticle.sConfigurator but it doesn't say if one of the variants is out of stock. I also checked the $sArticle.instock and $sArticle.isAvailable but as the detail page uses ajax to reload the data, those variables only work after selecting the out of stock variant, and I need to know which variant is out of stock before hand.
This is where I need to add the CSS class:
{foreach $sConfigurator.values as $configValue}
{if !{config name=hideNoInstock} || ({config name=hideNoInstock} && $configValue.selectable)}
<div class="variant--option {if $outofstock}OUT-OF-STOCK{/if} {if $configValue.selected}variant-selected{/if}">
<input type="radio"
class="option--input"
{if $configValue.selected} checked="checked"{/if}
value="{$configValue.optionID}"
name="group[{$sConfigurator.groupID}]"
{if $theme.ajaxVariantSwitch}
data-ajax-select-variants="true"{else}
data-auto-submit="true"{/if} />
{$configValue.optionname}{if $configValue.upprice} {if $configValue.upprice > 0}{/if}{/if}
</div>
{/if}
{/foreach}
Any clue would be appreciated,
Thanks.
Try to use the selection-configurator. With this configurator this information will be available. See: https://github.com/shopware/shopware/blob/5.5/themes/Frontend/Bare/frontend/detail/config_variant.tpl#L31
No other configurator will provide this data. When you want to use an other configurator, you need to implement such a variable/function yourself.

change from template to ng-template

I'm getting this error with angular 4:
The <template> element is deprecated. Use <ng-template> instead ("
[attr.tabIndex]="-1"
[ngClass]="{'k-item': true}">
[WARNING ->]<template *ngIf="template"
[templateContext]="{
are you planning on updating this for the final release?
Yes, the components have been updated and released with Angular 4 support.

Magnolia CMS: Search result item excerpt differs in quality between 5.4.1 and 5.4.3

The quality of the item excerpt of a search result seems to differ between Magnolia 5.4.1 CE and 5.4.3 CE. I have the same website/pages on both system. On 5.4.1, the excerpts look good and it actually shows the parts where the keywords occurs and highlights them, whereas on 5.4.3, the excerpts does not show this but instead shows weird UUIDs and author names, that should not be visible to a public user:
The content nodes on both systems have the identical content. I pretty much use the default installation of 5.4.1 and 5.4.3 CE.
Anybody else having this problem or knows a reason for this? Is it a bug? Any way to fix this without having to write my own SearchTemplatingFunctions or ExcerptProvider?
The code that I use for the search:
[#-------------- ASSIGNMENTS --------------]
[#assign queryStr = ctx.getParameter('q')!?html]
[#-------------- RENDERING --------------]
[#if queryStr?has_content]
[#assign searchResults = searchfn.searchPages(queryStr, '/mysubfolder') /]
[#assign recordsFound = searchResults?size /]
<h3><em>${recordsFound}</em> ${i18n['search.pagesFoundFor']} "${queryStr}"</span></h3>
<div class="list-group">
[#if searchResults?has_content]
[#list searchResults as item]
<a href="${cmsfn.link(item)}" class="list-group-item">
<h4 class="list-group-item-heading">${item.title!}</h4>
<p class="list-group-item-text">${item.excerpt!}</p>
</a>
[/#list]
[/#if]
</div>
[/#if]
Thanks.
================== Update ==================
It seems to be a know bug as per https://jira.magnolia-cms.com/browse/MAGNOLIA-6245 but it is said to be fixed (in June 2015). However I still have the issue. See my comment in the Jira Ticket: https://jira.magnolia-cms.com/browse/MAGNOLIA-6245?focusedCommentId=120828&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-120828
================== Update 2 ==================
I setup a new 5.4.3 locally, where the issue does not occur. The issue still occurs at the 5.4.3 instance at my hosting provider though (about which my original posting is about). I downloaded the repo-conf, and made a diff with my local repo-conf folder, there are no differences in either jackrabbit-memory-search.xml nor jackrabbit-bundle-mysql-search.xml.
I found the solution to the problem thanks to a hint in the Jira:
https://jira.magnolia-cms.com/browse/MAGNOLIA-6245?focusedCommentId=120872&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-120872
The lines
<!-- needed to highlight the searched term -->
<param name="supportHighlighting" value="true"/>
<!-- custom provider for getting an HTML excerpt in a query result with rep:excerpt() -->
<param name="excerptProviderClass" value="info.magnolia.jackrabbit.lucene.SearchHTMLExcerpt"/>
were also missing in the file
${magnolia.repositories.home}/magnolia/workspaces/website/workspace.xml
due to some mistake at the hosting provider's template which they use for setting up Magnolia.

Error adding capability in windows phone app

I am working on a Windows phone app in Visual studio 2012 and finding difficulties showing pub center ads. I have searched that we need to add certain capabilities reference : Windows phone ads not working, I have added all the capabilities but while adding "ID_CAP_MEDIA_LIB" its throws an error
"The Name attribute is Ivalid - The value "ID_CAP_MEDIA_LIB"is Invalid
according to its datatype 'string' - The enumeration constraint
failed."
Any help would be appreciated
Hum this capability doesn't not exit.
<Capability Name="ID_CAP_MEDIALIB_AUDIO" />
<Capability Name="ID_CAP_MEDIALIB_PLAYBACK" />
<Capability Name="ID_CAP_MEDIALIB_PHOTO" />
You need =>
ID_CAP_IDENTIFY_USER
ID_CAP_MEDIALIB_PHOTO
ID_CAP_NETWORKING
ID_CAP_PHONEDIALER
ID_CAP_WEBBROWSERCOMPONENT
You can add an event handler to the Error Event on the AdControl, by catching that or adding a break point and drilling into the error event args you can normally pinpoint what the specific problem is or which capability your app is lacking during development.
As MatDev8 alluded to, it's probably best just to add capabilities through the wpmanifest UI.

Resources