-
-
Notifications
You must be signed in to change notification settings - Fork 853
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
[16.0][ADD] partner_search_alias #1833
base: 16.0
Are you sure you want to change the base?
Conversation
c055fed
to
f97d82d
Compare
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.
@AungKoKoLin1997 Can you please also extend the partner search view to consider search_alias
for the name field?
Please also make it clear in the readme file where in the form view users can find the added field.
<field name="inherit_id" ref="base.view_partner_tree" /> | ||
<field name="arch" type="xml"> | ||
<field name="translated_display_name" position="after"> | ||
<field name="search_alias" /> |
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.
<field name="search_alias" /> | |
<field name="search_alias" optional="hide" /> |
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.
Done!
<field name="model">res.partner</field> | ||
<field name="inherit_id" ref="base.view_partner_form" /> | ||
<field name="arch" type="xml"> | ||
<field name="vat" position="after"> |
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.
Let's move the field somewhere less obtrusive.
<field name="vat" position="after"> | |
<field name="ref" position="after"> |
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 updated the code.
fc36289
to
12ef300
Compare
Hi community, With my current design, there might be issues if another module also extends |
@api.model | ||
def _name_search( | ||
self, name="", args=None, operator="ilike", limit=100, name_get_uid=None | ||
): | ||
args = list(args or []) | ||
if name: | ||
args += ["|", ("search_alias", operator, name)] | ||
return super()._name_search(name, args, operator, limit, name_get_uid) |
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.
@AungKoKoLin1997 Please try this.
@api.model | |
def _name_search( | |
self, name="", args=None, operator="ilike", limit=100, name_get_uid=None | |
): | |
args = list(args or []) | |
if name: | |
args += ["|", ("search_alias", operator, name)] | |
return super()._name_search(name, args, operator, limit, name_get_uid) | |
@property | |
def _rec_names_search(self): | |
return list(set(super()._rec_names_search + ["search_alias"])) |
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.
It works. Thank you.
36e4083
to
27995fc
Compare
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.
Code review.
27995fc
to
ecf3c6a
Compare
This module allows users to set non-official names for partners in the search_alias field, improving search usability by enabling searches using alternative names.
@qrtl QT4793