pengyuthon wechat
This commit is contained in:
@@ -57,10 +57,11 @@ class HolidaysRequestBatch(models.Model):
|
||||
days = fields.Float(string='天数')
|
||||
hours = fields.Float(string='小时')
|
||||
text = fields.Html(string='申请事由')
|
||||
leave_line_ids = fields.One2many('hr.leave.line', 'leave_batch_id', string="关联请假详情明细行")
|
||||
leave_line_ids = fields.One2many('hr.leave.line', 'leave_batch_id', string="关联请假详情明细行", domain=[('leave_unit', '=', 'day')])
|
||||
hour_leave_line_ids = fields.One2many('hr.leave.line', 'leave_batch_id', string="关联请假详情明细行", domain=[('leave_unit', '=', 'hour')])
|
||||
|
||||
is_issues = fields.Boolean(string='是否上会')
|
||||
leave_by_hour = fields.Boolean(string='按小时请假', default=True)
|
||||
leave_unit = fields.Selection(string='时长单位', selection=[('day', '天'), ('hour', '小时')])
|
||||
leave_by_hour = fields.Boolean(string='按小时请假', default=False)
|
||||
|
||||
# @api.constrains('leave_line_ids')
|
||||
# def _check_leave_line_ids(self):
|
||||
@@ -70,8 +71,7 @@ class HolidaysRequestBatch(models.Model):
|
||||
|
||||
@api.onchange('leave_by_hour')
|
||||
def _onchange_leave_by_hour(self):
|
||||
self.leave_unit = 'day'
|
||||
self.leave_line_ids = None
|
||||
self.hour_leave_line_ids = None
|
||||
|
||||
# 提交
|
||||
def action_submit(self):
|
||||
@@ -131,7 +131,7 @@ class HrLeaveLine(models.Model):
|
||||
start_hour_from = fields.Selection(string="开始时间", selection=HOUR_SELECTION, default='9')
|
||||
end_time = fields.Date(string="结束日期", required=True)
|
||||
end_hour_from = fields.Selection(string="结束时间", selection=HOUR_SELECTION)
|
||||
leave_unit = fields.Selection(string="单位", related='leave_batch_id.leave_unit')
|
||||
leave_unit = fields.Selection(string="单位", selection=[('day', '天'), ('hour', '小时')], required=True)
|
||||
custom_document_ids = fields.Many2many(
|
||||
string='文件',
|
||||
comodel_name='ir.attachment',
|
||||
|
||||
@@ -44,48 +44,78 @@
|
||||
<group>
|
||||
<field name="employee_id" invisible="1" force_save="1"/>
|
||||
<field name="department_id"/>
|
||||
<field name="leave_by_hour" invisible="1" force_save="1"/>
|
||||
<field name="leave_unit" invisible="1" force_save="1"/>
|
||||
<field name="leave_by_hour" force_save="1"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="is_issues" invisible="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="请假详情">
|
||||
<field name="leave_line_ids">
|
||||
<tree editable="bottom">
|
||||
<field name="leave_batch_id" column_invisible="1"/>
|
||||
<field name="employee_id" column_invisible="1"/>
|
||||
<field name="leave_type_id"
|
||||
force_save="1"
|
||||
domain="[
|
||||
('request_unit', '=', leave_unit),
|
||||
'|',
|
||||
('requires_allocation', '=', 'no'),
|
||||
'&',
|
||||
('has_valid_allocation', '=', True),
|
||||
'|',
|
||||
('allows_negative', '=', True),
|
||||
'&',
|
||||
('virtual_remaining_leaves', '>', 0),
|
||||
('allows_negative', '=', False),
|
||||
]"
|
||||
context="{'employee_id': employee_id, 'default_date_from': start_time, 'default_date_to': end_time}"
|
||||
options="{'no_create': True, 'no_open': True, 'request_type': 'leave'}"
|
||||
/>
|
||||
<field name="duration_leave" sum = "Total"/>
|
||||
<field name="start_time"/>
|
||||
<field name="start_hour_from" column_invisible="not parent.leave_by_hour" required="parent.leave_by_hour"/>
|
||||
<field name="end_time"/>
|
||||
<field name="end_hour_from" column_invisible="not parent.leave_by_hour" required="parent.leave_by_hour"/>
|
||||
<field name="leave_unit" column_invisible="1"/>
|
||||
<field name="leave_documents_ids" widget="preview_many2many" options="{'preview_type': 'button', 'preview_string': '查看详情'}"/>
|
||||
<field name="custom_document_ids" widget="preview_many2many" options="{'show_select_btn': false}"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
<div>
|
||||
<label for="leave_line_ids" string="按天请假"/>
|
||||
<field name="leave_line_ids" nolabel="1" context="{'default_leave_unit': 'day'}">
|
||||
<tree editable="bottom">
|
||||
<field name="leave_batch_id" column_invisible="1"/>
|
||||
<field name="employee_id" column_invisible="1"/>
|
||||
<field name="leave_type_id"
|
||||
force_save="1"
|
||||
domain="[
|
||||
('request_unit', '=', leave_unit),
|
||||
'|',
|
||||
('requires_allocation', '=', 'no'),
|
||||
'&',
|
||||
('has_valid_allocation', '=', True),
|
||||
'|',
|
||||
('allows_negative', '=', True),
|
||||
'&',
|
||||
('virtual_remaining_leaves', '>', 0),
|
||||
('allows_negative', '=', False),
|
||||
]"
|
||||
context="{'employee_id': employee_id, 'default_date_from': start_time, 'default_date_to': end_time}"
|
||||
options="{'no_create': True, 'no_open': True, 'request_type': 'leave'}"
|
||||
/>
|
||||
<field name="duration_leave"/>
|
||||
<field name="start_time"/>
|
||||
<field name="end_time"/>
|
||||
<field name="leave_unit" column_invisible="1" force_save="1"/>
|
||||
<field name="leave_documents_ids" widget="preview_many2many" options="{'preview_type': 'button', 'preview_string': '查看详情'}"/>
|
||||
<field name="custom_document_ids" widget="preview_many2many" options="{'show_select_btn': false}"/>
|
||||
</tree>
|
||||
</field>
|
||||
</div>
|
||||
<div invisible="leave_by_hour == False">
|
||||
<label for="hour_leave_line_ids" string="按小时请假"/>
|
||||
<field name="hour_leave_line_ids" nolabel="1" context="{'default_leave_unit': 'hour'}">
|
||||
<tree editable="bottom">
|
||||
<field name="leave_batch_id" column_invisible="1"/>
|
||||
<field name="employee_id" column_invisible="1"/>
|
||||
<field name="leave_type_id"
|
||||
force_save="1"
|
||||
domain="[
|
||||
('request_unit', '=', leave_unit),
|
||||
'|',
|
||||
('requires_allocation', '=', 'no'),
|
||||
'&',
|
||||
('has_valid_allocation', '=', True),
|
||||
'|',
|
||||
('allows_negative', '=', True),
|
||||
'&',
|
||||
('virtual_remaining_leaves', '>', 0),
|
||||
('allows_negative', '=', False),
|
||||
]"
|
||||
context="{'employee_id': employee_id, 'default_date_from': start_time, 'default_date_to': end_time}"
|
||||
options="{'no_create': True, 'no_open': True, 'request_type': 'leave'}"
|
||||
/>
|
||||
<field name="duration_leave"/>
|
||||
<field name="start_time"/>
|
||||
<field name="start_hour_from" required="1"/>
|
||||
<field name="end_time"/>
|
||||
<field name="end_hour_from" required="1"/>
|
||||
<field name="leave_unit" column_invisible="1" force_save="1"/>
|
||||
<field name="leave_documents_ids" widget="preview_many2many" options="{'preview_type': 'button', 'preview_string': '查看详情'}"/>
|
||||
<field name="custom_document_ids" widget="preview_many2many" options="{'show_select_btn': false}"/>
|
||||
</tree>
|
||||
</field>
|
||||
</div>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
@@ -245,12 +245,12 @@ class HrAttendance(models.Model):
|
||||
if datetime.now() <= will_datetime_end:
|
||||
self.card_out_comment(employee_id)
|
||||
|
||||
def card_in_comment(self,employee_id):
|
||||
def card_in_comment(self, employee_id):
|
||||
self.ensure_one()
|
||||
data = "您还有10分钟上班,记得打卡"
|
||||
self.sudo().env["wecom.apps"].sync_send_message(employee_id.wecom_userid, data)
|
||||
|
||||
def card_out_comment(self,employee_id):
|
||||
def card_out_comment(self, employee_id):
|
||||
self.ensure_one()
|
||||
data = "下班时间到了,记得打卡"
|
||||
self.sudo().env["wecom.apps"].sync_send_message(employee_id.wecom_userid, data)
|
||||
@@ -311,3 +311,20 @@ class HrAttendance(models.Model):
|
||||
self.card_in_comment(resource.employee_id)
|
||||
elif datetime.now() >= today_slots_id.end_datetime+timedelta(hours=8):
|
||||
self.card_out_comment(resource.employee_id)
|
||||
def button_correct_approval(self):
|
||||
for record in self:
|
||||
year = record.current_data.year
|
||||
month = record.current_data.month
|
||||
day = record.current_data.day
|
||||
current_date = datetime.today()
|
||||
min_hour_from = record.employee_id.resource_id.calendar_id.attendance_ids[0].hour_from
|
||||
min_hour = int(min_hour_from)
|
||||
min_minute = int(min_hour_from * 10 % min_hour_from)
|
||||
will_datetime_start = current_date.replace(year=year, month=month, day=day, hour=min_hour, minute=min_minute) - timedelta(hours=8)
|
||||
record.write({'check_in': will_datetime_start, 'is_approval': True})
|
||||
max_hour_to = record.employee_id.resource_id.calendar_id.attendance_ids[-1].hour_to
|
||||
max_hour = int(max_hour_to)
|
||||
max_minute = int(max_hour_to * 10 % max_hour_to)
|
||||
will_datetime_end = current_date.replace(year=year, month=month, day=day, hour=max_hour, minute=max_minute) - timedelta(hours=8)
|
||||
record.write({'check_out': will_datetime_end, 'is_approval': True})
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
invisible="not is_abnormal"/>
|
||||
<button name="button_duty_approval" type="object" string="外出" class="oe_highlight"
|
||||
invisible="not is_abnormal"/>
|
||||
<button name="button_correct_approval" type="object" string="修正" class="oe_highlight"
|
||||
invisible="not is_abnormal"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -51,6 +53,8 @@
|
||||
invisible="not is_abnormal"/>
|
||||
<button name="button_duty_approval" type="object" string="外出" class="oe_highlight"
|
||||
invisible="not is_abnormal"/>
|
||||
<button name="button_correct_approval" type="object" string="修正" class="oe_highlight"
|
||||
invisible="not is_abnormal"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -24,8 +24,8 @@ class YuthonProperty(models.Model):
|
||||
vr_link = fields.Char(string="VR链接")
|
||||
notice_documents_ids = fields.Many2many('ir.attachment', string='议题附件')
|
||||
current_rent = fields.Float(string="现租金")
|
||||
is_merge = fields.Boolean(string="是否可合并")
|
||||
is_split = fields.Boolean(string="是否可拆分")
|
||||
is_merge = fields.Boolean(string="可合并")
|
||||
is_split = fields.Boolean(string="可拆分")
|
||||
is_done_split = fields.Boolean(string="已拆分")
|
||||
is_done_merge = fields.Boolean(string="已合并")
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
<field name="name">property.meter.archives.tree</field>
|
||||
<field name="model">property.meter.archives</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="仪表档案">
|
||||
<field name="gauge_type"/>
|
||||
<tree string="电表库">
|
||||
<field name="name"/>
|
||||
<field name="device_number"/>
|
||||
<field name="gauge_model"/>
|
||||
<field name="gauge_magnification"/>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<field name="model">property.meter.water</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="仪表档案">
|
||||
<field name="gauge_type"/>
|
||||
<field name="name"/>
|
||||
<field name="device_number"/>
|
||||
<field name="gauge_model"/>
|
||||
<field name="gauge_magnification"/>
|
||||
|
||||
Reference in New Issue
Block a user