Skip to Content
Menu
This question has been flagged
3120 Views

Hi everyone,

In my article form I had added a smart button that call a wizard form I need to set the active_id to the article_id using the wizard form how could I doing this?

Here is my python code:

from openerp.osv import osv
from openerp.osv import fields
from openerp.tools.translate import _
class comment_wizard(osv.osv_memory):
 
    _name = 'comment.wizard'
 
    _columns = {
        'new_comment': fields.text('New Comment')
            }
 
  def save_button(self, cr, uid, ids, context=None):
        if 'active_id' in context:
            info = self.browse(cr, uid, ids)[0].new_comment
            comm_req = self.pool.get('comment.comment')
            for comm_data in comm_req.browse(cr, uid, context.get('active_ids'), context=context):
                comm_data.create({'comment':info})
        return {'type':'ir.actions.act_window_close'}
class comment_comment(osv.osv):
 _name='comment.comment' 
        
    _columns={
        'article_id':fields.many2one('article.article','Article'), 
        'comment':fields.text('Comment'),
        
            }


Avatar
Discard