Merge pull request !432 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2024-11-12 10:25:06 +00:00
committed by Gitee
13 changed files with 110 additions and 21 deletions
+1 -1
View File
@@ -737,7 +737,7 @@ msgstr "仪表盘"
#. module: ks_dashboard_ninja
#: model_terms:ir.ui.view,arch_db:ks_dashboard_ninja.item_form_view
msgid "Data"
msgstr "日期"
msgstr "数据"
#. module: ks_dashboard_ninja
#: model_terms:ir.ui.view,arch_db:ks_dashboard_ninja.item_form_view
@@ -4,7 +4,7 @@
<t t-name="ks_dashboard_ninja.dashboardItem">
<!-- <div t-att-class="'ks_item_click ' + container_class " t-att-id="'txGrid-' + props.item.id" >-->
<div t-if="props.item" t-att-class="'ks_item_click ' + container_class " t-att-gs-id="props.item.id"
<div t-if="props.item" t-att-class="container_class" t-att-gs-id="props.item.id"
t-att-gs-x="props?.gridConfig?.x ?? -1" t-att-gs-y="props.gridConfig?.y ?? -1" t-att-gs-w="props.gridConfig?.w ?? 4"
t-att-gs-h="props.gridConfig?.h ?? 2"
t-att-gs-minW="2" t-att-gs-minH="2" >
@@ -22,6 +22,7 @@ export class KsKpi extends Component {
}
setup() {
this.action = useService('action');
this.kpi_data = JSON.parse(this.props.record.ks_kpi_data);
this.count_1 = this.kpi_data[0] ? this.kpi_data[0]?.record_data : undefined;
this.count_2 = this.kpi_data[1] ? this.kpi_data[1]?.record_data : undefined;
@@ -81,4 +82,19 @@ export class KsKpi extends Component {
return mainBodyStyle(rgba_background_color, rgba_font_color, this.props.record).background_style;
}
onClickAction() {
const action = {
name: this.props.record.ks_model_display_name,
type: 'ir.actions.act_window',
res_model: this.props.record.ks_model_name,
// res_id: this.props.dashboard_id,
// context: {'create':false},
domain: this.props.record.ks_domain,
views: [[false, 'tree']],
view_mode: 'tree',
target: 'current',
};
this.action.doAction(action);
}
}
@@ -5,8 +5,8 @@
<t t-name="ks_dashboard_ninja.kpi" >
<t t-set="item" t-value="props?.record"/>
<div class="ks_dashboard_kpi ks_dashboard_custom_srollbar ks_db_kpi_preview"
t-att-class="'ks_dashboarditem_id ks_dashboard_item_hover ' + inner_container_class"
<div class="ks_dashboard_kpi ks_dashboard_custom_srollbar ks_db_kpi_preview" t-on-click="onClickAction"
t-att-class="'ks_dashboarditem_id ks_dashboard_item_hover ks_item_click ' + inner_container_class"
t-att-style="style_main_body">
<div class="ks_dashboard_icon_l5 ">
<t t-if="item.ks_icon_select=='Custom'">
@@ -21,6 +21,10 @@ export class KsTile extends Component {
KsToolBar
}
setup() {
this.action = useService('action');
}
get container_class() {
return "grid-stack-item ui-draggable-disabled ui-resizable-disabled"
@@ -51,4 +55,18 @@ export class KsTile extends Component {
return mainBodyStyle(rgba_background_color, rgba_font_color, this.props.record).background_style;
}
onClickAction() {
this.action.doAction({
name: this.props.record.ks_model_display_name,
type: 'ir.actions.act_window',
res_model: this.props.record.ks_model_name,
// res_id: this.props.dashboard_id,
// context: {'create':false},
domain: this.props.record.ks_domain,
views: [[false, 'tree']],
view_mode: 'tree',
target: 'current',
});
}
}
@@ -5,8 +5,8 @@
<t t-name="ks_dashboard_ninja.tile_layout1" >
<t t-set="item" t-value="props?.record"/>
<!-- <div >-->
<div t-att-id="item.id"
t-att-class="'ks_dashboarditem_id ks_dashboard_item ks_dashboard_item_hover ' + inner_container_class"
<div t-att-id="item.id" t-on-click="onClickAction"
t-att-class="'ks_dashboarditem_id ks_dashboard_item ks_dashboard_item_hover ks_item_click ' + inner_container_class"
t-att-style="style_main_body"
t-att-title="item.ks_info">
<div class="ks_dashboard_item_button_container ks_dropdown_container ks_dashboard_item_header_l6 ks_dashboard_item_header_hover"
@@ -21,6 +21,9 @@ export class KsTODO extends Component {
KsToolBar
}
setup() {
this.action = useService('action');
}
get container_class() {
return "grid-stack-item ui-draggable-disabled ui-resizable-disabled"
@@ -51,4 +54,18 @@ export class KsTODO extends Component {
return mainBodyStyle(rgba_background_color, rgba_font_color, this.props.record).background_style;
}
onClickAction() {
this.action.doAction({
name: this.props.record.ks_model_display_name,
type: 'ir.actions.act_window',
res_model: this.props.record.ks_model_name,
// res_id: this.props.dashboard_id,
// context: {'create':false},
domain: this.props.record.ks_domain,
views: [[false, 'tree']],
view_mode: 'tree',
target: 'current',
});
}
}
@@ -5,8 +5,8 @@
<t t-name="ks_dashboard_ninja.todo" >
<t t-set="item" t-value="props?.record"/>
<!-- <div >-->
<div t-att-id="item.id"
t-att-class="'ks_dashboarditem_id ks_dashboard_item ks_dashboard_item_hover ' + inner_container_class"
<div t-att-id="item.id" t-on-click="onClickAction"
t-att-class="'ks_dashboarditem_id ks_dashboard_item ks_dashboard_item_hover ks_item_click ' + inner_container_class"
t-att-style="style_main_body"
t-att-title="item.ks_info">
<div class="ks_dashboard_item_button_container ks_dropdown_container ks_dashboard_item_header ks_dashboard_item_header_hover"
@@ -18,6 +18,7 @@ export class KsList extends Component {
static components = { KsToolBar };
setup() {
this.action = useService('action');
this.ref = useState({
listData: null
})
@@ -27,4 +28,19 @@ export class KsList extends Component {
})
}
onClickAction(row) {
this.action.doAction({
name: this.props.record.ks_model_display_name,
type: 'ir.actions.act_window',
res_model: this.props.record.ks_model_name,
res_id: row.id,
// context: {'create':false},
domain: this.props.record.ks_domain,
views: [[false, 'form']],
view_mode: 'form',
target: 'current',
});
}
}
@@ -73,6 +73,8 @@
t-att-data-record-id="row['id']" t-att-data-item-id="props.record.id"
t-att-data-list-view-type="list_type"
t-att-data-domain="row['domain']"
t-on-click="() => this.onClickAction(row)"
t-att-class="'ks_item_click '"
class="fa fa-pencil"/>
</td>
</tr>
@@ -81,7 +81,7 @@ export class KsToolBar extends Component {
removeItem() {
this.dialog.add(ConfirmationDialog, {
body: _t('Do you really want to delete this chart?'),
body: _t('确定删除这个图表吗?'),
cancel: () => {},
confirm: () => this.doDelete(),
});
+22 -11
View File
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models
from datetime import date, datetime
from odoo.exceptions import UserError, ValidationError
@@ -63,11 +65,11 @@ class YuthonHrEmployee(models.Model):
new_end_contract_data = fields.Date(string="合同终止日期")
open_start_time = fields.Date(string="参加工作时间")
social_insurance_date = fields.Date(string="缴纳社保日期")
social_insurance_time = fields.Integer(string="社保时长")
social_insurance_time = fields.Char(string="社保时长", compute='_compute_social_insurance_time', store=True)
open_start_time_today = fields.Date(string="工作至今")
interrupt_work_month = fields.Integer(string="中断工作月数")
cumulative_work_month = fields.Integer(string="累计工作月数")
cumulative_work_years = fields.Integer(string="累计工作年限")
cumulative_work_month = fields.Integer(string="累计工作月数", compute='_compute_cumulative_work_month', store=True)
cumulative_work_years = fields.Char(string="累计工作年限")
# 教育
high_degree = fields.Char(string="最高学历")
high_degree2 = fields.Char(string="最高学位")
@@ -149,14 +151,6 @@ class YuthonHrEmployee(models.Model):
"target": "new",
}
@api.onchange('social_insurance_date')
def onchange_insurance_time(self):
for social in self:
if social.social_insurance_date:
social.social_insurance_time = (fields.Datetime.now().date() - social.social_insurance_date).days
else:
social.social_insurance_time = False
@api.depends('entry_date')
def _compute_company_old(self):
"""司龄计算"""
@@ -172,6 +166,23 @@ class YuthonHrEmployee(models.Model):
else:
record.company_old = None
@api.depends('social_insurance_date')
def _compute_cumulative_work_month(self):
for record in self:
if record.social_insurance_time :
today = datetime.now().date()
delta = relativedelta(today, record.social_insurance_date)
record.cumulative_work_month = delta.years * 12 + delta.months
else:
record.cumulative_work_month = 0
@api.depends('cumulative_work_month', 'interrupt_work_month')
def _compute_social_insurance_time(self):
for record in self:
record.social_insurance_time = record.cumulative_work_month - record.interrupt_work_month
if record.social_insurance_time < 0:
record.social_insurance_time = 0
@api.depends('identification_id') # 只依赖身份证号码
def _compute_info(self):
for record in self:
+10 -1
View File
@@ -43,7 +43,16 @@
parent="yuthon_dashboard_setting"
action="spreadsheet_dashboard.spreadsheet_dashboard_action_configuration_dashboards"
sequence="1"/>
<menuitem id="yuthon_ks_dashboard_ninja_board"
name="仪表盘"
parent="yuthon_dashboard_setting"
action="ks_dashboard_ninja.board_form_tree_action_window"
sequence="1"/>
<menuitem id="yuthon_ks_dashboard_ninja_board_layout"
name="仪表板布局"
parent="yuthon_dashboard_setting"
action="ks_dashboard_ninja.layout_tree_action_window"
sequence="3"/>
<!-- 工作流程 -->
<!-- <menuitem id="menu_soong_workflow_root_board"-->