I have been developing module for Odoo8 under Ubuntu 14.04 . I am trying to set field data of my current class to field data of other class. I tried to assign the value but it does not get shown on the field of that other class. On printing the value on command prompt, it displays the right value but on Odoo field the textbox remains empty. Any clue or suggestions on this? Hopes for suggestion. Please check my code below
class hrEmployee(models.Model):
_inherit = "hr.employee"
passports_ids = fields.One2many('hr.employee.passports', 'employee_id', 'Passport')
class hr_employee_passports(models.Model):
_name='hr.employee.passports'
employee_id = fields.Many2one("hr.employee", "Employee" , ondelete="cascade")
@api.onchange('passports_number')
@api.depends( 'passports_number')
def set_passport(self):
result={}
if self.passports_number:
for obj in self.employee_id:
obj.passport_id=self.passports_number
print obj.passport_id # this is the inherited field
passports_number = fields.Char('Passport No', help='Passport Number')