!4782 添加功能

Merge pull request !4782 from 李鹏宇/dev_zhou
This commit is contained in:
李鹏宇
2025-08-27 07:28:47 +00:00
committed by Gitee
11 changed files with 52 additions and 44 deletions
+5 -2
View File
@@ -169,17 +169,18 @@ class HrAttendance(models.Model):
#考勤异常提醒
def attendance_abnormal_remind(self):
menu_id = self.env['ir.ui.menu'].search([('name', '=', '我的异常')])
all_employees = self.env['hr.employee'].search([])
current_date = fields.Date.today()
month_start = current_date.replace(day=1)
month_end = (month_start + relativedelta(months=1) - relativedelta(days=1))
current_time = fields.Datetime.now()
for employee in all_employees:
domain = [
('shift_name', '=', '行政班次'),
('employee_id', '=', employee.id),
('current_data', '>=', month_start),
('current_data', '<=', month_end)
('current_data', '<=', month_end),
('employee_id.name', '=', '叶华锋')
]
is_no_card = 0
is_early_card = 0
@@ -207,6 +208,8 @@ class HrAttendance(models.Model):
description="本月迟到: {}\n本月缺卡: {}\n本月早退: {}\n本月异常:{}\n 本月旷工: {}\n"
.format(is_late_card, is_no_card, is_early_card, is_abnormal, absenteeism_card),
url=url, btntxt="详细信息")
logging.info(f"执行时间为{current_time}")
logging.info(f"打卡异常提醒发送成功,员工:{employee.name},本月迟到: {is_late_card},本月缺卡: {is_no_card},本月早退: {is_early_card},本月异常:{is_abnormal},本月旷工: {absenteeism_card}")
def missing_card_judgment(self):
@@ -59,33 +59,33 @@
<group col="4" string="基本情况">
<group>
<field name="staff_name" required="1"/>
<field name="id_card"/>
<field name="users_id" invisible="1"/>
<field name="department_id" invisible="1"/>
<field name="sex"/>
<field name="old"/>
<field name="work_end" invisible="1"/>
<field name="date_birth"/>
<field name="nation"/>
<field name="is_relatives_work"/>
</group>
<group>
<field name="id_card"/>
<field name="nation"/>
<field name="political"/>
<field name="party_time"/>
<field name="marital_status"/>
<field name="origin"/>
</group>
<group>
<field name="house_hold"/>
<field name="house_type"/>
</group>
<group>
<field name="phone"/>
<field name="marital_status"/>
<field name="working_time"/>
<field name="current_address"/>
</group>
<group>
<field name="email"/>
<field name="home_address"/>
<field name="home_phone"/>
<field name="origin"/>
<field name="working_time"/>
</group>
<group>
<field name="current_address"/>
<field name="phone"/>
<field name="email"/>
</group>
</group>
<group>
@@ -39,7 +39,7 @@ class PropertyMeterArchives(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 * record.line_loss
record.receivables = record.current_meter * record.unit * (1 + record.line_loss) * record.gauge_magnification
def format_update(self):
insurances_ids = self.env["property.meter.archives"].browse(
@@ -82,13 +82,20 @@ class PropertyMeterArchives(models.Model):
else:
record.archives_state = 'use'
@api.onchange('current_meter')
def _onchange_current_meter(self):
current_date = fields.Date.today()
if self.current_meter > 0:
self.is_push = False
self.meter_date = current_date
@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) * record.gauge_magnification
record.current_meter = record.current_read - record.last_read
else:
record.current_meter = (record.maximum_count - record.last_read + record.current_read) * record.gauge_magnification
record.current_meter = record.maximum_count - record.last_read + record.current_read
@api.onchange('yuthon_property_id')
def _onchange_property(self):
+10 -3
View File
@@ -38,7 +38,7 @@ class PropertyMeterWater(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 * record.line_loss
record.receivables = record.current_meter * record.unit * (1 + record.line_loss) * record.gauge_magnification
def format_update(self):
insurances_ids = self.env["property.meter.water"].browse(
@@ -51,6 +51,13 @@ class PropertyMeterWater(models.Model):
record.write({'maximum_count': 99999,
})
@api.onchange('current_meter')
def _onchange_current_meter(self):
current_date = fields.Date.today()
if self.current_meter > 0:
self.is_push = False
self.meter_date = current_date
@api.depends('lessee_id')
def _compute_water_state(self):
for record in self:
@@ -86,9 +93,9 @@ class PropertyMeterWater(models.Model):
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) * record.gauge_magnification
record.current_meter = record.current_read - record.last_read
else:
record.current_meter = (record.maximum_count - record.last_read + record.current_read) * record.gauge_magnification
record.current_meter = record.maximum_count - record.last_read + record.current_read
@api.onchange('yuthon_property_id')
@@ -5,7 +5,6 @@ class PropertyTariffList(models.Model):
_name = 'property.tariff.list'
_description = '电费列表'
contract_code = fields.Char(string='合同编号')
property_id = fields.Many2one('yuthon.property', string='物业')
admin_id = fields.Many2one(related='property_id.admin_id', string="片区管理员", store=True)
lessee_id = fields.Many2one('property.tenant.information', string='承租方')
@@ -5,7 +5,6 @@ class PropertyWaterList(models.Model):
_name = 'property.water.list'
_description = '水费列表'
contract_code = fields.Char(string='合同编号')
property_id = fields.Many2one('yuthon.property', string='物业')
lessee_id = fields.Many2one('property.tenant.information', string='承租方')
admin_id = fields.Many2one(related='property_id.admin_id', string="片区管理员", store=True)
@@ -6,7 +6,6 @@
<field name="arch" type="xml">
<tree string="电费列表" editable="bottom">
<field name="name"/>
<field name="contract_code" optional="hide"/>
<field name="property_id" options="{'no_create': True}"/>
<field name="lessee_id" options="{'no_create': True}"/>
<field name="tariff_meter_number" optional="hide"/>
@@ -6,7 +6,6 @@
<field name="arch" type="xml">
<tree string="水费列表" editable="bottom">
<field name="name"/>
<field name="contract_code" optional="hide"/>
<field name="property_id" options="{'no_create': True}"/>
<field name="lessee_id" options="{'no_create': True}"/>
<field name="water_meter_number" optional="hide"/>
@@ -56,7 +56,7 @@
<field name="inherit_id" ref="yuthon_property.view_property_rent_list_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='property_id']" position="before">
<field name="contract_id" string="合同" options="{'no_create': True}"/>
<field name="contract_id" string="合同编号" options="{'no_create': True}"/>
</xpath>
<xpath expr="//field[@name='is_reconciliation']" position="after">
<button name="push_rent" type="object" string="推送" class="oe_highlight"/>
@@ -170,8 +170,8 @@
<field name="model">property.tariff.list</field>
<field name="inherit_id" ref="yuthon_property.view_property_tariff_list_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='property_id']" position="after">
<field name="contract_id" string="合同" options="{'no_create': True}"/>
<xpath expr="//field[@name='property_id']" position="before">
<field name="contract_id" string="合同编号" options="{'no_create': True}"/>
</xpath>
<xpath expr="//tree/field[@name='remarks']" position="after">
<button name="push_tariff" string="推送" type="object" class="oe_highlight"/>
@@ -216,8 +216,8 @@
<field name="model">property.water.list</field>
<field name="inherit_id" ref="yuthon_property.view_property_water_list_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='property_id']" position="after">
<field name="contract_id" string="合同" options="{'no_create': True}"/>
<xpath expr="//field[@name='property_id']" position="before">
<field name="contract_id" string="合同编号" options="{'no_create': True}"/>
</xpath>
<xpath expr="//tree/field[@name='remarks']" position="after">
<button name="push_water" string="推送" type="object" class="oe_highlight"/>
@@ -293,8 +293,8 @@
<xpath expr="//field[@name='is_suspend']" position="before">
<button name="button_accounts_wizard" string="操作" type="object" class="btn btn-primary"/>
</xpath>
<xpath expr="//field[@name='property_id']" position="after">
<field name="contract_id" string="合同" options="{'no_create': True}"/>
<xpath expr="//field[@name='property_id']" position="before">
<field name="contract_id" string="合同编号" options="{'no_create': True}"/>
</xpath>
<xpath expr="//field[@name='receivable_log']" position="after">
<field name="penalty"/>
@@ -72,9 +72,9 @@
<group>
<field name="state" invisible="1"/>
<field name="work_end" invisible="1"/>
<field name="rent_company" string="出租方" required="1"/>
<field name="rent_company" string="出租方" readonly="1"/>
<field name="lessee_id"/>
<field name="lessor_id" invisible="1"/>
<!-- <field name="lessor_id" invisible="1"/>-->
<field name="users_id" readonly="1" invisible="1"/>
<field name="department_id" invisible="1" required="0"/>
<field name="property_name"/>
@@ -397,7 +397,7 @@
<field name="actual_end_time"/>
<field name="end_comparison" column_invisible="1"/>
<field name="deposit_status" column_invisible="1"/>
<field name="lessor_id" string="公司"/>
<!-- <field name="lessor_id" string="公司"/>-->
<field name="admin_id" string="负责人"/>
<field name="contact_state" widget="badge"
decoration-info="contact_state == 'to'"
@@ -25,12 +25,12 @@ class ChoosePropertyWizard(models.Model):
title_deed = []
title_address = []
for record in self.property_ids:
lease_name.append(str(record.name) if record.name is not None else "")
lease_name.append(record.name if record.name is not None else "")
title_addr_name = record.title_address.name if (record.title_address and record.title_address.name) else ""
title_address.append(str(title_addr_name))
title_address.append(title_addr_name)
if record.title_deed != '无产权':
title_deed.append(str(record.title_deed) if record.title_deed is not None else "")
if record.title_deed != '无产权' and record.title_deed:
title_deed.append(record.title_deed)
lease_ids_to_add.append((0, 0, {
"lease_id": self.lease_contract_id.id,
@@ -63,9 +63,8 @@ class ChoosePropertyWizard(models.Model):
existing_names = []
for lease in self.lease_contract_id.lease_ids:
if lease.address_id:
# 确保name为字符串,空值时用空字符串
name_val = lease.address_id.name
existing_names.append(str(name_val) if name_val is not None else "无")
existing_names.append(name_val if name_val is not None else "无")
information_names = []
for lease in self.lease_contract_id.lease_ids:
@@ -82,10 +81,6 @@ class ChoosePropertyWizard(models.Model):
# 过滤空字符串,避免拼接时出现空内容
all_names = [name for name in list(set(existing_names + lease_name)) if name]
title_information = [info for info in list(set(information_names + title_deed))]
if title_information:
title_address = [addr for addr in list(set(title_address + title_information)) if addr]
else:
title_address = '无'
title_address_combined = [addr for addr in list(set(title_address + title_name)) if addr]
existing_lease_ids = [(4, lease.id) for lease in self.lease_contract_id.lease_ids]