-
Notifications
You must be signed in to change notification settings - Fork 51
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] util/fields : update field in context of custom search view #18
base: master
Are you sure you want to change the base?
Conversation
858ee54
to
7c2fe49
Compare
7c2fe49
to
0f22f5b
Compare
upgradeci retry with always only hr |
src/util/fields.py
Outdated
class _Skip(Exception): | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid duplication with code in domains.py
. This should be factorized and moved to records.py
.
src/util/fields.py
Outdated
@@ -1121,3 +1138,48 @@ def update_server_actions_fields(cr, src_model, dst_model=None, fields_mapping=N | |||
) % {"src_model": src_model, "dst_model": dst_model, "actions": ", ".join(action_names)} | |||
|
|||
add_to_migration_reports(message=msg, category="Server Actions") | |||
|
|||
|
|||
def update_custom_filter(cr, old, model, new=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Bad function name.
- Not a fan of the magic
None
value fornew
for the removal. What about passing a callback method? - follow the same pattern as other function and should iterate over inherits.
def update_custom_filter(cr, old, model, new=None): | |
def adapt_search_views(cr, old, model, callback, skip_inherit=()): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please provide a reference for callback method, I didn't get it.
src/util/fields.py
Outdated
WHERE {} ~ %s | ||
AND type = 'search' | ||
AND model = %s | ||
AND active = 't' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why only active views?
AND active = 't' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to avoid False negative cases.
src/util/fields.py
Outdated
except lxml.etree.XMLSyntaxError as e: | ||
if e.msg.startswith("Opening and ending tag mismatch"): | ||
# this view is already wrong, we don't change it | ||
_logger.warning("Skipping custom filter adaptaiton for invalid view (id=%s):\n%s", view_id, e.msg) | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, code copy/pasted from domains.py
. Should be factorized.
5e83138
to
f48f3f5
Compare
This commit aims to make views compatible which are generated when a search filter is created using studio, view looks like <data> <xpath expr="xyz" position="after"> <filter name="filter1" context="{'group_by': 'renamed field'}"/> <filter name="filter2" context="{'group_by': 'removed field'}"/> </xpath> </data> Currently after upgrade this view will be disabled because we are not updating the field in this view. After this fix view: <data> <xpath expr="xyz" position="after"> <filter name="filter1" context="{'group_by': 'New Name'}"/> <filter name="filter2" context="{}"/> </xpath> </data>
f48f3f5
to
585940d
Compare
This commit aims to make views compatible which are generated when a search filter is created using studio, view looks like
Currently after upgrade this view will be disabled because we are not updating the field in this view.
After this fix
view:
Alternative upgrade PR
idk whether update_custom_filter is in correct file any suggestion where it should be ?