From 55e0f2f5f840c4d2bd3909b682aec09f9f18db38 Mon Sep 17 00:00:00 2001 From: Admin Date: Thu, 11 Dec 2025 13:41:01 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E6=98=8E=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/src/js/financial.js | 32 ++++++++++- .../static/src/js/information.js | 30 ++++++++++ .../static/src/xml/financial.xml | 57 +++++++++++-------- .../static/src/xml/information.xml | 7 ++- yuthon_account_report/views/custom.xml | 54 +++++++++++++++--- .../views/yuthon_hr_employee_views.xml | 2 +- 6 files changed, 147 insertions(+), 35 deletions(-) diff --git a/yuthon_account_report/static/src/js/financial.js b/yuthon_account_report/static/src/js/financial.js index 9838416bc..d8e307ade 100644 --- a/yuthon_account_report/static/src/js/financial.js +++ b/yuthon_account_report/static/src/js/financial.js @@ -1,7 +1,7 @@ /** @odoo-module **/ import {registry} from "@web/core/registry"; -import {useService} from "@web/core/utils/hooks"; +import { useService } from "@web/core/utils/hooks"; const {Component, useState, onWillStart, onMounted} = owl; @@ -409,6 +409,36 @@ class FinancialPage extends Component { } + // 数据点击事件 + onDataCellClick(params){ + const queryParams = { + project_id: params.row.id, + group_id: params.group.id, + date: params.filters.date, + }; + let domain = [] + if(queryParams.date){ + domain.push(['sheet_id.create_date', '<=', queryParams.date]) + } + if(queryParams.group_id){ + domain.push(['sheet_id.company_id.id', '=', queryParams.group_id]) + } + if(queryParams.project_id){ + domain.push(['collection_id', '=', queryParams.project_id]) + } + this.action.doAction({ + type: 'ir.actions.act_window', + res_model: 'financial.sheet.line', + name: '提报数据明细', + view_mode: 'tree', + view_type: 'tree', + views: [[false, 'tree']], + target: 'new', // 以弹窗形式打开 + domain: domain, + context: {}, + }) + } + // 重置筛选条件 onReset() { this.state.filters = { diff --git a/yuthon_account_report/static/src/js/information.js b/yuthon_account_report/static/src/js/information.js index cf2e171e5..fd4aec66d 100644 --- a/yuthon_account_report/static/src/js/information.js +++ b/yuthon_account_report/static/src/js/information.js @@ -260,6 +260,36 @@ export class FinancialSinglePage extends Component { this.notification.add("使用演示数据", { type: "info" }); } + // 数据点击事件 + onDataCellClick(params){ + const queryParams = { + project_id: params.row.id, + group_id: params.group.id, + date: params.filters.date, + }; + let domain = [] + if(queryParams.date){ + domain.push(['summary_id.create_date', '<=', queryParams.date]) + } + if(queryParams.group_id && Number.isFinite(queryParams.group_id)){ + domain.push(['summary_id.company_id.id', '=', queryParams.group_id]) + } + if(queryParams.project_id){ + domain.push(['table_id', '=', queryParams.project_id]) + } + this.action.doAction({ + type: 'ir.actions.act_window', + res_model: 'information.summary.line', + name: '信息汇总明细', + view_mode: 'tree', + view_type: 'tree', + views: [[false, 'tree']], + target: 'new', // 以弹窗形式打开 + domain: domain, + context: {}, + }) + } + fillExampleData() { // 填充一些示例数据以便预览 const rows = this.state.tableData.rows; diff --git a/yuthon_account_report/static/src/xml/financial.xml b/yuthon_account_report/static/src/xml/financial.xml index 3a923dbb7..a44013689 100644 --- a/yuthon_account_report/static/src/xml/financial.xml +++ b/yuthon_account_report/static/src/xml/financial.xml @@ -12,10 +12,10 @@
@@ -23,9 +23,9 @@
@@ -50,19 +50,19 @@
- - + +
@@ -125,7 +127,8 @@ - +
@@ -155,9 +158,14 @@
- + - + @@ -169,7 +177,8 @@ - +

暂无数据

diff --git a/yuthon_account_report/static/src/xml/information.xml b/yuthon_account_report/static/src/xml/information.xml index 13338651d..ebec09c7d 100644 --- a/yuthon_account_report/static/src/xml/information.xml +++ b/yuthon_account_report/static/src/xml/information.xml @@ -160,7 +160,12 @@ - + diff --git a/yuthon_account_report/views/custom.xml b/yuthon_account_report/views/custom.xml index fd9cf7032..741ab03bd 100644 --- a/yuthon_account_report/views/custom.xml +++ b/yuthon_account_report/views/custom.xml @@ -11,15 +11,53 @@ - - - - + - - - - + + + + financial.sheet.line.tree + financial.sheet.line + + + + + + + + + + + + 财务数据表收集明细 + financial.sheet.line + tree + + + + + information.summary.line.tree + information.summary.line + + + + + + + + + + + 信息汇总收集明细 + information.summary.line + tree + diff --git a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml index c7584139e..d4ef83526 100644 --- a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml +++ b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml @@ -695,4 +695,4 @@ - \ No newline at end of file + From 322a6373d64549d8d8820766487208d373d7bc07 Mon Sep 17 00:00:00 2001 From: Admin Date: Thu, 11 Dec 2025 13:41:01 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E6=98=8E=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/src/js/financial.js | 32 ++++++++++- .../static/src/js/information.js | 30 ++++++++++ .../static/src/xml/financial.xml | 57 +++++++++++-------- .../static/src/xml/information.xml | 7 ++- yuthon_account_report/views/custom.xml | 54 +++++++++++++++--- .../views/yuthon_hr_employee_views.xml | 2 +- 6 files changed, 147 insertions(+), 35 deletions(-) diff --git a/yuthon_account_report/static/src/js/financial.js b/yuthon_account_report/static/src/js/financial.js index 9838416bc..d8e307ade 100644 --- a/yuthon_account_report/static/src/js/financial.js +++ b/yuthon_account_report/static/src/js/financial.js @@ -1,7 +1,7 @@ /** @odoo-module **/ import {registry} from "@web/core/registry"; -import {useService} from "@web/core/utils/hooks"; +import { useService } from "@web/core/utils/hooks"; const {Component, useState, onWillStart, onMounted} = owl; @@ -409,6 +409,36 @@ class FinancialPage extends Component { } + // 数据点击事件 + onDataCellClick(params){ + const queryParams = { + project_id: params.row.id, + group_id: params.group.id, + date: params.filters.date, + }; + let domain = [] + if(queryParams.date){ + domain.push(['sheet_id.create_date', '<=', queryParams.date]) + } + if(queryParams.group_id){ + domain.push(['sheet_id.company_id.id', '=', queryParams.group_id]) + } + if(queryParams.project_id){ + domain.push(['collection_id', '=', queryParams.project_id]) + } + this.action.doAction({ + type: 'ir.actions.act_window', + res_model: 'financial.sheet.line', + name: '提报数据明细', + view_mode: 'tree', + view_type: 'tree', + views: [[false, 'tree']], + target: 'new', // 以弹窗形式打开 + domain: domain, + context: {}, + }) + } + // 重置筛选条件 onReset() { this.state.filters = { diff --git a/yuthon_account_report/static/src/js/information.js b/yuthon_account_report/static/src/js/information.js index cf2e171e5..fd4aec66d 100644 --- a/yuthon_account_report/static/src/js/information.js +++ b/yuthon_account_report/static/src/js/information.js @@ -260,6 +260,36 @@ export class FinancialSinglePage extends Component { this.notification.add("使用演示数据", { type: "info" }); } + // 数据点击事件 + onDataCellClick(params){ + const queryParams = { + project_id: params.row.id, + group_id: params.group.id, + date: params.filters.date, + }; + let domain = [] + if(queryParams.date){ + domain.push(['summary_id.create_date', '<=', queryParams.date]) + } + if(queryParams.group_id && Number.isFinite(queryParams.group_id)){ + domain.push(['summary_id.company_id.id', '=', queryParams.group_id]) + } + if(queryParams.project_id){ + domain.push(['table_id', '=', queryParams.project_id]) + } + this.action.doAction({ + type: 'ir.actions.act_window', + res_model: 'information.summary.line', + name: '信息汇总明细', + view_mode: 'tree', + view_type: 'tree', + views: [[false, 'tree']], + target: 'new', // 以弹窗形式打开 + domain: domain, + context: {}, + }) + } + fillExampleData() { // 填充一些示例数据以便预览 const rows = this.state.tableData.rows; diff --git a/yuthon_account_report/static/src/xml/financial.xml b/yuthon_account_report/static/src/xml/financial.xml index 3a923dbb7..a44013689 100644 --- a/yuthon_account_report/static/src/xml/financial.xml +++ b/yuthon_account_report/static/src/xml/financial.xml @@ -12,10 +12,10 @@
@@ -23,9 +23,9 @@
@@ -50,19 +50,19 @@
- - + +
@@ -125,7 +127,8 @@ - +
@@ -155,9 +158,14 @@
- + - + @@ -169,7 +177,8 @@ - +

暂无数据

diff --git a/yuthon_account_report/static/src/xml/information.xml b/yuthon_account_report/static/src/xml/information.xml index 13338651d..ebec09c7d 100644 --- a/yuthon_account_report/static/src/xml/information.xml +++ b/yuthon_account_report/static/src/xml/information.xml @@ -160,7 +160,12 @@ - + diff --git a/yuthon_account_report/views/custom.xml b/yuthon_account_report/views/custom.xml index fd9cf7032..741ab03bd 100644 --- a/yuthon_account_report/views/custom.xml +++ b/yuthon_account_report/views/custom.xml @@ -11,15 +11,53 @@ - - - - + - - - - + + + + financial.sheet.line.tree + financial.sheet.line + + + + + + + + + + + + 财务数据表收集明细 + financial.sheet.line + tree + + + + + information.summary.line.tree + information.summary.line + + + + + + + + + + + 信息汇总收集明细 + information.summary.line + tree + diff --git a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml index c7584139e..d4ef83526 100644 --- a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml +++ b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml @@ -695,4 +695,4 @@ - \ No newline at end of file + From a711a6f813cdb7217afcd1c1227e6a91c9024336 Mon Sep 17 00:00:00 2001 From: Admin Date: Thu, 11 Dec 2025 13:41:01 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E6=98=8E=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/src/js/financial.js | 32 ++++++++++- .../static/src/js/information.js | 30 ++++++++++ .../static/src/xml/financial.xml | 57 +++++++++++-------- .../static/src/xml/information.xml | 7 ++- yuthon_account_report/views/custom.xml | 54 +++++++++++++++--- .../views/yuthon_hr_employee_views.xml | 2 +- 6 files changed, 147 insertions(+), 35 deletions(-) diff --git a/yuthon_account_report/static/src/js/financial.js b/yuthon_account_report/static/src/js/financial.js index 9838416bc..d8e307ade 100644 --- a/yuthon_account_report/static/src/js/financial.js +++ b/yuthon_account_report/static/src/js/financial.js @@ -1,7 +1,7 @@ /** @odoo-module **/ import {registry} from "@web/core/registry"; -import {useService} from "@web/core/utils/hooks"; +import { useService } from "@web/core/utils/hooks"; const {Component, useState, onWillStart, onMounted} = owl; @@ -409,6 +409,36 @@ class FinancialPage extends Component { } + // 数据点击事件 + onDataCellClick(params){ + const queryParams = { + project_id: params.row.id, + group_id: params.group.id, + date: params.filters.date, + }; + let domain = [] + if(queryParams.date){ + domain.push(['sheet_id.create_date', '<=', queryParams.date]) + } + if(queryParams.group_id){ + domain.push(['sheet_id.company_id.id', '=', queryParams.group_id]) + } + if(queryParams.project_id){ + domain.push(['collection_id', '=', queryParams.project_id]) + } + this.action.doAction({ + type: 'ir.actions.act_window', + res_model: 'financial.sheet.line', + name: '提报数据明细', + view_mode: 'tree', + view_type: 'tree', + views: [[false, 'tree']], + target: 'new', // 以弹窗形式打开 + domain: domain, + context: {}, + }) + } + // 重置筛选条件 onReset() { this.state.filters = { diff --git a/yuthon_account_report/static/src/js/information.js b/yuthon_account_report/static/src/js/information.js index cf2e171e5..fd4aec66d 100644 --- a/yuthon_account_report/static/src/js/information.js +++ b/yuthon_account_report/static/src/js/information.js @@ -260,6 +260,36 @@ export class FinancialSinglePage extends Component { this.notification.add("使用演示数据", { type: "info" }); } + // 数据点击事件 + onDataCellClick(params){ + const queryParams = { + project_id: params.row.id, + group_id: params.group.id, + date: params.filters.date, + }; + let domain = [] + if(queryParams.date){ + domain.push(['summary_id.create_date', '<=', queryParams.date]) + } + if(queryParams.group_id && Number.isFinite(queryParams.group_id)){ + domain.push(['summary_id.company_id.id', '=', queryParams.group_id]) + } + if(queryParams.project_id){ + domain.push(['table_id', '=', queryParams.project_id]) + } + this.action.doAction({ + type: 'ir.actions.act_window', + res_model: 'information.summary.line', + name: '信息汇总明细', + view_mode: 'tree', + view_type: 'tree', + views: [[false, 'tree']], + target: 'new', // 以弹窗形式打开 + domain: domain, + context: {}, + }) + } + fillExampleData() { // 填充一些示例数据以便预览 const rows = this.state.tableData.rows; diff --git a/yuthon_account_report/static/src/xml/financial.xml b/yuthon_account_report/static/src/xml/financial.xml index 3a923dbb7..a44013689 100644 --- a/yuthon_account_report/static/src/xml/financial.xml +++ b/yuthon_account_report/static/src/xml/financial.xml @@ -12,10 +12,10 @@
@@ -23,9 +23,9 @@
@@ -50,19 +50,19 @@
- - + +
@@ -125,7 +127,8 @@ - +
@@ -155,9 +158,14 @@
- + - + @@ -169,7 +177,8 @@ - +

暂无数据

diff --git a/yuthon_account_report/static/src/xml/information.xml b/yuthon_account_report/static/src/xml/information.xml index 13338651d..ebec09c7d 100644 --- a/yuthon_account_report/static/src/xml/information.xml +++ b/yuthon_account_report/static/src/xml/information.xml @@ -160,7 +160,12 @@ - + diff --git a/yuthon_account_report/views/custom.xml b/yuthon_account_report/views/custom.xml index fd9cf7032..741ab03bd 100644 --- a/yuthon_account_report/views/custom.xml +++ b/yuthon_account_report/views/custom.xml @@ -11,15 +11,53 @@ - - - - + - - - - + + + + financial.sheet.line.tree + financial.sheet.line + + + + + + + + + + + + 财务数据表收集明细 + financial.sheet.line + tree + + + + + information.summary.line.tree + information.summary.line + + + + + + + + + + + 信息汇总收集明细 + information.summary.line + tree + diff --git a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml index c7584139e..d4ef83526 100644 --- a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml +++ b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml @@ -695,4 +695,4 @@ - \ No newline at end of file + From b76e91787000f868b6c10b29df40df0a14b79ca4 Mon Sep 17 00:00:00 2001 From: Admin Date: Sat, 20 Dec 2025 17:02:11 +0800 Subject: [PATCH 4/4] =?UTF-8?q?token=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/applet_attendance.py | 8 ++- yuthon_hr_attendance/until/base.py | 72 +++++++++++++++++++ 2 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 yuthon_hr_attendance/until/base.py diff --git a/yuthon_hr_attendance/controllers/applet_attendance.py b/yuthon_hr_attendance/controllers/applet_attendance.py index c606a2361..da3103d48 100644 --- a/yuthon_hr_attendance/controllers/applet_attendance.py +++ b/yuthon_hr_attendance/controllers/applet_attendance.py @@ -6,6 +6,7 @@ from datetime import datetime, date import logging from geopy.distance import geodesic from datetime import timedelta +from ..until import base import json import requests @@ -56,17 +57,22 @@ class AppletAttendance(Controller): return json.dumps(return_data) user_id = request.env['res.users'].sudo().browse(uid) + # 创建token + token = base.set_token(user_id.id, user_id.name) employee_id = user_id.with_company(user_id.company_id.id).employee_id applet_security_setting_ids = request.env['applet.security'].search( [('employee_id', '=', employee_id.id)]).applet_security_setting_ids access_list = [access.name for access in applet_security_setting_ids] # 查询一下用户的手机号phone, 承租人关联的 - data = {'name': employee_id.name, 'id': user_id.id, 'access': access_list, 'phone': employee_id.mobile_phone} + data = {'name': employee_id.name, 'id': user_id.id, 'access': access_list, 'phone': employee_id.mobile_phone, 'token': token} _logger.info(f"接口人{employee_id.name}权限{access_list}__用户id: {user_id}________") return_data = {'data': data, 'code': 200, 'message': ''} return json.dumps(return_data) + # 验证token就在url下面加这个装饰器 + # @base.authorize + @route('/yuthon/att/today', methods=['POST'], type='http', auth='none', cors='*', csrf=False) def apple_yuthon_att_today(self, **kw): """ diff --git a/yuthon_hr_attendance/until/base.py b/yuthon_hr_attendance/until/base.py new file mode 100644 index 000000000..a06f6a303 --- /dev/null +++ b/yuthon_hr_attendance/until/base.py @@ -0,0 +1,72 @@ +import datetime +import functools +import hashlib +import jwt +import logging +from odoo.http import request + + +def logutils(): + # 创建日志的记录等级 + logger = logging.getLogger(__name__) + logger.setLevel(logging.INFO) + return logger + + +_logging = logutils() + + +def set_token(user_id, user_name): + '''创建jwt token''' + payload = { + # 过期时间 + 'exp': datetime.datetime.utcnow() + datetime.timedelta(days=1), + # token签发者 + 'iss': 'system', + # token创建时间 + 'iat': datetime.datetime.utcnow(), + 'data': { + 'id': user_id, + 'name': user_name, + } + } + key = hashlib.md5('yuthon'.encode('utf-8')).hexdigest() + token = jwt.encode(payload=payload, key=key, algorithm="HS256") + return token + + +def check_token(token): + '''验证jwt token''' + try: + key = hashlib.md5('yuthon'.encode('utf-8')).hexdigest() + payload = jwt.decode(jwt=token, key=key, algorithms="HS256") + data = payload.get('data') + if data and data.get('id'): + return payload + except Exception as e: + _logging.error(str(e)) + return None + + +# token登录验证装饰器 +def authorize(func): + @functools.wraps(func) + def wrapper(*args, **kw): + token = request.httprequest.headers.get('Authorization') + if not token: + raise ValueError('用户登录异常') + + payload = check_token(token=token) + if not payload: + raise ValueError('用户登录异常') + data = payload.get('data') + user = request.env.user.search([('id', '=', data.get('id'))]) + if user and user.login == data.get('name'): + request.env.uid = user.id + request.env.user = user + else: + raise ValueError('用户登录异常') + return func(*args, **kw) + + return wrapper +