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

星环-易应用需求

XMLWord打印

    • Icon: Change Change
    • 解决结果: 完成
    • Icon: High High
    • 202106
    • X-星环科技-Y2021007
    • 基础通用功能
    • 隐藏
      # 该规则写在计算字段里
      # 总出勤天数
      for record in self:
          total_ = 0
          record['x_total'] = total_
          if record['x_attendance_item_ids']:
              for attendanc in record['x_attendance_item_ids']:
                  total_ = total_ + float(attendanc.x_work_time or 0)
              record['x_total'] = total_
      
      # 该规则写在计算字段里
      # 计算星期几
      weekday_map = {0: "星期一", 1: "星期二", 2: "星期三", 3: "星期四", 4: "星期五", 5: "星期六", 6: "星期天",}
      for record in self:
          weekday_ = record['x_date'].weekday()
          if weekday_ in weekday_map:
              record['x_zhou_ji'] = weekday_map.get(weekday_)
      
      # 该规则写在规则中心
      # 校验考勤日期
      attend_items = self.env['bp'].query_status(self.env['x_builder_intern_attend_item'], status=['waiting', 'done']).mapped('x_date')
      if self.x_attendance_item_ids:
          for attendance in self.x_attendance_item_ids:
              if attendance.x_date in attend_items:
                  raise ValidationError("考勤日期与已有考勤明细单据重复!")
      
      显示
      # 该规则写在计算字段里 # 总出勤天数 for record in self: total_ = 0 record[ 'x_total' ] = total_ if record[ 'x_attendance_item_ids' ]: for attendanc in record[ 'x_attendance_item_ids' ]: total_ = total_ + float (attendanc.x_work_time or 0) record[ 'x_total' ] = total_ # 该规则写在计算字段里 # 计算星期几 weekday_map = {0: "星期一" , 1: "星期二" , 2: "星期三" , 3: "星期四" , 4: "星期五" , 5: "星期六" , 6: "星期天" ,} for record in self: weekday_ = record[ 'x_date' ].weekday() if weekday_ in weekday_map: record[ 'x_zhou_ji' ] = weekday_map.get(weekday_) # 该规则写在规则中心 # 校验考勤日期 attend_items = self.env[ 'bp' ].query_status(self.env[ 'x_builder_intern_attend_item' ], status=[ 'waiting' , 'done' ]).mapped( 'x_date' ) if self.x_attendance_item_ids: for attendance in self.x_attendance_item_ids: if attendance.x_date in attend_items: raise ValidationError( "考勤日期与已有考勤明细单据重复!" )

      易应用父子表单需求
      1、父表单:自动计算出子表单"出勤时长(天)"的合计值,并显示到"总出勤天数"中
      2、子表单:
      (1)根据"出勤日期"自动带出当天是"星期几"
      (2)提交时校验该员工本次提交单子中的"出勤日期"与"已审批完成"、"审批中"单子的"出勤日期"是否有重复,如果有,提示出哪几天重复,并阻止提交。

      父表单模型:x_builder_intern_attendance
      子表单模型:x_builder_intern_attend_item

            chengdd 程丹丹
            yumch 于明朝
            表决:
            0 为这个问题表决

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