Skip to content

Conversation

@tishmen
Copy link

@tishmen tishmen commented Oct 1, 2025

Scope

  • queue_job, test_queue_job only

Summary

  • Migrate to Odoo 19 using the working feature branch code.
  • Tests create their own users (no demo data), context handling aligned with 19.0.
  • Asset paths are relative under web.assets_backend.

Pre-commit

  • Verified locally; no additional changes applied here to keep parity with the feature branch.

Tests

  • Command:
    ./odoo/odoo-bin -c odoo.conf -d odoo_queue_pr_queue_job_base_001 --init queue_job,test_queue_job --test-tags="/queue_job,/test_queue_job" --stop-after-init
  • Result: all tests green locally.

Milan Topuzov added 11 commits October 1, 2025 18:01
Scope: queue_job, test_queue_job only
…config.yaml excluded-addons update\n- Prettier reformat XML/JS/SCSS and pyproject changes\n- Fix ruff UP031 in controllers and job repr/exception
…._ in controller\n- Use self.env._ + lazy %% formatting in models\n- Paginate channel search in autovacuum\n- Avoid raise in unlink; skip root channel\n- Fix tests: avoid search([]) and correct pylint disable id
@sbidoul
Copy link
Member

sbidoul commented Oct 1, 2025

/ocabot migration queue_job

@OCA-git-bot OCA-git-bot added this to the 19.0 milestone Oct 1, 2025
@OCA-git-bot OCA-git-bot mentioned this pull request Oct 1, 2025
8 tasks
@sbidoul
Copy link
Member

sbidoul commented Oct 1, 2025

/ocabot migration test_queue_job

Copy link

@hoangtrann hoangtrann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

appreciate all the work you done here! please review the comments since I notice many weird comments and many changes should be in another PR instead of a migration one

Milan Topuzov added 2 commits October 5, 2025 00:14
…Users)\n\n- Places the privilege below typical user/security items (e.g., OAuth providers at 30)\n- Functional change limited to security.xml data\n- pre-commit: all hooks pass locally
@tishmen tishmen force-pushed the pr/queue_job_base branch from 1bb209c to 6d330f2 Compare October 4, 2025 23:14
@tishmen
Copy link
Author

tishmen commented Oct 4, 2025

@hoangtrann quick update:

  • We’re down to just 3 open comments on this PR; the rest are addressed and pushed.
  • When you have a moment, a fresh check would be super helpful.

I’d also really appreciate it if you could take a look at PR #842—specifically the tests:

You can run the suite locally with (use any throwaway DB name in place of <DB_NAME>):

./odoo/odoo-bin -c odoo.conf -d <DB_NAME>
--init queue_job,queue_job_batch,queue_job_cron,queue_job_cron_jobrunner,queue_job_subscribe,test_queue_job,test_queue_job_batch
--test-tags="/queue_job,/queue_job_batch,/queue_job_cron,/queue_job_cron_jobrunner,/queue_job_subscribe,/test_queue_job,/test_queue_job_batch"
--stop-after-init

Thanks again for the thorough and detailed review—really grateful for your contributions and feedback 🙏

@tishmen tishmen requested a review from hoangtrann October 4, 2025 23:31
Copy link

@hoangtrann hoangtrann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are still some comments stating odoo 19 scattered across the changes which I thing we should removed.

for anyone comes after these are removed, I think it's good to just summarized the major changes to the description of the pr which can also works as a good resource for reference in other mig pr

Comment on lines 273 to 285
# carry over wrapper attributes (name, doc, etc.)
wrapped = functools.update_wrapper(method, origin)
# propagate common decorator metadata used by the framework
for attr in (
"_constrains",
"_depends",
"_onchange",
"_ondelete",
"_api_model",
"_api_private",
):
if hasattr(origin, attr):
setattr(wrapped, attr, getattr(origin, attr))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what the best to do here, but hard coding a list of apis here also don't work as a proper propagation. because if there is another api being added through customization, it will be skipped by this implementation I think 🤔

Milan Topuzov added 2 commits October 11, 2025 15:06
Comment-only cleanup; no functional changes.
…iate variables

Address review nit: split complex f-strings into clearer parts; no functional change.
@tishmen
Copy link
Author

tishmen commented Oct 11, 2025

there are still some comments stating odoo 19 scattered across the changes which I thing we should removed.

for anyone comes after these are removed, I think it's good to just summarized the major changes to the description of the pr which can also works as a good resource for reference in other mig pr

Resolved in: d27f83d

Milan Topuzov added 2 commits October 11, 2025 15:24
…ssing

Drop flat options merge; config-only change per review guidance.
Align with review: create_index already checks existence; no functional change.
…register_hook; fix auto-delay wrapper

- Remove unused `_patch_method` from Base per review
- Update docstring example to patch methods in `_register_hook`
- Adjust test models to patch using `functools.update_wrapper`
- Fix auto-delay wrapper to store unbound origin and bind at call time

Functional change limited to patching helper/tests; no manifest changes.
Copy link

@hoangtrann hoangtrann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@amh-mw amh-mw mentioned this pull request Oct 13, 2025
@richard-willdooit
Copy link

From my checks and tests, this is all ready to go. Can it be merged?

@sbidoul

@PieterPaulussen
Copy link
Contributor

@tishmen have you tested this version with the preforkserver configuration (using --workers=4)? Jobs are enqueued, but never started.
The threaded server setup does work.

Additionally, there is an error due to the upstream config refactoring in this method:
https://github.com/tishmen/queue/blob/pr/queue_job_base/queue_job/jobrunner/runner.py#L474-L479. On the line db_names = config["db_name"].split(",") specifically: config["db_name"] is no longer a comma separated string, but already a list so the split can be omitted.

@PieterPaulussen
Copy link
Contributor

@tishmen An additional refactoring is necessary here because read_group is no longer supported by the core. You'll have to refactor this into the use of the new _read_group method.

@nilshamerlinck
Copy link
Contributor

@PieterPaulussen fyi, workers mode working fine here, is the runner starting properly on your end?

$ egrep "(runner|runner\.channels): .*(starting|initializing|.+runner ready|database connections ready|Configured channel)" odoo.log

image

Copy link
Contributor

@PieterPaulussen PieterPaulussen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tishmen Thanks for your effort on this. On the whole, this PR does the trick, but there are a lot of additional changes that are not essential to the module migration. In my opinion, you will get faster approvals if you slim down the changes to the bare minimum given the complexity of this module.

If you want to keep the translations in this PR, can we go one step further and use positional arguments for all translated string variables? This results in more flexibility for other languages during translating.

On the refactoring of the tests to remove the reliance on the demo_user, I would beg to differ. Unittests should rely on the presence of the demo data, just as the core does.

Finally, I would like to stress the following issue that I encountered during a local test with your code: #840 (comment)
The jobrunner does not seem to enqueue AND process the queue jobs when running is preforked server configuration. This issue should be addressed first.

Comment on lines +157 to +159
uuids = [uuid for uuid in self.mapped("graph_uuid") if uuid]
ids_per_graph_uuid = {}
if uuids:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
uuids = [uuid for uuid in self.mapped("graph_uuid") if uuid]
ids_per_graph_uuid = {}
if uuids:
ids_per_graph_uuid = {}
if any(self.mapped("graph_uuid")):

Isn't any faster in this case?

Comment on lines +28 to +29
"company_ids": [(6, 0, [main_company.id])],
"group_ids": [(6, 0, [group_user.id])],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be replaced by Command.set() to be consistent with the rest of your PR.

Comment on lines +20 to +23
User = cls.env["res.users"]
main_company = cls.env.ref("base.main_company")
group_user = cls.env.ref("base.group_user")
cls.demo_user = User.create(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
User = cls.env["res.users"]
main_company = cls.env.ref("base.main_company")
group_user = cls.env.ref("base.group_user")
cls.demo_user = User.create(
main_company = cls.env.ref("base.main_company")
group_user = cls.env.ref("base.group_user")
cls.demo_user = cls.env["res.users"].create(

A bit opnionated, but the User variable is unnecessary and Camel cased variables should not be used.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Camelcase is ok in this case as cls.env["res.users"] is (roughly) a class.

def test_decoder_recordset_list_without_user(self):
value_json = (
'["a", 1, {"_type": "odoo_recordset",' '"model": "res.users", "ids": [1]}]'
'["a", 1, {"_type": "odoo_recordset","model": "res.users", "ids": [1]}]'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'["a", 1, {"_type": "odoo_recordset","model": "res.users", "ids": [1]}]'
'["a", 1, {"_type": "odoo_recordset", "model": "res.users", "ids": [1]}]'

Comment on lines +417 to +418
"company_ids": [(6, 0, [main_company.id])],
"group_ids": [(6, 0, [group_user.id])],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be replaced by Command.set()

Comment on lines +557 to +558
"company_ids": [(6, 0, [main_company.id])],
"group_ids": [(6, 0, [group_user.id])],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be replaced by Command.set()

Comment on lines +25 to +26
"company_ids": [(6, 0, [main_company.id])],
"group_ids": [(6, 0, [group_user.id])],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be replaced by Command.set()

Comment on lines +549 to +552
User = cls.env["res.users"]
main_company = cls.env.ref("base.main_company")
group_user = cls.env.ref("base.group_user")
cls.demo_user = User.create(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
User = cls.env["res.users"]
main_company = cls.env.ref("base.main_company")
group_user = cls.env.ref("base.group_user")
cls.demo_user = User.create(
main_company = cls.env.ref("base.main_company")
group_user = cls.env.ref("base.group_user")
cls.demo_user = cls.env["res.users"].create(

Comment on lines +17 to +20
User = cls.env["res.users"]
main_company = cls.env.ref("base.main_company")
group_user = cls.env.ref("base.group_user")
cls.demo_user = User.create(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
User = cls.env["res.users"]
main_company = cls.env.ref("base.main_company")
group_user = cls.env.ref("base.group_user")
cls.demo_user = User.create(
main_company = cls.env.ref("base.main_company")
group_user = cls.env.ref("base.group_user")
cls.demo_user = cls.env["res.users"].create(

@PieterPaulussen
Copy link
Contributor

@PieterPaulussen fyi, workers mode working fine here, is the runner starting properly on your end?

$ egrep "(runner|runner\.channels): .*(starting|initializing|.+runner ready|database connections ready|Configured channel)" odoo.log

image

@nilshamerlinck Curious, could you share your worker and channel configuration please? In my test, the jobs got enqueued, but were never actually processed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants