diff --git a/attendance_iot/controllers/kaoqin_test.py b/attendance_iot/controllers/kaoqin_test.py
index 2a5025c02..f10e25ff1 100644
--- a/attendance_iot/controllers/kaoqin_test.py
+++ b/attendance_iot/controllers/kaoqin_test.py
@@ -53,7 +53,7 @@ class BusController(Controller):
_logger.info("----------------/api/v1/record/face---------接口收到响应-------------------------------")
data = request.httprequest.json
user_id = data.get('logs')[0].get('user_id')
- employee_id = request.env(user=SUPERUSER_ID)["hr.employee"].search([('mobile_phone', '=', user_id)])
+ employee_id = request.env(user=SUPERUSER_ID)["hr.employee"].search([('user_id', '=', user_id)])
attendance_iot_id = request.env(user=SUPERUSER_ID)["attendance.iot"].search([('name', '=', data.get('sn'))])
if employee_id:
request.env(user=SUPERUSER_ID)["hr.attendance.detail"].create({
diff --git a/yuthon_official/models/yuthon_official.py b/yuthon_official/models/yuthon_official.py
index 967e8da5f..2e95333d1 100644
--- a/yuthon_official/models/yuthon_official.py
+++ b/yuthon_official/models/yuthon_official.py
@@ -14,7 +14,7 @@ class YuthonOfficial(models.Model):
name = fields.Char(string="标题")
code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('official_code'))
official_type_id = fields.Many2one('official.type', string="文件类型")
- reference_cold = fields.Integer(string="发文字号")
+ reference_cold = fields.Char(string="发文字号")
major_event_category = fields.Integer(string="重大事项所属类别")
official_partner_id = fields.Many2one('official.partner', string="来文单位")
remarks = fields.Char(string="备注事项")
@@ -27,13 +27,14 @@ class YuthonOfficial(models.Model):
employee_ids = fields.Many2many('hr.employee', string='人员范围')
users_role_ids = fields.Many2many('soong.user.role', string='角色范围')
servings_number = fields.Integer(string="份数")
+
urgency_level = fields.Selection([('normal', '一般'), ('urgent', '紧急'), ('extra_urgent', '特急')], string="紧急程度", default='normal')
secret_level = fields.Selection([('normal', '一般'), ('urgent', '秘密'), ('secret', '机密'), ('so_secret', '绝密')], string="密级")
date = fields.Datetime(string="拟稿日期", default=fields.Datetime.now)
official_statu = fields.Selection([('done', '办结'), ('approval', '审核')], string="公文环节")
users_id = fields.Many2one('res.users', string="拟稿人", default=lambda self: self.env.user)
department_id = fields.Many2one(related='users_id.employee_id.department_id', string="拟稿部门")
- company_id = fields.Many2one(related="users_id.employee_id.company_id", string="公司", store=True)
+ company_id = fields.Many2one('res.company', string="公司前缀")
is_meet = fields.Boolean(string="是否上会")
issues_result = fields.Html(string="会议结果")
related_issues_id = fields.Many2one('issue.library', string="关联议题")
@@ -57,6 +58,41 @@ class YuthonOfficial(models.Model):
name_title = fields.Char(default=_get_default_name_title)
self_users_ids = fields.Many2many('res.users', string="当前经办人", default=lambda self: [(6, 0, [self.env.user.id])])
+ @api.onchange('company_id')
+ def onchange_company_id(self):
+ current_year = fields.Date.today().year
+ self.reference_cold = False
+ if self.company_id and self.company_id.name:
+ company_name = self.company_id.name
+ prefix_map = {
+ '集团本部': '穗天投',
+ '天河粮储': '穗天粮',
+ '天河物管': '穗天物'
+ }
+ prefix = prefix_map.get(company_name)
+ if not prefix:
+ return
+ # 构建查询条件:同公司 + 同一年份的文号
+ year_str = f"【{current_year}】"
+ domain = [
+ ('company_id', '=', self.company_id.id),
+ ('reference_cold', 'like', f"{prefix}{year_str}%")
+ ]
+ last_record = self.search(domain, order='reference_cold desc', limit=1)
+ # 计算下一个序号(格式化为3位数字:001、002...)
+ if last_record and last_record.reference_cold:
+ # 从现有文号中提取数字部分(如从"穗天物【2025】003号"提取"003")
+ try:
+ # 截取序号部分(假设格式固定为"前缀【年份】序号号")
+ seq_str = last_record.reference_cold.split(year_str)[1].rsplit('号', 1)[0]
+ last_seq = int(seq_str)
+ next_seq = last_seq + 1
+ except (IndexError, ValueError):
+ next_seq = 1
+ else:
+ next_seq = 1
+ seq_str = f"{next_seq:03d}"
+ self.reference_cold = f"{prefix}{year_str}{seq_str}号"
def supervising_button(self):
return {
diff --git a/yuthon_official/models/yuthon_official_labor.py b/yuthon_official/models/yuthon_official_labor.py
index a4a77c64d..aecd7b19e 100644
--- a/yuthon_official/models/yuthon_official_labor.py
+++ b/yuthon_official/models/yuthon_official_labor.py
@@ -11,30 +11,71 @@ class YuthonOfficialLabor(models.Model):
name = fields.Char(string="名称")
code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('official_code'))
- official_type_id = fields.Many2one('official.type', string="公文种类")
- reference_cold = fields.Integer(string="公文字号")
+ official_type_id = fields.Many2one('official.type', string="文件类型")
+ reference_cold = fields.Char(string="发文字号")
major_event_category = fields.Integer(string="重大事项所属类别")
remarks = fields.Char(string="备注事项")
- main_text = fields.Text(string='正文')
- main_flats = fields.Char(string="主送")
- copy_flats = fields.Char(string="抄送")
+ main_text = fields.Text(string='文件内容')
+ main_flats = fields.Char(string="主送单位")
+ copy_flats = fields.Char(string="抄送单位")
servings_number = fields.Integer(string="份数")
- date = fields.Datetime(string="日期", default=fields.Datetime.now)
+ date = fields.Datetime(string="拟稿日期", default=fields.Datetime.now)
statu = fields.Selection([('drft', '草稿'), ('going', '执行中'), ('cancel', '已取消'), ('done', '已完成')],
string="状态", default='drft')
+ secret_level = fields.Selection([('normal', '一般'), ('urgent', '秘密'), ('secret', '机密'), ('so_secret', '绝密')],
+ string="密级")
deadline = fields.Datetime(string="办理期限")
red_suit = fields.Char(string="套红")
- users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user)
- department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门")
- company_id = fields.Many2one(related="users_id.employee_id.company_id", string="公司", store=True)
+ users_id = fields.Many2one('res.users', string="拟稿人", default=lambda self: self.env.user)
+ department_id = fields.Many2one(related='users_id.employee_id.department_id', string="拟稿部门")
+ company_id = fields.Many2one('res.company', string="公司前缀")
official_documents_ids = fields.Many2many('ir.attachment', string="附件")
urgency_level = fields.Selection([('normal', '一般'), ('urgent', '紧急'), ('extra_urgent', '特急')], default='normal'
,string="紧急程度")
active = fields.Boolean('Active', default=True, tracking=True)
work_end = fields.Boolean(string="结束")
+ is_meet = fields.Boolean(string="是否上会")
+ issues_result = fields.Html(string="会议结果")
+ related_issues_id = fields.Many2one('issue.library', string="关联议题")
def _get_default_name_title(self):
return self._description if self._description else self._name
name_title = fields.Char(default=_get_default_name_title)
- self_users_ids = fields.Many2many('res.users', string="当前经办人", default=lambda self: [(6, 0, [self.env.user.id])])
\ No newline at end of file
+ self_users_ids = fields.Many2many('res.users', string="当前经办人", default=lambda self: [(6, 0, [self.env.user.id])])
+
+ @api.onchange('company_id')
+ def onchange_company_id(self):
+ current_year = fields.Date.today().year
+ self.reference_cold = False
+ if self.company_id and self.company_id.name:
+ company_name = self.company_id.name
+ prefix_map = {
+ '集团本部': '穗天投',
+ '天河粮储': '穗天粮',
+ '天河物管': '穗天物'
+ }
+ prefix = prefix_map.get(company_name)
+ if not prefix:
+ return
+ # 构建查询条件:同公司 + 同一年份的文号
+ year_str = f"【{current_year}】"
+ domain = [
+ ('company_id', '=', self.company_id.id),
+ ('reference_cold', 'like', f"{prefix}{year_str}%")
+ ]
+ last_record = self.search(domain, order='reference_cold desc', limit=1)
+ # 计算下一个序号(格式化为3位数字:001、002...)
+ if last_record and last_record.reference_cold:
+ # 从现有文号中提取数字部分(如从"穗天物【2025】003号"提取"003")
+ try:
+ # 截取序号部分(假设格式固定为"前缀【年份】序号号")
+ seq_str = last_record.reference_cold.split(year_str)[1].rsplit('号', 1)[0]
+ last_seq = int(seq_str)
+ next_seq = last_seq + 1
+ except (IndexError, ValueError):
+ next_seq = 1
+ else:
+ next_seq = 1
+ seq_str = f"{next_seq:03d}"
+ self.reference_cold = f"{prefix}{year_str}{seq_str}号"
\ No newline at end of file
diff --git a/yuthon_official/models/yuthon_official_party.py b/yuthon_official/models/yuthon_official_party.py
index 6d156f0f8..4c3a80b2b 100644
--- a/yuthon_official/models/yuthon_official_party.py
+++ b/yuthon_official/models/yuthon_official_party.py
@@ -10,27 +10,26 @@ class YuthonOfficialParty(models.Model):
_rec_name = 'name'
name = fields.Char(string="名称")
- users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user)
- department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门")
- company_id = fields.Many2one(related="users_id.employee_id.company_id", string="公司", store=True)
+ users_id = fields.Many2one('res.users', string="拟稿人", default=lambda self: self.env.user)
+ department_id = fields.Many2one(related='users_id.employee_id.department_id', string="拟稿部门")
+ company_id = fields.Many2one('res.company', string="公司前缀")
code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('official_code'))
- official_type_id = fields.Many2one('official.type', string="公文种类")
+ official_type_id = fields.Many2one('official.type', string="文件类型")
# official_type = fields.Selection([('go', '发文'), ('come', '收文')], string="公文类型")
- reference_cold = fields.Integer(string="公文字号")
+ reference_cold = fields.Char(string="发文字号")
major_event_category = fields.Integer(string="重大事项所属类别")
# official_partner_id = fields.Many2one('official.partner', string="来文单位")
remarks = fields.Char(string="备注事项")
- main_text = fields.Text(string='正文')
+ main_text = fields.Text(string='文件内容')
# come_file_id = fields.Char(string="来文编号")
# incoming_file_id = fields.Char(string="收文编号")
- main_flats = fields.Char(string="主送")
- copy_flats = fields.Char(string="抄送")
+ main_flats = fields.Char(string="主送单位")
+ copy_flats = fields.Char(string="抄送单位")
servings_number = fields.Integer(string="份数")
urgency_level = fields.Selection([('normal', '一般'), ('urgent', '紧急'), ('extra_urgent', '特急')], string="紧急程度", default='normal')
secret_level = fields.Selection([('normal', '一般'), ('urgent', '秘密'), ('secret', '机密'), ('so_secret', '绝密')],
string="密级")
- date = fields.Datetime(string="日期", default=fields.Datetime.now)
- department_id = fields.Many2one('hr.department', string="申请人部门")
+ date = fields.Datetime(string="拟稿日期", default=fields.Datetime.now)
statu = fields.Selection([('drft', '草稿'), ('going', '执行中'), ('cancel', '已取消'), ('done', '已完成')],
string="状态", default='drft')
deadline = fields.Datetime(string="办理期限")
@@ -38,9 +37,48 @@ class YuthonOfficialParty(models.Model):
official_documents_ids = fields.Many2many('documents.document', string="公文相关文件")
active = fields.Boolean('Active', default=True, tracking=True)
work_end = fields.Boolean(string="结束")
+ is_meet = fields.Boolean(string="是否上会")
+ issues_result = fields.Html(string="会议结果")
+ related_issues_id = fields.Many2one('issue.library', string="关联议题")
def _get_default_name_title(self):
return self._description if self._description else self._name
name_title = fields.Char(default=_get_default_name_title)
- self_users_ids = fields.Many2many('res.users', string="当前经办人", default=lambda self: [(6, 0, [self.env.user.id])])
\ No newline at end of file
+ self_users_ids = fields.Many2many('res.users', string="当前经办人", default=lambda self: [(6, 0, [self.env.user.id])])
+
+ @api.onchange('company_id')
+ def onchange_company_id(self):
+ current_year = fields.Date.today().year
+ self.reference_cold = False
+ if self.company_id and self.company_id.name:
+ company_name = self.company_id.name
+ prefix_map = {
+ '集团本部': '穗天投',
+ '天河粮储': '穗天粮',
+ '天河物管': '穗天物'
+ }
+ prefix = prefix_map.get(company_name)
+ if not prefix:
+ return
+ # 构建查询条件:同公司 + 同一年份的文号
+ year_str = f"【{current_year}】"
+ domain = [
+ ('company_id', '=', self.company_id.id),
+ ('reference_cold', 'like', f"{prefix}{year_str}%")
+ ]
+ last_record = self.search(domain, order='reference_cold desc', limit=1)
+ # 计算下一个序号(格式化为3位数字:001、002...)
+ if last_record and last_record.reference_cold:
+ # 从现有文号中提取数字部分(如从"穗天物【2025】003号"提取"003")
+ try:
+ # 截取序号部分(假设格式固定为"前缀【年份】序号号")
+ seq_str = last_record.reference_cold.split(year_str)[1].rsplit('号', 1)[0]
+ last_seq = int(seq_str)
+ next_seq = last_seq + 1
+ except (IndexError, ValueError):
+ next_seq = 1
+ else:
+ next_seq = 1
+ seq_str = f"{next_seq:03d}"
+ self.reference_cold = f"{prefix}{year_str}{seq_str}号"
\ No newline at end of file
diff --git a/yuthon_official/views/yuthon_official_labor_views.xml b/yuthon_official/views/yuthon_official_labor_views.xml
index b63181279..ee5a17bfd 100644
--- a/yuthon_official/views/yuthon_official_labor_views.xml
+++ b/yuthon_official/views/yuthon_official_labor_views.xml
@@ -6,9 +6,9 @@
+
-
@@ -25,41 +25,57 @@
invisible="urgency_level != 'urgent'"/>
-
+
-
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
-
-
+
-
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/yuthon_official/views/yuthon_official_party_views.xml b/yuthon_official/views/yuthon_official_party_views.xml
index 95572a9f9..7a29c3827 100644
--- a/yuthon_official/views/yuthon_official_party_views.xml
+++ b/yuthon_official/views/yuthon_official_party_views.xml
@@ -6,9 +6,9 @@
+
-
@@ -28,14 +28,19 @@
invisible="urgency_level != 'urgent'"/>
-
+
-
+
+
+
+
+
+
@@ -48,28 +53,38 @@
-
-
-
+
+
+
+
+
+
+
+
-
-
+
-
+
-
-
+
-
-
-
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/yuthon_official/views/yuthon_official_views.xml b/yuthon_official/views/yuthon_official_views.xml
index 16516b626..fb682168b 100644
--- a/yuthon_official/views/yuthon_official_views.xml
+++ b/yuthon_official/views/yuthon_official_views.xml
@@ -6,6 +6,7 @@
+
@@ -57,13 +58,15 @@
-
+
+
+