Skip to Content
Menu
This question has been flagged
1 Reply
11272 Views

Is there a way to add the Kanban State of a project task to the task's form view, and make it editable? I tried adding the kanban_state field in the view editor, and it shows the state, but it is marked as read-only. Also, is there a way to change the text associated with each state?

Avatar
Discard
Best Answer

(There is no quick fix for this, but hopefully this answer helps in the learning process, at least.)

Quick and dirty override

I cannot confidently guarantee there would be no potential side effects, but a view field override to the model's read-only attribute would allow users to change the value while in the form view.

Rather than:

<field name="kanban_state"/>

Try:

<field name="kanban_state" readonly="0"/>

or

<field name="kanban_state" attrs="{'readonly':0}"/>

In OpenERP 7.0, either of those two lines produced a writeable field in my form view which overrode the object model's read-only setting. In edit mode, I was able to choose values from the option box and save them to the database.

Caveat:

This override probably skips the notifications from being sent to subscribers of the "Task Blocked" events, and the others. A proper solution should cause the selection input to call the same methods the kanban_state button on the kanban view usually call.

Selectable option names

The strings of the kanban_state options are unfortunately hard-coded and marked as non-translatable, so you'd need to create an add-on that would override the _columns dictionary in project_task and project_task_history objects. This is not very straight-forward to explain here, but I believe an add-on to do so would only need as little as three files. See the developer documentation at doc.openerp.com/trunk/server/03_module_dev_02/#object-inheritance-inherit for more about object inheritance. Alternatively, you could duplicate the entire folder for the standard Project add-on and apply your tweaks, installing it instead of the usual add-on for tasks. The lines you'd need to modify look like:

'kanban_state': fields.selection([('normal', 'Normal'), ('blocked', 'Blocked'), ('done', 'Ready for next stage')], 'Kanban State', required=False),
Avatar
Discard
Related Posts Replies Views Activity
0
Nov 23
1472
0
Nov 23
1245
0
Oct 23
1153
1
Jun 21
3283
0
Jun 22
2507