Skip to content

Commit

Permalink
Merge pull request aeroo#34 from akretion/master-context-in-name_get
Browse files Browse the repository at this point in the history
Add support for context is name_get()

Thanks, @alexis-via and all reviewers!
  • Loading branch information
sraps committed Jun 1, 2015
2 parents efe55c7 + d1ac1d9 commit bd019e1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions report_aeroo/ExtraFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,14 @@ def _asarray(self, attr, field):
exec expr in localspace
return localspace['value_list']

def _get_name(self, obj):
def _get_name(self, obj, context=None):
if isinstance(obj, models.Model):
return obj.name_get()[0][1]
if context and isinstance(context, dict):
new_context = obj._context.copy()
new_context.update(context)
return obj.with_context(new_context).name_get()[0][1]
else:
return obj.name_get()[0][1]
return ''

def _get_label(self, obj, field):
Expand Down

0 comments on commit bd019e1

Please sign in to comment.