Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
李鹏宇
2025-08-17 16:59:00 +08:00
8 changed files with 103 additions and 59 deletions
@@ -17,6 +17,7 @@ from odoo.addons.web.controllers.home import Home as WebHome
MENU_BADGE_MODEL_FUNC_ENUM = {
'base.menu_action_res_users': {'model': 'file.preview.test', 'func': 'get_menu_badge_count'},
'yuthon_notice.yuthon_notice_menu1': {'model': 'yuthon.notice', 'func': 'get_no_read_count'},
'purchase.purchase_order_view_tree': {'model': 'purchase.order', 'func': 'get_no_read_count'},
'yuthon_property.yuthon_property_rent_list': {'model': 'property.rent.list', 'func': 'get_no_read_count'},
'yuthon_property.yuthon_property_management_list': {'model': 'property.management.list', 'func': 'get_no_read_count'},
'yuthon_property.yuthon_property_tariff_list': {'model': 'property.tariff.list', 'func': 'get_no_read_count'},
@@ -68,7 +68,16 @@ class AppletAttendance(Controller):
}
"""
_logger.info("----------------/yuthon/att/today---------接口收到响应-------------------------------")
current_datetime = fields.Datetime.now() + timedelta(hours=8)
current_date = fields.Date.today() + timedelta(hours=8)
# 转换为字符串格式以便日志显示
current_datetime_str = fields.Datetime.to_string(current_datetime)
current_date_str = fields.Date.to_string(current_datetime.date())
# 日志输出
_logger.info(f'当前完整时间(含8小时偏移):{current_datetime_str}')
_logger.info(f'当前日期(含8小时偏移):{current_date_str}')
user_id = request.env(user=SUPERUSER_ID)["res.users"].search([('id', '=', int(kw['user_id']))])
employee_id = request.env(user=SUPERUSER_ID)["hr.employee"].search([('name', '=', user_id.name)])
attendance_id = request.env(user=SUPERUSER_ID)["hr.attendance"].search(
@@ -849,12 +858,25 @@ class AppletAttendance(Controller):
'code': 400,
'message': '参数不完整'
})
request.env['wifi.message'].sudo().create({
'mac': mac,
'name': name,
'bssid': bssid,
'company_id': company_id
})
wifi_message = request.env['wifi.message'].sudo().search([
('mac', '=', mac),
('bssid', '=', bssid),
('company_id', '=', company_id)
], limit=1)
if wifi_message:
wifi_message.sudo().write({
'name': name,
})
else:
request.env['wifi.message'].sudo().create({
'mac': mac,
'name': name,
'bssid': bssid,
'company_id': company_id
})
return json.dumps({
'code': 200,
'message': '成功'
@@ -885,14 +907,27 @@ class AppletAttendance(Controller):
'code': 400,
'message': '参数不完整'
})
request.env['applet.address'].sudo().create({
'address_name': address_name,
'address_name2': address_name2,
'longitude': longitude,
'latitude': latitude,
'card_rice': card_rice,
'company_id': company_id
})
applet_address = request.env['applet.address'].sudo().search([
('address_name', '=', address_name),
('longitude', '=', longitude),
('latitude', '=', latitude),
('company_id', '=', company_id)
], limit=1)
if applet_address:
applet_address.sudo().write({
'address_name2': address_name2,
'card_rice': card_rice,
})
else:
request.env['applet.address'].sudo().create({
'address_name': address_name,
'address_name2': address_name2,
'longitude': longitude,
'latitude': latitude,
'card_rice': card_rice,
'company_id': company_id
})
return json.dumps({
'code': 200,
'message': '成功'
@@ -122,37 +122,9 @@ class HrAttendanceDetail(models.Model):
attendance.check_in = record.checkin_time
attendance.check_out = record.checkin_time
else:
local_start = datetime.combine(checkin_date, datetime.min.time())
local_end = local_start + timedelta(days=1)
utc_start = local_start - timedelta(hours=8)
utc_end = local_end - timedelta(hours=8)
domain = [
("exception_type", "!=", "未打卡"),
('employee_id', '=', record.employee_id.id),
('checkin_time', '>=', fields.Datetime.to_string(utc_start)),
('checkin_time', '<', fields.Datetime.to_string(utc_end))
]
check_in = None
check_out = None
attendance_records = self.env['hr.attendance.detail'].search(domain)
if attendance_records:
checkin_times = sorted(attendance_records.mapped('checkin_time'))
check_in = checkin_times[0]
if len(checkin_times) == 1:
check_out = 0
else:
check_out = checkin_times[-1]
if check_in is not None:
attendance.create({
'employee_id': record.employee_id.id,
'check_in': check_in,
'check_out': check_out,
'current_data': checkin_date,
})
# now_time = fields.Datetime.to_datetime(checkin_date) + timedelta(hours=8, days=1)
# start_time = now_time - timedelta(days=2)
# self.env["hr.attendance.detail"].get_hr_attendance_time(record.employee_id, now_time, start_time)
now_time = fields.Datetime.to_datetime(checkin_date) + timedelta(hours=8, days=1)
start_time = now_time - timedelta(days=2)
self.env["hr.attendance.detail"].get_hr_attendance_time(record.employee_id, now_time, start_time)
@@ -36,10 +36,13 @@
invisible="condition != 'approval'"/>
<widget name="web_ribbon" title="作废" bg_color="text-bg-danger"
invisible="condition != 'cancel'"/>
<group col="2">
<group col="3">
<group>
<field name="code" string="流水号:"/>
</group>
<group>
<field name="is_split" string="拆分"/>
</group>
<group>
<field name="number" invisible="1"/>
</group>
@@ -65,7 +68,7 @@
</group>
<group>
<group>
<field name="is_split" string="拆分"/>
<field name="state" invisible="1"/>
<field name="work_end" invisible="1"/>
<field name="rent_company" string="出租方" readonly="0"/>
<field name="lessor_id" invisible="1"/>
@@ -85,7 +88,7 @@
</group>
</group>
<notebook>
<page string="物业列表">
<page string="物业列表" invisible="state in ['协办', '分管领导', '总经理', '二部协办']">
<button name="choose_property_button" string="添加物业" type="object"
class="btn-primary"/>
<field name="lease_ids" string=" ">
@@ -98,7 +101,7 @@
</tree>
</field>
</page>
<page string="承租方信息" invisible="1">
<page string="承租方信息" invisible="state in ['协办', '分管领导', '总经理', '二部协办']">
<group col="2">
<group>
<field name="invoicing_type"/>
@@ -240,7 +243,7 @@
<field name="miscellaneous"/>
</group>
<notebook>
<page string="租金明细">
<page string="租金明细" invisible="state in ['协办', '分管领导', '总经理', '二部协办']">
<field name="breakdown_ids" string=" ">
<tree editable="bottom">
<field name="breakdown_id" column_invisible="1"/>
@@ -253,7 +256,7 @@
</tree>
</field>
</page>
<page string="其他费用">
<page string="其他费用" invisible="state in ['协办', '分管领导', '总经理', '二部协办']">
<field name="other_ids" string=" ">
<tree editable="bottom">
<field name="other_id" column_invisible="1"/>
@@ -299,7 +302,7 @@
</tree>
</field>
</page>
<page string="银行流水">
<page string="银行流水" invisible="state in ['协办', '分管领导', '总经理', '二部协办']">
<field name="bank_statements_ids" string=" ">
<tree editable="bottom">
<field name="start_time"/>
@@ -331,7 +334,7 @@
</group>
</group>
<notebook>
<page string="附件">
<page string="附件" invisible="state in ['协办', '分管领导', '总经理', '二部协办']">
<group col="2">
<group>
<field name="license_id" widget="preview_many2one"/>
@@ -424,13 +427,16 @@
invisible="condition != 'expired'"/>
<widget name="web_ribbon" title="提前终止" bg_color="text-bg-danger"
invisible="condition != 'advance'"/>
<group col="2">
<group col="3">
<group>
<field name="code" readonly="1" string="流水号:"/>
</group>
<group>
<field name="number" invisible="1"/>
</group>
<group>
<field name="is_split" string="拆分"/>
</group>
</group>
<div class="col-12 text-center">
<h1>
@@ -450,22 +456,21 @@
</group>
<group>
<group>
<field name="is_split" string="拆分"/>
<field name="rent_company" string="出租方" readonly="0"/>
<field name="company_id" invisible="1"/>
<field name="lessee_id" readonly="0"/>
<field name="lessee_name" invisible="1"/>
<field name="users_id" invisible="1"/>
<field name="department_id" invisible="1"/>
<field name="name" readonly="0"/>
<field name="use_address" readonly="0"/>
<field name="address_for_delivery" readonly="0"/>
<field name="name" readonly="0"/>
<field name="is_child_contract" invisible="1"/>
<field name="is_contract" invisible="1"/>
<field name="contract_source_id" invisible="not is_child_contract"/>
<field name="contact_state" invisible="1"/>
<field name="deposit_status" invisible="1"/>
<field name="tenure_type" invisible="1"/>
<field name="address_for_delivery" readonly="0"/>
<field name="title_information" readonly="1"/>
<field name="condition" invisible="1" readonly="0"/>
<field name="is_equal" invisible="1"/>
@@ -367,4 +367,21 @@
<!-- name="押金累计欠收"-->
<!-- parent="yuthon_property.yuthon_property_science_menu"-->
<!-- action="property_deposit_list_report_action"/>-->
<menuitem
id="property_approval_report_menu"
parent="yuthon_property.yuthon_property_menu_root"
name="报表"
sequence="55"/>
<menuitem
id="property_bills_receivable_report_menu"
parent="property_approval_report_menu"
name="应收账单"
action="property_accounts_receivable_action"
sequence="1"/>
<menuitem
id="property_asset_information_report_menu"
parent="property_approval_report_menu"
name="资产信息"
action="yuthon_property.yuthon_property_action"
sequence="5"/>
</odoo>
@@ -249,7 +249,7 @@ class PropertyReconciliationWizard(models.Model):
'property_id': line.property_id.id,
'contract_id': line.contract_id.id,
'delivered1': line.amount,
'payout_date': self.actual_date,
'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(),
+2 -1
View File
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from . import purchase_fixed_assets
from . import purchase_low_orders
from . import purchase_service_orders
from . import purchase_service_orders
from . import inherit_purchase_order
@@ -0,0 +1,13 @@
# -*- coding: utf-8 -*-
from odoo import api, fields, models
class InheritPurchaseOrder(models.Model):
_inherit = 'purchase.order'
def get_no_read_count(self):
domain = [
('company_id', '=', self.env.user.company_id.id),
]
return self.search_count(domain)