Skip to Content
Menu
This question has been flagged
1 Reply
7615 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?

Avatar
Discard
Author Best Answer

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

Avatar
Discard
Related Posts Replies Views Activity
0
Mar 15
3169
1
Mar 15
8126
1
Mar 15
5179
1
Mar 15
3666
1
Mar 15
3668