党费工作台
This commit is contained in:
@@ -319,6 +319,22 @@ class KsDashboardNinjaBoard(models.Model):
|
||||
:param item_id: item object
|
||||
:return: object with formatted item data
|
||||
"""
|
||||
# 检查是否是党费卡片,如果当前用户不是党员则隐藏
|
||||
if rec.ks_model_name == 'yuthon.salary.party':
|
||||
current_user = self.env.user
|
||||
employee = self.env['hr.employee'].search([('user_id', '=', current_user.id)], limit=1)
|
||||
if employee and employee.political_aspects != 'cpc_dang':
|
||||
# 返回空数据,前端不会显示该卡片
|
||||
return {
|
||||
'id': rec.id,
|
||||
'name': rec.name,
|
||||
'ks_record_count': 0,
|
||||
'ks_chart_data': [],
|
||||
'ks_kpi_data': [],
|
||||
'ks_list_view_data': [],
|
||||
'hide_item': True,
|
||||
}
|
||||
|
||||
try:
|
||||
ks_precision = self.sudo().env.ref('ks_dashboard_ninja.ks_dashboard_ninja_precision')
|
||||
ks_precision_digits = ks_precision.digits
|
||||
|
||||
@@ -391,7 +391,17 @@ export class KsDashboardNinja extends Component {
|
||||
args: [[item_id], self.ks_dashboard_id, self.ksGetParamsForItemFetch(item_id)],
|
||||
kwargs: { context: self.getContext() }
|
||||
}).then(function (result) {
|
||||
self.ks_dashboard_data.ks_item_data[item_id] = result[item_id];
|
||||
var item_data = result[item_id];
|
||||
// 如果标记为隐藏,则不添加到仪表板
|
||||
if (item_data && item_data.hide_item) {
|
||||
// 从items_ids中移除该item
|
||||
var index = self.ks_dashboard_data.ks_dashboard_items_ids.indexOf(item_id);
|
||||
if (index > -1) {
|
||||
self.ks_dashboard_data.ks_dashboard_items_ids.splice(index, 1);
|
||||
}
|
||||
} else {
|
||||
self.ks_dashboard_data.ks_item_data[item_id] = item_data;
|
||||
}
|
||||
self.state.ks_show_create_layout_option = (Object.keys(self.ks_dashboard_data.ks_item_data).length > 0) && self.ks_dashboard_data.ks_dashboard_manager
|
||||
}));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user