@@ -58,7 +58,7 @@
|
||||
<filter string="状态" name="group_soong_state" context="{'group_by':'soong_state'}"/>
|
||||
</group>
|
||||
<header_search>
|
||||
<field name="workflow_id"/>
|
||||
<field name="workflow_id" string="审批类型"/>
|
||||
<field name="name"/>
|
||||
<field name="code"/>
|
||||
</header_search>
|
||||
|
||||
@@ -642,32 +642,33 @@ class HolidaysRequestBatch(models.Model):
|
||||
@api.constrains('is_day', 'is_hour', 'leave_ids', 'hour_leave_ids')
|
||||
def _check_leave_type_and_details(self):
|
||||
"""检查请假类型和明细行是否符合要求"""
|
||||
VALID_DAILY_HOURS = [2, 4, 6, 8]
|
||||
for record in self:
|
||||
if not record.is_day and not record.is_hour:
|
||||
raise ValidationError(_("请选择按天请假或按小时请假!"))
|
||||
if not record.leave_ids and not record.hour_leave_ids:
|
||||
raise ValidationError(_("请至少添加一条按天或按小时的请假记录!"))
|
||||
if record.leave_ids and not record.is_day:
|
||||
raise ValidationError(_("添加了按天请假记录,必须选择'按天请假'选项!"))
|
||||
raise ValidationError(_("添加了按天请假记录,必须选择'按天请假'选项!"))
|
||||
if record.hour_leave_ids and not record.is_hour:
|
||||
raise ValidationError(_("添加了按小时请假记录,必须选择'按小时请假'选项!"))
|
||||
if record.hour_leave_ids and not record.leave_ids:
|
||||
number_hours = 0
|
||||
if record.hour_leave_ids and record.company_id.name == '天河物管':
|
||||
for line in record.hour_leave_ids:
|
||||
if line.request_date_from and line.request_hour_to:
|
||||
# 使用正则表达式提取小时数
|
||||
match = re.search(r'(\d+(?:\.\d+)?)', line.number_of_hours_text or '')
|
||||
if match and float(match.group(1)) == 0:
|
||||
raise ValidationError(_("请假小时数不能为0!"))
|
||||
if record.company_id.name == '天河物管':
|
||||
match = re.search(r'(\d+(?:\.\d+)?)', line.number_of_hours_text or '')
|
||||
if match:
|
||||
number_hours += float(match.group(1))
|
||||
# 天河物管的总小时数验证
|
||||
if record.company_id.name == '天河物管' and number_hours:
|
||||
valid_hours = [2, 4, 6, 8]
|
||||
if number_hours not in valid_hours:
|
||||
raise ValidationError(_("休假时长必须为 2、4、6 或 8 小时才可以保存!"))
|
||||
if not line.request_date_from or not line.request_hour_to:
|
||||
continue
|
||||
match = re.search(r'(\d+(?:\.\d+)?)', line.number_of_hours_text or '')
|
||||
if not match:
|
||||
raise ValidationError(
|
||||
_(f"第{line.sequence or '一'}条小时请假记录:无法提取有效小时数!"))
|
||||
daily_hours = float(match.group(1))
|
||||
if daily_hours == 0.0:
|
||||
raise ValidationError(
|
||||
_(f"第{line.sequence or '一'}条小时请假记录:请假小时数不能为0!"))
|
||||
|
||||
if daily_hours not in VALID_DAILY_HOURS:
|
||||
raise ValidationError(
|
||||
_(f"第{line.sequence or '一'}条小时请假记录:休假时长必须为 2、4、6 或 8 小时才可以保存!")
|
||||
)
|
||||
|
||||
@api.onchange('leave_ids', 'hour_leave_ids', 'employee_id')
|
||||
def _onchange_leave_dates(self):
|
||||
|
||||
@@ -20,7 +20,6 @@ class ContractReviewApproval(models.Model):
|
||||
[('fixed', '固定资产'), ('low', '低值易耗'), ('service', '服务'), ('day', '日常消耗品')],
|
||||
string="采购类型", required=True, default='fixed')
|
||||
|
||||
documents_ids = fields.Many2many('ir.attachment', string="附件")
|
||||
urgency_level = fields.Selection([('normal', '普件'), ('urgent', '急件'), ('emergency', '特急件')], string='紧急度',
|
||||
default='normal')
|
||||
active = fields.Boolean('Active', default=True, tracking=True)
|
||||
@@ -28,6 +27,21 @@ class ContractReviewApproval(models.Model):
|
||||
contract_type = fields.Many2one('yuthon.contract.type', string="合同类型")
|
||||
formation_method = fields.Many2one('yuthon.contract.type', string="形成方式")
|
||||
|
||||
documents_ids = fields.Many2many(
|
||||
'ir.attachment',
|
||||
string="附件",
|
||||
relation='soong_contract_ir_attachment_documents_rel',
|
||||
column1='soong_contract_id',
|
||||
column2='attachment_document_id',
|
||||
)
|
||||
lawyer_opinion_ids = fields.Many2many(
|
||||
'ir.attachment',
|
||||
string="律师意见",
|
||||
relation='soong_contract_ir_attachment_lawyer_opinion_rel',
|
||||
column1='soong_contract_id',
|
||||
column2='attachment_lawyer_opinion_id',
|
||||
)
|
||||
|
||||
def _get_default_name_title(self):
|
||||
return self._description if self._description else self._name
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
<group string="审批信息" col="2">
|
||||
<group>
|
||||
<field name="name" required="1"/>
|
||||
<field name="is_back" invisible="1"/>
|
||||
<field name="work_end" invisible="1"/>
|
||||
<field name="user_id" invisible="1"/>
|
||||
<field name="department_id"/>
|
||||
@@ -58,6 +59,7 @@
|
||||
<group>
|
||||
<field name="remarks"/>
|
||||
<field name="documents_ids" widget="preview_many2many"/>
|
||||
<field name="lawyer_opinion_ids" widget="preview_many2many"/>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user