我正在odoo 9中工作。我已经从JS打开了一个向导,并且已经传递了上下文,因此我想在向导中使用此上下文。我怎样才能做到这一点? 请查看我的代码。
myfunc: function(e) {
var mycontext = {};
var is_checked = this.field_manager.get_field_value('Default')
if (is_checked)
{
var model_obj = new Model('olims.ar_priority');
var domain = [['Default', '=', true]];
model_obj.call('search_read',[domain]).then(function(result){
mycontext['current_priority'] = result[0]['Priority'];
})
alert()
this.do_action({
name: ("Pop Up"),
res_model: 'olims.ar.priority.wizard',
type: 'ir.actions.act_window',
view_type: 'form',
view_mode: 'form',
views: [
[false,'form']
],
target: 'new',
context : mycontext,
});
}
这是xml
<record model="ir.ui.view" id="olims_ar_priority_confirm_wizard">
<field name="name">Set Default Priority Wizard</field>
<field name="model">olims.ar.priority.wizard</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form>
<group>
<templates>
<t t-set="priority" t-value="request.env.context['current_priority']"/>
<span><t t-esc="priority"/> is set as default</span>
</templates>
</group>
<footer>
<button string="Cancel" special="cancel" class="oe_highlight"/>
<button name="agent_exceed_limit" string="Request Manager to Approve Sale" type="object" class="oe_highlight" />
</footer>
</form>
</field>
</record>