Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Coopdevs OCB mirror
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coopdevs
Odoo
Coopdevs OCB mirror
Commits
5cc7c400
Commit
5cc7c400
authored
13 years ago
by
Olivier Dony
Browse files
Options
Downloads
Patches
Plain Diff
[IMP] res.currency: name_search() implementation to match name_get()
bzr revid: odo@openerp.com-20111005002416-vz0vzfpb2uosxu4c
parent
982b2a08
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openerp/addons/base/res/res_currency.py
+15
-0
15 additions, 0 deletions
openerp/addons/base/res/res_currency.py
with
15 additions
and
0 deletions
openerp/addons/base/res/res_currency.py
+
15
−
0
View file @
5cc7c400
...
...
@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import
re
import
time
import
netsvc
from
osv
import
fields
,
osv
...
...
@@ -26,6 +27,8 @@ import tools
from
tools.misc
import
currency
from
tools.translate
import
_
CURRENCY_DISPLAY_PATTERN
=
re
.
compile
(
r
'
(\w+)\s*(?:\((.*)\))?
'
)
class
res_currency
(
osv
.
osv
):
def
_current_rate
(
self
,
cr
,
uid
,
ids
,
name
,
arg
,
context
=
None
):
if
context
is
None
:
...
...
@@ -101,6 +104,18 @@ class res_currency(osv.osv):
r
[
'
date
'
]
=
currency_date
return
res
def
name_search
(
self
,
cr
,
user
,
name
=
''
,
args
=
None
,
operator
=
'
ilike
'
,
context
=
None
,
limit
=
100
):
if
not
args
:
args
=
[]
if
name
:
ids
=
self
.
search
(
cr
,
user
,
([(
'
name
'
,
'
=
'
,
name
)]
+
args
),
limit
=
limit
,
context
=
context
)
name_match
=
CURRENCY_DISPLAY_PATTERN
.
match
(
name
)
if
not
ids
and
name_match
:
ids
=
self
.
search
(
cr
,
user
,
[(
'
name
'
,
'
=
'
,
name_match
.
group
(
1
))]
+
args
,
limit
=
limit
,
context
=
context
)
else
:
ids
=
self
.
search
(
cr
,
user
,
args
,
limit
=
limit
,
context
=
context
)
return
self
.
name_get
(
cr
,
user
,
ids
,
context
=
context
)
def
name_get
(
self
,
cr
,
uid
,
ids
,
context
=
None
):
if
not
ids
:
return
[]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment