Hi everyone,
I'm trying to make a simple wizard using a value from the current menu context.
But I can't find anyway to this. The farthest I get a warning popup with a None value.
Is it possible to use a context value from the view and pass it to a wizard ?
my view :
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id='view_form_custom_details' model='ir.ui.view'>
<field name="name">view_form_custom_details</field>
<field name="model">custom.details</field>
<field name="arch" type="xml">
<form string="Get details" version="8.0">
<sheet>
<center>
<center>
<button string="Details" name="get_details" type="object" class="oe_highlight" />
or
<button string="Cancel" class="oe_link" special="cancel" />
</center>
</center>
</sheet>
</form>
</field>
</record>
<act_window name="Get details" res_model="custom.details" src_model="account.invoice"
view_mode="form" key2="client_action_multi"
target="new" id="act_get_details"
context="{'journal_type':context.get('journal_type')}"
/>
</data>
</openerp>
my code
# -*- coding: utf-8 -*- from openerp import models, api from openerp.exceptions import Warning
class custom_details(models.TransientModel):
_name = 'custom.details'
@api.multi
def get_details(self):
invoice_obj = self.env['account.invoice']
context = self.env.context
raise Warning(str(context.get('journal_type')))
return True
Thanks
How to to use context: http://learnopenerp.blogspot.com/2018/01/get-parent-form-value-in-one2many-form.html
?:)
--
Отправлено из мобильной Яндекс.Почты
05.03.2020, 12:44, "Sehrish" <sehrishnaz47@gmail.com>: