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.

1

Can you show the string of a selection field in Report Editor, or write it to another field?

By
Laurens
on 6/18/13, 10:33 AM 2,417 views

Background information

I have used custom fields to set up the following.

I created a selection field in the Sales Order defined like this:

[('1','< half a day'),('2','> half a day'),('3','1 day'),('4','> 1 day'),('5',' 1,5 days'),('6','>1,5 days'),('7','+/- 2 days')]

I have also created a field in project.task which is set up like:

[('1','3 hours'),('2','6 hours'),('3','8 hours'),('4','10 hours'),('5','12 hours'),('6','14 hours'),('7','16 hours')]

This field will get copied over from the Sales Order to the project.task through the project_mrp module (Create Task on SO). Because the values are defined the same way, a field in the SO selected as "> half a day" can be converted to "3 hours" automatically under the tasks.

Actual question

I want to show my selection field on a custom report I created for the tasks. However if I just use "[[ o.x_worktime ]]" it will show the id value behind the string. E.g.: "1", "2", "3", ...

I want to show the string behind the id value on my print-out.

Can anyone tell me how I can show this string behind the value of this selection field with the Open Office Report Editor, if such a thing is possible?

Or how I can assign another field to take over the text-string of the selection field as it's value; so I can use this field for the report editor instead?

Update

I have created a many2one field under project.task, I have linked this many2one field under the tasks with a selection field under the Sales Order. Now I can show the many2one field on the project.task and print it out on my report. That part is covered. However, under the Sales Order - I still can't show the value of my selection field there.

I'd still be interested in a way to write the value of this selection field to another field, perhaps with an onchange function; or when the Sales Order gets confirmed (or preferably: saved) . Or is such a thing not possible, because the values aren't stored in the database?

1
Laurens
On 6/19/13, 1:17 PM

Well it seems you can not show the string of a selection field on the report direclty, through the OpenOffice ReportEditor. To the best of my knowledge, and lacking any replies; I think it is not possible to copy the selection_field string_value to another field either.

I have "solved" my problem using two many2one fields. I needed to convert "< half a day", "> half a day" and other strings under the Sales Order to effective hours under project.task. What I've done is change the id values of the estimated-worktime strings to actual hour count.

In the OORE I added "Estimated work hours: [[ o.work_hours.id ]]". This will show the ID, which are editted manually to correspond with the actual hour count.

This way I can print both the name field (< half a day) and the id field (string "Estimated work: " + id number + string: "hours"). The only downside is the many2one field always shows the name field, rather than for instance code. But either way this solution is 90% of what I wanted to accomplish.

Example:

image description

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: 6/18/13, 10:33 AM
Seen: 2417 times
Last updated: 3/16/15, 8:10 AM