Hello good day!,
I just want to ask how what is wrong my python code for copying/passing the value of one2many field in a record from a model to another model records with one2many field also. Only one record is having a content and the other records are all blanks. What I want is all of the records must have the same values on their one2many field of what was passed/copied from the other model record. What do you think is the problem on this code.
Here is my code:
@api.multi
def toggle_active(self):
if not self.active:
print "Active"
self.active = True
wsi_mrfs = self.env['hr.recruitment.request'].search([
# ('mrf_seq_num', '=', 'MRF04145')
('job_id', '=', self.job_ids.id),
('company_id', '=', self.company_ids.id),
('is_invisible', '=', False)
])
ques_ids = []
if wsi_mrfs:
# print self.questionnaire_details
for que in self.questionnaire_details:
ques_ids.append(que.id)
for rec in wsi_mrfs:
rec.mrf_questionnaires = [(6, 0, ques_ids)]
# print "for que in self.questionnaire_details:", rec.mrf_questionnaires, rec.mrf_seq_num, ques_ids
rec.is_invisible = True
Hoping for you response. Thank you very much in advance.