diff --git a/yuthon_purchase/models/inherit_purchase_order.py b/yuthon_purchase/models/inherit_purchase_order.py
index 202804b5a..671ce681a 100644
--- a/yuthon_purchase/models/inherit_purchase_order.py
+++ b/yuthon_purchase/models/inherit_purchase_order.py
@@ -14,9 +14,17 @@ class InheritPurchaseOrder(models.Model):
compute='_compute_json_display',
store=True
)
+ code = fields.Char(string="流水号", default=lambda self: self.env['ir.sequence'].next_by_code('purchase_workflow_approval_code'))
+ state = fields.Selection(selection_add=[('申请人', '申请人'),
+ ('部门经理', '部门经理'),
+ ('协办', '协办'),
+ ('分管领导', '分管领导'),
+ ('总经理', '总经理')] ,default='申请人')
work_end = fields.Boolean(string="结束")
- document_ids = fields.Many2many('ir.attachment', string="附件")
user_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user)
+ company_id = fields.Many2one(related='user_id.employee_ids.company_id', string="公司")
+ department_id = fields.Many2one(related='user_id.employee_ids.department_id', string="部门")
+ document_ids = fields.Many2many('ir.attachment', string="附件")
start_date = fields.Date(string="申请日期", default=fields.Date.today())
purchase_type = fields.Selection(
[('fixed', '固定资产'), ('low', '低值易耗'), ('service', '服务'), ('day', '日常消耗品')],
@@ -24,6 +32,9 @@ class InheritPurchaseOrder(models.Model):
pay_way = fields.Selection([('onetime', '一次性'), ('installment', '分期')], string="付款方式", default='onetime')
reason_text = fields.Text(string="申请事由")
+ def end_approval(self):
+ self.state = 'purchase'
+ self.write({'work_end': True})
@api.depends(
'order_line.product_id',
diff --git a/yuthon_purchase/views/inherit_purchase_order_views.xml b/yuthon_purchase/views/inherit_purchase_order_views.xml
index 4fdbf2e73..93a022f7c 100644
--- a/yuthon_purchase/views/inherit_purchase_order_views.xml
+++ b/yuthon_purchase/views/inherit_purchase_order_views.xml
@@ -33,7 +33,13 @@
1
+
+ 1
+
+
+
+
diff --git a/yuthon_will_task/models/inherit_room_booking.py b/yuthon_will_task/models/inherit_room_booking.py
index 0728cea73..ebbd1d6e4 100644
--- a/yuthon_will_task/models/inherit_room_booking.py
+++ b/yuthon_will_task/models/inherit_room_booking.py
@@ -1,15 +1,32 @@
from odoo import api, fields, models
from datetime import datetime, timedelta, date
+import logging
+_logger = logging.getLogger(__name__)
class InheritRoomBooking(models.Model):
_inherit = 'room.booking'
def get_no_read_count(self):
- today = date.today()+ timedelta(hours=8)
+ # 1. 计算各类时间参数
+ today = date.today() + timedelta(hours=8)
today_start = datetime.combine(today, datetime.min.time())
today_end = datetime.combine(today, datetime.max.time())
current_datetime = datetime.now() + timedelta(hours=8)
+
+ # 2. 输出核心时间参数日志(INFO级别,便于查看过滤条件)
+ _logger.info(
+ "【会议室未过期记录统计】时间参数详情:"
+ "\n 调整后当天日期:%s"
+ "\n 当天开始时间(筛选起始):%s"
+ "\n 当天结束时间(筛选结束):%s"
+ "\n 调整后当前时间(过期判断):%s",
+ today,
+ today_start.strftime('%Y-%m-%d %H:%M:%S'),
+ today_end.strftime('%Y-%m-%d %H:%M:%S'),
+ current_datetime.strftime('%Y-%m-%d %H:%M:%S')
+ )
+ # 3. 构建过滤域
domain = [
('start_datetime', '>=', today_start),
('start_datetime', '<=', today_end),
@@ -17,7 +34,27 @@ class InheritRoomBooking(models.Model):
('stop_datetime', '=', False),
('stop_datetime', '>', current_datetime)
]
- return 0
+ # 4. 查询符合条件的记录(先获取记录集,再统计数量,便于输出会议时间)
+ matching_records = self.search(domain)
+ count = len(matching_records)
+
+ # 5. 输出符合条件的会议记录时间详情(DEBUG级别,便于排障)
+ if matching_records:
+ meeting_info = []
+ for rec in matching_records:
+ meeting_info.append(
+ f"会议ID:{rec.id} | 开始时间:{rec.start_datetime.strftime('%Y-%m-%d %H:%M:%S') if rec.start_datetime else '无'} | 结束时间:{rec.stop_datetime.strftime('%Y-%m-%d %H:%M:%S') if rec.stop_datetime else '无'}"
+ )
+ _logger.debug(
+ "【会议室未过期记录统计】符合条件的会议共 %d 条,详情:\n%s",
+ count,
+ "\n ".join(meeting_info)
+ )
+ else:
+ _logger.info("【会议室未过期记录统计】未查询到符合条件的会议记录")
+
+ # 6. 返回统计数量
+ return count
@api.model
def create(self, vals):