Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
263 มุมมอง

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

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ส.ค. 25
2655
1
ก.ค. 25
1034
1
ส.ค. 25
1151
0
พ.ค. 25
1492
2
เม.ย. 25
3646