Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][MIG] fastapi: Migration to 17.0 #409

Merged
merged 12 commits into from
Jun 6, 2024

Conversation

nguyenminhchien
Copy link

@nguyenminhchien nguyenminhchien commented Jan 8, 2024

@nguyenminhchien
Copy link
Author

nguyenminhchien commented Jan 8, 2024

The check failed because of the issue #141747

@nguyenminhchien nguyenminhchien marked this pull request as ready for review January 8, 2024 05:19
@nguyenminhchien nguyenminhchien mentioned this pull request Jan 8, 2024
18 tasks
@hunghn
Copy link

hunghn commented Jan 12, 2024

Thank you, Mr. Chien, for your contribution. It works for me.

Copy link
Contributor

@lmignon lmignon left a comment

Choose a reason for hiding this comment

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

@nguyenminhchien Thank you for the migration. Con you remove the dependency on odoo-addon-endpoint-route-handler @ git+https://github.com/OCA/web-api.git@refs/pull/31/head#subdirectory=endpoint_route_handler This one is merged.

@nguyenminhchien
Copy link
Author

@nguyenminhchien Thank you for the migration. Con you remove the dependency on odoo-addon-endpoint-route-handler @ git+https://github.com/OCA/web-api.git@refs/pull/31/head#subdirectory=endpoint_route_handler This one is merged.

Removed, thanks.

@gurneyalex
Copy link
Member

/ocabot migration fastapi

@OCA-git-bot OCA-git-bot added this to the 17.0 milestone Jan 25, 2024
@gurneyalex
Copy link
Member

@lmignon @sbidoul it seems that Odoo 17 has issues with the addons having a 16.0.x.y.z version, even if they are installable=False

cf. https://github.com/OCA/rest-framework/actions/runs/7634588421/job/20798693591?pr=409#step:7:74

Is this something you prefer reporting as an issue to Odoo or handle in the test scripts or process with a commit updating the versions of the uninstallable addons in the repo?

@lmignon
Copy link
Contributor

lmignon commented Feb 2, 2024

@lmignon @sbidoul it seems that Odoo 17 has issues with the addons having a 16.0.x.y.z version, even if they are installable=False

cf. https://github.com/OCA/rest-framework/actions/runs/7634588421/job/20798693591?pr=409#step:7:74

Is this something you prefer reporting as an issue to Odoo or handle in the test scripts or process with a commit updating the versions of the uninstallable addons in the repo?

An issue is open on odoo regarding this problem odoo/odoo#141747

@rven
Copy link

rven commented Feb 5, 2024

After an update of Odoo the following error is raised on the fastapi module

odoo.tools.convert.ParseError: while parsing /opt/odoo/parts/oca_pull/fastapi/security/ir_rule+acl.xml:37
2002Invalid domain: <class 'NameError'>: "name 'authenticated_partner_id' is not defined" while evaluating
2003" ['|', ('user_id', '=', user.id), ('id', '=', authenticated_partner_id)]"
To fix this, the following code needs to be changed in fastapi/models/ir_rule.py

    @api.model
    def _eval_context(self):
        ctx = super()._eval_context()
        if "authenticated_partner_id" in self.env.context:
            ctx["authenticated_partner_id"] = self.env.context[
                "authenticated_partner_id"
            ]
        return ctx

Should be changed to this

    @api.model
    def _eval_context(self):
        ctx = super()._eval_context()
        ctx["authenticated_partner_id"] = self.env.context.get("authenticated_partner_id")
        return ctx

@sbidoul
Copy link
Member

sbidoul commented Feb 5, 2024

@rven this looks like #410

@nguyenminhchien
Copy link
Author

@rven this looks like #410

@rven @sbidoul I have picked #410

@ahmed-aly-aut
Copy link

@nguyenminhchien this pull request is now needed too #416

@nguyenminhchien nguyenminhchien force-pushed the 17.0-mig-fastapi branch 2 times, most recently from 114895e to 956c1a3 Compare February 21, 2024 02:56
@nguyenminhchien
Copy link
Author

@nguyenminhchien this pull request is now needed too #416

I picked this one.

@lmignon lmignon added the 17.0 label Mar 14, 2024
@lmignon
Copy link
Contributor

lmignon commented Apr 16, 2024

/ocabot merge nobump

Copy link
Contributor

@lmignon lmignon left a comment

Choose a reason for hiding this comment

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

Code review only

@OCA-git-bot
Copy link
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 17.0-ocabot-merge-pr-409-by-lmignon-bump-nobump, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Apr 16, 2024
Signed-off-by lmignon
@dreispt
Copy link
Member

dreispt commented May 3, 2024

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 17.0-ocabot-merge-pr-409-by-dreispt-bump-nobump, awaiting test results.

OCA-git-bot added a commit that referenced this pull request May 3, 2024
Signed-off-by dreispt
@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 17.0-ocabot-merge-pr-409-by-sbidoul-bump-nobump, awaiting test results.

OCA-git-bot added a commit that referenced this pull request May 26, 2024
Signed-off-by sbidoul
lmignon and others added 11 commits May 26, 2024 12:25
If you pass an override of the authenticated_partner_impl to the _create_test_client method, don't override it by a default one
This is to ensure that `retrying` in `service/model.py` does not try to flush.
Currently translated at 100.0% (41 of 41 strings)

Translation: rest-framework-16.0/rest-framework-16.0-fastapi
Translate-URL: https://translation.odoo-community.org/projects/rest-framework-16-0/rest-framework-16-0-fastapi/it/
…en evaluating ir rules

This fix is needed since a modificiation of ir.rule that checks the domain when creating/modifying ir rules
The solution is to set authenticate_partner_id to False when it is not present in context
From odoo/odoo@cb1d057, the orignal werkzeug request is wrapped in a dedicated class to keep under control the attributes developers use. This change add code to make the fastapi addon working with version including this last change and prior version

refs OCA#414
@sbidoul sbidoul force-pushed the 17.0-mig-fastapi branch from c231e78 to 91e9647 Compare May 26, 2024 10:25
@sbidoul
Copy link
Member

sbidoul commented May 26, 2024

Ah I understand #409 (comment) now. The base branch CI was sill configured for 16.0. I ran copier update --trust, answered the questions for 17.0 and rebased.

@lmignon
Copy link
Contributor

lmignon commented Jun 6, 2024

/ocabot merge nobump

@lmignon
Copy link
Contributor

lmignon commented Jun 6, 2024

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 17.0-ocabot-merge-pr-409-by-lmignon-bump-nobump, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Jun 6, 2024
Signed-off-by lmignon
@OCA-git-bot
Copy link
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 17.0-ocabot-merge-pr-409-by-lmignon-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit fc6ef5d into OCA:17.0 Jun 6, 2024
7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at dfe1f4a. Thanks a lot for contributing to OCA. ❤️

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

Successfully merging this pull request may close these issues.