Odoo Help


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.


Enter values in two tables at a time. Is it possible?

on 2/4/14, 4:54 AM 1,461 views

I am working on Recruitment module. I have five stages. When a candidate reach the last stage, the candidates some details should be saved into another table. Is it possible? I know all the datas are available in recruitment table. But i want some datas in another table. Please help anyone.

can you help me to get started, am a beginner, this is ma first project inopen erp..where can i find administration-modules-import modules, provideme screen shots...buddy

on 2/5/14, 1:04 AM

When you reach the last stage, use "create"(ORM) function and write the values in another table.

on 2/5/14, 3:21 AM

I need your tables details,and what are the fields will be updated in new table.

on 2/5/14, 5:04 AM

In hr.applicant i have added x_project(many2one),x_project_start_date,x_project_end date(both are date field) etc. Create a new table ie,x_project.details add all these fields as char. When the candidate reach last stage. All its datas that we want to save in x_project.details, wants to save automatically.

on 2/5/14, 5:08 AM

without any action like click a button, you have to save the record in another table?

on 2/5/14, 5:13 AM

We have to write the values from hr.applicant to x_project.details. right?

on 2/5/14, 5:33 AM
On 2/5/14, 7:24 AM

New Table:

_columns = {
'hr_applicant_id': fields.many2one('hr.applicant', 'Hr Applicant Ref'),
'x_project_start_date': fields.date('Start Date', required=True, select=True),
'x_project_end date': fields.date('End Date', required=True, select=True),


active_id = context.get('active_id') 
applicant_obj = self.pool.get('hr.applicant') 
project_obj = self.pool.get('x_project.details') 
applicant_record = self.browse(cr, uid, ids, active_id, context=context) 
x_project_sr = project_obj .search(cr, uid, [('hr_applicant_id', '=', applicant_record .id)])
if not x_project_sr:
    project_obj.create(cr, uid, {'hr_applicant_id': applicant_record .id,'x_project_start_date':applicant_record.x_project_start_date, 'x_project_end_date':applicant_record.x_project_end_date})
    project_obj.write(cr, uid, x_project_sr[0], {'x_project_start_date':applicant_record.x_project_start_date, 'x_project_end_date':applicant_record.x_project_end_date})

No changes has to be done in hr_applicant class

on 2/5/14, 7:26 AM

Do you want "x_project.details" object reference in "hr.applicant" object?

on 2/5/14, 8:17 AM

In hr_applicant class: _columns = {'x_project':many2one('x_project.details', 'Project Ref'),}

on 2/5/14, 8:27 AM

In x_project.details class: _columns = {'x_project':char('Ref', size=64),}

on 2/5/14, 8:29 AM

In x_project.details details form you want to add "x_project" field. what value will be stored in that field?

on 2/5/14, 8:32 AM

We have to save the id of the "x_project.details" object?

on 2/5/14, 8:36 AM

Hi Ayyappan, thanks for your answer. Its working. But one issue is i dont want to overwrite record. Each time a new record should be created in the x_project.details table.

on 2/6/14, 1:07 AM

One hr_applicant form will be linked with one x_project.details or one hr_applicant form will be linked with multiple x_project.details?

on 2/6/14, 1:29 AM

whenever you updating the hr_applicant form that should be created in x_project.details form or only one time x_project.details form will be created from hr_applicant ?

on 2/6/14, 1:51 AM

Hr_applicant form value : id =1, start_date = 23/12/2013, end_date = 24/12/2013 while saving the record one x_project.details will be created. right? but in case you edit the hr_applicant same form like : id =1, start_date = 23/12/2013, end_date = 25/12/2013, while saving again this form it will create a new x_project.details form or update the value?

on 2/6/14, 2:16 AM

active_id = context.get('active_id') applicant_obj = self.pool.get('hr.applicant') project_obj = self.pool.get('x_project.details') applicant_record = self.browse(cr, uid, ids, active_id, context=context) project_obj.create(cr, uid, {'hr_applicant_id': applicant_record .id,'x_project_start_date':applicant_record.x_project_start_date, 'x_project_end_date':applicant_record.x_project_end_date})

on 2/6/14, 2:29 AM

use above one. It will create more than one x_project.details record whenever you save the hr_applicant form.

on 2/6/14, 2:30 AM

It will work, just check with button functionality. Keep a button in the hr_applicant form and click the button which will call the function you have write above.

on 2/6/14, 2:48 AM

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

0 follower(s)


Asked: 2/4/14, 4:54 AM
Seen: 1461 times
Last updated: 3/16/15, 8:10 AM