上传的图像用于项目: 'CST技术支持'
  1. CST技术支持
  2. SLAL2-1873

【夏尔天逸】自定义模型字段逻辑问题

XMLWord打印

    • Icon: Change Change
    • 解决结果: 完成
    • Icon: Medium Medium
    • 202102
    • X-成都夏尔-Y2020042
    • xiaertest
    • 基础通用功能
    • 隐藏

      计算字段语法错误,修改如下:
      for record in self:
      year_diff = int(record.x_hr_month[0:4]) - record.x_startdate_efficientcy.year
      month_diff = int(record.x_hr_month[4:]) - record.x_startdate_efficientcy.month
      x_month = year_diff*12 + month_diff + 1
      if record.x_employee_id.hire_date.day<15:
      if record.x_employeegrade == 'G1':
      record['x_person_efficiency'] = 0
      elif record.x_employeegrade == 'G5':
      record['x_person_efficiency'] = 1
      elif record.x_employeegrade == 'G2':
      if x_month<1:
      record['x_person_efficiency'] = 0
      elif 1<=x_month<=3:
      record['x_person_efficiency'] = 0.25
      elif 4<=x_month<=6:
      record['x_person_efficiency'] = 0.5
      elif x_month>=7:
      record['x_person_efficiency'] = 1
      elif record.x_employeegrade == 'G3':
      if x_month<1:
      record['x_person_efficiency'] = 0
      elif 1<=x_month<=3:
      record['x_person_efficiency'] = 0.5
      elif 4<=x_month:
      record['x_person_efficiency'] = 1
      elif record.x_employeegrade == 'G4':
      if x_month<1:
      record['x_person_efficiency'] = 0
      elif 1==x_month:
      record['x_person_efficiency'] = 0.5
      elif 2<=x_month:
      record['x_person_efficiency'] = 1
      else:
      if record.x_employeegrade == 'G1':
      record['x_person_efficiency'] = 0
      elif record.x_employeegrade == 'G5':
      record['x_person_efficiency'] = 1
      elif record.x_employeegrade == 'G2':
      if x_month<1:
      record['x_person_efficiency'] = 0
      elif 1<=x_month<=4:
      record['x_person_efficiency'] = 0.25
      elif 5<=x_month<=7:
      record['x_person_efficiency'] = 0.5
      elif x_month>=8:
      record['x_person_efficiency'] = 1
      elif record.x_employeegrade == 'G3':
      if x_month<1:
      record['x_person_efficiency'] = 0
      elif 1<=x_month<=4:
      record['x_person_efficiency'] = 0.5
      elif 4<=x_month:
      record['x_person_efficiency'] = 1
      elif record.x_employeegrade == 'G4':
      if x_month<1:
      record['x_person_efficiency'] = 0
      elif 1<=x_month<=2:
      record['x_person_efficiency'] = 0.5
      elif 3<=x_month:
      record['x_person_efficiency'] = 1

      显示
      计算字段语法错误,修改如下: for record in self: year_diff = int(record.x_hr_month [0:4] ) - record.x_startdate_efficientcy.year month_diff = int(record.x_hr_month [4:] ) - record.x_startdate_efficientcy.month x_month = year_diff*12 + month_diff + 1 if record.x_employee_id.hire_date.day<15: if record.x_employeegrade == 'G1': record ['x_person_efficiency'] = 0 elif record.x_employeegrade == 'G5': record ['x_person_efficiency'] = 1 elif record.x_employeegrade == 'G2': if x_month<1: record ['x_person_efficiency'] = 0 elif 1<=x_month<=3: record ['x_person_efficiency'] = 0.25 elif 4<=x_month<=6: record ['x_person_efficiency'] = 0.5 elif x_month>=7: record ['x_person_efficiency'] = 1 elif record.x_employeegrade == 'G3': if x_month<1: record ['x_person_efficiency'] = 0 elif 1<=x_month<=3: record ['x_person_efficiency'] = 0.5 elif 4<=x_month: record ['x_person_efficiency'] = 1 elif record.x_employeegrade == 'G4': if x_month<1: record ['x_person_efficiency'] = 0 elif 1==x_month: record ['x_person_efficiency'] = 0.5 elif 2<=x_month: record ['x_person_efficiency'] = 1 else: if record.x_employeegrade == 'G1': record ['x_person_efficiency'] = 0 elif record.x_employeegrade == 'G5': record ['x_person_efficiency'] = 1 elif record.x_employeegrade == 'G2': if x_month<1: record ['x_person_efficiency'] = 0 elif 1<=x_month<=4: record ['x_person_efficiency'] = 0.25 elif 5<=x_month<=7: record ['x_person_efficiency'] = 0.5 elif x_month>=8: record ['x_person_efficiency'] = 1 elif record.x_employeegrade == 'G3': if x_month<1: record ['x_person_efficiency'] = 0 elif 1<=x_month<=4: record ['x_person_efficiency'] = 0.5 elif 4<=x_month: record ['x_person_efficiency'] = 1 elif record.x_employeegrade == 'G4': if x_month<1: record ['x_person_efficiency'] = 0 elif 1<=x_month<=2: record ['x_person_efficiency'] = 0.5 elif 3<=x_month: record ['x_person_efficiency'] = 1

      导入数据报错

            grant.yang 杨光磊
            luoj 罗军
            表决:
            0 为这个问题表决

              创建日期:
              已更新:
              已解决: