i work with OpenERP 7 and i have 2 radio buttons that changes values of table. i have created an event wich call a python function that execute an sql query, after that i must reload the page to show the table whith new values. but the problem is that the radio buttons take the default value !! so the user will have only one choice, so i must set the default values of radio buttons after reloading the page. This is my Qweb code:
<t t-if="number === 2">
<table style="margin-left:360px;margin-top:0px;margin-bottom:0px;">
<tr>
<td style="text-align:left;font-size:12px;"><b>Jusqu'au mois courant:</b></td>
<td>
<input type="radio" id="radio_budget_cumulee_jusque_mois_courant" value="courant" name="radio_budget_cumulee" checked="checked"/>
</td>
</tr>
<tr>
<td style="text-align:left;font-size:12px;"><b>Jusqu'au fin d'année:</b></td>
<td>
<input type="radio" id="radio_budget_cumulee_jusque_fin_anneee" value="fin" name="radio_budget_cumulee"/>
</td>
</tr>
</table>
<div id="itkbudg">
<div t-attf-id="#{view.element_id}_action_#{column_index}_#{action_index}" class="oe_content" t-att-style="action.attrs.fold ? 'display: none;' : 'height: 220px;overflow-x: hidden;overflow-y: auto;padding: 0 12px 1px;'"></div>
</div>
</t>
and this is my Javascript Code:
$("#radio_budget_cumulee_jusque_mois_courant, #radio_budget_cumulee_jusque_fin_anneee").change(function(){
est_jusqu_mois_courant=self.$el.find('#radio_budget_cumulee_jusque_mois_courant').is(':checked')
est_jusqu_finannee=self.$el.find('#radio_budget_cumulee_jusque_fin_anneee').is(':checked')
var mod=new instance.web.Model("itk.compta.dashboard");
mod.call("itk_compta_dashboard_fct_changer_vue",[est_jusqu_mois_courant],{}).done(function(res) {
});
self.do_action({
type: 'ir.actions.client',
tag: 'reload',
});
// $radios.filter('[value=fin]').prop('checked', est_jusqu_finannee);
//$radios.filter('[value=courant]').prop('checked', est_jusqu_mois_courant);
//I tried to use this code
var $radios = $('input:radio[name=radio_budget_cumulee]');
$radios.filter('[value=fin]').attr('checked', est_jusqu_finannee);
$radios.filter('[value=courant]').attr('checked', est_jusqu_mois_courant);
// ANd i tried this code
radiobtnmois_courant = document.getElementById("radio_budget_cumulee_jusque_mois_courant");
radiobtnmois_courant.checked = false;
radiobtnfin_anneee = document.getElementById("radio_budget_cumulee_jusque_fin_anneee");
radiobtnfin_anneee.checked = true;
});
But always the radio buttons takes the default values. Please any Help?