0 votes
31 views

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.multi
@api.depends('start', 'end')
def years(self):
    self.rang = [int(x) for x in range(int(self.start),int(self.end))]
    pass

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.2k points)
closed by | 31 views

1 Answer

+1 vote
Best answer

Hello

  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 (5.8k points)
selected by
192 questions
163 answers
32 comments
39,438 users