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

[FIX] base: add more information if wrong related field #31889

Closed
wants to merge 1 commit into from

Conversation

fmdl
Copy link
Contributor

@fmdl fmdl commented Mar 15, 2019

Description of the issue/feature this PR addresses:
During a migration process if a field have change/removed, during the installation there is a KeyError on related field.

Before :
KeyError: "purchase_line_id"

After
KeyError: "Wrong related field, 'stock.move.purchase_order_id', relation : 'purchase_line_id.order_id', wrong field : 'purchase_line_id'"

@odony @nim-odoo

cc @sla-subteno-it

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@robodoo robodoo added seen 🙂 CI 🤖 Robodoo has seen passing statuses labels Mar 15, 2019
@Yenthe666
Copy link
Collaborator

Should make debugging easier in some cases. +1

@nim-odoo nim-odoo requested a review from Elkasitu March 18, 2019 07:51
Copy link
Contributor

@Elkasitu Elkasitu left a comment

Choose a reason for hiding this comment

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

@nim-odoo can you r+?

Copy link
Contributor

@nim-odoo nim-odoo left a comment

Choose a reason for hiding this comment

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

robodoo r+

@odony
Copy link
Contributor

odony commented Mar 18, 2019

@robodoo r-
@nim-odoo @Elkasitu Could you guys take care of commit messages before merging PRs?

@xmo-odoo are you still opposed to making merge-bot more responsible for whatever it's merging? ;-)

@xmo-odoo
Copy link
Collaborator

@xmo-odoo are you still opposed to making merge-bot more responsible for whatever it's merging? ;-)

Mostly yeah, it's not really its point or goal. I still think it would make more sense to have separate status check / checkers for constraints we want to put on commit or PR messages (and others e.g. we might eventually want to add JS linters and whatnot).

@nim-odoo
Copy link
Contributor

@fmdl Could you please make sure to write correct commit messages? As far as I can remember, I always had to rewrite your commit message for all your PRs I merged. Most of the time, it was a simple copy-paste of the PR title/description since these are fine. Thanks.

@robodoo robodoo removed the CI 🤖 Robodoo has seen passing statuses label Mar 18, 2019
@fmdl
Copy link
Contributor Author

fmdl commented Mar 18, 2019

@nim-odoo for the future I will try to make a better commit message.

@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Mar 18, 2019
@robodoo robodoo removed the CI 🤖 Robodoo has seen passing statuses label Mar 19, 2019
@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Mar 20, 2019
odoo/fields.py Outdated Show resolved Hide resolved
@fmdl
Copy link
Contributor Author

fmdl commented Jun 25, 2019

ping @nim-odoo

@fmdl
Copy link
Contributor Author

fmdl commented Aug 5, 2019

cc @mart-e

@C3POdoo C3POdoo added the ORM ORM, python Framework related label Dec 31, 2019
@fmdl
Copy link
Contributor Author

fmdl commented Mar 27, 2020

ping @xmo-odoo

@fmdl
Copy link
Contributor Author

fmdl commented Jun 11, 2020

ping @nim-odoo @Elkasitu

@fmdl fmdl closed this Jun 11, 2020
@robodoo robodoo added closed 💔 and removed CI 🤖 Robodoo has seen passing statuses labels Jun 11, 2020
@fmdl fmdl reopened this Jul 15, 2021
@fmdl
Copy link
Contributor Author

fmdl commented Jul 15, 2021

ping @rco-odoo @Elkasitu

@Elkasitu
Copy link
Contributor

The comment raised by @odony is still not resolved (although you marked it as such without any explanation), other than that I'm not opposed to merging this into master

@fmdl
Copy link
Contributor Author

fmdl commented Jul 16, 2021

@Elkasitu updated

Before this commit, if a related field's path definition contained a
non-existing field (either because of a typo or field removal) the ORM
would simply send a generic Python KeyError that didn't really help in
debugging.

With this commit, we raise our own KeyError stating which related field
has the wrong path definition and exactly which field within the path is
incorrect.

See test for an example.
@Elkasitu
Copy link
Contributor

@robodoo r+

robodoo pushed a commit that referenced this pull request Jul 16, 2021
Before this commit, if a related field's path definition contained a
non-existing field (either because of a typo or field removal) the ORM
would simply send a generic Python KeyError that didn't really help in
debugging.

With this commit, we raise our own KeyError stating which related field
has the wrong path definition and exactly which field within the path is
incorrect.

See test for an example.

closes #31889

Signed-off-by: Adrian Torres (adt) <adt@odoo.com>
@robodoo robodoo added the 14.5 label Jul 16, 2021
@robodoo robodoo closed this Jul 16, 2021
@robodoo robodoo temporarily deployed to merge July 16, 2021 12:30 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
14.5 ORM ORM, python Framework related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants