单击一个按钮弹出一个form表单,怎么不刷新原表单?
-
我在按钮的事件是返回一个formB表单:
def draft_force_assign_winbo(self, cr, uid, ids, context=None):
print '--11111111111------------'
if context is None:
context = {}
"""Open the partial picking wizard"""dict2 = { 'view_type': 'form', 'view_mode': 'form', 'res_model': 'stock.partial.picking', 'type': 'ir.actions.act_window', 'target': 'new', 'context': context, 'nodestroy': True, } return dict2 -
我也遇到过类似需求,也发现这个问题,不过odoo框架机制是这样子设置的。我没有找到类似方法,不过我想了下,form表单里面可以自定义html标签,你再插入js,js里面再以json-rpc的方式提交,或者直接调用call方法,或许是一个解决方法。我没有试,你可以试试
-
@萧云飞 def create(self, cr, uid, vals, context=None):
print "==============winbo=========create"
print vals
super(stock_picking_in_winbo, self).write(cr, uid, picking_id, vals, context=context)
# self.draft_force_assign_winbo(self, cr, uid,picking_id)return picking_id def draft_force_assign_winbo(self, cr, uid, ids, context=None): if context is None: context = {} stock_obj = self.browse(cr, uid, ids) """Open the partial picking wizard""" context.update({ 'active_model': self._name, 'active_ids': ids, 'active_id': len(ids) and ids[0] or False, 'ref_id': 13 }) mod_obj = self.pool.get('ir.model.data') res = mod_obj.get_object_reference(cr, uid, 'starmerx_stock', 'starmerx_stock_partial_picking_form') # raise osv.except_osv(_('无法保存 !'), _('字段值有错误!')) return { 'view_type': 'form', 'view_mode': 'form', 'view_id': [res and res[1] or False], 'res_model': 'stock.partial.picking', 'type': 'ir.actions.act_window', 'target': 'new', 'context': context, 'nodestroy': True, }我的这个场景可能跟你的不一样,我之前也以为要在create里面调用我的方法,但其实不用
-
如果你的按钮的类型是
object,在点击的时候会调用read方法来刷新你的FormA,如果你的按钮类型是action,则可以不刷新FormA,也能弹出FormB。例如:
<button name="%(action_view_sale_advance_payment_inv)d" string="Create Invoice" type="action" class="btn-primary" attrs="{'invisible': [('invoice_status', '!=', 'to invoice')]}"/> -
如果你的按钮的类型是
object,在点击的时候会调用read方法来刷新你的FormA,如果你的按钮类型是action,则可以不刷新FormA,也能弹出FormB。例如:
<button name="%(action_view_sale_advance_payment_inv)d" string="Create Invoice" type="action" class="btn-primary" attrs="{'invisible': [('invoice_status', '!=', 'to invoice')]}"/> -
@萧云飞 def create(self, cr, uid, vals, context=None):
print "==============winbo=========create"
print vals
super(stock_picking_in_winbo, self).write(cr, uid, picking_id, vals, context=context)
# self.draft_force_assign_winbo(self, cr, uid,picking_id)return picking_id def draft_force_assign_winbo(self, cr, uid, ids, context=None): if context is None: context = {} stock_obj = self.browse(cr, uid, ids) """Open the partial picking wizard""" context.update({ 'active_model': self._name, 'active_ids': ids, 'active_id': len(ids) and ids[0] or False, 'ref_id': 13 }) mod_obj = self.pool.get('ir.model.data') res = mod_obj.get_object_reference(cr, uid, 'starmerx_stock', 'starmerx_stock_partial_picking_form') # raise osv.except_osv(_('无法保存 !'), _('字段值有错误!')) return { 'view_type': 'form', 'view_mode': 'form', 'view_id': [res and res[1] or False], 'res_model': 'stock.partial.picking', 'type': 'ir.actions.act_window', 'target': 'new', 'context': context, 'nodestroy': True, }我的这个场景可能跟你的不一样,我之前也以为要在create里面调用我的方法,但其实不用
-
如果你的按钮的类型是
object,在点击的时候会调用read方法来刷新你的FormA,如果你的按钮类型是action,则可以不刷新FormA,也能弹出FormB。例如:
<button name="%(action_view_sale_advance_payment_inv)d" string="Create Invoice" type="action" class="btn-primary" attrs="{'invisible': [('invoice_status', '!=', 'to invoice')]}"/>
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login
