Odoo 8 many2many field outside form when visible - many-to-many

I developed a module that creates a songbook on-the-fly. Based on the song_id it loads the verses of that song in the next many2many field. Sometimes, a song does not have verses and in that case the field is not visible.
<page string="Liturgy Morning">
<field name="liturgy_morning_line">
<form string="Liturgy Morning Lines">
<group>
<group>
<field name="song_id"/>
</group>
</group>
</form>
<tree string="Liturgy Morning Lines" editable="bottom">
<field name="sequence" widget="handle"/>
<field name="song_id" options="{'no_quick_create':True,'no_create_edit':True}"/>
<field name="has_songverses" invisible="1"/>
<field name="songverse_ids" widget="many2many_tags" options="{'no_quick_create':True, 'no_create_edit': True}" domain="[('song_id', '=', song_id)]" attrs="{'invisible':[('has_songverses','=',False)]}"/>
</tree>
</field>
</page>
Note the "attrs="{'invisible':[('has_songverses','=',False)]}"" in the code. The model has a field 'has_songverses' which checkes if a song has verses or not. In case the song has no verses the field is invisible.
My issue is as follows: in case a song has verses the many2many field with song verses is loaded outside the form (see attached screenshot). IMAGE:
many2many field with song verses is loaded outside the form
If I click again in the form the field is correctly rendered inside the form.
Does anyone have a solution for this issue?
Thanks in advance!

Related

How to add label to the right side of checkbox in odoo-12

Hi im trying to design my checkbox in odoo i want it to have a label to the right side of the checkbox just like this
Any Idea how can I Achieve this?
I've tried adding <span>Percentage</span> After my field but its always breaking the line
Suppose you have two checkbox fields chk1 and chk2, To make them appear like in the picture you will need to:
Add two labels one with Discount Mode string and another with an empty string.
Add a div after each label which will contain the field and its label.
<group>
<label for="chk1" string="Discount Mode"/>
<div class="o_row">
<field name="chk1"/>
<label for="chk1"/>
</div>
<label for='chk2' string=""/>
<div class="o_row">
<field name="chk2"/>
<label for="chk2"/>
</div>
</group>
You can refer to weight field in Product -> Inventory (tab) -> logistics (group).

editable field even if the Edit button is not clicked

I hope everyone is fine.
I have an issue regarding the widget "priority", I have a selection field "rating" that has this widget.
<field name="rating" widget="priority" />
the problem is this widget is editable either I click on Edit or not.
any help will be much appreciated.
use this class > class="oe_edit_only"
Like this

cockpit configuration not being picked up

I created my own cockpit from the ycockpit template, called TestCockpit. When I log into this cockpit, a List of Orders is displayed on the browser area.
I've configured the listView and the editorArea, both using XML files according to convention. The files are named listViewContentBrowser_Order.xml and editorArea_Order.xml, and are both placed under the folder for the ordermanagergroup user group.
When I run an update running system, the listView is affected by my configuration but the editorArea not.
This is what my editorArea config file looks like:
<?xml version="1.0" encoding="UTF-8"?>
<editor>
<group qualifier="General" visible="true" initially-opened="true">
<label key="testcockpit.config.label.properties"/>
<property qualifier="Order.code"/>
<property qualifier="Order.user"/>
<property qualifier="Order.currency" visible="false"/>
<property qualifier="Order.date"/>
<property qualifier="Order.displayStatus"/>
</group>
<group qualifier="admin" visible="true" initially-opened="false">
<label key="cockpit.config.label.administration"/>
<property qualifier="Item.pk" />
<property qualifier="Item.creationTime" />
<property qualifier="Item.modifiedtime" />
</group>
<custom-group
class="de.hybris.platform.cockpit.services.config.impl.UnassignedEditorSectionConfiguration"
qualifier="unassigned"
initially-opened="false">
<label key="cockpit.config.label.other"/>
</custom-group>
</editor>
Any ideas why my configuration doesn't affect the cockpit? I do log in with a user from the ordermanagergroup, by the way.
Try clicking on "Menu" (top left in your cockpit), then selecting "User Settings" and "Reset Personalized Settings".

How to refresh component after blur event in JSF

I'm using gmaps4jsf to show Google Maps in my application, but I would like to update the map after user type his/her stret, city, state and country. This way I could give more accurate information to gmaps4jsf dynamically.
But everytime I fill some of the fields, the maps it's gone. I'm doing this for instance with state:
State:<h:message id="m_state" for="state" styleClass="red" /><br/>
<h:selectOneMenu id="state" value="#{propertyC.property.addressState.state}">
<f:selectItem itemLabel="" itemValue="" />
<f:selectItems value="#{addressB.states('US')}" var="state" itemValue="#{state.key}" itemLabel="#{state.value}" />
<f:ajax event="blur" render="m_state map" />
</h:selectOneMenu>
<br/>
// others fields
<m:map id="map" width="425px" height="250px" address="#{propertyC.property.street}, #{propertyC.property.addressCity.city}, #{propertyC.property.addressState.state}, #{propertyC.property.addressCountry.country}, #{propertyC.property.cep}" zoom="25" autoReshape="true" >
<m:marker>
<m:icon imageURL="http://i.imgur.com/WFJo62Q.png"/>
</m:marker>
</m:map>
How can I show the map dynamically as user type his/her address?
Yes, in order to change the map content dynamically using Ajax, you need to set partiallyTriggered attribute to true.
Check the JSF Mashup remix demo that uses GMaps4JSF 3.0.0 for seeing how you can update the map content using Ajax:
http://www.mashups4jsf.com/gmaps4jsf-examples2-3.0.0/pages/theater2.xhtml
This is also the demo source code:
http://www.mashups4jsf.com/gmaps4jsf-examples2-3.0.0/pages/theater2.xhtml.source
Try to set the following attribute: partiallyTriggered="true".
This will allow partial rendering, sepcially if you are using ajaxfied data submittion.

Assigning form variable value to html element

I have a search bar. Entering text in it and clicking search takes you to another page which displays the search results.
Issue is, this search bar is visible at the top of every page in the application and is not a part of any particular page(including the search page).
As per the requirement, I am required to show the old search string in the search bar. Something like google.
In the file that actually displays your search form you could add the following (assuming the form field name is 'search'
<cfparam name="form.search" default="" />
<input type="text" name="search" value="#HTMLEditFormat(form.search)#" ... />
Make sure the INPUT has CFOUTPUT tags around it as well. Also, use HTMLEditFormat() when outputing input variables, otherwise you are opening yourself to injection attacks.
If you're posting the form then:
<input ... value='#form.FieldName#' />
If you're passing it through the url then:
<input ... value='#url.FieldName#' />
Use ifs or cfparams to your likening to control how it's displayed.