İçereği Atla
Menü
Bu soru işaretlendi
3 Cevaplar
260 Görünümler

Please help!!!

How to open a new window through a button please

here is my code

python function:

def edit_data(self, cr, uid, ids, context=None):

mod_obj = self.pool.get('ir.model.data')

res = mod_obj.get_object_reference(cr, uid, 'add_credit', 'callims_form')

momo_id = self.read(cr, uid, ids,['id','add_credit'])

print ("cc")

return {

'name': 'New Data',

'view_type': 'form',

'view_mode': 'form',

'view_id': False,

'res_model': 'add_credit',

'type': 'ir.actions.act_window',

'nodestroy': True,

'target': 'new',

'flags' : { 'action_buttons' : True,},

}

and the xml:

<button name="edit_data" type="objet" icon="gtk-add"/>



i want to open add_credit window but it doesnt work

Avatar
Vazgeç
En İyi Yanıt

You can try:

def action_view_po(self, cr, uid, ids, context=None):

mod_obj = self.pool.get('ir.model.data')

purchase_obj = self.pool.get('purchase.order')

list_po = []

for po in purchase_obj.search(cr, uid, [('sale_id', '=', ids[0])], context=context):

list_po.append(po)

action_model, action_id = tuple(mod_obj.get_object_reference(cr, uid, 'purchase', 'purchase_form_action'))

action = self.pool.get(action_model).read(cr, uid, action_id, context=context)

ctx = eval(action['context'])

action.update({'context': ctx,

'domain': "[('id','in',%s)]" % list_po})

return action

Avatar
Vazgeç
Üretici En İyi Yanıt

It is the name of the class of the window that i want to open.can you please give me an example

Avatar
Vazgeç
En İyi Yanıt

'res_model': 'add_credit'   <= this seems a bit strange...

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
2
Ağu 25
2655
1
Tem 25
1034
1
Ağu 25
1151
0
May 25
1492
2
Nis 25
3646