Skip to Content
Menu
This question has been flagged
1 Reply
4337 Views

i want to concat standard with academic year but an error occours give me solution
academice_year_id = fields.Many2one('academic.year', 'Academic Year')

standard_id = fields.Many2one('odoo.education.school.standards', 'Class')

@api.multi
@api.depends('academice_year_id','school_id')
def comp_code(self):
for rec in self:
c = (rec.academice_year_id )+''+(rec.school_id)
rec.write({
'code' : c,
})


c = (rec.academice_year_id )+''+(rec.school_id)
  File "C:\Program Files (x86)\Odoo 12.0\server\odoo\models.py", line 4975, in __add__
    return self.concat(other)
  File "C:\Program Files (x86)\Odoo 12.0\server\odoo\models.py", line 4984, in concat
    raise TypeError("Mixing apples and oranges: %s.concat(%s)" % (self, arg))
TypeError: Mixing apples and oranges: academic.year(1,).concat()

Avatar
Discard
Best Answer

c = (rec.academice_year_id.id )+''+(rec.school_id.id)

Avatar
Discard