Merge branch 'dev2' of gitee.com:jinan-pengyusen-data/gzth into dev2

This commit is contained in:
sunjie
2025-10-08 21:43:30 +08:00
13 changed files with 224 additions and 113 deletions
@@ -399,12 +399,11 @@ class SoongWorkflowCommentWizard(models.TransientModel):
action_id = self.env['ir.actions.act_window'].search([('res_model', '=', self.res_model)])[0]
url = f'https://oa.thtzjt.com/web?login={employee.user_id.login}&oauth_uid={employee.wecom_userid}#id={record_id.id}&cids=2&action={action_id.id}&model={record_id._name}&view_type=form&menu_id=10104'
self.sudo().env["wecom.apps"].sync_send_message_textcard(category='oa',
user_id=employee.wecom_userid,
user_id='18562027762',
title=record_id._description,
description="标题: {}\n".format(
record_id.name) + self.env.user.name + ' ' + str(
fields.Datetime.now() + timedelta(
hours=8)),
fields.Datetime.now() + timedelta(hours=8)),
url=url, btntxt="查看详情")
else: # 串审模式 (沿用原有逻辑)
# 查找下一个节点
+1
View File
@@ -19,6 +19,7 @@
'security/planning_group.xml',
'data/hr_attendance_time.xml',
'data/mothly_report_time.xml',
'data/create_attendance_every_day.xml',
'data/attendance_code_data.xml',
'data/attendance_time_data.xml',
'data/attendance_month_date.xml',
@@ -36,9 +36,23 @@
<field name="user_id" ref="base.user_root"/>
<field name="interval_type">months</field>
<field name="interval_number">1</field>
<field name="nextcall" eval="(DateTime.now()).strftime('%Y-%m-%d 12:30:00')"/>
<field name="nextcall" eval="(DateTime.now()).strftime('%Y-%m-%d 12:30:00')"/>
<field name="numbercall">-1</field>
<field eval="False" name="doall"/>
</record>
<!-- 定时任务: 每天触发一次,判断节假日,生成每个人的出勤数据 -->
<record forcecreate="True" id="hr_attendance" model="ir.cron">
<field name="name">每天生成出勤数据</field>
<field name="model_id" ref="model_hr_attendance"/>
<field name="state">code</field>
<field name="code">model.create_attendance_data_holiday()</field>
<field eval="False" name="active"/>
<field name="user_id" ref="base.user_root"/>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field eval="False" name="doall"/>
</record>
</data>
</odoo>
</odoo>
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data noupdate="1">
<!-- 定时任务: 每天触发一次,判断节假日,生成每个人的出勤数据 -->
<record forcecreate="True" id="hr_attendance" model="ir.cron">
<field name="name">每天生成出勤数据</field>
<field name="model_id" ref="model_hr_attendance"/>
<field name="state">code</field>
<field name="code">model.create_attendance_data_holiday()</field>
<field eval="False" name="active"/>
<field name="user_id" ref="base.user_root"/>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field eval="False" name="doall"/>
</record>
</data>
</odoo>
+70 -1
View File
@@ -58,6 +58,75 @@ class HrAttendance(models.Model):
workflow_id = fields.Many2one('soong.workflow.record', string="流程")
is_month = fields.Boolean(string="是否为本月数据", compute='_compute_month_status', store=True)
is_last_month = fields.Boolean(string="是否为上月数据", compute='_compute_month_status', store=True)
is_holiday = fields.Boolean(string="是否是假期")
def create_attendance_data_holiday(self):
"""
定时任务create_attendance_data_holiday
:return:
"""
att_ids = self.sudo().env['hr.attendance']
employee_ids = self.sudo().env['hr.employee'].search([])
self_date_time = fields.Date.today()
start_date1 = fields.Date.today() - timedelta(days=7)
start_date3 = fields.Date.today() - timedelta(days=5)
start_date5 = fields.Date.today() - timedelta(days=3)
start_date6 = fields.Date.today() - timedelta(days=2)
start_date66 = fields.Date.today() - timedelta(days=6)
start_date7 = fields.Date.today() - timedelta(days=1)
# 补充假期橙色逻辑
for emp in employee_ids:
test1 = att_ids.search([('current_data', '=', self_date_time), ('employee_id', '=', emp.id)])
test2 = att_ids.search([('current_data', '=', start_date1), ('employee_id', '=', emp.id)])
test3 = att_ids.search([('current_data', '=', start_date3), ('employee_id', '=', emp.id)])
test4 = att_ids.search([('current_data', '=', start_date5), ('employee_id', '=', emp.id)])
test5 = att_ids.search([('current_data', '=', start_date6), ('employee_id', '=', emp.id)])
test6 = att_ids.search([('current_data', '=', start_date7), ('employee_id', '=', emp.id)])
test7 = att_ids.search([('current_data', '=', start_date66), ('employee_id', '=', emp.id)])
if not test1:
att_ids.create({
'employee_id': emp.id,
'current_data': self_date_time,
})
if not test2:
att_ids.create({
'employee_id': emp.id,
'current_data': start_date1,
})
if not test3:
att_ids.create({
'employee_id': emp.id,
'current_data': start_date3,
})
if not test4:
att_ids.create({
'employee_id': emp.id,
'current_data': start_date5,
})
if emp.company_id.name == '集团本部':
test5.write({
'absenteeism_card': False,
'is_no_card': False,
'is_abnormal': False,
'is_warning': False,
})
test6.write({
'absenteeism_card': False,
'is_no_card': False,
'is_abnormal': False,
'is_warning': False,
})
test7.write({
'absenteeism_card': False,
'is_no_card': False,
'is_abnormal': False,
'is_warning': False,
})
def state_fix(self):
for att in self.env["hr.attendance"].browse(self._context.get('active_ids', self._context.get('active_id'))):
@@ -65,7 +134,7 @@ class HrAttendance(models.Model):
'is_early_card': False,
'is_late_card': False,
'is_abnormal': False,
'is_warning':False,
'is_warning': False,
'absenteeism_card': False})
@api.depends('is_no_card', 'is_early_card', 'is_late_card', 'is_abnormal', 'absenteeism_card')
@@ -22,7 +22,7 @@
</header>
<field name="employee_id" class="list_current_data" options="{'no_create': True}"/>
<field name="current_data" optional="show" class="list_current_data"/>
<field name="week" optional="show" class="list_ids_width"/>
<field name="week" optional="show" class="list_ids_width"/>
<field name="check_in" optional="show" widget="time" decoration-danger="is_check_in_red == 1"/>
<field name="check_out" optional="show" widget="time" class="list_current_data" decoration-danger="is_check_out_red == 1"/>
<field name="shift_id" optional="hidden"/>
@@ -41,6 +41,7 @@
<field name="is_approval" optional="hidden"/>
<field name="is_check_in_red" column_invisible="1"/>
<field name="is_check_out_red" column_invisible="1"/>
<field name="is_holiday"/>
<field name="is_warning" optional="hidden"/>
<field name="is_workflow" optional="hidden"/>
<field name="workflow_id" optional="hidden"/>
+1 -1
View File
@@ -87,7 +87,7 @@
],
},
'demo': [],
'depends': ['mail', 'documents'],
'depends': ['mail', 'documents', 'yuthon_issue'],
'installable': True,
'application': True,
}
@@ -100,17 +100,17 @@ class PropertyMeterArchives(models.Model):
record.archives_state = 'stop'
@api.onchange('current_read', 'last_read')
def _onchange_current_meter(self):
for record in self:
if record.current_read > record.last_read:
record.current_meter = record.current_read - record.last_read
else:
if record.maximum_count > 0:
max_value = 10 ** record.maximum_count - 1
record.current_meter = max_value - record.last_read + record.current_read
else:
record.current_meter = 0
# @api.onchange('current_read', 'last_read')
# def _onchange_current_meter(self):
# for record in self:
# if record.current_read > record.last_read:
# record.current_meter = record.current_read - record.last_read
# else:
# if record.maximum_count > 0:
# max_value = 10 ** record.maximum_count - 1
# record.current_meter = max_value - record.last_read + record.current_read
# else:
# record.current_meter = 0
@api.onchange('yuthon_property_ids')
def _onchange_property(self):
@@ -172,17 +172,19 @@ class MeterArchivesLine(models.Model):
epitope_values_id = fields.Many2one('yuthon.epitope.values', string='表位置')
lessee_id = fields.Many2one('property.tenant.information', string='承租方')
yuthon_property_ids = fields.Many2many('yuthon.property', string='物业信息')
last_meter = fields.Date(string='上次抄表日期')
last_dosage = fields.Float(string='上次用量', compute="compute_meter_values")
last_read = fields.Float(string='上次读数', compute="compute_meter_values")
last_meter = fields.Date(string='上次抄表日期', compute="_compute_last")
last_dosage = fields.Float(string='上次用量', store=True, group_operator=None, compute="_compute_last")
last_read = fields.Float(string='上次读数', store=True, group_operator=None, compute="_compute_last")
meter_date = fields.Date(string='任务日期')
current_meter = fields.Float(string='本次用量', compute='compute_meter_values')
current_read = fields.Float(string='本次读数')
current_meter = fields.Float(string='本次用量', store=True, group_operator=None)
current_read = fields.Float(string='本次读数', group_operator=None)
unit_number = fields.Char(string='单元编号/用途')
gauge_magnification = fields.Integer(string='仪表倍率', readonly=True, default=1)
gauge_magnification = fields.Integer(string='仪表倍率', readonly=True, default=1, group_operator=None)
last_reading_time = fields.Date(string="最后读数时间")
receivables = fields.Float(string="应收", compute='_compute_receivables', store=True)
unit = fields.Float(string='当月单价')
receivables = fields.Float(string="应收", compute='_compute_receivables', store=True, group_operator=None)
unit = fields.Float(string='当月单价', group_operator=None)
line_loss = fields.Float(string="线损", default=0.02)
type = fields.Selection([('public', '公共'), ('fees', '收费')], string='类型')
start_time = fields.Date(string="安装日期")
@@ -198,8 +200,7 @@ class MeterArchivesLine(models.Model):
def _compute_receivables(self):
for record in self:
if record.line_loss and record.current_meter and record.unit:
record.receivables = record.current_meter * record.unit * (
1 + record.line_loss) * record.gauge_magnification
record.receivables = record.current_meter * record.unit * (1 + record.line_loss) * record.gauge_magnification
def update_meter(self):
current_year = datetime.now().year
@@ -213,43 +214,36 @@ class MeterArchivesLine(models.Model):
domain.append(('id', 'in', active_ids))
unread_meter_lines = self.env['meter.archives.line'].search(domain)
if unread_meter_lines:
unread_meter_lines.write({
'state': 'reading'
})
unread_meter_lines.write({'state': 'reading'})
@api.depends('current_read', 'last_read', 'meter_date', 'maximum_count', 'archives_id')
def compute_meter_values(self):
"""合并计算当前用量和上次用量"""
for line in self:
if line.current_read >= line.last_read:
line.current_meter = line.current_read - line.last_read
else:
if line.current_read != 0:
if line.maximum_count > 0:
max_value = 10 ** line.maximum_count - 1
line.current_meter = max_value - line.last_read + line.current_read
@api.depends('archives_id', 'last_dosage', 'last_read', 'last_meter', 'current_meter', 'current_read', 'maximum_count')
def _compute_last(self):
"""
上次用量,读数,超标日期
:return:
"""
for i in self:
last_id = self.env['meter.archives.line'].search([('meter_date', '<', i.meter_date), ('archives_id', '=', i.archives_id.id)]).sorted('meter_date')
if last_id:
i.last_dosage = last_id[-1].current_meter
i.last_read = last_id[-1].current_read
i.last_meter = last_id[-1].meter_date
if i.current_read >= i.last_read:
i.current_meter = i.current_read - i.last_read
else:
if i.current_read != 0:
if i.maximum_count > 0:
max_value = 10 ** i.maximum_count - 1
i.current_meter = max_value - i.last_read + i.current_read
else:
i.current_meter = 0
else:
line.current_meter = 0
else:
line.current_meter = 0
lines = self.search([
('unit_number', '=', line.unit_number),
('meter_date', '!=', False)
], order='meter_date asc')
if line in lines:
idx = lines.ids.index(line.id)
if idx > 0:
prev_line = lines[idx - 1]
line.last_dosage = prev_line.current_meter
line.last_read = prev_line.current_read
else:
line.last_read = 0
line.last_dosage = 0.0
i.current_meter = 0
else:
line.last_read = 0
line.last_dosage = 0.0
i.last_dosage = 0
i.last_read = 0
i.last_meter = i.meter_date
i.current_meter = 0
@api.onchange('yuthon_property_ids')
def onchange_lessee_id(self):
@@ -264,7 +258,3 @@ class MeterArchivesLine(models.Model):
self._context.get('active_ids', self._context.get('active_id')))
for record in meter_ids:
record.onchange_lessee_id()
class PropertyElectricReading(models.Model):
_name = 'property.electric.reading'
current_meter = fields.Float(string='本次用量', tracking=True)
+43 -44
View File
@@ -3,6 +3,10 @@ from odoo.exceptions import UserError, ValidationError
from datetime import datetime
class PropertyElectricReading(models.Model):
_name = 'property.electric.reading'
class PropertyMeterWater(models.Model):
_name = 'property.meter.water'
_description = '水表库'
@@ -84,9 +88,9 @@ class PropertyMeterWater(models.Model):
record.water_state = 'use'
def button_water_state(self):
archives_ids = self.env["property.meter.water"].browse(
water_ids = self.env["property.meter.water"].browse(
self._context.get('active_ids', self._context.get('active_id')))
for record in archives_ids:
for record in water_ids:
record.water_state = 'stop'
@api.onchange('yuthon_property_ids')
@@ -136,15 +140,17 @@ class MeterWaterLine(models.Model):
epitope_values_id = fields.Many2one('yuthon.epitope.values', string='表位置')
lessee_id = fields.Many2one('property.tenant.information', string='承租方')
yuthon_property_ids = fields.Many2many('yuthon.property', string='物业信息')
last_meter = fields.Date(string='上次抄表日期')
last_dosage = fields.Float(string='上次用量', compute="compute_meter_values")
last_read = fields.Float(string='上次读数')
last_meter = fields.Date(string='上次抄表日期', compute="_compute_last")
last_dosage = fields.Float(string='上次用量', store=True, group_operator=None, compute="_compute_last")
last_read = fields.Float(string='上次读数', store=True, group_operator=None, compute="_compute_last")
meter_date = fields.Date(string='任务日期')
current_meter = fields.Float(string='本次用量', readonly=True, compute='compute_meter_values')
current_meter = fields.Float(string='本次用量', store=True, compute="compute_meter_values", group_operator=None)
current_read = fields.Float(string='本次读数', group_operator=None)
unit_number = fields.Char(string='单元编号/用途')
unit = fields.Float(string='当月单价')
receivables = fields.Float(string="应收", compute='_compute_receivables', store=True)
unit = fields.Float(string='当月单价', group_operator=None)
receivables = fields.Float(string="应收", compute='_compute_receivables', store=True, group_operator=None)
gauge_magnification = fields.Integer(string='仪表倍率', readonly=True, default=1, group_operator=None)
last_reading_time = fields.Date(string="最后读数时间")
type = fields.Selection([('public', '公共'), ('fees', '收费')], string='类型')
@@ -185,39 +191,36 @@ class MeterWaterLine(models.Model):
'state': 'reading'
})
@api.depends('current_read', 'last_read', 'meter_date', 'maximum_count', 'water_id')
def compute_meter_values(self):
"""合并计算当前用量和上次用量"""
for line in self:
if line.current_read >= line.last_read:
line.current_meter = line.current_read - line.last_read
else:
if line.current_read != 0:
if line.maximum_count > 0:
max_value = 10 ** line.maximum_count - 1
line.current_meter = max_value - line.last_read + line.current_read
@api.depends('water_id', 'last_dosage', 'last_read', 'last_meter', 'current_meter', 'current_read',
'maximum_count')
def _compute_last(self):
"""
上次用量,读数,超标日期
:return:
"""
for i in self:
last_id = self.env['meter.archives.line'].search(
[('meter_date', '<', i.meter_date), ('water_id', '=', i.water_id.id)]).sorted('meter_date')
if last_id:
i.last_dosage = last_id[-1].current_meter
i.last_read = last_id[-1].current_read
i.last_meter = last_id[-1].meter_date
if i.current_read >= i.last_read:
i.current_meter = i.current_read - i.last_read
else:
if i.current_read != 0:
if i.maximum_count > 0:
max_value = 10 ** i.maximum_count - 1
i.current_meter = max_value - i.last_read + i.current_read
else:
i.current_meter = 0
else:
line.current_meter = 0
else:
line.current_meter = 0
lines = self.search([
('unit_number', '=', line.unit_number),
('meter_date', '!=', False)
], order='meter_date asc')
if line in lines:
idx = lines.ids.index(line.id)
if idx > 0:
prev_line = lines[idx - 1]
line.last_dosage = prev_line.current_meter
line.last_read = prev_line.current_read
else:
line.last_read = 0
line.last_dosage = 0.0
i.current_meter = 0
else:
line.last_read = 0
line.last_dosage = 0.0
i.last_dosage = 0
i.last_read = 0
i.last_meter = i.meter_date
i.current_meter = 0
@api.onchange('yuthon_property_ids')
def onchange_lessee_id(self):
@@ -231,8 +234,4 @@ class MeterWaterLine(models.Model):
meter_ids = self.env["meter.water.line"].browse(
self._context.get('active_ids', self._context.get('active_id')))
for record in meter_ids:
record.onchange_lessee_id()
class PropertyWaterReading(models.Model):
_name = 'property.water.reading'
current_meter = fields.Float(string='本次用量', tracking=True)
record.onchange_lessee_id()
@@ -93,6 +93,7 @@ class YuthonProperty(models.Model):
annual_increase_percentage = fields.Float(string='递增百分比', igits=(6, 2))
annual_increase_amount = fields.Float(string='递增金额', igits=(6, 2))
rent_unit = fields.Float(string='租金单价', igits=(6, 2))
property_type = fields.Selection([('property', '物业'), ('guanggao', '广告位'), ('guanzi', '管子间')], string="资产类型", default='property')
def update_mange(self):
property_ids = self.env['yuthon.property'].search([('name', 'ilike', '天河商贸大厦')])
@@ -20,6 +20,7 @@
<field name="title_deed"/>
<field name="title_address" optional="hide"/>
<field name="property_state" class="list_ids_width"/>
<field name="property_type"/>
<field name="first_letter" column_invisible="1"/>
<button name="put_assessment_approval" type="object" string="评估推送" class="btn btn-primary" invisible="property_state == 'ing'"/>
<button name="put_offline_approval" type="object" string="提交线下审批" class="btn btn-primary" invisible="property_state != 'done'"/>
@@ -73,6 +74,7 @@
<field name="street"/>
<field name="financial_address"/>
<field name="effective_date"/>
<field name="property_type"/>
</group>
<group>
<field name="company_id" invisible="1"/>
@@ -250,6 +250,23 @@ class PropertyLeaseContract(models.Model):
contract_count = fields.Integer(string="联系人数量", compute='_compute_contract_count')
reconciliation_count = fields.Integer(string="对账数量", compute='_compute_reconciliation_count')
process_count = fields.Integer(string="流程数量", compute='_compute_process_count')
is_issues = fields.Boolean(string='是否上会')
@api.onchange('is_issues')
def _onchange_is_issues(self):
if self.is_issues:
issue_id = self.env['issue.library'].create({'name': self.name, 'is_invisible_workflow': True})
self.related_issues_id = issue_id.id
self.env['issue.library.approval.line'].create({
'issue_library_id': issue_id.id,
'workflow_name': self.name,
'approval_type': self.workflow_id.name,
'res_model': self._name,
'res_id': self.id,
'code': self.code,
'approval_date': fields.Datetime.now(),
})
def _get_default_name_title(self):
return self._description if self._description else self._name
@@ -1239,8 +1256,7 @@ class PropertyLeaseContract(models.Model):
record.deposit = 0.0
def update_lease_ids(self):
property_ids = self.env["property.lease.contract"].browse(
self._context.get('active_ids', self._context.get('active_id')))
property_ids = self.env["property.lease.contract"].browse(self._context.get('active_ids', self._context.get('active_id')))
for rec in property_ids:
lease_name = []
electricity_list = []
@@ -46,6 +46,7 @@
</group>
<group>
<field name="number" invisible="1"/>
<field name="is_issues"/>
</group>
</group>
<div class="col-12 text-center">