Merge pull request !3549 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2025-06-28 13:16:07 +00:00
committed by Gitee
21 changed files with 315 additions and 62 deletions
@@ -355,6 +355,7 @@ class SoongWorkflowCommentWizard(models.TransientModel):
if self.employee_ids:
workflow_record_id.users_ids = [(4, employee.user_id.id) for employee in self.employee_ids if employee.user_id]
workflow_record_id.employee_ids = self.employee_ids
workflow_record_id.approve_state = "pending" # 待审批
record_id.write({'state': self.trans_link_id.name})
for employee in self.employee_ids:
@@ -21,6 +21,50 @@ class SoongWorkflowRecordRevokeWizard(models.TransientModel):
model = self.env[model_name]
record_to_update = model.browse(record_id_dx)
if record_to_update.exists():
if model_name == 'hr.leave.batch':
# 请假审批 -> 删除年假明细
self.env['vacation.leave.line'].search([
('workflow_record_id', '=', self.record_id.id)
]).unlink()
elif model_name == 'overtime.approval':
# 加班审批 -> 删除加班明细
over_line = self.env['vacation.over.line'].search([
('workflow_record_id', '=', self.record_id.id),
('update_type', '=', 'add')
])
employee = over_line.vacation_id.employee_id
if employee:
if over_line.workday > 0:
employee.write({'normal_overtime_hours': employee.normal_overtime_hours - over_line.workday})
if over_line.legal_day > 0:
employee.write(
{'holiday_overtime_hours': employee.holiday_overtime_hours - over_line.legal_day})
if over_line.public_holidays > 0:
employee.write(
{'weekend_overtime_hours': employee.weekend_overtime_hours - over_line.public_holidays})
over_line.unlink()
# 从加班审批模型获取误餐数据
if record_to_update.meal == 'yes':
employee = record_to_update.users_id.employee_id
if employee:
employee.write({'meal_number': employee.meal_number - 1})
elif model_name == 'go.approval':
# 外出审批 -> 删除误餐明细并恢复误餐次数
meal_line = self.env['vacation.meal.line'].search([
('workflow_record_id', '=', self.id),
('update_type', '=', 'add') # 只处理增加类型的记录
])
employee_id = meal_line.vacation_id.employee_id.id
if employee_id:
# 恢复误餐次数
meal_count = employee_id.update_lines
employee_id.write({'meal_fee': employee_id.meal_fee - meal_count})
meal_line.unlink()
record_to_update.write({'log_ids': [(5, 0, 0)]})
record_to_update.state = '申请人'
self.record_id.approve_state = 'start'
+1 -1
View File
@@ -395,7 +395,7 @@ class HolidaysRequestBatch(models.Model):
'update_type': 'reduce',
'workflow_record_id':workflow_record_id.id,
'update_date': fields.Datetime.now(),
'update_lines': days,
'update_lines': days,
'text': '审批'
}))
reports_id.write({'leave_ids': leave_list})
@@ -10,12 +10,53 @@ class YuthonVacationReports(models.Model):
employee_id = fields.Many2one('hr.employee', string='员工')
company_id = fields.Many2one(related="employee_id.company_id", string="公司")
leave = fields.Float(string='年假')
working_overtime = fields.Float(string='加班时')
meal_fee = fields.Integer(string="误餐次数")
leave_ids = fields.One2many('vacation.leave.line', 'vacation_id', string='年假明细')
overtime_ids = fields.One2many('vacation.over.line', 'vacation_id', string='加班明细')
meal_fee_ids = fields.One2many('vacation.meal.line', 'vacation_id', string='误餐明细')
allocate_credits = fields.Float(string='分配额度')
leave = fields.Float(string='年假', compute='_compute_leave', store=True)
working_overtime = fields.Float(string='加班时', compute='_compute_working_overtime', store=True)
meal_fee = fields.Integer(string="误餐次数", compute='_compute_meal_fee', store=True)
@api.depends('vacation_leave_line_ids.update_lines', 'vacation_leave_line_ids.update_type')
def _compute_leave(self):
for record in self:
leave_total = 0.0
for line in record.vacation_leave_line_ids:
if line.update_type == 'add':
leave_total += line.update_lines or 0
elif line.update_type == 'reduce':
leave_total -= line.update_lines or 0
record.leave = leave_total
@api.depends(
'vacation_over_line_ids.workday',
'vacation_over_line_ids.legal_day',
'vacation_over_line_ids.public_holidays',
'vacation_over_line_ids.update_type'
)
def _compute_working_overtime(self):
for record in self:
overtime_total = 0.0
for line in record.vacation_over_line_ids:
line_total = (line.workday or 0) + (line.legal_day or 0) + (line.public_holidays or 0)
if line.update_type == 'add':
overtime_total += line_total
elif line.update_type == 'reduce':
overtime_total -= line_total
record.working_overtime = overtime_total
@api.depends('vacation_meal_line_ids.update_lines', 'vacation_meal_line_ids.update_type')
def _compute_meal_fee(self):
for record in self:
meal_total = 0
for line in record.vacation_meal_line_ids:
if line.update_type == 'add':
meal_total += int(line.update_lines or 0)
elif line.update_type == 'reduce':
meal_total -= int(line.update_lines or 0)
record.meal_fee = meal_total
def button_fixes_approval(self):
form_id = self.env.ref('yuthon_holiday.view_yuthon_fixes_approval_form').id
@@ -69,6 +110,13 @@ class YuthonVacationReports(models.Model):
'meal_fee': employee.meal_number,
})
def update_log(self):
vacation_ids = self.env["yuthon.vacation.reports"].browse(
self._context.get('active_ids', self._context.get('active_id')))
for vacation_id in vacation_ids:
vacation_id.leave_ids.unlink()
vacation_id.overtime_ids.unlink()
vacation_id.meal_fee_ids.unlink()
def log(self):
return {
@@ -88,9 +136,17 @@ class VacationLeaveLine(models.Model):
workflow_record_id = fields.Many2one('soong.workflow.record', string='流程')
update_type= fields.Selection([('add', '增加'), ('reduce', '减少')], string='更新类型')
update_date = fields.Date(string='更新时间')
allocate_credits = fields.Float(string='分配额度')
is_soon = fields.Boolean(string="流程修改")
is_manual = fields.Boolean(string="手动修改")
update_lines = fields.Text(string='更新额度')
text = fields.Text(string='备注')
@api.model
def create(self, vals):
vals['is_manual'] = True
return super(VacationLeaveLine, self).create(vals)
class VacationOverline(models.Model):
_name = 'vacation.over.line'
@@ -99,10 +155,41 @@ class VacationOverline(models.Model):
vacation_id = fields.Many2one('yuthon.vacation.reports', string='关联假期报表')
workflow_record_id = fields.Many2one('soong.workflow.record', string='流程')
update_type= fields.Selection([('add', '增加'), ('reduce', '减少')], string='更新类型')
workday = fields.Float(string='工作日')
legal_day = fields.Float(string='法定节假日')
public_holidays = fields.Float(string='公休日')
update_date = fields.Date(string='更新时间')
update_lines = fields.Text(string='更新额度')
is_soon = fields.Boolean(string="流程修改")
is_manual = fields.Boolean(string="手动修改")
text = fields.Text(string='备注')
@api.model
def create(self, vals):
vals['is_manual'] = True
return super(VacationOverline, self).create(vals)
def _sync_to_employee(self):
"""将数据同步到关联员工"""
employee = self.vacation_id.employee_id
if self.update_type == 'add':
employee.write({
'normal_overtime_hours': employee.normal_overtime_hours + self.workday,
'holiday_overtime_hours': employee.holiday_overtime_hours + self.legal_day,
'weekend_overtime_hours': employee.weekend_overtime_hours + self.public_holidays
})
elif self.update_type == 'reduce':
employee.write({
'normal_overtime_hours': employee.normal_overtime_hours - self.workday,
'holiday_overtime_hours': employee.holiday_overtime_hours - self.legal_day,
'weekend_overtime_hours': employee.weekend_overtime_hours - self.public_holidays
})
@api.model
def create(self, vals):
record = super(VacationOverline, self).create(vals)
record._sync_to_employee()
return record
class VacationMealLine(models.Model):
_name = 'vacation.meal.line'
@@ -112,9 +199,25 @@ class VacationMealLine(models.Model):
workflow_record_id = fields.Many2one('soong.workflow.record', string='流程')
update_type= fields.Selection([('add', '增加'), ('reduce', '减少')], string='更新类型')
update_date = fields.Date(string='更新时间')
update_lines = fields.Text(string='更新额度')
update_lines = fields.Float(string='更新额度')
is_soon = fields.Boolean(string="流程修改")
is_manual = fields.Boolean(string="手动修改")
text = fields.Text(string='备注')
@api.model
def create(self, vals):
vals['is_manual'] = True
record = super(VacationMealLine, self).create(vals)
record._sync_to_employee()
return record
def _sync_to_employee(self):
"""将数据同步到关联员工"""
employee = self.vacation_id.employee_id
if self.update_type == 'add':
employee.write({'meal_count': employee.meal_count + int(self.update_lines)})
elif self.update_type == 'reduce':
employee.write({'meal_count': employee.meal_count - int(self.update_lines)})
class DetailsTree(models.Model):
_name = 'details.tree'
@@ -30,6 +30,7 @@
<field name="update_type"/>
<field name="update_date"/>
<field name="update_lines"/>
<field name="allocate_credits"/>
<field name="text"/>
</tree>
</field>
@@ -40,8 +41,12 @@
<field name="vacation_id" column_invisible="1"/>
<field name="workflow_record_id"/>
<field name="update_type"/>
<field name="is_soon"/>
<field name="is_manual"/>
<field name="update_date"/>
<field name="update_lines"/>
<field name="workday"/>
<field name="legal_day"/>
<field name="public_holidays"/>
<field name="text"/>
</tree>
</field>
@@ -75,6 +80,13 @@
<field name="state">code</field>
<field name="code">action = model.update_vacation()</field>
</record>
<record id="all_update_log" model="ir.actions.server">
<field name="name">初始化日志</field>
<field name="model_id" ref="yuthon_holiday.model_yuthon_vacation_reports"/>
<field name="binding_model_id" ref="yuthon_holiday.model_yuthon_vacation_reports"/>
<field name="state">code</field>
<field name="code">action = model.update_log()</field>
</record>
<record id="details_tree_view" model="ir.ui.view">
@@ -27,7 +27,8 @@ class OvertimeApprovals(models.Model):
employee_ids = fields.Many2many('hr.employee', string="加班人", default=lambda self: self.env['hr.employee'].search([('user_id', '=', self.env.uid)]))
related_issues_id = fields.Many2one('issue.library', string="关联议题")
documents_ids = fields.Many2many('ir.attachment', string="附件")
duration = fields.Float(string="时长", compute='_compute_duration', store=True)
duration = fields.Float(string="时长", compute='_compute_duration', store=True, help="如果时长大于8则按8小时算")
real_duration = fields.Float(string="实际时长", compute='_compute_duration', store=True, help="如果时长大于8则按实际时长算")
overtime_hours = fields.Float(string="本月加班时长")
start_time = fields.Datetime(string="开始时间")
start_week = fields.Char(string="星期", compute='_compute_weekday')
@@ -68,8 +69,13 @@ class OvertimeApprovals(models.Model):
for rec in self:
if rec.start_time and rec.end_time:
rec.duration = round((rec.end_time - rec.start_time).total_seconds() / 3600, 1)
rec.real_duration = rec.duration
else:
rec.duration = 0.0
rec.real_duration = 0.0
if rec.duration > 8 :
rec.real_duration = 8
@api.depends('start_time', 'end_time')
def _compute_weekday(self):
@@ -159,11 +165,11 @@ class OvertimeApprovals(models.Model):
employee_id = self.env['hr.employee'].search([('id', '=', record.users_id.employee_id.id)])
meal_number = employee_id.meal_number
if record.type_overtime == 'work':
employee_id.write({'normal_overtime_hours': employee_id.normal_overtime_hours + record.duration})
employee_id.write({'normal_overtime_hours': employee_id.normal_overtime_hours + record.real_duration})
elif record.type_overtime == 'weekend':
employee_id.write({'weekend_overtime_hours': employee_id.weekend_overtime_hours + record.duration})
employee_id.write({'weekend_overtime_hours': employee_id.weekend_overtime_hours + record.real_duration})
else:
employee_id.write({'holiday_overtime_hours': employee_id.holiday_overtime_hours + record.duration})
employee_id.write({'holiday_overtime_hours': employee_id.holiday_overtime_hours + record.real_duration})
record.overtime_hours = employee_id.holiday_overtime_hours + employee_id.weekend_overtime_hours + employee_id.normal_overtime_hours
if self.meal == 'yes':
meal_number +=1
@@ -172,30 +178,43 @@ class OvertimeApprovals(models.Model):
allocation = self.env['hr.leave.allocation'].create({
'employee_id': employee_id.id,
'name': '补休',
'number_of_days': self.duration/7,
'number_of_days': self.real_duration/7,
'holiday_status_id': holiday_status_id.id,
'allocation_type': 'regular',
"number_of_days_display": self.duration/7,
"number_of_days_display": self.real_duration/7,
})
if allocation:
allocation.sudo().action_validate()
# 创建日志
overtime_list = []
reports_id = self.env['yuthon.vacation.reports'].search([
('employee_id', '=', self.users_id.employee_id.id),
])
workflow_record_id = self.env['soong.workflow.record'].search([
('code', '=', self.code)
])
overtime_list.append((0, 0, {
workday = 0.0
legal_day = 0.0
public_holidays = 0.0
if record.type_overtime == 'work':
workday = record.real_duration
elif record.type_overtime == 'weekend':
public_holidays = record.real_duration
elif record.type_overtime == 'holiday':
legal_day = record.real_duration
overtime_data = {
'vacation_id': reports_id.id,
'update_type': 'reduce',
'workflow_record_id': workflow_record_id.id,
'update_type': 'add',
'workflow_record_id': workflow_record_id.id if workflow_record_id else False,
'workday': workday,
'legal_day': legal_day,
'public_holidays': public_holidays,
'update_date': fields.Datetime.now(),
'update_lines': self.duration,
'is_soon': True,
'text': '审批'
}))
reports_id.write({'overtime_ids': overtime_list})
}
reports_id.write({'overtime_ids': overtime_data})
@api.depends('users_id', 'duration')
def _compute_name(self):
@@ -55,6 +55,7 @@
<field name="users_id"/>
<field name="work_end" invisible="1"/>
<field name="reason_application"/>
<field name="real_duration"/>
<field name="issues_result" invisible="is_issues == False"/>
<field name="documents_ids" widget="preview_many2many"/>
</group>
+8 -2
View File
@@ -17,7 +17,7 @@
<field name="notice_state" class="list_ids_width"/>
<button name="on_sequence" string="置顶" invisible="sequence != 0" type="object" class="btn-primary"/>
<button name="no_sequence" string="取消置顶" invisible="sequence != 1" type="object" class="btn-primary"/>
<button name="look_up_notice_users" string="查阅情况" type="object" class="btn-primary"/>
<!-- <button name="look_up_notice_users" string="查阅情况" type="object" class="btn-primary"/>-->
<button name="stop_notice" string="终止" type="object" class="btn-primary"/>
<field name="sequence" column_invisible="1"/>
</tree>
@@ -46,6 +46,9 @@
<group>
<field name="is_this_company"/>
</group>
<group>
<field name="start_date"/>
</group>
</group>
<div class="col-12 text-center">
<h1>
@@ -133,7 +136,7 @@
<field name="model">yuthon.notice</field>
<field name="arch" type="xml">
<form create="false" edit="false" delete="false" string="公告管理">
<group col="4">
<group col="5">
<group>
<field name="notice_type_id" string="发布类型"/>
</group>
@@ -146,6 +149,9 @@
<group>
<field name="create_date1"/>
</group>
<group>
<field name="start_date"/>
</group>
</group>
<div class="col-12 text-center">
<h1>
@@ -30,7 +30,7 @@ class YuthonOfficialIncomingParty(models.Model):
department_id = fields.Many2one('hr.department', string="申请人部门")
statu = fields.Selection([('drft', '草稿'), ('going', '执行中'), ('cancel', '已取消'), ('done', '已完成')],
string="状态", default='drft')
deadline = fields.Date(string="办理期限")
deadline = fields.Datetime(string="办理期限")
red_suit = fields.Char(string="套红")
official_documents_ids = fields.Many2many('ir.attachment', string="附件")
is_issues = fields.Boolean(string="是否上会")
+1 -1
View File
@@ -42,7 +42,7 @@ class YuthonOfficial(models.Model):
official_documents_ids = fields.Many2many('ir.attachment', string="附件")
is_supervising = fields.Boolean(string="是否督办")
deadline = fields.Date(string="办理期限")
deadline = fields.Datetime(string="办理期限")
done_date = fields.Date(string="完成时间")
workflow_inspector_ids = fields.One2many('soong.workflow.inspector', 'yuthon_official_id', string="督办事项")
room_booking_ids = fields.One2many('room.booking', 'yuthon_official_id', string="会议关联")
@@ -30,7 +30,7 @@ class YuthonOfficialIncomingLabor(models.Model):
department_id = fields.Many2one('hr.department', string="申请人部门")
statu = fields.Selection([('drft', '草稿'), ('going', '执行中'), ('cancel', '已取消'), ('done', '已完成')],
string="状态", default='drft')
deadline = fields.Date(string="办理期限")
deadline = fields.Datetime(string="办理期限")
red_suit = fields.Char(string="套红")
official_documents_ids = fields.Many2many('ir.attachment', string="附件")
is_issues = fields.Boolean(string="是否上会")
@@ -33,7 +33,7 @@ class YuthonOfficialIncomingNormal(models.Model):
is_issues = fields.Boolean(string="是否上会")
issues_result = fields.Html(string="会议结果")
is_supervising = fields.Boolean(string="是否督办")
deadline = fields.Date(string="办理期限")
deadline = fields.Datetime(string="办理期限")
done_date = fields.Date(string="完成时间")
is_official_incoming = fields.Boolean(string="是否收文")
official_documents_ids = fields.Many2many('ir.attachment', string="收文附件")
@@ -23,7 +23,7 @@ class YuthonOfficialLabor(models.Model):
department_id = fields.Many2one('hr.department', string="申请人部门")
statu = fields.Selection([('drft', '草稿'), ('going', '执行中'), ('cancel', '已取消'), ('done', '已完成')],
string="状态", default='drft')
deadline = fields.Date(string="办理期限")
deadline = fields.Datetime(string="办理期限")
red_suit = fields.Char(string="套红")
official_documents_ids = fields.Many2many('ir.attachment', string="附件")
urgency_level = fields.Selection([('normal', '一般'), ('urgent', '紧急'), ('extra_urgent', '特急')], default='normal'
@@ -30,7 +30,7 @@ class YuthonOfficialParty(models.Model):
department_id = fields.Many2one('hr.department', string="申请人部门")
statu = fields.Selection([('drft', '草稿'), ('going', '执行中'), ('cancel', '已取消'), ('done', '已完成')],
string="状态", default='drft')
deadline = fields.Date(string="办理期限")
deadline = fields.Datetime(string="办理期限")
red_suit = fields.Char(string="套红")
official_documents_ids = fields.Many2many('documents.document', string="公文相关文件")
active = fields.Boolean('Active', default=True, tracking=True)
@@ -16,10 +16,23 @@ class PropertyEvaluationPlan(models.Model):
registered_id2 = fields.Many2one('yuthon.purpose.evidence', string='设定用途')
rent_id = fields.Many2one('rent.free.setting', string="办法")
lease_period = fields.Integer(string='租赁期限(<=)')
annual_increase_percentage = fields.Float(string='每年递增(%)', igits=(6, 2))
first_years_begin = fields.Integer(string='第几年开始')
increments_few_years = fields.Integer(string='每几年递增')
lease_form = fields.Selection([('sublease', '分租'), ('whole', '整租')], string="租赁形式", compute='compute_lease_form')
annual_increase_percentage = fields.Float(string='递增百分比', igits=(6, 2))
remake = fields.Text(string='备注')
property_state = fields.Selection([('to', '待审批'), ('done', '已审批')], string="状态", default='to')
@api.depends('property_ids')
def compute_lease_form(self):
for record in self:
if record.property_ids:
if len(record.property_ids) > 1:
record.lease_form = 'sublease'
else:
record.lease_form = 'whole'
def put_assessment_approval(self):
property_evaluation_ids = self.env["property.evaluation.plan"].browse(
self._context.get('active_ids', self._context.get('active_id')))
@@ -50,6 +63,20 @@ class PropertyEvaluationPlan(models.Model):
"type": "ir.actions.act_window",
"view_mode": "tree",
"res_model": "yuthon.property",
'tree_view_ref': 'yuthon_property.view_property_evaluation_plan_tree1',
"domain": domain,
"target": "new",
}
}
def update_message(self):
property_evaluation_ids = self.env["property.evaluation.plan"].browse(
self._context.get('active_ids', self._context.get('active_id')))
for record in property_evaluation_ids:
property_id = self.sudo().env['yuthon.property'].search([('name', 'in', record.name)])
if property_id:
record.write({
'owner_id': property_id.owner_id,
'lease_period': property_id.lease_period,
'registered_id': property_id.registered_id,
})
+29 -19
View File
@@ -81,11 +81,18 @@ class YuthonProperty(models.Model):
produce_ids = fields.One2many('yuthon.property.production', 'yuthon_property_id', string='关联安全生产明细行')
property_merge_approval_id = fields.Many2one('yuthon.property', string='关联物业信息')
reference_ids = fields.One2many('yuthon.reference.conditions', 'yuthon_property_id', string='关联出租参考条件明细行')
first_letter = fields.Char(string="首字母", compute='_compute_first_letter', store=True)
owner_id = fields.Many2one('yuthon.owner.message', string="权属人")
vacant_duration = fields.Float(string="空置时长", digits=(16, 2))
lease_period = fields.Integer(string='租赁期限(<=)')
@api.onchange('reference_ids')
def _onchange_reference_ids(self):
for record in self:
if record.reference_ids:
record.lease_period = record.reference_ids[-1].lease_period
else:
record.lease_period = 0.0
@api.depends('name')
def _compute_first_letter(self):
@@ -107,6 +114,7 @@ class YuthonProperty(models.Model):
if rec.title_information_ids:
latest_title_information = sorted(rec.title_information_ids, key=lambda x: x.start_time, reverse=True)[0]
rec.write({
'owner_id': latest_title_information.owner_id,
'title_deed': latest_title_information.title_certificate,
'registered_id': latest_title_information.registered_id,
'equity_area': latest_title_information.equity_area,
@@ -274,10 +282,9 @@ class YuthonProperty(models.Model):
'name': record.name,
'property_ids': [(6, 0, [record.id])],
'evaluation_area': record.rent_area,
'owner_id': record.title_information_ids[-1].owner_id.id if record.title_information_ids else None,
'registered_id': record.title_information_ids[-1].registered_id.id if record.title_information_ids else None,
'rent_id': record.reference_ids[-1].rent_id.id if record.reference_ids else None,
'lease_period': record.reference_ids[-1].lease_period if record.reference_ids else None,
'owner_id': record.owner_id.id if record.owner_id else None,
'registered_id': record.registered_id.id if record.registered_id else None,
'lease_period': record.lease_period if record.lease_period else None,
'annual_increase_percentage': record.reference_ids[-1].annual_increase_percentage if record.reference_ids else None,
'assessment_category': 'rent_money',
'remake': record.remark,
@@ -294,16 +301,15 @@ class YuthonProperty(models.Model):
property_ids = self.env["yuthon.property"].browse(
self._context.get('active_ids', self._context.get('active_id')))
for record in property_ids:
if record.state == 'ing':
if record.property_state == 'ing':
raise UserError(f'{record.name}该物业已在评估,请勿重复提交')
self.env['property.evaluation.plan'].create({
'name': record.name,
'property_ids': [(6, 0, [record.id])],
'evaluation_area': record.rent_area,
'owner_id': record.title_information_ids[-1].owner_id.id if record.title_information_ids else None,
'registered_id': record.title_information_ids[-1].registered_id.id if record.title_information_ids else None,
'rent_id': record.reference_ids[-1].rent_id.id if record.reference_ids else None,
'lease_period': record.reference_ids[-1].lease_period if record.reference_ids else None,
'owner_id': record.owner_id.id if record.owner_id else None,
'registered_id': record.registered_id.id if record.registered_id else None,
'lease_period': record.lease_period if record.lease_period else None,
'annual_increase_percentage': record.reference_ids[-1].annual_increase_percentage if record.reference_ids else None,
'assessment_category': 'rent_money',
'remake': record.remark,
@@ -372,12 +378,14 @@ class YuthonProperty(models.Model):
property_ids = self.env["yuthon.property"].browse(
self._context.get('active_ids', self._context.get('active_id')))
for record in property_ids:
precinct_id = self.env["yuthon.precinct.message"].search([('employee_id.name', '=', record.admin_id.name)])
precinct_id = self.env["yuthon.precinct.message"].search([('employee_id.name', '=', record.owner_id .name)])
company_id = record.manage_information_ids[-1].company_id.id if record.manage_information_ids else ''
lease_period = record.reference_ids[-1].lease_period if record.reference_ids else ''
title_deed = record.title_information_ids[-1].title_certificate if record.title_information_ids else ''
registered_id = record.title_information_ids[-1].registered_id if record.title_information_ids else ''
record.registered_id = registered_id
record.company_id = company_id
record.lease_period = lease_period
record.title_deed = title_deed
record.precinct_id = precinct_id.id if precinct_id else ''
if record.manage_information_ids:
@@ -452,12 +460,12 @@ class TitleInformationLine(models.Model):
yuthon_property_id = fields.Many2one('yuthon.property', string="关联物业信息")
property_message_id = fields.Many2one('yuthon.property.message', string='产权地址')
owner_id = fields.Many2one(related='property_message_id.owner_id', string="权属人")
equity_area = fields.Float(related='property_message_id.equity_area', string="产权面积", digits=(16, 4))
registered_id = fields.Many2one(related='property_message_id.registered_id', string='证载用途')
property_use_time = fields.Selection(related='property_message_id.property_use_time', string="产权年限")
life_timer = fields.Date(related='property_message_id.life_timer', string="使用时间")
title_certificate = fields.Char(related='property_message_id.title_certificate', string="产权证号")
owner_id = fields.Many2one(related='property_message_id.owner_id', string="权属人", store=True)
equity_area = fields.Float(related='property_message_id.equity_area', string="产权面积", digits=(16, 4), store=True)
registered_id = fields.Many2one(related='property_message_id.registered_id', string='证载用途', store=True)
property_use_time = fields.Selection(related='property_message_id.property_use_time', string="产权年限", store=True)
life_timer = fields.Date(related='property_message_id.life_timer', string="使用时间", store=True)
title_certificate = fields.Char(related='property_message_id.title_certificate', string="产权证号", store=True)
start_time = fields.Date(string="生效日期", default=fields.Date.today)
end_date = fields.Date(string="失效日期")
@@ -530,7 +538,9 @@ class YuthonReferenceConditions(models.Model):
yuthon_property_id = fields.Many2one('yuthon.property', string="关联物业信息")
lease_period = fields.Integer(string='租赁期限(<=)')
rent_period = fields.Integer(string="免租期(<=)")
annual_increase_percentage = fields.Float(string='每年递增(%)', igits=(6, 2))
first_years_begin = fields.Integer(string='第几年开始')
increments_few_years = fields.Integer(string='每几年递增')
annual_increase_percentage = fields.Float(string='递增百分比', igits=(6, 2))
class YuthonMajorEventLine(models.Model):
_name = 'yuthon.major.event.line'
@@ -36,7 +36,7 @@
</field>
</record>
<record id="all_property_accounts_receivable_contract" model="ir.actions.server">
<record id="all_property_accounts_receivable_contract" model="ir.actions.server">
<field name="name">批量导入合同</field>
<field name="model_id" ref="yuthon_property.model_property_accounts_receivable"/>
<field name="binding_model_id" ref="yuthon_property.model_property_accounts_receivable"/>
@@ -17,9 +17,12 @@
<field name="registered_id2"/>
<field name="lease_period"/>
<field name="rent_id"/>
<field name="first_years_begin"/>
<field name="increments_few_years"/>
<field name="annual_increase_percentage"/>
<field name="remake"/>
<field name="property_state"/>
<field name="lease_form" optional="hide"/>
<button name="button_source" type="object" string="详情" class="btn btn-primary"/>
</tree>
</field>
@@ -39,4 +42,27 @@
<field name="res_model">property.evaluation.plan</field>
<field name="view_mode">tree,search</field>
</record>
<record id="all_property_accounts_receivable_contract" model="ir.actions.server">
<field name="name">更新信息</field>
<field name="model_id" ref="yuthon_property.model_property_evaluation_plan"/>
<field name="binding_model_id" ref="yuthon_property.model_property_evaluation_plan"/>
<field name="state">code</field>
<field name="code">action = model.update_message()</field>
</record>
<record id="view_property_evaluation_plan_tree1" model="ir.ui.view">
<field name="name">property.evaluation.plan.tree1</field>
<field name="model">yuthon.property</field>
<field name="arch" type="xml">
<tree string="物业信息">
<field name="name" required="1" class="list_name_width"/>
<field name="management_area" digits="[16, 4]" class="list_ids_width"/>
<field name="rent_area" digits="[16, 4]" class="list_ids_width"/>
<field name="equity_area" digits="[16, 4]" class="list_ids_width"/>
<field name="title_deed"/>
<field name="title_address" optional="hide"/>
<field name="property_state" class="list_ids_width"/>
</tree>
</field>
</record>
</odoo>
@@ -13,10 +13,11 @@
<button name="put_property_management" string="物业变更" type="object" class="btn btn-primary"/>
</header>
<field name="name" required="1" class="list_name_width"/>
<field name="title_deed" optional="hide"/>
<field name="management_area" digits="[16, 4]" class="list_ids_width"/>
<field name="rent_area" digits="[16, 4]" class="list_ids_width"/>
<field name="equity_area" digits="[16, 4]" class="list_ids_width"/>
<field name="title_deed"/>
<field name="title_address" optional="hide"/>
<field name="property_state" class="list_ids_width"/>
<field name="first_letter" column_invisible="1"/>
<button name="put_assessment_approval" type="object" string="评估推送" class="btn btn-primary" invisible="property_state == 'ing'"/>
@@ -201,6 +202,8 @@
<field name="yuthon_property_id" column_invisible="1"/>
<field name="lease_period"/>
<field name="rent_period"/>
<field name="first_years_begin"/>
<field name="increments_few_years"/>
<field name="annual_increase_percentage"/>
</tree>
</field>
@@ -23,29 +23,29 @@ class ClickReconciliationWizard(models.Model):
# 检查所有明细行的rent_month和rent是否相等
all_lines_match = True
amount_been_reconciled = 0.0
for val in all_vals:
if isinstance(val, tuple) and len(val) == 3 and isinstance(val[2], dict):
line_data = val[2]
# 检查金额是否匹配
if line_data.get('rent_month') != line_data.get('rent'):
all_lines_match = False
break
# 累加已对账金额
amount_been_reconciled += line_data.get('amount', 0.0)
amount_reconciled = max(record.original_amount - amount_been_reconciled, 0.0)
# 更新对账状态(总金额相等且所有行金额匹配)
if total_rent_month == record.original_amount and all_lines_match:
record.bank_state = 'reconciled'
# 查找对应的银行行记录
bank_lines = self.env['property.bank.line'].search([
('bank', '=', record.bank_id.name)
('bank', '=', record.name)
])
if bank_lines:
# 更新银行账户相关信息
if record.actual_total > record.receivable_total:
record.bank_id.registered = record.actual_total - record.receivable_total
record.bank_id.bank_state = 'reconciled'
record.bank_id.yes_amount = record.amount_been_reconciled
record.bank_id.no_amount = record.amount_reconciled
record.bank_state = 'reconciled'
record.yes_amount = amount_been_reconciled
record.no_amount = amount_reconciled
first_line = bank_lines[0]
# 直接使用all_vals中的数据更新应收账款
@@ -79,7 +79,7 @@ class ClickReconciliationWizard(models.Model):
receivable.write({
'is_reconciliation': True,
'delivered1': amount,
'payout_date': record.bank_id.start_time.date(),
'payout_date': record.start_time.date(),
'remark': line_data.get('remark', ''), # 使用line_data中的备注
'receivable_log': f'当前登录人{record.env.user.name}于{fields.Datetime.now()}对户名为{record.bank_id.name_account}进行对账操作,对账应收金额为{record.receivable_total},实际金额为{record.actual_total}'
'receivable_log': f'当前登录人{record.env.user.name}于{fields.Datetime.now()}对户名为{record.name_account}进行对账操作,对账应收金额为{record.receivable_total},实际金额为{record.original_amount}'
})
@@ -158,6 +158,7 @@ class PropertyRentalWizard(models.Model):
rent = self.env['property.rent.list'].search([
('due_date', '>=', first_day),
('due_date', '<=', last_day),
('is_push', '=', True)
])
if rent:
raise UserError('该月已租金已推送,不能生成重复数据')