Skip to content

[IMP] util/misc: dynamic literal_replace #231

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

aj-fuentes
Copy link
Contributor

@aj-fuentes aj-fuentes commented Mar 11, 2025

Allow to match in a glob-like fashion and produce the replacement node
dynamically.

Improvements:

  • Do not replace if no match happens (allows to write less to the DB.)
  • Do not buble syntax errors, log instead.
  • Most valid nodes for Python expressions in the ORM are covered.
  • Implement node matching in same order as the reference below.
  • Much higher test coverage.
  • Adapt tests for Python3.6 (Odoo 13 and 14)

@robodoo
Copy link
Contributor

robodoo commented Mar 11, 2025

Pull request status dashboard

@KangOl
Copy link
Contributor

KangOl commented Mar 11, 2025

upgradeci retry with always only hr

@aj-fuentes aj-fuentes force-pushed the master-imp_literal_replace2-afu branch 4 times, most recently from 6cdae5f to 889bd3e Compare March 14, 2025 16:57
@aj-fuentes aj-fuentes requested a review from KangOl March 17, 2025 09:29
@KangOl
Copy link
Contributor

KangOl commented Mar 17, 2025

upgradeci retry
(with new docker image with astunparse installed in all venv)

@aj-fuentes
Copy link
Contributor Author

All green \o/

@aj-fuentes
Copy link
Contributor Author

I will squash the commits

@aj-fuentes aj-fuentes force-pushed the master-imp_literal_replace2-afu branch from 889bd3e to 2ddbdd8 Compare March 17, 2025 13:07
@aj-fuentes
Copy link
Contributor Author

Still all green :D

@aj-fuentes aj-fuentes force-pushed the master-imp_literal_replace2-afu branch 3 times, most recently from db4217a to 5ca2131 Compare March 21, 2025 16:51
@aj-fuentes aj-fuentes force-pushed the master-imp_literal_replace2-afu branch 2 times, most recently from 31cf26c to a07cc3b Compare March 31, 2025 15:25
Allow to match in a glob-like fashion and produce the replacement node
dynamically.

Improvements:
* Do not replace if no update happens (allows to write less to the DB.)
* Do not buble syntax errors, log instead.
* Most valid nodes for Python expressions in the ORM are covered.
* Implement node matching in same order as the reference below.
* Much higher test coverage.
* Adapt tests for Python3.6 (Odoo 13 and 14)

See: https://greentreesnakes.readthedocs.io/en/latest/nodes.html
@aj-fuentes aj-fuentes force-pushed the master-imp_literal_replace2-afu branch from a07cc3b to 8269e9f Compare April 15, 2025 12:54
Before it was impossible to handle domains defined as
`context.get('key') and [<dom1>] or [<dom2>]`

Example:
```
context.get('default_move_type') in ('out_invoice', 'out_refund', 'out_receipt') and [('sale_ok', '=', True), '|', ('company_id', '=', False), ('company_id', '=', parent.company_id)] or [('purchase_ok', '=', True), '|', ('company_id', '=', False), ('company_id', '=', parent.company_id)]
```
@aj-fuentes aj-fuentes force-pushed the master-imp_literal_replace2-afu branch from 8269e9f to f070537 Compare April 15, 2025 13:30
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.

3 participants