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

Open
wants to merge 12 commits into
base: 17.0
Choose a base branch
from

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
Sponsor 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
Sponsor 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
Sponsor Contributor

lmignon commented Apr 16, 2024

/ocabot merge nobump

Copy link
Sponsor 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
Sponsor 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
@nilshamerlinck
Copy link
Contributor

Hi @dreispt could you please try again your merge bot command? I believe it wasn't going through previously because of an old pending runboat build, but this has now been fixed thanks to Chien's rebase

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@lmignon
Copy link
Sponsor Contributor

lmignon commented May 24, 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-lmignon-bump-nobump, awaiting test results.

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

Hi @dreispt could you please try again your merge bot command? I believe it wasn't going through previously because of an old pending runboat build, but this has now been fixed thanks to Chien's rebase

Yikes, wrong hypothesis 😅

Hi @sbidoul the 17.0 branch of this repo is based on 16.0 and some manual changes

Do you think it could now be initialized "normally" through copier?

Copy link
Member

@sbidoul sbidoul left a comment

Choose a reason for hiding this comment

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

A couple of comments "en passant".

There are a few missing commits from the 16.0 branch. Would be nice to pick them up before merging.

I'll look at why the bot does not merge.

@@ -30,5 +30,5 @@
]
},
"development_status": "Beta",
"installable": False,
# "installable": False,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# "installable": False,
"installable": True,

Or remove the line.

Comment on lines 40 to 41
limit: Optional[int] = None # noqa: UP007
offset: Optional[int] = None # noqa: UP007
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
limit: Optional[int] = None # noqa: UP007
offset: Optional[int] = None # noqa: UP007
limit: int | None
offset: int | None

Would this work?

Copy link
Author

Choose a reason for hiding this comment

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

yes indeed

@sbidoul
Copy link
Member

sbidoul commented May 26, 2024

Hm, weird. Trying again.

/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-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
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.

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.

None yet