Merge branch 'dev' of gitee.com:jinan-pengyusen-data/gzth into dev
This commit is contained in:
@@ -11,7 +11,7 @@ import { session } from "@web/session";
|
||||
|
||||
export class CalculaterSh extends Component {
|
||||
static template = "CalculatorTemplate";
|
||||
|
||||
static props = ["*"];
|
||||
setup() {
|
||||
this.orm = useService("orm");
|
||||
this.search_sh_enable_calculator_mode()
|
||||
@@ -22,9 +22,9 @@ export class CalculaterSh extends Component {
|
||||
}
|
||||
|
||||
onClickCalculator() {
|
||||
if($('.calculator').length > 0){
|
||||
if ($('.calculator').length > 0) {
|
||||
$(".sh_calc_results").html("");
|
||||
}else{
|
||||
} else {
|
||||
// render template
|
||||
var qweb_data = `
|
||||
<script type="text/javascript" src="/sh_backmate_theme_adv_enterprise/static/src/js/calculate.js"></script>
|
||||
@@ -69,16 +69,16 @@ export class CalculaterSh extends Component {
|
||||
</div>`
|
||||
$(".sh_calc_results").html(qweb_data);
|
||||
}
|
||||
if($('.sh_calc_util').hasClass('active')){
|
||||
if ($('.sh_calc_util').hasClass('active')) {
|
||||
$('.sh_calc_util').removeClass('active')
|
||||
}else{
|
||||
} else {
|
||||
$('.sh_calc_util').addClass('active')
|
||||
}
|
||||
// close other popup
|
||||
$('.sh_user_language_list_cls').css("display","none")
|
||||
$('.sh_wqm_quick_menu_submenu_list_cls').css("display","none")
|
||||
$('.sh_user_language_list_cls').css("display", "none")
|
||||
$('.sh_wqm_quick_menu_submenu_list_cls').css("display", "none")
|
||||
$('.todo_layout').removeClass("sh_theme_model");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
registry.category("systray").add("sh_entmate_theme.calculater_sh", { Component: CalculaterSh }, { sequence: 25 });
|
||||
|
||||
@@ -13,7 +13,7 @@ var show_company = false;
|
||||
|
||||
export class GlobalSearchSh extends Component {
|
||||
static template = "sh_backmate_theme_adv_enterprise.GlobalSearch";
|
||||
|
||||
static props = ["*"];
|
||||
setup() {
|
||||
super.setup()
|
||||
this.orm = useService("orm");
|
||||
@@ -22,13 +22,13 @@ export class GlobalSearchSh extends Component {
|
||||
this.sh_enable_gloabl_search_mode = session.sh_enable_gloabl_search_mode
|
||||
this.sidebar_collapse_style = ""
|
||||
onMounted(() => {
|
||||
if ($("input[name='sidebar_collapse_style']:checked").val() == 'collapsed' && $("input[name='search_style']:checked").val() == 'expanded'){
|
||||
$(".sh_search").css("left","80px")
|
||||
if ($("input[name='sidebar_collapse_style']:checked").val() == 'collapsed' && $("input[name='search_style']:checked").val() == 'expanded') {
|
||||
$(".sh_search").css("left", "80px")
|
||||
}
|
||||
else{
|
||||
$(".sh_search").css("left","275px")
|
||||
else {
|
||||
$(".sh_search").css("left", "275px")
|
||||
}
|
||||
if (isMobileOS()){
|
||||
if (isMobileOS()) {
|
||||
$("#topbar_search_icon").css("display", "block");
|
||||
$(".usermenu_search_input2").css("display", "none");
|
||||
$("#topbar_full_search_icon").css("display", "none");
|
||||
@@ -37,28 +37,28 @@ export class GlobalSearchSh extends Component {
|
||||
}
|
||||
|
||||
async _onclick_search_top_bar(event) {
|
||||
const data = await this.orm.searchRead(
|
||||
const data = await this.orm.searchRead(
|
||||
"sh.back.theme.config.settings",
|
||||
[['id', '=', 1]],
|
||||
["search_style"]);
|
||||
if (data) {
|
||||
if (!isMobileOS()) {
|
||||
if (data[0]['search_style'] == 'collapsed') {
|
||||
if ($(".usermenu_search_input").css("display") == 'block') {
|
||||
$(".usermenu_search_input").css("display", "none");
|
||||
} else {
|
||||
$(".usermenu_search_input").css("display", "block");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($(".usermenu_search_input").css("display") == "block") {
|
||||
if (data) {
|
||||
if (!isMobileOS()) {
|
||||
if (data[0]['search_style'] == 'collapsed') {
|
||||
if ($(".usermenu_search_input").css("display") == 'block') {
|
||||
$(".usermenu_search_input").css("display", "none");
|
||||
} else {
|
||||
$(".usermenu_search_input").css("display", "block");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($(".usermenu_search_input").css("display") == "block") {
|
||||
$(".usermenu_search_input").css("display", "none");
|
||||
} else {
|
||||
$(".usermenu_search_input").css("display", "block");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_linkInfo(key) {
|
||||
var original = this._searchableMenus[key];
|
||||
@@ -89,17 +89,17 @@ export class GlobalSearchSh extends Component {
|
||||
[['id', '=', 1]],
|
||||
["search_style"]);
|
||||
if (data) {
|
||||
if (!isMobileOS()) {
|
||||
if (!isMobileOS()) {
|
||||
if (data[0]['search_style'] == 'expanded') {
|
||||
this.$search_input = $(".sh_search_input input.usermenu_search_input2");
|
||||
} else {
|
||||
this.$search_input = $(".sh_search_input input.usermenu_search_input");
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.$search_input = $(".sh_search_input input.usermenu_search_input");
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.$search_input = $(".sh_search_input input.usermenu_search_input");
|
||||
}
|
||||
}
|
||||
var query = this.$search_input.val();
|
||||
if (query === "") {
|
||||
$(".sh_search_container").removeClass("has-results");
|
||||
@@ -109,33 +109,33 @@ export class GlobalSearchSh extends Component {
|
||||
var self = this;
|
||||
|
||||
await jsonrpc("/web/dataset/call_kw/global.search/get_search_result", {
|
||||
model: 'global.search',
|
||||
method: 'get_search_result',
|
||||
args: [[query]],
|
||||
kwargs: {},
|
||||
}).then(function (data) {
|
||||
if (data) {
|
||||
self._searchableMenus = data
|
||||
model: 'global.search',
|
||||
method: 'get_search_result',
|
||||
args: [[query]],
|
||||
kwargs: {},
|
||||
}).then(function (data) {
|
||||
if (data) {
|
||||
self._searchableMenus = data
|
||||
|
||||
var results = Object.keys(self._searchableMenus)
|
||||
$(".sh_search_results").css("display", "block");
|
||||
$(".sh_search_container").toggleClass("has-results", Boolean(results.length));
|
||||
if (results.length > 0) {
|
||||
$(".sh_search_results").css("display", "block");
|
||||
var results = Object.keys(self._searchableMenus)
|
||||
$(".sh_search_results").css("display", "block");
|
||||
$(".sh_search_container").toggleClass("has-results", Boolean(results.length));
|
||||
if (results.length > 0) {
|
||||
$(".sh_search_results").css("display", "block");
|
||||
|
||||
const sh_search_results_html = renderToFragment(
|
||||
'sh_backmate_theme_adv_enterprise.MenuSearchResults', {
|
||||
results : results,
|
||||
widget: self,
|
||||
});
|
||||
const sh_search_results_html = renderToFragment(
|
||||
'sh_backmate_theme_adv_enterprise.MenuSearchResults', {
|
||||
results: results,
|
||||
widget: self,
|
||||
});
|
||||
|
||||
$(".sh_search_results").html(sh_search_results_html);
|
||||
$(".sh_search_results").html(sh_search_results_html);
|
||||
|
||||
} else {
|
||||
$(".sh_entmate_theme_appmenu_div").css("opacity", "1");
|
||||
$(".sh_search_results").css("display", "none");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$(".sh_entmate_theme_appmenu_div").css("opacity", "1");
|
||||
$(".sh_search_results").css("display", "none");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -13,50 +13,50 @@ import { Dropdown } from "@web/core/dropdown/dropdown";
|
||||
import { DropdownItem } from "@web/core/dropdown/dropdown_item";
|
||||
|
||||
export class LanguageTemplate extends Component {
|
||||
static components = { Dropdown };
|
||||
static template = "LanguageTemplate";
|
||||
static components = { Dropdown };
|
||||
static template = "LanguageTemplate";
|
||||
static props = ["*"];
|
||||
setup() {
|
||||
this.actionService = useService("action");
|
||||
this.orm = useService("orm");
|
||||
this.search_sh_enable_language_selection()
|
||||
this.fetch_sh_get_installed_lang()
|
||||
}
|
||||
|
||||
setup() {
|
||||
this.actionService = useService("action");
|
||||
this.orm = useService("orm");
|
||||
this.search_sh_enable_language_selection()
|
||||
this.fetch_sh_get_installed_lang()
|
||||
}
|
||||
async search_sh_enable_language_selection() {
|
||||
this.sh_enable_language_selection = session.sh_enable_language_selection
|
||||
}
|
||||
|
||||
async search_sh_enable_language_selection() {
|
||||
this.sh_enable_language_selection = session.sh_enable_language_selection
|
||||
}
|
||||
async fetch_sh_get_installed_lang() {
|
||||
var self = this;
|
||||
jsonrpc("/web/dataset/call_kw/res.lang/sh_get_installed_lang", {
|
||||
model: 'res.lang',
|
||||
method: 'sh_get_installed_lang',
|
||||
args: [],
|
||||
kwargs: {},
|
||||
}).then(function (languages) {
|
||||
self.languages_list = languages
|
||||
self.selected_lang = session.user_context.lang
|
||||
});
|
||||
}
|
||||
|
||||
async fetch_sh_get_installed_lang() {
|
||||
var self = this;
|
||||
jsonrpc("/web/dataset/call_kw/res.lang/sh_get_installed_lang", {
|
||||
model: 'res.lang',
|
||||
method: 'sh_get_installed_lang',
|
||||
args: [],
|
||||
kwargs: {},
|
||||
}).then(function (languages) {
|
||||
self.languages_list = languages
|
||||
self.selected_lang = session.user_context.lang
|
||||
});
|
||||
}
|
||||
onBeforeOpen() {
|
||||
this.fetch_sh_get_installed_lang();
|
||||
}
|
||||
|
||||
onBeforeOpen() {
|
||||
this.fetch_sh_get_installed_lang();
|
||||
}
|
||||
change_sh_user_lang(e) {
|
||||
var self = this;
|
||||
var lang = e[0]
|
||||
var self = this;
|
||||
|
||||
change_sh_user_lang(e){
|
||||
var self = this;
|
||||
var lang = e[0]
|
||||
var self = this;
|
||||
|
||||
this.orm.write("res.users", [parseInt(session.user_context.uid)], { 'lang': lang }).then(function () {
|
||||
self.actionService.doAction({
|
||||
name: 'Reload Context',
|
||||
type: 'ir.actions.client',
|
||||
tag: 'reload_context',
|
||||
});
|
||||
});
|
||||
}
|
||||
this.orm.write("res.users", [parseInt(session.user_context.uid)], { 'lang': lang }).then(function () {
|
||||
self.actionService.doAction({
|
||||
name: 'Reload Context',
|
||||
type: 'ir.actions.client',
|
||||
tag: 'reload_context',
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
registry.category("systray").add("sh_entmate_theme.language_template", { Component: LanguageTemplate });
|
||||
|
||||
@@ -11,7 +11,7 @@ import { jsonrpc, RPCError } from "@web/core/network/rpc_service";
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
import { Many2XAutocomplete } from "@web/views/fields/relational_utils";
|
||||
import { session } from "@web/session";
|
||||
import { Component,onWillStart,onWillUpdateProps,useState } from "@odoo/owl";
|
||||
import { Component, onWillStart, onWillUpdateProps, useState } from "@odoo/owl";
|
||||
|
||||
|
||||
export class ModelSelection extends Component {
|
||||
@@ -28,6 +28,7 @@ ModelSelection.template = "sh_quick_create.ModelSelection";
|
||||
|
||||
|
||||
export class QuickCreateWebsiteSystray extends Component {
|
||||
static props = ["*"];
|
||||
setup() {
|
||||
this.user = useService("user");
|
||||
this.orm = useService("orm");
|
||||
@@ -43,12 +44,12 @@ export class QuickCreateWebsiteSystray extends Component {
|
||||
this.state = useState({
|
||||
showForm: false,
|
||||
quick_action_data: false,
|
||||
modelId:false,
|
||||
modelname:'Select Model',
|
||||
IsEditMode:false,
|
||||
icon:'fa fa-arrow-right',
|
||||
sequence:1,
|
||||
CurrentEditId:false,
|
||||
modelId: false,
|
||||
modelname: 'Select Model',
|
||||
IsEditMode: false,
|
||||
icon: 'fa fa-arrow-right',
|
||||
sequence: 1,
|
||||
CurrentEditId: false,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -58,7 +59,7 @@ export class QuickCreateWebsiteSystray extends Component {
|
||||
|
||||
AddNewQuickAction() {
|
||||
|
||||
console.log('=======modelname=======.',this.state.modelname)
|
||||
console.log('=======modelname=======.', this.state.modelname)
|
||||
this.state.IsEditMode = false
|
||||
this.state.modelId = false
|
||||
this.state.modelname = 'Select Model'
|
||||
@@ -73,30 +74,30 @@ export class QuickCreateWebsiteSystray extends Component {
|
||||
async getActionItems(props) {
|
||||
jsonrpc("/get/quick/action/data", {}
|
||||
).then((result) => {
|
||||
this.state.quick_action_data=result[0]
|
||||
this.state.modeldata=result[1]
|
||||
this.state.quick_action_data = result[0]
|
||||
this.state.modeldata = result[1]
|
||||
// this.state.quick_action_data=result[0]
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
RecordEditQuickAction(ev,action_id){
|
||||
RecordEditQuickAction(ev, action_id) {
|
||||
ev.stopPropagation();
|
||||
this.state.showForm = !this.state.showForm
|
||||
this.state.CurrentEditId=action_id
|
||||
this.state.CurrentEditId = action_id
|
||||
|
||||
jsonrpc("/get/edit/quick/action/data", {
|
||||
action_id:action_id
|
||||
action_id: action_id
|
||||
}).then((result) => {
|
||||
this.state.modelId=result[0].model_id
|
||||
this.state.modelname=result[0].name
|
||||
this.state.icon=result[0].icon
|
||||
this.state.sequence=result[0].sequence
|
||||
this.state.modelId = result[0].model_id
|
||||
this.state.modelname = result[0].name
|
||||
this.state.icon = result[0].icon
|
||||
this.state.sequence = result[0].sequence
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
async onActionSelectedEdit(ev,action){
|
||||
async onActionSelectedEdit(ev, action) {
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
if (action.model_id !== undefined) {
|
||||
@@ -107,38 +108,38 @@ export class QuickCreateWebsiteSystray extends Component {
|
||||
this.state.modelname = action.name
|
||||
this.state.CurrentEditId = action.id
|
||||
// extra
|
||||
this.state.icon=action.icon
|
||||
this.state.sequence=action.sequence
|
||||
this.state.icon = action.icon
|
||||
this.state.sequence = action.sequence
|
||||
this.state.showForm = !this.state.showForm
|
||||
}
|
||||
|
||||
async onActionSelected(ev,action){
|
||||
async onActionSelected(ev, action) {
|
||||
this.actionService.doAction({
|
||||
type: 'ir.actions.act_window',
|
||||
// name: _t('Manage Questions Setting'),
|
||||
target: 'new',
|
||||
res_model: action.model_name,
|
||||
views: [[false, 'form']],
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
async DeleteNewAction(){
|
||||
async DeleteNewAction() {
|
||||
await jsonrpc("/unlink/quick/action/data", {
|
||||
action_id:this.state.CurrentEditId
|
||||
action_id: this.state.CurrentEditId
|
||||
}).then((result) => {
|
||||
this.state.CurrentEditId=false
|
||||
this.state.CurrentEditId = false
|
||||
this.state.IsEditMode = false
|
||||
this.state.showForm =false
|
||||
this.state.modelId=false
|
||||
this.state.modelname=false
|
||||
this.state.icon='fa fa-car'
|
||||
this.state.sequence=1
|
||||
this.state.showForm = false
|
||||
this.state.modelId = false
|
||||
this.state.modelname = false
|
||||
this.state.icon = 'fa fa-car'
|
||||
this.state.sequence = 1
|
||||
this.getActionItems()
|
||||
});
|
||||
}
|
||||
|
||||
async SaveAction(){
|
||||
async SaveAction() {
|
||||
let isEmpty = false;
|
||||
const formData = {};
|
||||
const inputs = document.querySelectorAll('.sh_input_data');
|
||||
@@ -148,56 +149,56 @@ export class QuickCreateWebsiteSystray extends Component {
|
||||
}
|
||||
formData[input.name] = input.value.trim();
|
||||
});
|
||||
|
||||
if (isEmpty || this.state.modelname=='Select Model') {
|
||||
|
||||
if (isEmpty || this.state.modelname == 'Select Model') {
|
||||
$('#quick_create_errors_msg').removeClass("d-none");
|
||||
}
|
||||
|
||||
// FOR SAVE AFTER EDIT
|
||||
else if(this.state.IsEditMode){
|
||||
else if (this.state.IsEditMode) {
|
||||
formData['model_id'] = this.state.modelId;
|
||||
$('#quick_create_errors_msg').addClass('d-none');
|
||||
jsonrpc("/update/quick/action", {
|
||||
'data': formData,
|
||||
'action_id': this.state.CurrentEditId,
|
||||
}).then((result) => {
|
||||
}).then((result) => {
|
||||
this.getActionItems()
|
||||
});
|
||||
this.state.showForm=false
|
||||
this.state.showForm = false
|
||||
|
||||
}
|
||||
// FOR SAVE WHEN NEW CREATE
|
||||
else {
|
||||
else {
|
||||
formData['model_id'] = this.state.modelId;
|
||||
this.state.modelId=false
|
||||
this.state.modelname=false
|
||||
this.state.modelId = false
|
||||
this.state.modelname = false
|
||||
|
||||
$('#quick_create_errors_msg').addClass('d-none');
|
||||
jsonrpc("/create/quick/action", {
|
||||
'data': formData,
|
||||
}).then((result) => {
|
||||
}).then((result) => {
|
||||
this.getActionItems()
|
||||
});
|
||||
this.state.showForm=false
|
||||
this.state.showForm = false
|
||||
}
|
||||
|
||||
}
|
||||
onUpdateModel(props){
|
||||
if (props){
|
||||
this.state.modelId=props[0].id
|
||||
this.state.modelname=this.state.modeldata[props[0].id]
|
||||
this.props.modelname=this.state.modeldata[props[0].id]
|
||||
onUpdateModel(props) {
|
||||
if (props) {
|
||||
this.state.modelId = props[0].id
|
||||
this.state.modelname = this.state.modeldata[props[0].id]
|
||||
this.props.modelname = this.state.modeldata[props[0].id]
|
||||
}
|
||||
else{
|
||||
this.state.modelId=false
|
||||
this.state.modelname=false
|
||||
this.props.modelname=''
|
||||
else {
|
||||
this.state.modelId = false
|
||||
this.state.modelname = false
|
||||
this.props.modelname = ''
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
QuickCreateWebsiteSystray.template = "sh_quick_create.QuickCreateWebsiteSystray";
|
||||
QuickCreateWebsiteSystray.components = { Dropdown, DropdownItem,ModelSelection };
|
||||
QuickCreateWebsiteSystray.components = { Dropdown, DropdownItem, ModelSelection };
|
||||
// UserMenu.props = {};
|
||||
|
||||
export const systrayItem = {
|
||||
|
||||
@@ -16,236 +16,237 @@ import { onWillStart } from "@odoo/owl";
|
||||
|
||||
export class QuickMenuSh extends Component {
|
||||
static template = "quick.menu";
|
||||
|
||||
setup() {
|
||||
super.setup()
|
||||
this.orm = useService("orm");
|
||||
this.actionService = useService("action");
|
||||
this.action = this.props.action;
|
||||
this.model = this.props.model;
|
||||
this._search_def = $.Deferred();
|
||||
this.onWillStart()
|
||||
this.sh_enable_quick_menu_mode = session.sh_enable_quick_menu_mode
|
||||
static props = ["*"];
|
||||
setup() {
|
||||
super.setup()
|
||||
this.orm = useService("orm");
|
||||
this.actionService = useService("action");
|
||||
this.action = this.props.action;
|
||||
this.model = this.props.model;
|
||||
this._search_def = $.Deferred();
|
||||
this.onWillStart()
|
||||
this.sh_enable_quick_menu_mode = session.sh_enable_quick_menu_mode
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
async render_quick_menulist_actions(quick_menus_html){
|
||||
async render_quick_menulist_actions(quick_menus_html) {
|
||||
|
||||
var self = this
|
||||
var quick_menu_list_html = await renderToFragment(
|
||||
'quick.menulist.actions', {
|
||||
quick_menulist_actions: quick_menus_html,
|
||||
remove_quick_menu: function (ev){
|
||||
self.remove_quick_menu(ev)},
|
||||
_onSearchResultsNavigate : function (ev){
|
||||
self._onSearchResultsNavigate(ev)},
|
||||
});
|
||||
$(".sh_wqm_quick_menu_submenu_list_cls").html(quick_menu_list_html)
|
||||
}
|
||||
var self = this
|
||||
var quick_menu_list_html = await renderToFragment(
|
||||
'quick.menulist.actions', {
|
||||
quick_menulist_actions: quick_menus_html,
|
||||
remove_quick_menu: function (ev) {
|
||||
self.remove_quick_menu(ev)
|
||||
},
|
||||
_onSearchResultsNavigate: function (ev) {
|
||||
self._onSearchResultsNavigate(ev)
|
||||
},
|
||||
});
|
||||
$(".sh_wqm_quick_menu_submenu_list_cls").html(quick_menu_list_html)
|
||||
}
|
||||
|
||||
async render_quick_menulist(quick_menus_html){
|
||||
async render_quick_menulist(quick_menus_html) {
|
||||
|
||||
var self = this
|
||||
var quick_menu_list_html = await renderToFragment(
|
||||
'quick.menulist', {
|
||||
quick_menulist_actions: quick_menus_html,
|
||||
remove_quick_menu: function (ev){
|
||||
self.remove_quick_menu(ev)
|
||||
},
|
||||
var self = this
|
||||
var quick_menu_list_html = await renderToFragment(
|
||||
'quick.menulist', {
|
||||
quick_menulist_actions: quick_menus_html,
|
||||
remove_quick_menu: function (ev) {
|
||||
self.remove_quick_menu(ev)
|
||||
},
|
||||
|
||||
});
|
||||
$(".sh_wqm_quick_menu_submenu_list_cls").html(quick_menu_list_html)
|
||||
}
|
||||
});
|
||||
$(".sh_wqm_quick_menu_submenu_list_cls").html(quick_menu_list_html)
|
||||
}
|
||||
|
||||
async render_quick_menulist_no_menu(){
|
||||
|
||||
var final_quick_menu_list_html = renderToFragment(
|
||||
'quick.menulist', {
|
||||
no_menu: 1
|
||||
});
|
||||
$(".sh_wqm_quick_menu_submenu_list_cls").html(final_quick_menu_list_html)
|
||||
}
|
||||
async render_quick_menulist_no_menu() {
|
||||
|
||||
async onWillStart() {
|
||||
var self = this;
|
||||
var quick_menus_html = await jsonrpc("/web/dataset/call_kw/sh.wqm.quick.menu/get_quick_menu_data", {
|
||||
model: 'sh.wqm.quick.menu',
|
||||
method: 'get_quick_menu_data',
|
||||
args: ['', ['name', 'sh_url']],
|
||||
kwargs: {
|
||||
},
|
||||
});
|
||||
var final_quick_menu_list_html = renderToFragment(
|
||||
'quick.menulist', {
|
||||
no_menu: 1
|
||||
});
|
||||
$(".sh_wqm_quick_menu_submenu_list_cls").html(final_quick_menu_list_html)
|
||||
}
|
||||
|
||||
if (quick_menus_html.length > 0) {
|
||||
if(quick_menus_html.length > 13){
|
||||
this.render_quick_menulist_actions(quick_menus_html)
|
||||
}else{
|
||||
this.render_quick_menulist(quick_menus_html)
|
||||
}
|
||||
}
|
||||
async onWillStart() {
|
||||
var self = this;
|
||||
var quick_menus_html = await jsonrpc("/web/dataset/call_kw/sh.wqm.quick.menu/get_quick_menu_data", {
|
||||
model: 'sh.wqm.quick.menu',
|
||||
method: 'get_quick_menu_data',
|
||||
args: ['', ['name', 'sh_url']],
|
||||
kwargs: {
|
||||
},
|
||||
});
|
||||
|
||||
else {
|
||||
this.render_quick_menulist_no_menu()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
open_quick_menu(e) {
|
||||
this.onWillStart()
|
||||
$('.o_user_bookmark_menu').addClass('bookmark_active')
|
||||
if ($('.sh_wqm_quick_menu_submenu_list_cls').css('display') == 'none')
|
||||
{
|
||||
$('.sh_wqm_quick_menu_submenu_list_cls').css('display','revert')
|
||||
}else{
|
||||
$('.sh_wqm_quick_menu_submenu_list_cls').css('display','none')
|
||||
$('.o_user_bookmark_menu').removeClass('bookmark_active')
|
||||
if (quick_menus_html.length > 0) {
|
||||
if (quick_menus_html.length > 13) {
|
||||
this.render_quick_menulist_actions(quick_menus_html)
|
||||
} else {
|
||||
this.render_quick_menulist(quick_menus_html)
|
||||
}
|
||||
|
||||
// close other popup
|
||||
$('.sh_user_language_list_cls').css("display","none")
|
||||
$('.todo_layout').removeClass("sh_theme_model");
|
||||
$('.sh_calc_util').removeClass("active")
|
||||
$(".sh_calc_results").html("");
|
||||
|
||||
}
|
||||
|
||||
async _searchData() {
|
||||
var query = $(".sh_bookmark_search").val();
|
||||
var self = this;
|
||||
var menus = await jsonrpc("/web/dataset/call_kw/sh.wqm.quick.menu/get_search_result", {
|
||||
model: 'sh.wqm.quick.menu',
|
||||
method: 'get_search_result',
|
||||
args: [[query]],
|
||||
kwargs:{ },
|
||||
});
|
||||
if (menus.length > 0) {
|
||||
var self = this
|
||||
var quick_menu_list_html = await renderToFragment(
|
||||
'quick.menulist', {
|
||||
quick_menulist_actions:menus,
|
||||
remove_quick_menu: function (ev){
|
||||
self.remove_quick_menu(ev)
|
||||
},
|
||||
});
|
||||
$(".sh_search_result").html(quick_menu_list_html)
|
||||
} else {
|
||||
self.render_quick_menulist_no_menu()
|
||||
}
|
||||
else {
|
||||
this.render_quick_menulist_no_menu()
|
||||
}
|
||||
|
||||
_onSearchResultsNavigate(event) {
|
||||
this._search_def.reject();
|
||||
this._search_def = $.Deferred();
|
||||
setTimeout(this._search_def.resolve.bind(this._search_def), 50);
|
||||
this._search_def.done(this._searchData.bind(this));
|
||||
}
|
||||
|
||||
open_quick_menu(e) {
|
||||
this.onWillStart()
|
||||
$('.o_user_bookmark_menu').addClass('bookmark_active')
|
||||
if ($('.sh_wqm_quick_menu_submenu_list_cls').css('display') == 'none') {
|
||||
$('.sh_wqm_quick_menu_submenu_list_cls').css('display', 'revert')
|
||||
} else {
|
||||
$('.sh_wqm_quick_menu_submenu_list_cls').css('display', 'none')
|
||||
$('.o_user_bookmark_menu').removeClass('bookmark_active')
|
||||
}
|
||||
|
||||
async remove_quick_menu(e) {
|
||||
var self = this;
|
||||
var id = parseInt(e.target.dataset.id);
|
||||
if (id !== NaN) {
|
||||
var quick_menus_html = await jsonrpc("/web/dataset/call_kw/sh.wqm.quick.menu/remove_quick_menu_data", {
|
||||
model: 'sh.wqm.quick.menu',
|
||||
method: 'remove_quick_menu_data',
|
||||
args: ['', id],
|
||||
kwargs:{},
|
||||
}).then(function (res) {
|
||||
if (res.id) {
|
||||
if (window.location.href == res.sh_url) {
|
||||
$('.sh_bookmark').removeClass('active')
|
||||
}
|
||||
if (res.final_quick_menu_list.length > 0) {
|
||||
if(res.final_quick_menu_list.length > 13){
|
||||
self.render_quick_menulist_actions(res.final_quick_menu_list)
|
||||
}else{
|
||||
self.render_quick_menulist(res.final_quick_menu_list)
|
||||
}
|
||||
// close other popup
|
||||
$('.sh_user_language_list_cls').css("display", "none")
|
||||
$('.todo_layout').removeClass("sh_theme_model");
|
||||
$('.sh_calc_util').removeClass("active")
|
||||
$(".sh_calc_results").html("");
|
||||
|
||||
}
|
||||
|
||||
async _searchData() {
|
||||
var query = $(".sh_bookmark_search").val();
|
||||
var self = this;
|
||||
var menus = await jsonrpc("/web/dataset/call_kw/sh.wqm.quick.menu/get_search_result", {
|
||||
model: 'sh.wqm.quick.menu',
|
||||
method: 'get_search_result',
|
||||
args: [[query]],
|
||||
kwargs: {},
|
||||
});
|
||||
if (menus.length > 0) {
|
||||
var self = this
|
||||
var quick_menu_list_html = await renderToFragment(
|
||||
'quick.menulist', {
|
||||
quick_menulist_actions: menus,
|
||||
remove_quick_menu: function (ev) {
|
||||
self.remove_quick_menu(ev)
|
||||
},
|
||||
});
|
||||
$(".sh_search_result").html(quick_menu_list_html)
|
||||
} else {
|
||||
self.render_quick_menulist_no_menu()
|
||||
}
|
||||
}
|
||||
|
||||
_onSearchResultsNavigate(event) {
|
||||
this._search_def.reject();
|
||||
this._search_def = $.Deferred();
|
||||
setTimeout(this._search_def.resolve.bind(this._search_def), 50);
|
||||
this._search_def.done(this._searchData.bind(this));
|
||||
}
|
||||
|
||||
async remove_quick_menu(e) {
|
||||
var self = this;
|
||||
var id = parseInt(e.target.dataset.id);
|
||||
if (id !== NaN) {
|
||||
var quick_menus_html = await jsonrpc("/web/dataset/call_kw/sh.wqm.quick.menu/remove_quick_menu_data", {
|
||||
model: 'sh.wqm.quick.menu',
|
||||
method: 'remove_quick_menu_data',
|
||||
args: ['', id],
|
||||
kwargs: {},
|
||||
}).then(function (res) {
|
||||
if (res.id) {
|
||||
if (window.location.href == res.sh_url) {
|
||||
$('.sh_bookmark').removeClass('active')
|
||||
}
|
||||
if (res.final_quick_menu_list.length > 0) {
|
||||
if (res.final_quick_menu_list.length > 13) {
|
||||
self.render_quick_menulist_actions(res.final_quick_menu_list)
|
||||
} else {
|
||||
self.render_quick_menulist_no_menu()
|
||||
self.render_quick_menulist(res.final_quick_menu_list)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
getUrlVars() {
|
||||
var vars = [], hash;
|
||||
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
|
||||
for (var i = 0; i < hashes.length; i++) {
|
||||
hash = hashes[i].split('=');
|
||||
vars.push(hash[0]);
|
||||
vars[hash[0]] = hash[1];
|
||||
}
|
||||
return vars;
|
||||
}
|
||||
|
||||
getUrl() {
|
||||
return window.location.href;
|
||||
}
|
||||
|
||||
async getMenuRecord() {
|
||||
|
||||
var action_id = this.actionService.currentController.action.id
|
||||
|
||||
var model = this.actionService.currentController.action.res_model
|
||||
if(!model){
|
||||
model = this.actionService.currentController.action.context.params.id
|
||||
}
|
||||
|
||||
if (this.actionService.currentController.view.type == 'form') {
|
||||
var res_id = this.actionService.currentController.props.resId
|
||||
}
|
||||
var sh_url = this.getUrl()
|
||||
|
||||
var self = this;
|
||||
|
||||
var search_result = await jsonrpc("/web/dataset/call_kw/sh.wqm.quick.menu/set_quick_url", {
|
||||
model: 'sh.wqm.quick.menu',
|
||||
method: 'set_quick_url',
|
||||
args: ['', sh_url, model, res_id, action_id],
|
||||
kwargs: {
|
||||
},
|
||||
});
|
||||
return search_result
|
||||
}
|
||||
|
||||
on_click(ev) {
|
||||
|
||||
var self = this;
|
||||
this.getMenuRecord().then(function (rec) {
|
||||
|
||||
$('.sh_bookmark').addClass('active')
|
||||
if (rec.is_set_quick_menu) {
|
||||
if (rec.final_quick_menu_list.length > 0) {
|
||||
|
||||
if(rec.final_quick_menu_list.length > 13){
|
||||
self.render_quick_menulist_actions(rec.final_quick_menu_list)
|
||||
}else{
|
||||
self.render_quick_menulist(rec.final_quick_menu_list)
|
||||
}
|
||||
} else {
|
||||
self.render_quick_menulist_no_menu()
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
$('.sh_bookmark').removeClass('active')
|
||||
if (rec.final_quick_menu_list.length > 0) {
|
||||
if(rec.final_quick_menu_list.length > 13){
|
||||
self.render_quick_menulist_actions(rec.final_quick_menu_list)
|
||||
}else{
|
||||
self.render_quick_menulist(rec.final_quick_menu_list)
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
self.render_quick_menulist_no_menu()
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
getUrlVars() {
|
||||
var vars = [], hash;
|
||||
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
|
||||
for (var i = 0; i < hashes.length; i++) {
|
||||
hash = hashes[i].split('=');
|
||||
vars.push(hash[0]);
|
||||
vars[hash[0]] = hash[1];
|
||||
}
|
||||
return vars;
|
||||
}
|
||||
|
||||
getUrl() {
|
||||
return window.location.href;
|
||||
}
|
||||
|
||||
async getMenuRecord() {
|
||||
|
||||
var action_id = this.actionService.currentController.action.id
|
||||
|
||||
var model = this.actionService.currentController.action.res_model
|
||||
if (!model) {
|
||||
model = this.actionService.currentController.action.context.params.id
|
||||
}
|
||||
|
||||
if (this.actionService.currentController.view.type == 'form') {
|
||||
var res_id = this.actionService.currentController.props.resId
|
||||
}
|
||||
var sh_url = this.getUrl()
|
||||
|
||||
var self = this;
|
||||
|
||||
var search_result = await jsonrpc("/web/dataset/call_kw/sh.wqm.quick.menu/set_quick_url", {
|
||||
model: 'sh.wqm.quick.menu',
|
||||
method: 'set_quick_url',
|
||||
args: ['', sh_url, model, res_id, action_id],
|
||||
kwargs: {
|
||||
},
|
||||
});
|
||||
return search_result
|
||||
}
|
||||
|
||||
on_click(ev) {
|
||||
|
||||
var self = this;
|
||||
this.getMenuRecord().then(function (rec) {
|
||||
|
||||
$('.sh_bookmark').addClass('active')
|
||||
if (rec.is_set_quick_menu) {
|
||||
if (rec.final_quick_menu_list.length > 0) {
|
||||
|
||||
if (rec.final_quick_menu_list.length > 13) {
|
||||
self.render_quick_menulist_actions(rec.final_quick_menu_list)
|
||||
} else {
|
||||
self.render_quick_menulist(rec.final_quick_menu_list)
|
||||
}
|
||||
} else {
|
||||
self.render_quick_menulist_no_menu()
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
$('.sh_bookmark').removeClass('active')
|
||||
if (rec.final_quick_menu_list.length > 0) {
|
||||
if (rec.final_quick_menu_list.length > 13) {
|
||||
self.render_quick_menulist_actions(rec.final_quick_menu_list)
|
||||
} else {
|
||||
self.render_quick_menulist(rec.final_quick_menu_list)
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
self.render_quick_menulist_no_menu()
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
registry.category("systray").add("sh_entmate_theme.QuickMenuSh", { Component: QuickMenuSh }, { sequence: 25 });
|
||||
+4
-4
@@ -7,7 +7,7 @@ import { session } from "@web/session";
|
||||
import { Dropdown } from '@web/core/dropdown/dropdown';
|
||||
|
||||
export class RecentRecordsSystray extends Component {
|
||||
|
||||
static props = ["*"];
|
||||
setup() {
|
||||
this.orm = useService("orm");
|
||||
this.actionService = useService("action");
|
||||
@@ -27,7 +27,7 @@ export class RecentRecordsSystray extends Component {
|
||||
this.removeRecord = this.removeRecord.bind(this);
|
||||
this.searchRecords = this.searchRecords.bind(this);
|
||||
|
||||
onMounted( () => {
|
||||
onMounted(() => {
|
||||
document.addEventListener('click', this.handleDocumentClick);
|
||||
});
|
||||
|
||||
@@ -38,7 +38,7 @@ export class RecentRecordsSystray extends Component {
|
||||
|
||||
handleDocumentClick() {
|
||||
if ($('.o_recent_records_dropdown').css('display') == 'block') {
|
||||
$('.o_recent_records_dropdown').css('display', 'none')
|
||||
$('.o_recent_records_dropdown').css('display', 'none')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ export class RecentRecordsSystray extends Component {
|
||||
this.render(true)
|
||||
}
|
||||
|
||||
async removeRecord(record){
|
||||
async removeRecord(record) {
|
||||
debugger;
|
||||
await this.orm.unlink("sh.recent.records", [record.id]);
|
||||
await this.get_records()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -7,36 +7,36 @@ import { session } from "@web/session";
|
||||
import { ToDoWidget } from "./todo_widget";
|
||||
|
||||
export class ToDoTemplate extends Component {
|
||||
static template = "ToDoTemplate";
|
||||
static template = "ToDoTemplate";
|
||||
static props = ["*"];
|
||||
setup() {
|
||||
this.orm = useService("orm");
|
||||
this.sh_enable_todo_mode = session.sh_enable_todo_mode
|
||||
}
|
||||
|
||||
setup() {
|
||||
this.orm = useService("orm");
|
||||
this.sh_enable_todo_mode = session.sh_enable_todo_mode
|
||||
}
|
||||
_click_todo() {
|
||||
/*close pop-ups*/
|
||||
$('.sh_wqm_quick_menu_submenu_list_cls').css('display', 'none')
|
||||
$('.o_user_bookmark_menu').removeClass('bookmark_active')
|
||||
$('.sh_calc_util').removeClass("active")
|
||||
$(".sh_calc_results").html("");
|
||||
|
||||
_click_todo() {
|
||||
/*close pop-ups*/
|
||||
$('.sh_wqm_quick_menu_submenu_list_cls').css('display','none')
|
||||
$('.o_user_bookmark_menu').removeClass('bookmark_active')
|
||||
$('.sh_calc_util').removeClass("active")
|
||||
$(".sh_calc_results").html("");
|
||||
|
||||
if ($('.todo_layout').length) {
|
||||
if ($('.sh_theme_model').length) {
|
||||
$('.todo_layout').removeClass('sh_theme_model');
|
||||
$('.todo').removeClass('todo_active');
|
||||
} else{
|
||||
$('.todo_layout').addClass('sh_theme_model');
|
||||
$('.todo').addClass('todo_active');
|
||||
}
|
||||
}else{
|
||||
this.body_container = new todo_widget();
|
||||
this.body_container.appendTo($('.o_web_client')).then(function () {
|
||||
$('.todo_layout').addClass('sh_theme_model');
|
||||
$('.todo').addClass('todo_active');
|
||||
});
|
||||
if ($('.todo_layout').length) {
|
||||
if ($('.sh_theme_model').length) {
|
||||
$('.todo_layout').removeClass('sh_theme_model');
|
||||
$('.todo').removeClass('todo_active');
|
||||
} else {
|
||||
$('.todo_layout').addClass('sh_theme_model');
|
||||
$('.todo').addClass('todo_active');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.body_container = new todo_widget();
|
||||
this.body_container.appendTo($('.o_web_client')).then(function () {
|
||||
$('.todo_layout').addClass('sh_theme_model');
|
||||
$('.todo').addClass('todo_active');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
registry.category("systray").add("sh_backmate_theme_adv_enterprise.ToDoTemplate", { Component: ToDoTemplate }, { sequence: 25 });
|
||||
|
||||
@@ -5,165 +5,166 @@ import { session } from "@web/session";
|
||||
import { registry } from "@web/core/registry";
|
||||
import { useService } from "@web/core/utils/hooks";
|
||||
import { renderToElement } from "@web/core/utils/render";
|
||||
import {useRef, onWillStart, onMounted } from "@odoo/owl";
|
||||
import { useRef, onWillStart, onMounted } from "@odoo/owl";
|
||||
|
||||
var todo_card_html = ''
|
||||
|
||||
export class ToDoWidget extends Component {
|
||||
static template = 'ToDoWidget';
|
||||
setup() {
|
||||
super.setup()
|
||||
this.orm = useService("orm");
|
||||
onMounted(() => {
|
||||
this.render_template();
|
||||
static template = 'ToDoWidget';
|
||||
static props = ["*"];
|
||||
setup() {
|
||||
super.setup()
|
||||
this.orm = useService("orm");
|
||||
onMounted(() => {
|
||||
this.render_template();
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
render_template() {
|
||||
this.render_todo_card();
|
||||
}
|
||||
render_template() {
|
||||
this.render_todo_card();
|
||||
}
|
||||
|
||||
async render_todo_card() {
|
||||
var accordion_html = ''
|
||||
var self = this
|
||||
$("#accordion").html('')
|
||||
await self.getAllTodo().then(function (each_data) {
|
||||
$.each(each_data, function (todo_data) {
|
||||
const accordion_html = renderToElement(
|
||||
'sh_backmate_theme_adv_enterprise.todo_card', {
|
||||
name: each_data[todo_data].name,
|
||||
rec: each_data[todo_data].id,
|
||||
is_done: each_data[todo_data].is_done,
|
||||
_remove_todo: function (ev){
|
||||
self._remove_todo(each_data[todo_data].id)
|
||||
ev.target.parentElement.parentElement.parentElement.remove();
|
||||
},
|
||||
_click_sh_header_pencil : function (ev){
|
||||
self._click_sh_header_pencil(ev)
|
||||
},
|
||||
_focusout_sh_todo_description : function (ev){
|
||||
self._focusout_sh_todo_description(ev)
|
||||
},
|
||||
_click_sh_todo_checklist : function(ev){
|
||||
self._click_sh_todo_checklist(ev)
|
||||
},
|
||||
});
|
||||
$("#accordion").append(accordion_html);
|
||||
|
||||
todo_card_html += accordion_html
|
||||
});
|
||||
async render_todo_card() {
|
||||
var accordion_html = ''
|
||||
var self = this
|
||||
$("#accordion").html('')
|
||||
await self.getAllTodo().then(function (each_data) {
|
||||
$.each(each_data, function (todo_data) {
|
||||
const accordion_html = renderToElement(
|
||||
'sh_backmate_theme_adv_enterprise.todo_card', {
|
||||
name: each_data[todo_data].name,
|
||||
rec: each_data[todo_data].id,
|
||||
is_done: each_data[todo_data].is_done,
|
||||
_remove_todo: function (ev) {
|
||||
self._remove_todo(each_data[todo_data].id)
|
||||
ev.target.parentElement.parentElement.parentElement.remove();
|
||||
},
|
||||
_click_sh_header_pencil: function (ev) {
|
||||
self._click_sh_header_pencil(ev)
|
||||
},
|
||||
_focusout_sh_todo_description: function (ev) {
|
||||
self._focusout_sh_todo_description(ev)
|
||||
},
|
||||
_click_sh_todo_checklist: function (ev) {
|
||||
self._click_sh_todo_checklist(ev)
|
||||
},
|
||||
});
|
||||
}
|
||||
$("#accordion").append(accordion_html);
|
||||
|
||||
_onKeydown() {
|
||||
ev.stopPropagation();
|
||||
if (ev.which === 13) {
|
||||
var self = this;
|
||||
var todo_input = $(".sh_add_todo_input").val()
|
||||
if(!$(".sh_add_todo_input").val()){
|
||||
alert("Please Enter Title !")
|
||||
}else{
|
||||
ev.stopPropagation();
|
||||
this.saveTodo(todo_input).then(function (rec) {
|
||||
$("#accordion").prepend(QWeb.render("ToDoCard", {
|
||||
name: todo_input,
|
||||
rec:parseInt(rec),
|
||||
widget: self,
|
||||
}));
|
||||
});
|
||||
$(".sh_add_todo_input").val("")
|
||||
}
|
||||
}
|
||||
}
|
||||
todo_card_html += accordion_html
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
_click_sh_header_pencil(ev) {
|
||||
ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_todo_description")[0].style.display = "block";
|
||||
ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_todo_label")[0].style.display = "none";
|
||||
ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_header_pencil")[0].style.display = "none";
|
||||
ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_header_save")[0].style.display = "block";
|
||||
var fieldInput = ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_todo_description");
|
||||
var fldLength= fieldInput.valueOf().length;
|
||||
fieldInput[0].focus()
|
||||
fieldInput[0].setSelectionRange(fldLength, fldLength);
|
||||
}
|
||||
|
||||
_focusout_sh_todo_description(ev) {
|
||||
var fieldInput = ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_todo_description");
|
||||
ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_header_pencil")[0].style.display = "block";
|
||||
ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_header_save")[0].style.display = "none";
|
||||
fieldInput[0].style.display = "none";
|
||||
ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_todo_label")[0].style.display = "block";
|
||||
ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_todo_label")[0].textContent = fieldInput[0].value
|
||||
var todo_id = parseInt(ev.target.getAttribute('ID'))
|
||||
this.orm.write("sh.todo", [todo_id], { name : ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_todo_label")[0].textContent });
|
||||
}
|
||||
|
||||
_remove_todo(todo_id) {
|
||||
this.removeTodo(todo_id)
|
||||
}
|
||||
|
||||
removeTodo(todo_id) {
|
||||
return this.orm.unlink("sh.todo", [todo_id]);
|
||||
}
|
||||
|
||||
_close_todo() {
|
||||
$('.todo_layout').removeClass('sh_theme_model');
|
||||
$('.todo').removeClass('todo_active');
|
||||
}
|
||||
|
||||
async saveTodo(todo_input) {
|
||||
var data = await this.orm.create("sh.todo", [{
|
||||
'name': todo_input,
|
||||
}]);
|
||||
$(".sh_add_todo_input").val("")
|
||||
}
|
||||
|
||||
async _click_add_todo() {
|
||||
_onKeydown() {
|
||||
ev.stopPropagation();
|
||||
if (ev.which === 13) {
|
||||
var self = this;
|
||||
var todo_input = $(".sh_add_todo_input").val()
|
||||
if(!$(".sh_add_todo_input").val()){
|
||||
if (!$(".sh_add_todo_input").val()) {
|
||||
alert("Please Enter Title !")
|
||||
}else{
|
||||
} else {
|
||||
ev.stopPropagation();
|
||||
this.saveTodo(todo_input).then(function (rec) {
|
||||
$("#accordion").prepend(QWeb.render("ToDoCard", {
|
||||
name: todo_input,
|
||||
rec: parseInt(rec),
|
||||
widget: self,
|
||||
}));
|
||||
});
|
||||
$(".sh_add_todo_input").val("")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_click_sh_header_pencil(ev) {
|
||||
ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_todo_description")[0].style.display = "block";
|
||||
ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_todo_label")[0].style.display = "none";
|
||||
ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_header_pencil")[0].style.display = "none";
|
||||
ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_header_save")[0].style.display = "block";
|
||||
var fieldInput = ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_todo_description");
|
||||
var fldLength = fieldInput.valueOf().length;
|
||||
fieldInput[0].focus()
|
||||
fieldInput[0].setSelectionRange(fldLength, fldLength);
|
||||
}
|
||||
|
||||
_focusout_sh_todo_description(ev) {
|
||||
var fieldInput = ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_todo_description");
|
||||
ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_header_pencil")[0].style.display = "block";
|
||||
ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_header_save")[0].style.display = "none";
|
||||
fieldInput[0].style.display = "none";
|
||||
ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_todo_label")[0].style.display = "block";
|
||||
ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_todo_label")[0].textContent = fieldInput[0].value
|
||||
var todo_id = parseInt(ev.target.getAttribute('ID'))
|
||||
this.orm.write("sh.todo", [todo_id], { name: ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_todo_label")[0].textContent });
|
||||
}
|
||||
|
||||
_remove_todo(todo_id) {
|
||||
this.removeTodo(todo_id)
|
||||
}
|
||||
|
||||
removeTodo(todo_id) {
|
||||
return this.orm.unlink("sh.todo", [todo_id]);
|
||||
}
|
||||
|
||||
_close_todo() {
|
||||
$('.todo_layout').removeClass('sh_theme_model');
|
||||
$('.todo').removeClass('todo_active');
|
||||
}
|
||||
|
||||
async saveTodo(todo_input) {
|
||||
var data = await this.orm.create("sh.todo", [{
|
||||
'name': todo_input,
|
||||
}]);
|
||||
$(".sh_add_todo_input").val("")
|
||||
}
|
||||
|
||||
async _click_add_todo() {
|
||||
var self = this;
|
||||
var todo_input = $(".sh_add_todo_input").val()
|
||||
if (!$(".sh_add_todo_input").val()) {
|
||||
alert("Please Enter Title !")
|
||||
} else {
|
||||
await this.saveTodo(todo_input)
|
||||
this.render_todo_card()
|
||||
}
|
||||
}
|
||||
|
||||
async add_todo(ev) {
|
||||
if (ev.which === 13) {
|
||||
var self = this;
|
||||
var todo_input = $(".sh_add_todo_input").val()
|
||||
if (!$(".sh_add_todo_input").val()) {
|
||||
alert("Please Enter Title !")
|
||||
} else {
|
||||
await this.saveTodo(todo_input)
|
||||
this.render_todo_card()
|
||||
}
|
||||
}
|
||||
|
||||
async add_todo(ev){
|
||||
if (ev.which === 13) {
|
||||
var self = this;
|
||||
var todo_input = $(".sh_add_todo_input").val()
|
||||
if(!$(".sh_add_todo_input").val()){
|
||||
alert("Please Enter Title !")
|
||||
}else{
|
||||
await this.saveTodo(todo_input)
|
||||
this.render_todo_card()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async doneTodo(done_todo ,todo_id) {
|
||||
await this.orm.write("sh.todo", [todo_id], { is_done : done_todo });
|
||||
}
|
||||
|
||||
async getAllTodo() {
|
||||
const data = await this.orm.searchRead(
|
||||
"sh.todo",
|
||||
[['user_id', '=', session.uid]],
|
||||
['name','is_done']
|
||||
);
|
||||
return data
|
||||
}
|
||||
|
||||
async _click_sh_todo_checklist(ev) {
|
||||
var done_todo = ev.target.checked
|
||||
var todo_id = parseInt(ev.target.id)
|
||||
await this.doneTodo(done_todo, todo_id)
|
||||
this.render_todo_card()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async doneTodo(done_todo, todo_id) {
|
||||
await this.orm.write("sh.todo", [todo_id], { is_done: done_todo });
|
||||
}
|
||||
|
||||
async getAllTodo() {
|
||||
const data = await this.orm.searchRead(
|
||||
"sh.todo",
|
||||
[['user_id', '=', session.uid]],
|
||||
['name', 'is_done']
|
||||
);
|
||||
return data
|
||||
}
|
||||
|
||||
async _click_sh_todo_checklist(ev) {
|
||||
var done_todo = ev.target.checked
|
||||
var todo_id = parseInt(ev.target.id)
|
||||
await this.doneTodo(done_todo, todo_id)
|
||||
this.render_todo_card()
|
||||
}
|
||||
}
|
||||
|
||||
registry.category("systray").add("sh_backmate_theme_adv_enterprise.ToDoWidget", { Component: ToDoWidget }, { sequence: 25 });
|
||||
@@ -5,12 +5,13 @@ import { useService } from "@web/core/utils/hooks";
|
||||
import { session } from "@web/session";
|
||||
|
||||
export class NavTab extends Component {
|
||||
static props = ["*"];
|
||||
setup() {
|
||||
super.setup();
|
||||
this.actionService = useService("action");
|
||||
this.sh_enable_multi_tab = session.sh_enable_multi_tab
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
NavTab.template = 'sh_backmate_theme_adv_enterprise.NavTab';
|
||||
}
|
||||
|
||||
NavTab.template = 'sh_backmate_theme_adv_enterprise.NavTab';
|
||||
|
||||
@@ -6,48 +6,48 @@ import { jsonrpc } from "@web/core/network/rpc_service";
|
||||
import { useService, useBus } from "@web/core/utils/hooks";
|
||||
|
||||
export class ZoomWidget extends Component {
|
||||
static props = ["*"];
|
||||
setup() {
|
||||
super.setup();
|
||||
this.orm = useService("orm");
|
||||
this.show_zoom = session.sh_enable_zoom
|
||||
}
|
||||
|
||||
setResetZoom(){
|
||||
setResetZoom() {
|
||||
var zoom = $('.sh_full').text().split('%')
|
||||
if($('.o_content').find('div')[0]){
|
||||
$($('.o_content').find('div')[0]).removeClass("sh_zoom_"+zoom[0])
|
||||
if ($('.o_content').find('div')[0]) {
|
||||
$($('.o_content').find('div')[0]).removeClass("sh_zoom_" + zoom[0])
|
||||
zoom = 100
|
||||
$('.sh_full').text(zoom.toString()+'%');
|
||||
$($('.o_content').find('div')[0]).addClass("sh_zoom_"+zoom)
|
||||
$('.sh_full').text(zoom.toString() + '%');
|
||||
$($('.o_content').find('div')[0]).addClass("sh_zoom_" + zoom)
|
||||
}
|
||||
}
|
||||
zoomDropdown(ev){
|
||||
if ($('.sh-zoom-panel').css('display') == 'none')
|
||||
{
|
||||
$('.sh-zoom-panel').css('display','table')
|
||||
}else{
|
||||
$('.sh-zoom-panel').css('display','none')
|
||||
}
|
||||
zoomDropdown(ev) {
|
||||
if ($('.sh-zoom-panel').css('display') == 'none') {
|
||||
$('.sh-zoom-panel').css('display', 'table')
|
||||
} else {
|
||||
$('.sh-zoom-panel').css('display', 'none')
|
||||
}
|
||||
}
|
||||
setDecZoom(){
|
||||
setDecZoom() {
|
||||
var zoom = $('.sh_full').text().split('%')
|
||||
if(parseInt(zoom[0])-10 >= 20 && parseInt(zoom[0])-10 <= 200){
|
||||
if($('.o_content').find('div')[0]){
|
||||
$($('.o_content').find('div')[0]).removeClass("sh_zoom_"+zoom[0])
|
||||
zoom = parseInt(zoom[0])-10
|
||||
$('.sh_full').text(zoom.toString()+'%');
|
||||
$($('.o_content').find('div')[0]).addClass("sh_zoom_"+zoom)
|
||||
if (parseInt(zoom[0]) - 10 >= 20 && parseInt(zoom[0]) - 10 <= 200) {
|
||||
if ($('.o_content').find('div')[0]) {
|
||||
$($('.o_content').find('div')[0]).removeClass("sh_zoom_" + zoom[0])
|
||||
zoom = parseInt(zoom[0]) - 10
|
||||
$('.sh_full').text(zoom.toString() + '%');
|
||||
$($('.o_content').find('div')[0]).addClass("sh_zoom_" + zoom)
|
||||
}
|
||||
}
|
||||
}
|
||||
setIncZoom(){
|
||||
setIncZoom() {
|
||||
var zoom = $('.sh_full').text().split('%')
|
||||
if(parseInt(zoom[0])+10 >= 20 && parseInt(zoom[0])+10 <= 200){
|
||||
if($('.o_content').find('div')[0]){
|
||||
$($('.o_content').find('div')[0]).removeClass("sh_zoom_"+zoom[0])
|
||||
zoom = parseInt(zoom[0])+10
|
||||
$('.sh_full').text(zoom.toString()+'%');
|
||||
$($('.o_content').find('div')[0]).addClass("sh_zoom_"+zoom)
|
||||
if (parseInt(zoom[0]) + 10 >= 20 && parseInt(zoom[0]) + 10 <= 200) {
|
||||
if ($('.o_content').find('div')[0]) {
|
||||
$($('.o_content').find('div')[0]).removeClass("sh_zoom_" + zoom[0])
|
||||
zoom = parseInt(zoom[0]) + 10
|
||||
$('.sh_full').text(zoom.toString() + '%');
|
||||
$($('.o_content').find('div')[0]).addClass("sh_zoom_" + zoom)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<odoo>
|
||||
<template id="soong_workflow_log_manager">
|
||||
<notebook>
|
||||
<page string="审批详情,正常-显示退回" invisible="work_end">
|
||||
<page string="审批详情" invisible="work_end">
|
||||
<field name="log_ids" style="width:100%%; margin-top: 10px;">
|
||||
<tree editable="bottom">
|
||||
<field name="sequence" string="" widget="handle" groups="soong_workflow.group_soong_workflow_manager"/>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
'security/ir.model.access.csv',
|
||||
'security/yuthon_holiday_group.xml',
|
||||
'data/yuthon_holiday_data.xml',
|
||||
'data/mothly_report_time.xml',
|
||||
'views/inherit_hr_type_views.xml',
|
||||
'views/inherit_hr_leave_allocation_views.xml',
|
||||
'views/inherit_hr_leave_accrual_plan_views.xml',
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
<record forcecreate="True" id="yuthon_vacation_start_end_time" model="ir.cron">
|
||||
<field name="name">定时任务:生成我的考勤确认单</field>
|
||||
<field name="model_id" ref="model_yuthon_vacation_reports"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">model.monthly_report()</field>
|
||||
<field eval="False" name="active"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="interval_number">1</field>
|
||||
<field name="interval_type">months</field>
|
||||
<field name="nextcall" eval="(DateTime.now()).strftime('%Y-%m-%d 00:00:00')"/>
|
||||
<field name="numbercall">-1</field>
|
||||
<field eval="False" name="doall"/>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -38,6 +38,39 @@ class YuthonVacationReports(models.Model):
|
||||
|
||||
record.medical_fee = max(total, 0.0)
|
||||
|
||||
def monthly_report(self):
|
||||
today = fields.Date.today()
|
||||
employees = self.env['hr.employee'].search([])
|
||||
for employee in employees:
|
||||
existing_record = self.search([
|
||||
('employee_id', '=', employee.id),
|
||||
('vacation_date', '=', today)
|
||||
], limit=1)
|
||||
if not existing_record:
|
||||
self.create({
|
||||
'employee_id': employee.id,
|
||||
'vacation_date': today,
|
||||
# 明细行和计算字段留空,由后续逻辑处理
|
||||
})
|
||||
|
||||
def disposable_report(self):
|
||||
year = 2025
|
||||
months = range(1, 8) # 1到7月
|
||||
employees = self.env['hr.employee'].search([])
|
||||
for month in months:
|
||||
report_date = fields.Date.from_string(f"{year}-{month:02d}-01")
|
||||
for employee in employees:
|
||||
existing = self.search([
|
||||
('employee_id', '=', employee.id),
|
||||
('vacation_date', '=', report_date)
|
||||
], limit=1)
|
||||
if not existing:
|
||||
self.create({
|
||||
'employee_id': employee.id,
|
||||
'vacation_date': report_date,
|
||||
# 计算字段会自动触发,无需手动设置
|
||||
})
|
||||
|
||||
def overtime_allocation(self):
|
||||
form_id = self.env.ref('hr_holidays.hr_leave_allocation_view_form_manager').id
|
||||
holiday_status_id = self.env['hr.leave.type'].search([('name', '=', '补休')])
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<field name="working_overtime"/>
|
||||
<field name="meal_fee"/>
|
||||
<field name="company_id" optional="hide"/>
|
||||
<field name="vacation_date"/>
|
||||
<button name="button_fixes_approval" string="修正" type="object" class="oe_highlight"/>
|
||||
<button name="log" string="日志" type="object" class="oe_highlight"/>
|
||||
</tree>
|
||||
@@ -152,6 +153,10 @@
|
||||
<field name="arch" type="xml">
|
||||
<search>
|
||||
<field name="employee_id"/>
|
||||
<group expand="0" string="Group By">
|
||||
<filter string="员工" name="group_by_employee_id" domain="[]" context="{'group_by': 'employee_id'}"/>
|
||||
<filter string="日期" name="group_by_vacation_date" domain="[]" context="{'group_by' : 'vacation_date'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
@@ -263,15 +268,17 @@
|
||||
<field name="name">假期额度日志</field>
|
||||
<field name="res_model">yuthon.vacation.reports</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="context">{'search_default_group_by_employee_id': 1, 'search_default_group_by_vacation_date': True}</field>
|
||||
<field name="view_ids" eval="[(5, 0, 0),
|
||||
(0, 0, {'view_mode': 'tree', 'view_id': ref('yuthon_holiday.view_yuthon_vacation_reports_tree')}),
|
||||
(0, 0, {'view_mode': 'form', 'view_id': ref('yuthon_holiday.view_yuthon_vacation_reports_form')})]"/>
|
||||
</record>
|
||||
<record id="action_server_open_my_vacation_form1" model="ir.actions.act_window">
|
||||
<field name="name">我的假期额度表单</field>
|
||||
<field name="name">我的假期额度</field>
|
||||
<field name="res_model">yuthon.vacation.reports</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('employee_id.user_id', '=', uid)]</field>
|
||||
<field name="context">{'search_default_group_by_vacation_date': 1}</field>
|
||||
<field name="view_ids" eval="[(5, 0, 0),
|
||||
(0, 0, {'view_mode': 'tree', 'view_id': ref('yuthon_holiday.view_yuthon_vacation_my_reports_tree')}),
|
||||
(0, 0, {'view_mode': 'form', 'view_id': ref('yuthon_holiday.view_yuthon_vacation_reports_form1')})]"/>
|
||||
@@ -302,7 +309,7 @@
|
||||
<field name="model_id" ref="yuthon_holiday.model_yuthon_vacation_reports"/>
|
||||
<field name="binding_model_id" ref="yuthon_holiday.model_yuthon_vacation_reports"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = model.batch_compute_leave_and_overtime()</field>
|
||||
<field name="code">action = model.disposable_report()</field>
|
||||
</record>
|
||||
<record id="details_tree_view" model="ir.ui.view">
|
||||
<field name="name">details.tree.tree</field>
|
||||
|
||||
@@ -618,7 +618,6 @@
|
||||
</header>
|
||||
<field name="employee_id" string="姓名" options="{'no_open': True}"/>
|
||||
<field name="struct_id" string="职级"/>
|
||||
<field name="position_salary" optional="show"/>
|
||||
<field name="card_type" optional="show"/>
|
||||
<field name="identification_id" optional="show"/>
|
||||
<field name="tax_payable" decoration-danger="1" decoration-bf="1" column_invisible=""/>
|
||||
@@ -643,11 +642,6 @@
|
||||
<field name="total_pre_tax_deductions" optional="show"/>
|
||||
<field name="tax_reduction" optional="show"/>
|
||||
<field name="deduction_standard" optional="show"/>
|
||||
<field name="social_security" optional="show"/>
|
||||
<field name="individual_tax_refund" optional="show"/>
|
||||
<field name="safety_incentives" optional="show"/>
|
||||
<field name="last_year_safety" optional="show"/>
|
||||
<field name="last_year_performance_evaluation" optional="show"/>
|
||||
<field name="paid_tax" optional="show"/>
|
||||
<field name="company_id" optional="hide"/>
|
||||
<field name="is_push" column_invisible="1"/>
|
||||
|
||||
@@ -633,7 +633,7 @@
|
||||
action="yuthon_holiday.action_server_open_my_vacation_form1"
|
||||
sequence="7"/>
|
||||
<menuitem id="menu_hr_attendance_month_my_detail"
|
||||
name="考勤确认"
|
||||
name="我的考勤确认"
|
||||
parent="holiday_manage_menu_root_board"
|
||||
sequence="10"
|
||||
action="yuthon_hr_attendance.hr_attendance_month_my_detail_action"/>
|
||||
|
||||
Reference in New Issue
Block a user