我目前正在使用两个类,现在我处于一个混乱状态。请帮我解决这个Openerp如何更新两个类中的字段值
我需要做的就是曾经在“roster_allocation”级要取消他/她被分配花名册雇员,然后为目的,你必须要经过“roster_substitution”级,这使记录原始分配和替代分配以及日期和时间。一旦你通过该表输入记录,我想用**“roster_substitute”**表中的substitute_employee_id更新现有的employee_id来更新该特定的“roster_allocation”表记录。
这些都是我的两个班
名册配置类别
class roster_allocation(osv.osv):
_name="roster.allocation"
_description ="Allocate rosters on employees"
_columns={
'emp_id':fields.many2one('hr.employee','Employee'),
'department_id':fields.many2one('hr.department','Department'),
'roster_allocation_allocation':fields.one2many('roster.days.allocation','roster_allocation_connection','Days connection'),
'roster_time':fields.char('Take the related field roster_time.name'),
'monthly allocation':fields.char('Month') ,
'roster_rest_allocation':fields.one2many('roster.rest.days','roster_id','Rest Days'),
'roster_substitute':fields.one2many('roster.substitution','allocation_id','Substitution'),
roster_allocation()
名册天分配类(这使开始日期,名册类型和时间段的记录)
class roster_days_allocation(osv.osv):
_name="roster.days.allocation"
_description = "To allocate days in to the already defined time slots"
def get_domain_useer_id(self,cr,uid,ids,roster_type_list,context=None):
mach=[]
filter = self.pool.get('roster.type').search(cr,uid,[('id','=',roster_type_list)])
return {'domain':{'roster_time_list':[('rostertype','=',filter)]}}
_columns={
'name':fields.char('Days_Allocation'),
'allocation_start_day':fields.date('Start Date',required=True),
'allocation_end_day':fields.date('End Date',required=True),
'type_connection':fields.one2many('roster.type','date_allocation_connection','Roster Type'),
'roster_type_list':fields.many2one('roster.type','Rosters'),
'roster_time_list':fields.many2one('roster.time','Time Slot'),
'roster_allocation_connection':fields.many2one('roster.allocation','Allocation Connection')
}
roster_days_allocation()
名册替换类(wh ICH保持最初分配员工和替代员工)的记录
class roster_substitution(osv.osv):
_name="roster.substitution"
_description="Substituting employees "
_columns={
'allocation_id':fields.many2one('roster.allocation','Allocation'),
'employee':fields.many2one('hr.employee','Employee'),
'sub_employee':fields.many2one('hr.employee','Employee'),
'time_slot':fields.many2one('roster.time','Roster'),
'roster_day':fields.date('Day'),
'reason':fields.text('Reason'),
'department_id':fields.many2one('hr.department','Department'),
}
def onchange_date(self, cr, uid, ids, roster_date):
result = {'value': {'type': False}}
if type_id:
type = self.pool.get('roster.time').browse(cr, uid, roster_date)
result['value'] = {'time_slot': type.name.id}
return result
roster_substitution()
请帮我解决这个