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

Start time and End time should be displayed in one field

By
supreeth
on 11/3/15, 12:39 AM 385 views

I have two fields Start Time and End Time i need to display these two fields in one fields

For Eg:

Start Time: 08:00
End Time: 11:00
I need output like this:
Start End Time: 08:00 - 11:00

Can we merge this two fields in one field?


Thanks in advance

1

Baiju

--Baiju--
3154
| 5 4 8
Kochi, India
--Baiju--
ODOO technical and functional

        I like learning new thing, especially technical thing. I am a quick learner, I can learn technical things very fast. I have good logical skill,  I have immense interest in programming.

e-mail id : baijuks@hotmail.com

Baiju
On 11/3/15, 2:05 AM

Hi,

You can achieve this by using Computed fields with type Char.

fields.Char(compute='_compute_time',string='Start-End Time')

And in function get values from that two field and join it like you want.


Hope this helps.

Thanks

supreeth
on 11/3/15, 5:19 AM
0
supreeth
On 11/3/15, 1:58 AM

def _combine(self, cr, uid, ids, field_name, args, context=None):
values = {}
for id in ids:
rec = self.browse(cr, uid, [id], context=context)[0]
values[id] = {}
values[id] = '%s - %s' % (rec.start_time, rec.end_time)
return values 

'start_end_time': fields.function(_combine, string='Start End Time!', type='char',
arg=('start_time','end_time'), method=True),

Got solution

Thanks

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

1 follower(s)

Stats

Asked: 11/3/15, 12:39 AM
Seen: 385 times
Last updated: 11/3/15, 2:05 AM