0

Trying to add some demo data to a module of ours, some records can't be created

The culprit seems to be this piece of code

@api.model
def create(self, vals_list):
    if not self.env.user.has_group('some-project.group_super') and not self.env.user.has_group(
            'some-project.group_some_role'):
        raise ValidationError(
            f"Some error message.")
    vals_list['serial_number_for_this_entity'] = self.env['ir.sequence'].next_by_code('some_project.res.partner')
    return super(ThisEntity, self).create(vals_list)

and the error I'm having is "Some error message"

it seems that because while installing I still can't have the role "group_some_role" I can't add a partner

So I should

  1. create a database without demo data
  2. install my module
  3. putting my user in the "some_role" group
  4. load the demo data manually

I'd like to be able to install my module with its demo data flawlessly

What's the idiomatic solution for this ?

user1632812
  • 431
  • 3
  • 16

0 Answers0