queue icon indicating copy to clipboard operation
queue copied to clipboard

14.0 Setting Company id in jobs question

Open gdgellatly opened this issue 3 years ago • 4 comments

https://github.com/OCA/queue/blob/911b995e66c2d550826d1ce9ea4e18ef97ae6dc4/queue_job/job.py#L499-L502

We have this code here but it is constantly causing me issues in v14 with AccessErrors if I perform a function on a record in a different company to the one I am presently primarily logged into.

env.company often has no relation to the record being actioned. I feel like we should be defaulting to the company of the record second, then taking the users current company. Or is it just me getting these problems.

gdgellatly avatar Jan 11 '22 10:01 gdgellatly

I agree w/ getting the default from the recordset company if available.

simahawk avatar Jan 11 '22 12:01 simahawk

I think we should drop this company_id field from jobs. It was a mistake when we added that.

sbidoul avatar Jul 01 '22 13:07 sbidoul

What are the implications of dropping it? So many functions in Odoo required the company to be set to get correct results, yet many many functions are naive and overlook this, just getting the company of current user.

I know the issues with keeping it as well, just not sure how we can resolve both sides.

gdgellatly avatar Jul 04 '22 00:07 gdgellatly

Dropping it would create multi company issues as we use this to separate jobs between multiple companies.

Not everyone should be able to see jobs from other companies. We also use this company_id field to execute some jobs in the correct company context.

robin5210 avatar Jul 06 '22 11:07 robin5210

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.

github-actions[bot] avatar Jan 08 '23 12:01 github-actions[bot]

We currently get around this by introducing a 'bot' (inactive) user per company. Jobs are placed onto the queue using the per-company bot-user.

daemonblade avatar Jan 24 '23 21:01 daemonblade

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.

github-actions[bot] avatar Jul 30 '23 12:07 github-actions[bot]