ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

How to change currency in Child table grid?


#1

I want to change currency in child table grid based on Currency I chose. It’s like when we create new Sales Invoice.


#2

Hi @magic-overflow

Can you explain this in brief?


#3

I want to change Expense Claim in HR module to have multi currency.
I added custom field Currency and Conversion Rate.
In Expense Claim, there’s a table grid. I want to change its columns [Claim Amount, Sanctioned Amount] currency based on the custom field Currency value. If i chose USD, value in table grid will have $ sign with amount like in Sales Invoice (Multi currency)


#4

Same here.Any news on this? Did you find a solution?


#5

I managed to see currency code in the grid by using Contract:parent:contract_currency.

So on the parent doctype “Contract” if the contract_currency is USD, then the prefix “USD” shows up on the child column…

But when you save or print, it gives error “Contract None was not found”. So it seems that while the display is possible, the print is not.

image

Can anybody confirm this if the behaviour is expected or not expected, so that a bug report can be created if required.


#6

One more trial. Changed the Options from Contract:parent:contract_currency to Contract::contract_currency and it worked to save. But gives error upon printing.

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 61, in application
response = frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 21, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 56, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1027, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/www/printview.py”, line 187, in get_html_and_style
no_letterhead=no_letterhead, trigger_print=trigger_print),
File “/home/frappe/frappe-bench/apps/frappe/frappe/www/printview.py”, line 158, in get_html
html = template.render(args, filters={“len”: len})
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/environment.py”, line 1008, in render
return self.environment.handle_exception(exc_info, True)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/environment.py”, line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File “/home/frappe/frappe-bench/apps/frappe/frappe/./templates/print_formats/standard.html”, line 32, in top-level template code
{{ render_field(df, doc) }}
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/runtime.py”, line 579, in _invoke
rv = self._func(*arguments)
File “/home/frappe/frappe-bench/apps/frappe/frappe/./templates/print_formats/standard_macros.html”, line 3, in template
{{ render_table(df, doc) }}
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/runtime.py”, line 579, in _invoke
rv = self._func(*arguments)
File “/home/frappe/frappe-bench/apps/frappe/frappe/./templates/print_formats/standard_macros.html”, line 55, in template

{{ print_value(tdf, d, doc, visible_columns) }}

File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/runtime.py”, line 579, in _invoke
rv = self._func(*arguments)
File “/home/frappe/frappe-bench/apps/frappe/frappe/./templates/print_formats/standard_macros.html”, line 134, in template
{{ doc.get_formatted(df.fieldname, parent_doc or doc, translated=df.translatable) }}
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 715, in get_formatted
return format_value(val, df=df, doc=doc, currency=currency)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/formatters.py”, line 60, in format_value
currency=currency if currency else (get_field_currency(df, doc) if doc else None))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/meta.py”, line 484, in get_field_currency
currency = frappe.get_cached_value(split_opts[0], doc.get(split_opts[1]), split_opts[2])
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 697, in get_cached_value
doc = get_cached_doc(doctype, name)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 682, in get_cached_doc
doc = get_doc(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 725, in get_doc
doc = frappe.model.document.get_doc(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 69, in get_doc
return controller(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 97, in init
self.name = frappe.db.get_value(args[0], args[1], “name”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 484, in get_value
order_by, cache=cache)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 528, in get_values
out = self._get_values_from_table(fields, filters, doctype, as_dict, debug, order_by, update)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 664, in _get_values_from_table
conditions, values = self.build_conditions(filters)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 448, in build_conditions
_build_condition(f)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 415, in _build_condition
_operator = value[0]
IndexError: list index out of range