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

[13.0] Create module base_domain_inverse_function #2474

Merged

Conversation

grindtildeath
Copy link
Contributor

This module provides functions to decompose normalized domains
into domains operands, as these functions are the inverse of
AND and OR functions available in odoo.osv.expression.

@grindtildeath grindtildeath force-pushed the 13.0-add-base_domain_inverse_function branch from 216a47e to 76b6e61 Compare November 25, 2022 12:13
@i-vyshnevska
Copy link
Member

to fix the build you need to change from gitlab to github

- repo: https://gitlab.com/pycqa/flake8

@grindtildeath
Copy link
Contributor Author

@i-vyshnevska that probably won't be enough, we need to move to GH actions but there are some issues in this repo, cf #2459

self.assertEqual(
inverse_OR(self.complex_domain_or_and_and),
result
)
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't you add a test that ensures that an OR domain isn't split by inverse_AND, and an AND domain isn't split by inverse_OR

self.assertEqual(inverse_OR(self.complex_domain_and_or_or),  self.complex_domain_and_or_or)
self.assertEqual(inverse_AND(self.complex_domain_or_and_and), self.complex_domain_or_and_and)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's no sense to use the inverse_OR function on a domain that doesn't begin with an OR operator, as it means such domain wasn't created with OR function. I could still add a test and raise an error in this case.

)


def inverse_combine(domain, operator):
Copy link
Member

Choose a reason for hiding this comment

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

I find it very difficult to understand.
Domains use infix notation a + b -> + b a.
I remember in compilation courses at school, we created a lexer for that notation, and I would have gone this way.
The grammar here is quite easy: |, &, ! and tuples, I think it would be easier to review and to maintain.
However, it might take some time to implement.
Ping me if you have questions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Feel free to propose another implementation if you can do better 😝

@grindtildeath grindtildeath force-pushed the 13.0-add-base_domain_inverse_function branch from ef7d3fc to 3c8d2a0 Compare April 24, 2023 16:00
@gurneyalex
Copy link
Member

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 13.0-ocabot-merge-pr-2474-by-gurneyalex-bump-nobump, awaiting test results.

@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). 🤖

@OCA-git-bot OCA-git-bot merged commit 1a05045 into OCA:13.0 May 16, 2023
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at fa15dcd. 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.

7 participants