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

Dynamically create selection values for selection Field

By
Vaibhav
on 7/8/13, 7:33 AM 1,117 views

Hello, In time sheet Module I am creating many2one field project activity

class hr_timesheet_line(osv.osv):

_inherit = "hr.analytic.timesheet"

_columns = {
                'activity':fields.many2one('hr.timesheet.activities', 'Activity'),
                 <new_field_name> :fields.<field type>(??????)
           }

This field is changes with respective project.

Then In hr.timesheet.activities this class I mentioned

 class hr_timesheet_activities(osv.osv):

_name = "hr.timesheet.activities"
_columns = {

          'name': fields.char('Activity Name', size = 64,required = True),
          'related_account_id': fields.many2one("account.analytic.account", 'Project / Account ID',required = True),
          'activity':fields.text('Activity Description'),
          'minimum_amount_activity':fields.selection([("00.15", "00:15"),("00.30", "00:30"),("00.45", "00:45"), ("0.60", "01:00"),("00.75", "01:15"),("00.90", "01:30"), ("01.05", "01:45"), ("01.20", "02:00")],"Select Minimum time Span for Activity", required = True),
          'maximum_amount_activity':fields.many2one("activity.amount.hours", "Select Maximum time for Activity", required = True),
          }

For this class view --> "hr_timesheet_line if I select project activity and details for that activity are as follows

name : project Activity1
related_account_id : Project1
minimum_amount_activity :00:30
maximum_amount_activity: 4.00

Then In hr_timesheet_line form view I want one new selection field having selection values are(00:30,01:00,01:30,02:00....,04:00)

How I create new field which is dynamically changes with "activity" field from hr.analytic.timesheet class.?

Help In --> to create new_field --> fields.type ? functionality ?

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