Skip to content

Instantly share code, notes, and snippets.

@tienhieuD
Last active May 29, 2018 10:12
Show Gist options
  • Save tienhieuD/99269a3fea634d5f90e6743ddec5e8a8 to your computer and use it in GitHub Desktop.
Save tienhieuD/99269a3fea634d5f90e6743ddec5e8a8 to your computer and use it in GitHub Desktop.
def get_selection_name(env, model, field, value):
return dict(env[model].fields_get(field, 'selection').get(field, {}).get('selection',{})).get(value)
# usage
get_selection_name(request.env, 'sale.order', 'general_status', 'picking') # 'Đang lấy hàng'
get_selection_name(self.env, 'sale.order', 'general_status', 'picking') # 'Đang lấy hàng'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment