0 votes

I have three fields: start year, end year and range. I need to add the list of ranges of the two second fields into the range field.

@api.depends('start', 'end')
def years(self):
    self.rang = [int(x) for x in range(int(self.start),int(self.end))]

start = fields.Char(string="", required=False, )
end = fields.Char(string="", required=False, )
rang = fields.One2many(compute=years )

I get this error message:

Sorry, you are not allowed to access this document. Please contact your system administrator if you think this is an error.

(Document model: _unknown) - (Operation: read, User: 2)

closed with the note: Fixed
in Server by (10.5k points)
closed by | 229 views

1 Answer

+1 vote
Best answer


  1. for this error (Document model: _unknown) - (Operation: read, User: 2) you need to define the model of one2many field
  2. To add records from a list to one2many fields: you need to append data into list like                                   list.append((0, 0, {'start': self.start,'end':self.end})) and put this list to the 2onemany field.

by (6k points)
selected by
202 questions
179 answers
175,268 users