添加功能
This commit is contained in:
@@ -62,7 +62,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<tree string="流程查询" action="open_record" type="object"
|
||||
decoration-danger="approve_state == 'end'"
|
||||
create="false" default_order="write_date2 desc" expand="1">
|
||||
create="false" default_order="write_date2 desc, id desc" expand="1">
|
||||
<header>
|
||||
<button name="admin_end" type="object" string="管理员强制结束" class="oe_highlight"/>
|
||||
</header>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<field name="model">hr.attendance</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="出勤"
|
||||
edit="false" delete="false" create="false"
|
||||
edit="false" delete="false" create="false" duplicate="false"
|
||||
decoration-danger="is_workflow or is_approval"
|
||||
editable="bottom">
|
||||
<header>
|
||||
@@ -51,7 +51,7 @@
|
||||
<field name="model">hr.attendance</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="出勤"
|
||||
edit="false" delete="false" create="false"
|
||||
edit="false" delete="false" create="false" duplicate="false"
|
||||
editable="bottom" default_order="current_data desc">
|
||||
<!-- <header>-->
|
||||
<!-- <button name="compute_company_id" string="公司更新" type="object" class="btn btn-primary"/>-->
|
||||
|
||||
@@ -216,6 +216,26 @@ class YuthonHrEmployee(models.Model):
|
||||
security_amount = fields.Float(string="安全委员会金额", compute='_compute_subsidy_amount', store=True)
|
||||
quality_inspector_amount = fields.Float(string="质检员金额", compute='_compute_subsidy_amount', store=True)
|
||||
|
||||
# 请假记录
|
||||
done_leave = fields.Float(string='年假')
|
||||
done_working_overtime = fields.Float(string='加班时')
|
||||
compensatory_leave = fields.Integer(string="调休")
|
||||
leave_of_absence = fields.Float(string="事假")
|
||||
statutory_leave = fields.Integer(string="加班时(法定)")
|
||||
cop_leave = fields.Float(string='补休')
|
||||
duty_off_leave = fields.Integer(string='值班调休')
|
||||
marriage_leave = fields.Integer(string='婚假')
|
||||
maternity_leave = fields.Integer(string='产假')
|
||||
paternity_leave = fields.Integer(string='陪产假')
|
||||
family_planning_leave = fields.Integer(string='计生假')
|
||||
bereavement_leave = fields.Float(string='丧假')
|
||||
home_visit_leave = fields.Integer(string='探亲假')
|
||||
parents_meeting_leave = fields.Integer(string='家长会假')
|
||||
general_sick_leave = fields.Float(string='病假(普通)')
|
||||
hospital_sick_leave = fields.Float(string='病假(住院期)')
|
||||
recovery_sick_leave = fields.Float(string='病假(出院恢复期)')
|
||||
exam_leave = fields.Integer(string='考试假')
|
||||
|
||||
def get_my_employee_action(self):
|
||||
current_user = self.env.user
|
||||
my_employee = self.search([('user_id', '=', current_user.id)], limit=1)
|
||||
|
||||
@@ -12,7 +12,7 @@ class IssueLibrary(models.Model):
|
||||
name = fields.Char(string='议题名称')
|
||||
name_text = fields.Text(string='议题名称', compute='_compute_name', readonly=False)
|
||||
depart_opinions = fields.Text(string='部门意见')
|
||||
topic_content = fields.Text(string='议题内容')
|
||||
topic_content = fields.Text(string='议题详细描述')
|
||||
will_based = fields.Text(string='上会依据')
|
||||
code = fields.Char(string='编号', required=True, copy=False,
|
||||
default=lambda self: self.env['ir.sequence'].next_by_code('issue_library_code'))
|
||||
|
||||
@@ -66,11 +66,11 @@
|
||||
<field name="name" required="1" force_save="1"/>
|
||||
<field name="name_text" invisible="1"/>
|
||||
<field name="work_end" invisible="1"/>
|
||||
<field name="code"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
<field name="approval_decision_sequence" invisible="1"/>
|
||||
<field name="creart_datetime" invisible="1"/>
|
||||
<field name="topic_content"/>
|
||||
<field name="documents_ids" widget="preview_many2many"/>
|
||||
<field name="creart_datetime"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="employee_id" invisible="1"/>
|
||||
@@ -235,11 +235,14 @@
|
||||
</group>
|
||||
<group>
|
||||
<group>
|
||||
<field name="name" required="1"/>
|
||||
<field name="approval_decision_sequence" invisible="1"/>
|
||||
<field name="name" required="1" force_save="1"/>
|
||||
<field name="name_text" invisible="1"/>
|
||||
<field name="work_end" invisible="1"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
<field name="approval_decision_sequence" invisible="1"/>
|
||||
<field name="creart_datetime" invisible="1"/>
|
||||
<field name="topic_content"/>
|
||||
<field name="documents_ids" widget="preview_many2many"/>
|
||||
<field name="creart_datetime"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="employee_id" invisible="1"/>
|
||||
@@ -383,12 +386,14 @@
|
||||
</group>
|
||||
<group>
|
||||
<group>
|
||||
<field name="name" required="1"/>
|
||||
<field name="name" required="1" force_save="1"/>
|
||||
<field name="name_text" invisible="1"/>
|
||||
<field name="approval_decision_sequence" invisible="1"/>
|
||||
<field name="work_end" invisible="1"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
<field name="approval_decision_sequence" invisible="1"/>
|
||||
<field name="creart_datetime" invisible="1"/>
|
||||
<field name="topic_content"/>
|
||||
<field name="documents_ids" widget="preview_many2many"/>
|
||||
<field name="creart_datetime"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="employee_id" invisible="1"/>
|
||||
@@ -520,11 +525,14 @@
|
||||
</group>
|
||||
<group>
|
||||
<group>
|
||||
<field name="name" required="1"/>
|
||||
<field name="approval_decision_sequence" invisible="1"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
<field name="documents_ids" widget="preview_many2many"/>
|
||||
<field name="creart_datetime"/>
|
||||
<field name="name" required="1" force_save="1"/>
|
||||
<field name="name_text" invisible="1"/>
|
||||
<field name="work_end" invisible="1"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
<field name="approval_decision_sequence" invisible="1"/>
|
||||
<field name="creart_datetime" invisible="1"/>
|
||||
<field name="topic_content"/>
|
||||
<field name="documents_ids" widget="preview_many2many"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="employee_id" invisible="1"/>
|
||||
|
||||
@@ -307,134 +307,145 @@ class PropertyReconciliationWizard(models.Model):
|
||||
('bank', '=', rec.bank_id.name),
|
||||
('tenant_id.name', '!=', False)
|
||||
])
|
||||
if bank_lines:
|
||||
if rec.actual_total > rec.receivable_total:
|
||||
rec.bank_id.registered = rec.actual_total - rec.receivable_total
|
||||
rec.bank_id.bank_state = 'registered'
|
||||
else:
|
||||
rec.bank_id.registered = 0
|
||||
rec.bank_id.bank_state = 'reconciled'
|
||||
rec.reconciliation_time = fields.Datetime.now() - timedelta(hours=8),
|
||||
first_line = bank_lines[0]
|
||||
for line in rec.reconciliation_line_ids:
|
||||
# 跳过金额为0的行
|
||||
if (line.amount == 0 and line.collection_type != 'penalty') or \
|
||||
(line.contract_id and line.contract_id.is_split):
|
||||
continue
|
||||
if line.amount != line.rent:
|
||||
if not line.remake:
|
||||
raise UserError(_(
|
||||
"错误:物业 '%s' 的对账明细行金额与租金不符,备注信息为必填项,请填写备注后再试。"
|
||||
) % line.property_id.name)
|
||||
line_date = fields.Date.from_string(line.due_date)
|
||||
rec_date = fields.Date.from_string(rec.actual_date)
|
||||
if (line_date.year, line_date.month) != (rec_date.year, rec_date.month):
|
||||
if not line.remake:
|
||||
raise UserError(_(
|
||||
"错误:物业 '%s' 的对账明细行月份与对账月份不符,备注信息为必填项,请填写备注后再试。"
|
||||
) % line.property_id.name)
|
||||
first_day = line.due_date.replace(day=1)
|
||||
last_day = (first_day + relativedelta(months=1)) - relativedelta(days=1)
|
||||
domain = [
|
||||
('management_type_id.name', '!=', '违约金'),
|
||||
if not bank_lines:
|
||||
information = self.env['property.tenant.information'].search(
|
||||
[('name', '=', rec.name_account)],
|
||||
limit=1)
|
||||
if information:
|
||||
bank_lines = self.env['property.bank.line'].create({
|
||||
'tenant_id': information.id,
|
||||
'bank': rec.name,
|
||||
'user': information.name,
|
||||
'name': rec.name,
|
||||
})
|
||||
|
||||
if rec.actual_total > rec.receivable_total:
|
||||
rec.bank_id.registered = rec.actual_total - rec.receivable_total
|
||||
rec.bank_id.bank_state = 'registered'
|
||||
else:
|
||||
rec.bank_id.registered = 0
|
||||
rec.bank_id.bank_state = 'reconciled'
|
||||
rec.reconciliation_time = fields.Datetime.now() - timedelta(hours=8),
|
||||
first_line = bank_lines[0]
|
||||
for line in rec.reconciliation_line_ids:
|
||||
# 跳过金额为0的行
|
||||
if (line.amount == 0 and line.collection_type != 'penalty') or \
|
||||
(line.contract_id and line.contract_id.is_split):
|
||||
continue
|
||||
if line.amount != line.rent:
|
||||
if not line.remake:
|
||||
raise UserError(_(
|
||||
"错误:物业 '%s' 的对账明细行金额与租金不符,备注信息为必填项,请填写备注后再试。"
|
||||
) % line.property_id.name)
|
||||
line_date = fields.Date.from_string(line.due_date)
|
||||
rec_date = fields.Date.from_string(rec.actual_date)
|
||||
if (line_date.year, line_date.month) != (rec_date.year, rec_date.month):
|
||||
if not line.remake:
|
||||
raise UserError(_(
|
||||
"错误:物业 '%s' 的对账明细行月份与对账月份不符,备注信息为必填项,请填写备注后再试。"
|
||||
) % line.property_id.name)
|
||||
first_day = line.due_date.replace(day=1)
|
||||
last_day = (first_day + relativedelta(months=1)) - relativedelta(days=1)
|
||||
domain = [
|
||||
('management_type_id.name', '!=', '违约金'),
|
||||
('lessee_id', '=', first_line.tenant_id.id),
|
||||
('is_reconciliation', '=', False),
|
||||
('is_suspend', '=', False),
|
||||
('due_date', '>=', first_day),
|
||||
('due_date', '<=', last_day),
|
||||
]
|
||||
# 如果有物业信息
|
||||
if line.property_id:
|
||||
domain.append(('property_id', '=', line.property_id.id))
|
||||
if line.contract_id:
|
||||
domain.append(('contract_id', '=', line.contract_id.id))
|
||||
receivable_ids = self.env['property.accounts.receivable'].search(domain)
|
||||
for receivable in receivable_ids:
|
||||
if line.rent == line.amount:
|
||||
is_reconciliation = True
|
||||
else:
|
||||
is_reconciliation = False
|
||||
if line.collection_type != 'penalty':
|
||||
receivable.write({
|
||||
'is_reconciliation': is_reconciliation,
|
||||
'delivered1': line.amount,
|
||||
'payout_date': rec.actual_date if line.rent == line.amount else None,
|
||||
'remark': line.remake,
|
||||
'reconciliation_time': fields.Datetime.now(),
|
||||
'receivable_log': f'当前登录人{rec.env.user.name}于{fields.Datetime.now()}对户名为{rec.bank_id.name_account}进行对账操作,对账应收金额为{rec.receivable_total},实际金额为{rec.actual_total}'
|
||||
})
|
||||
management_type_id = self.env['yuthon.management.type'].search([('name', '=', '违约金')])
|
||||
if line.collection_type == 'penalty':
|
||||
# 用备注的的开始日期和结束日期
|
||||
date_pattern = r'(\d{4}-\d{2}-\d{2})[至-](\d{4}-\d{2}-\d{2})'
|
||||
date_match = re.search(date_pattern, line.remake or '')
|
||||
extract_start_date = date_match.group(1) if date_match else line.due_date
|
||||
extract_end_date = date_match.group(2) if date_match else None
|
||||
check_domain = [
|
||||
('due_date', '=', extract_start_date),
|
||||
('property_id', '=', line.property_id.id),
|
||||
('contract_id', '=', line.contract_id.id),
|
||||
('management_type_id', '=', management_type_id.id),
|
||||
('lessee_id', '=', first_line.tenant_id.id),
|
||||
('is_reconciliation', '=', False),
|
||||
('is_suspend', '=', False),
|
||||
('due_date', '>=', first_day),
|
||||
('due_date', '<=', last_day),
|
||||
]
|
||||
# 如果有物业信息
|
||||
if line.property_id:
|
||||
domain.append(('property_id', '=', line.property_id.id))
|
||||
if line.contract_id:
|
||||
domain.append(('contract_id', '=', line.contract_id.id))
|
||||
receivable_ids = self.env['property.accounts.receivable'].search(domain)
|
||||
for receivable in receivable_ids:
|
||||
if line.rent == line.amount:
|
||||
is_reconciliation = True
|
||||
else:
|
||||
is_reconciliation = False
|
||||
if line.collection_type != 'penalty':
|
||||
receivable.write({
|
||||
'is_reconciliation': is_reconciliation,
|
||||
'delivered1': line.amount,
|
||||
'payout_date': rec.actual_date if line.rent == line.amount else None,
|
||||
'remark': line.remake,
|
||||
'reconciliation_time': fields.Datetime.now(),
|
||||
'receivable_log': f'当前登录人{rec.env.user.name}于{fields.Datetime.now()}对户名为{rec.bank_id.name_account}进行对账操作,对账应收金额为{rec.receivable_total},实际金额为{rec.actual_total}'
|
||||
})
|
||||
management_type_id = self.env['yuthon.management.type'].search([('name', '=', '违约金')])
|
||||
if line.collection_type == 'penalty':
|
||||
# 用备注的的开始日期和结束日期
|
||||
date_pattern = r'(\d{4}-\d{2}-\d{2})[至-](\d{4}-\d{2}-\d{2})'
|
||||
date_match = re.search(date_pattern, line.remake or '')
|
||||
extract_start_date = date_match.group(1) if date_match else line.due_date
|
||||
extract_end_date = date_match.group(2) if date_match else None
|
||||
check_domain = [
|
||||
('due_date', '=', extract_start_date),
|
||||
# 检查是否已有相同记录
|
||||
existing_record = self.env['property.accounts.receivable'].search(check_domain)
|
||||
is_reconciliation = line.amount == round(line.rent, 2)
|
||||
|
||||
if not existing_record:
|
||||
domain2 = [
|
||||
('due_date', '=', line.due_date),
|
||||
('property_id', '=', line.property_id.id),
|
||||
('contract_id', '=', line.contract_id.id),
|
||||
('management_type_id', '=', management_type_id.id),
|
||||
('lessee_id', '=', first_line.tenant_id.id),
|
||||
('collection_type', '=', 'rent'),
|
||||
]
|
||||
# 检查是否已有相同记录
|
||||
existing_record = self.env['property.accounts.receivable'].search(check_domain)
|
||||
is_reconciliation = line.amount == round(line.rent, 2)
|
||||
reconciliation_id = self.env['property.reconciliation.line'].search(domain2, limit=1)
|
||||
receivable_id = self.env['property.accounts.receivable'].create({
|
||||
'is_reconciliation': is_reconciliation,
|
||||
'due_date': extract_start_date,
|
||||
'due_date_end': extract_end_date,
|
||||
'penalty': reconciliation_id.rent,
|
||||
'management_type_id': management_type_id.id,
|
||||
'lessee_id': first_line.tenant_id.id,
|
||||
'property_id': line.property_id.id,
|
||||
'contract_id': line.contract_id.id,
|
||||
'delivered1': line.amount,
|
||||
'payout_date': rec.actual_date if (line.rent == line.amount and line.rent != 0) else None,
|
||||
'original_amount': line.rent,
|
||||
'remark': line.remake,
|
||||
'reconciliation_time': fields.Datetime.now(),
|
||||
})
|
||||
rec.bank_id.write({
|
||||
'create_receivable_ids': [(4, receivable_id.id)]
|
||||
})
|
||||
# if receivable_id:
|
||||
# rec.bank_id.write({
|
||||
# 'create_receivable_ids': [(4, receivable_id.id)]
|
||||
# })
|
||||
else:
|
||||
existing_record.write({
|
||||
'delivered1': existing_record.delivered1 + line.amount,
|
||||
'due_date_end': extract_end_date,
|
||||
'is_reconciliation': is_reconciliation,
|
||||
'payout_date': rec.actual_date if (line.rent == line.amount and line.rent != 0) else None,
|
||||
'remark': line.remake,
|
||||
'bank_id': rec.bank_id.id if line.amount != 0 else None,
|
||||
'is_write': True if line.amount != 0 else None,
|
||||
'reconciliation_time': fields.Datetime.now(),
|
||||
})
|
||||
# rec.bank_id.write({
|
||||
# 'write_receivable_ids': [(4, existing_record.id)]
|
||||
# })
|
||||
|
||||
if not existing_record:
|
||||
domain2 = [
|
||||
('due_date', '=', line.due_date),
|
||||
('property_id', '=', line.property_id.id),
|
||||
('contract_id', '=', line.contract_id.id),
|
||||
('collection_type', '=', 'rent'),
|
||||
]
|
||||
reconciliation_id = self.env['property.reconciliation.line'].search(domain2, limit=1)
|
||||
receivable_id = self.env['property.accounts.receivable'].create({
|
||||
'is_reconciliation': is_reconciliation,
|
||||
'due_date': extract_start_date,
|
||||
'due_date_end': extract_end_date,
|
||||
'penalty': reconciliation_id.rent,
|
||||
'management_type_id': management_type_id.id,
|
||||
'lessee_id': first_line.tenant_id.id,
|
||||
'property_id': line.property_id.id,
|
||||
'contract_id': line.contract_id.id,
|
||||
'delivered1': line.amount,
|
||||
'payout_date': rec.actual_date if (line.rent == line.amount and line.rent != 0) else None,
|
||||
'original_amount': line.rent,
|
||||
'remark': line.remake,
|
||||
'reconciliation_time': fields.Datetime.now(),
|
||||
})
|
||||
rec.bank_id.write({
|
||||
'create_receivable_ids': [(4, receivable_id.id)]
|
||||
})
|
||||
# if receivable_id:
|
||||
# rec.bank_id.write({
|
||||
# 'create_receivable_ids': [(4, receivable_id.id)]
|
||||
# })
|
||||
else:
|
||||
existing_record.write({
|
||||
'delivered1': existing_record.delivered1 + line.amount,
|
||||
'due_date_end': extract_end_date,
|
||||
'is_reconciliation': is_reconciliation,
|
||||
'payout_date': rec.actual_date if (line.rent == line.amount and line.rent != 0) else None,
|
||||
'remark': line.remake,
|
||||
'bank_id': rec.bank_id.id if line.amount != 0 else None,
|
||||
'is_write': True if line.amount != 0 else None,
|
||||
'reconciliation_time': fields.Datetime.now(),
|
||||
})
|
||||
# rec.bank_id.write({
|
||||
# 'write_receivable_ids': [(4, existing_record.id)]
|
||||
# })
|
||||
# 计算已对账和未对账金额
|
||||
rec.amount_been_reconciled += line.amount
|
||||
|
||||
# 计算已对账和未对账金额
|
||||
rec.amount_been_reconciled += line.amount
|
||||
|
||||
if rec.actual_total > rec.amount_been_reconciled:
|
||||
amount_reconciled = rec.actual_total - rec.amount_been_reconciled
|
||||
else:
|
||||
amount_reconciled = 0.0
|
||||
rec.bank_id.yes_amount = rec.amount_been_reconciled
|
||||
rec.bank_id.no_amount = amount_reconciled
|
||||
if rec.actual_total > rec.amount_been_reconciled:
|
||||
amount_reconciled = rec.actual_total - rec.amount_been_reconciled
|
||||
else:
|
||||
amount_reconciled = 0.0
|
||||
rec.bank_id.yes_amount = rec.amount_been_reconciled
|
||||
rec.bank_id.no_amount = amount_reconciled
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -97,6 +97,53 @@ class SalaryComputeWizard(models.Model):
|
||||
'state': 'draft',
|
||||
'payslip_count': 0
|
||||
})
|
||||
query_date = datetime(year, month, 1).date()
|
||||
|
||||
vacation_report = self.env['yuthon.vacation.reports'].search([
|
||||
('employee_id', '=', employee.id),
|
||||
('vacation_date', '=', query_date)
|
||||
], limit=1)
|
||||
if vacation_report:
|
||||
update_vals = {
|
||||
# 年假
|
||||
'done_leave': vacation_report.done_leave,
|
||||
# 加班时
|
||||
'done_working_overtime': vacation_report.done_working_overtime,
|
||||
# 调休
|
||||
'compensatory_leave': vacation_report.compensatory_leave,
|
||||
# 事假
|
||||
'leave_of_absence': vacation_report.leave_of_absence,
|
||||
# 法定加班
|
||||
'statutory_leave': vacation_report.statutory_leave,
|
||||
# 补休
|
||||
'cop_leave': vacation_report.cop_leave,
|
||||
# 值班调休
|
||||
'duty_off_leave': vacation_report.duty_off_leave,
|
||||
# 婚假
|
||||
'marriage_leave': vacation_report.marriage_leave,
|
||||
# 产假
|
||||
'maternity_leave': vacation_report.maternity_leave,
|
||||
# 陪产假
|
||||
'paternity_leave': vacation_report.paternity_leave,
|
||||
# 计生假
|
||||
'family_planning_leave': vacation_report.family_planning_leave,
|
||||
# 丧假
|
||||
'bereavement_leave': vacation_report.bereavement_leave,
|
||||
# 探亲假
|
||||
'home_visit_leave': vacation_report.home_visit_leave,
|
||||
# 家长会假
|
||||
'parents_meeting_leave': vacation_report.parents_meeting_leave,
|
||||
# 普通病假
|
||||
'general_sick_leave': vacation_report.general_sick_leave,
|
||||
# 住院病假
|
||||
'hospital_sick_leave': vacation_report.hospital_sick_leave,
|
||||
# 出院恢复期病假
|
||||
'recovery_sick_leave': vacation_report.recovery_sick_leave,
|
||||
# 考试假
|
||||
'exam_leave': vacation_report.exam_leave,
|
||||
}
|
||||
# 更新员工花名册记录
|
||||
employee.write(update_vals)
|
||||
employee.salary_date = start_date
|
||||
employee.salary_month = self.select_time
|
||||
employee.salary_year_jin_ids = [(6, 0, self.employee_ids.ids)]
|
||||
|
||||
Reference in New Issue
Block a user