Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Setting Values using wizard form

By
Jihen BEN ALI
on 3/25/16, 9:27 AM 311 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'),
        
            }


Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 3/25/16, 9:27 AM
Seen: 311 times
Last updated: 3/25/16, 9:34 AM