1
votes

I made a model A with lots of fields. It has a Many2one relationship with a minimal model B. B has only one name = fields.Char(...) field.

Now I have a transient model C which is a wizard where its fields correspond to the fields of model A. So that when the user inputs some data on the wizard or selects one of the predefined values of minimal model B, it creates a record of model C and saves the data.

This works just fine as long as I only use the wizard with one user. Since I have to be able to use it with as many users I want, I have tested it with two users and now the strange thing happens:

Lets say I have multiple predefined records of model B, I'll name them B1, B2 etc. If User 1 uses the wizard and selects B1 and create a record of model A everything works. If User 2 does the same with B2 everything works. But if User 2 wants to use the wizard and selected B1 following error occurs:

Access denied
For this kind of document, you may only access records you created yourself.
(Document type: [modulename.wizard_model_C])

The same thing happens if User 1 wants to use the wizard with model B2 selected. I have no clue what is wrong. This is what I tried:

  • deleting all record rules -> nothing changed
  • making all access rules to global and 1,1,1,1 -> nothing changed

I would be happy about some hints where the problem could be located. Is model B to blame? Or is it the Many2one relationship of the wizard model C?

2
Hi, have you been able to figure this out?gpothier

2 Answers

2
votes

It mean you have problem(write or unlink) in model osv.osv_memory or models.Transient..

osv_memory or transient will save in temporary memory. if user use a wizard.

For example table_transient_x you have data
id, create_uid, name, age
499, 5, 'Batman', 29
500, 6, 'Bahrudin', 20
501, 5, 'Sumanto', 40

case 1 : your code try to update row 499 by user ID:5 but because your code get wrong row for example 500 created by user ID:6.

your code will get error from models.py line 3557

case 2 : in osv_memory or transient you add field related.(don't use related field)

I hope this help you :)

0
votes

Just add s to char, change name = field.Char by name = fields.Char

and restart a service.