Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Adding Kanban State to Form View?

By
Nick K
on 7/16/13, 4:56 PM 2,579 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?

0
Devvyn Murphy
On 3/18/14, 9:44 PM

(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),

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 7/16/13, 4:56 PM
Seen: 2579 times
Last updated: 3/16/15, 8:10 AM