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

Hello everyone i'am trying to create smart button with action to open other form view and i want to pass my current form data to the new form am trying to do this : 

<div class="oe_button_box" name="button_box">

<button type="object" name="action_view_cash" class="oe_stat_button"  icon="fa-money" attrs="{'invisible':[('state', 'in', ('draft','sent','confirmed','mand')),('cash_policy_ids','=',[])]}">

<field name="policy_cash_count" widget="statinfo" string="Cash Policy"/>

<field name='cash_policy_ids' invisible="1"/>

</button>

</div>

in my model.py : 

@api.multi

def action_view_cash(self):

view_id = self.env.ref('custom_shipping.shipping_cash_form').id

context = self._context.copy()

return {

'name':'Cash Policy',

'view_type':'form',

'view_mode':'tree',

'views' : [(view_id,'form')],

'res_model':'shipping.cash',

'view_id':view_id,

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

'res_id':self.id,

'target':'new',

'context':context,

}


on click this button it says (Form view couldn't be loaded) in warning error validation i guess any one can help ?

อวตาร
ละทิ้ง

add view mode form

ผู้เขียน

same problem nothing change

คำตอบที่ดีที่สุด

Please share the executable code.

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

ok i solved it and now i can see the form but all the fields are empty how i pass data to those fields from this button anyone know

อวตาร
ละทิ้ง

You have to pass your values into context.

context = {'policy_cash_count':self.policy_cash_count}

ผู้เขียน

its give me alot warning about alot fields not null

ผู้เขียน

at last its not working

ผู้เขียน

thank you everyone i did it

Hi Salem, please share the solution in order to close the issue

I have the same issue here! please share your solution

Related Posts ตอบกลับ มุมมอง กิจกรรม
Odoo 10 field calculation problem แก้ไขแล้ว
1
ส.ค. 19
2426
2
ส.ค. 18
4406
1
ส.ค. 15
3084
2
มี.ค. 15
5378
1
มี.ค. 15
4222