Special="save" button doesn't work in odoo16 form view - odoo-16

When I add my "save" button and "discard" button as following:
<footer>
<button string="Save" special="save" class="btn-primary" close="1" />
<button string="Discard" class="btn-secondary" special="cancel"/>
</footer>
Both buttons dont work and when I click them, nothing happends.

Related

How to position edit button?

I am trying to position the edit button in FilePond but it is not working, here is what i've tried:
<file-pond
ref="pond"
stylePanelLayout="compact"
captureMethod="camera"
:allow-multiple="false"
:imageEditor="myEditor"
:files="myFiles"
styleImageEditButtonEditItemPosition="top right"
/>

System should not refresh after clicking on already selected radio button

I have 2 radio buttons , i selected one to them , there is an ajax call when i select that , what i want that there should not be any ajax call when i click on the already selected radio button . How to implement this.
<label for="cooperativeAuthorisedRepresentativeType">#{msg['com.crimsonlogic.egov.rol.rnra.landsubdivision.applicantdetails.cooperative.cooperativeAuthorisedRepresentativeType']}</label>
<h:selectOneRadio id="applicantDetails_cooperative_cooperativeAuthorisedRepresentativeType" required="true"
value="#{landSubdivisionController.cooperativeDetails.repCode}" requiredMessage="#{cmn['rol.common.message.error.RADIO_REQUIRED']}" >
<f:selectItem itemLabel="#{msg['REPRWAND']}" itemValue="REPRWAND" />
<f:selectItem itemLabel="#{msg['REPFOR']}" itemValue="REPFOR" />
<f:validateRequired />
<a4j:ajax event="click" listener="#{landSubdivisionController.changeRepresentativeTypeForCooperative()}" render="cooperativeCitizenNationalId,cooperativeCitizenNationalIdForFranchisee,cooperativeCitizenSurname,cooperativeCitizenOtherNames,cooperativeCitizenDistrict,cooperativeCitizenSector,cooperativeCitizenCell,cooperativeCitizenVillage,cooperativeForeignerPassportNo,cooperativeForeignerSurname,cooperativeForeignerOtherNames,cooperativeForeignerCountry,cooperativeForeignerCity" />
</h:selectOneRadio>
<div class="col-md-4">
<h:message for="applicantDetails_cooperative_cooperativeAuthorisedRepresentativeType" styleClass="help-block"></h:message>
</div>
You should use change event instead of click event of javascript.
You can try writing like this:
<a4j:ajax event="change"

In Titanium JS, when setting rightNavButtons, the buttons only work for the first 4 taps

In my app for iOS I've used the rightNavButtons property of a window to add two buttons in the top right.
However, the click events on these buttons only work for the first 4 taps and then nothing happens when you click on them. What is going on? Could this be a bug with Titanium?
Here is my code:
Titanium SDK version: 3.4.0.v20140916181713
Alloy version: 1.5.1
Controller - index.js:
var addButton = Ti.UI.createButton({ systemButton: Ti.UI.iPhone.SystemButton.ADD });
var searchButton = Ti.UI.createButton({ systemButton: Ti.UI.iPhone.SystemButton.SEARCH });
addButton.addEventListener("click", function () {
console.log("ADD was clicked!");
});
searchButton.addEventListener("click", function () {
console.log("SEARCH was clicked!");
});
$.win.setRightNavButtons([searchButton, addButton]);
$.index.open();
View - index.xml
<Alloy>
<TabGroup>
<Tab title="Tab 1" icon="KS_nav_ui.png">
<Window id="win" title="Tab 1">
<Label>I am Window 1</Label>
</Window>
</Tab>
<Tab title="Tab 2" icon="KS_nav_views.png">
<Window title="Tab 2">
<Label>I am Window 2</Label>
</Window>
</Tab>
</TabGroup>
</Alloy>
Found a workaround!
I avoid the <RightNavButtons>, which can contain more than one view.
Instead I use <RightNavButton> which can contain only one child view.
To add still add two buttons to my navbar, I nested the buttons in the view container (the single child of the <RightNavButton>.
<RightNavButton>
<View>
<Button class="i i-heart nav-button" id="favorite" onClick="toggleFavorite" right="0" />
<Button class="i i-share nav-button" id="share" right="32" />
</View>
</RightNavButton>
No issues anymore. Both onClick events of the <Button> childs inside the View container are fired.
Tested this code and it should work for you
<Tab title="Tab 1" icon="KS_nav_ui.png">
<Window id="win" title="Tab 1">
<RightNavButtons platform=ios>
<Button systemButton="Ti.UI.iPhone.SystemButton.ADD" onClick="addHandler" />
<Button systemButton="Ti.UI.iPhone.SystemButton.SEARCH" onClick="searchHandler" />
</RightNavButtons>
<Label>I am Window 1</Label>
</Window>
</Tab>
When I tried to execute your code, the event listeners weren't being called at all for me on 3.4.0.GA / Alloy 1.5.0 and iOS8 Simulator.
However, when I put the RightNavButton inside the XML as below, it worked fine and the event listener was called every time I clicked on it. Looks like a bug to me...
<Tab title="Tab 1" icon="KS_nav_ui.png">
<Window id="win" title="Tab 1">
<RightNavButton platform=ios>
<Button systemButton="Ti.UI.iPhone.SystemButton.ADD" onClick="closeWindow" />
</RightNavButton>
<Label>I am Window 1</Label>
</Window>
</Tab>

Titanium Alloy LeftNavButton not showing up in simulator

Not sure where I am doing wrong. I tried via code and by xml, but for some reason the left nav button does not show up. I am using the simulator since I don't have an actual device for ios.
The xml view
<!--filename: playType.xml->
<Alloy>
<Window class="container">
<LeftNavButton platform="ios">
<Button title="Back" onClick="closeWindow"/>
</LeftNavButton>
<View class="buttonContainer">
<Button class="menuButton" title="Single Player"/>
<Button class="menuButton" title ="Duel"/>
</View>
</Window>
</Alloy>
The Controller
//playType.js
var args = arguments[0] || {};
var closeWindow = function(){
$.playType.close();
};
The tss style
//playType.tss
".container" : {
backgroundColor:"white",
height:Ti.UI.FILL,
},
".buttonContainer":{
center:{x:"50%",y:"50%"},
height:Ti.UI.SIZE,
layout:"vertical"
}
I using this from the index.js
var playType = Alloy.createController('playType').getView();
playType.open();
The window shows up fine with the two buttons in the center but the back button doesn't appear.
What am I doing wrong. I went through the doc and also tried the code way too. Same result, no back button. :(
You have to create the window using navigation window otherwise navButton wont show up.here goes the code link for you
http://docs.appcelerator.com/titanium/3.0/#!/api/Titanium.UI.iOS.NavigationWindow
Thanks
Your window must be placed inside a TabGroup which handles all the capabilities of a navigation controller inside each tab.
<Alloy>
<TabGroup>
<Tab id="tab1" title="Tab 1">
<Window id="win1" title="Tab 1">
<LeftNavButton platform="ios">
<Button title="Back" onClick="closeWindow"/>
</LeftNavButton>
...
</Window>
</Tab>
</TabGroup>
</Alloy>
As for the back button, open a child window of the current tab using the tab as the reference to the open method.
tab.open(newWindow);

How to display button and status bar items in line

How to display below mentioned two group(marked in red circle) in line?
relevant code for the same is given below
<header>
<button name="mymod_assigned" class="oe_highlight" type="workflow" string="Assigned" state="new" />
<button name="mymod_negotiation" class="oe_highlight" type="workflow" string="In Negotiation" state="assigned" />
<button name="mymod_won" class="oe_highlight" type="workflow" string="Won" state="negotiating"/>
<button name="mymod_lost" class="oe_highlight" type="workflow" string="Lost" state="negotiating"/>
<field name="state" widget="statusbar"
statusbar_visible="new,assigned,negotiation,won,lost"
statusbar_colors='{
"new":"blue",
"assigned":"blue",
"negotiation":"blue",
"won":"red",
"lost":"red"
}'
/>
</header>
Try putting left group of buttons in one div with float:left and right group in another div with float:right.