annikoff/redmine_plugin_computed_custom_field

Doesn't work in Redmine 3.4.6

spb2010 opened this issue · 3 comments

Hi!

This plugin doesn't work in the following environment:
Redmine version 3.4.6.stable
Ruby version 2.4.4-p296 (2018-03-28) [x86_64-linux]
Rails version 4.2.8
Environment production
Database adapter Mysql2

Problem - after choosing field type (see below), the browser shows - "Internal error.
An error occurred on the page you were trying to access. If you continue to experience problems please contact your Redmine administrator for assistance. If you are the Redmine administrator, check your log files for details about the error."

image

log:
Started POST "/ajax_counters/counters" for 192.168.4.224 at 2018-09-26 11:41:38 +0300
Processing by AjaxCountersController#counters as JSON
Parameters: {"counters"=>["17e931ec4650adbf9dd1e740717854fc", "8afabb878df82ab70b90895578e6c8e8", "3086ee8126035e5e23490275a08f0258"]}
Current user: XXX (id=XXX)
Completed 200 OK in 44ms (Views: 0.3ms | ActiveRecord: 19.0ms)
Started GET "/custom_fields/new?utf8=%E2%9C%93&type=IssueCustomField" for XXX at 2018-09-26 11:43:18 +0300
Processing by CustomFieldsController#new as HTML
Parameters: {"utf8"=>"вњ“", "type"=>"IssueCustomField"}
Current user: efimov.s (id=191)
Rendered custom_fields/formats/_regexp.html.erb (0.8ms)
Rendered custom_fields/formats/_string.html.erb (2.3ms)
Rendered plugins/a_common_libs/app/views/hooks/a_common_libs/_view_custom_fields_form_upper_box.html.erb (0.1ms)
Rendered plugins/computed_custom_field/app/views/hooks/_view_custom_fields_form_upper_box.html.erb (31.8ms)
Rendered custom_fields/_form.html.erb (37.7ms)
Rendered custom_fields/new.html.erb within layouts/admin (39.0ms)
Completed 500 Internal Server Error in 68ms (ActiveRecord: 21.4ms)

ActionView::Template::Error (undefined method is_computed' for #<IssueCustomField:0x000000000704eb68> Did you mean? is_computed=): 1: <% if custom_field.new_record? || custom_field.is_computed? %> 2: <p><%= form.check_box :is_computed, 3: data: { enables: '#custom_field_formula, #available_cfs' }, 4: disabled: !custom_field.new_record? %></p> 5: <p><%= form.text_area :formula, rows: 7 %></p> lib/redmine/views/labelled_form_builder.rb:34:in check_box'
plugins/computed_custom_field/app/views/hooks/_view_custom_fields_form_upper_box.html.erb:2:in _plugins_computed_custom_field_app_views_hooks__view_custom_fields_form_upper_box_html_erb__2259488051550925668_70055330692280' lib/redmine/hook/view_listener.rb:59:in block (2 levels) in render_on'
lib/redmine/hook/view_listener.rb:57:in map' lib/redmine/hook/view_listener.rb:57:in block in render_on'
lib/redmine/hook.rb:61:in block (2 levels) in call_hook' lib/redmine/hook.rb:61:in each'
lib/redmine/hook.rb:61:in block in call_hook' lib/redmine/hook.rb:58:in tap'
lib/redmine/hook.rb:58:in call_hook' lib/redmine/hook.rb:96:in call_hook'
app/views/custom_fields/_form.html.erb:20:in _app_views_custom_fields__form_html_erb__1633238306386876193_70055331494540' app/views/custom_fields/new.html.erb:4:in block in _app_views_custom_fields_new_html_erb___771732804853340808_70055331631540'
app/helpers/application_helper.rb:1190:in labelled_form_for' app/views/custom_fields/new.html.erb:3:in _app_views_custom_fields_new_html_erb___771732804853340808_70055331631540'
lib/redmine/sudo_mode.rb:63:in `sudo_mode'

Hi. Did you apply migrations RAILS_ENV=production rake redmine:plugins:migrate?

Cool. I'm stupid. After migration all is right. But I don't understand how it works. I want to sum all values of the custom field in child issues. But if I create the new field and sign "computed" then I don't see this field in my issue. What is wrong?

Computed feilds are hidden, you should write some code in formula field and resave issues to apply calculations. There are some examples in readme file and closed issues.