Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

any help to Downgrade js file from v9 to v8

Odebírat

Get notified when there's activity on this post

This question has been flagged
javascriptodooV8odoo8.0odoo9.0
5103 Zobrazení
Avatar
Ibrahim Zool Odoo


odoo.define('hr_dashboard.dashboard', function (require) {
"use strict";
var core = require('web.core');
var formats = require('web.formats');
var Model = require('web.Model');
var session = require('web.session');
var ajax = require('web.ajax');
var KanbanView = require('web_kanban.KanbanView');
var KanbanRecord = require('web_kanban.Record');
var ActionManager = require('web.ActionManager');
var QWeb = core.qweb;

var _t = core._t;
var _lt = core._lt;

var HrDashboardView = KanbanView.extend({
display_name: _lt('Dashboard'),
icon: 'fa-dashboard text-red',
searchview_hidden: true,// To hide the search and filter bar
events: {
'click .leaves-left': 'leaves_left',
'click .payslip': 'action_payslip',
'click .timesheet': 'action_timesheet',
'click .contract': 'action_contract',
'click .leaves_to_approve': 'action_leaves_to_approve',
'click .timesheets_to_approve': 'action_timesheets_to_approve',
'click .job_applications': 'action_job_applications',
'click .leave_allocations': 'action_leave_allocations',
'click .attendance': 'action_attendance',
'click .expenses': 'action_expenses',
'click #generate_payroll_pdf': function(){this.generate_payroll_pdf("bar");},
'click #generate_attendance_pdf': function(){this.generate_payroll_pdf("pie")},
'click .my_profile': 'action_my_profile',
},
init: function (parent, dataset, view_id, options) {
this._super(parent, dataset, view_id, options);
this.options.creatable = false;
var uid = dataset.context.uid;
var employee_data = true;
var isFirefox = false;
console.log(this)
//Here we can bind any functions to be called before or after render.
//_.bindAll(this, 'render', 'graph');
//var _this = this;
//this.render = _.wrap(this.render, function(render) {
// render();
// _this.graph();
// return _this;
//});
},
fetch_data: function() {
// Overwrite this function with useful data
return $.when();
},
// Here we are calling a function 'get_employee_info' from model to retrieve enough data
render: function() {
var super_render = this._super;
var self = this;
var model = new Model('hr.dashboard').call('get_employee_info').then(function(result){
self.isFirefox = typeof InstallTrigger !== 'undefined';
self.employee_data = result[0]
return self.fetch_data().then(function(result){
var hr_dashboard = QWeb.render('hr_dashboard.dashboard', {
widget: self,
});
super_render.call(self);
$(hr_dashboard).prependTo(self.$el);
self.graph();
})
});
},
leaves_left: function(event){
var self = this;
event.stopPropagation();
event.preventDefault();
return this.do_action({
name: _t("Leaves"),
type: 'ir.actions.act_window',
res_model: 'hr.holidays',
src_model: 'hr.employee',
view_mode: 'tree,form',
view_type: 'form',
views: [[false, 'list'],[false, 'form']],
context: {'search_default_employee_id': [self.employee_data.id],
'default_employee_id': self.employee_data.id,
'search_default_group_type': true,
'search_default_year': true
},
domain: [['holiday_type','=','employee'], ['holiday_status_id.limit', '=', false], ['state','!=', 'refuse']],
search_view_id: self.employee_data.leave_search_view_id,
target: 'current'
})
},
action_payslip: function(event){
var self = this;
event.stopPropagation();
event.preventDefault();
this.do_action({
name: _t("Payslips"),
type: 'ir.actions.act_window',
res_model: 'hr.payslip',
view_mode: 'tree,form',
view_type: 'form',
views: [[false, 'list'],[false, 'form']],
context: {
'search_default_employee_id': [self.employee_data.id],
'default_employee_id': self.employee_data.id,
},
target: 'current'
})
},
action_timesheet: function(event){
var self = this;
event.stopPropagation();
event.preventDefault();
this.do_action({
name: _t("Timesheets"),
type: 'ir.actions.act_window',
res_model: 'hr_timesheet_sheet.sheet',
view_mode: 'tree,form',
view_type: 'form',
views: [[false, 'list'],[false, 'form']],
context: {
'search_default_employee_id': [self.employee_data.id],
'default_employee_id': self.employee_data.id,
},
target: 'current'
})
},
action_contract: function(event){
var self = this;
event.stopPropagation();
event.preventDefault();
this.do_action({
name: _t("Contracts"),
type: 'ir.actions.act_window',
res_model: 'hr.contract',
view_mode: 'tree,form',
view_type: 'form',
views: [[false, 'list'],[false, 'form']],
context: {
'search_default_employee_id': [self.employee_data.id],
'default_employee_id': self.employee_data.id,
},
target: 'current'
})
},
action_leaves_to_approve: function(event) {
var self = this;
event.stopPropagation();
event.preventDefault();
this.do_action({
name: _t("Department Leaves"),
type: 'ir.actions.act_window',
res_model: 'hr.holidays',
view_mode: 'tree,form,calendar',
view_type: 'form',
views: [[false, 'list'],[false, 'form']],
context: {
'search_default_approve': true,
},
domain: [['type','=','remove'],],
search_view_id: self.employee_data.leave_search_view_id,
target: 'current'
})
},
action_timesheets_to_approve: function(event) {
var self = this;
event.stopPropagation();
event.preventDefault();
this.do_action({
name: _t("Timesheets to Approve"),
type: 'ir.actions.act_window',
res_model: 'hr_timesheet_sheet.sheet',
view_mode: 'tree,form',
view_type: 'form',
views: [[false, 'list'],[false, 'form']],
context: {
'search_default_to_approve': true,
},
search_view_id: self.employee_data.timesheet_search_view_id,
target: 'current'
})
},
action_job_applications: function(event){
var self = this;
event.stopPropagation();
event.preventDefault();
this.do_action({
name: _t("Applications"),
type: 'ir.actions.act_window',
res_model: 'hr.applicant',
view_mode: 'kanban,tree,form,pivot,graph,calendar',
view_type: 'form',
views: [[false, 'kanban'],[false, 'list'],[false, 'form'],
[false, 'pivot'],[false, 'graph'],[false, 'calendar']],
context: {},
search_view_id: self.employee_data.job_search_view_id,
target: 'current'
})
},
action_leave_allocations: function(event) {
var self = this;
event.stopPropagation();
event.preventDefault();
this.do_action({
name: _t("Department Leaves Allocation"),
type: 'ir.actions.act_window',
res_model: 'hr.holidays',
view_mode: 'tree,form,calendar',
view_type: 'form',
views: [[false, 'list'],[false, 'calender']],
context: {
'search_default_approve': true,
},
domain: [['type','=','add'],],
search_view_id: self.employee_data.leave_search_view_id,
target: 'current'
})
},
action_attendance: function(event){
var self = this;
event.stopPropagation();
event.preventDefault();
this.do_action({
name: _t("Attendances"),
type: 'ir.actions.act_window',
res_model: 'hr.attendance',
view_mode: 'tree,form',
view_type: 'form',
views: [[false, 'list'],[false, 'form']],
context: {
'search_default_today': true,
},
domain: [],
search_view_id: self.employee_data.attendance_search_view_id,
target: 'current'
})
},
action_expenses: function(event){
var self = this;
event.stopPropagation();
event.preventDefault();
this.do_action({
name: _t("Expense Reports to Approve"),
type: 'ir.actions.act_window',
res_model: 'hr.expense',
view_mode: 'tree,kanban,form,pivot,graph',
view_type: 'form',
views: [[false, 'list'],[false, 'form'],[false, 'kanban'],[false, 'pivot'],[false, 'graph']],
context: {
'search_default_submitted': true,
},
domain: [],
search_view_id: self.employee_data.attendance_search_view_id,
target: 'current'
})
},
action_my_profile: function(event) {
var self = this;
event.stopPropagation();
event.preventDefault();
this.do_action({
name: _t("My Profile"),
type: 'ir.actions.act_window',
res_model: 'hr.employee',
res_id: self.employee_data.id,
view_mode: 'form',
view_type: 'form',
views: [[false, 'form']],
context: {},
domain: [],
target: 'inline'
})
},
// Function which gives random color for charts.
getRandomColor: function () {
var letters = '0123456789ABCDEF'.split('');
var color = '#';
for (var i = 0; i < 6; i++ ) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
},
// Here we are plotting bar,pie chart
graph: function() {
var self = this
var ctx = this.$el.find('#myChart')
// Fills the canvas with white background
Chart.plugins.register({
beforeDraw: function(chartInstance) {
var ctx = chartInstance.chart.ctx;
ctx.fillStyle = "white";
ctx.fillRect(0, 0, chartInstance.chart.width, chartInstance.chart.height);
}
});
var bg_color_list = []
for (var i=0;i<=12;i++){
bg_color_list.push(self.getRandomColor())
}
var myChart = new Chart(ctx, {
type: 'bar',
data: {
//labels: ["January","February", "March", "April", "May", "June", "July", "August", "September",
// "October", "November", "December"],
labels: self.employee_data.payroll_label,
datasets: [{
label: 'Payroll',
data: self.employee_data.payroll_dataset,
backgroundColor: bg_color_list,
borderColor: bg_color_list,
borderWidth: 1,
pointBorderColor: 'white',
pointBackgroundColor: 'red',
pointRadius: 5,
pointHoverRadius: 10,
pointHitRadius: 30,
pointBorderWidth: 2,
pointStyle: 'rectRounded'
}]
},
options: {
scales: {
yAxes: [{
ticks: {
min: 0,
max: Math.max.apply(null,self.employee_data.payroll_dataset),
//min: 1000,
//max: 100000,
stepSize: self.employee_data.
payroll_dataset.reduce((pv,cv)=>{return pv + (parseFloat(cv)||0)},0)
/self.employee_data.payroll_dataset.length
}
}]
},
responsive: true,
maintainAspectRatio: true,
animation: {
duration: 100, // general animation time
},
hover: {
animationDuration: 500, // duration of animations when hovering an item
},
responsiveAnimationDuration: 500, // animation duration after a resize
legend: {
display: true,
labels: {
fontColor: 'black'
}
},
},
});
//Pie Chart
var piectx = this.$el.find('#attendanceChart');
bg_color_list = []
for (var i=0;i<=self.employee_data.attendance_dataset.length;i++){
bg_color_list.push(self.getRandomColor())
}
var pieChart = new Chart(piectx, {
type: 'pie',
data: {
datasets: [{
data: self.employee_data.attendance_dataset,
backgroundColor: bg_color_list,
label: 'Attendance Pie'
}],
labels:self.employee_data.attendance_labels,
},
options: {
responsive: true
}
});
$('#emp_details').DataTable( {
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel',
{
extend: 'pdf',
footer: 'true',
orientation: 'landscape',
title:'Employee Details',
text: 'PDF',
exportOptions: {
modifier: {
selected: true
}
}
},
{
extend: 'print',
exportOptions: {
columns: ':visible'
}
},
'colvis'
],
columnDefs: [ {
targets: -1,
visible: false
} ],
lengthMenu: [[10, 25, 50, -1], [10, 25, 50, "All"]],
pageLength: 15,
} );
},
generate_payroll_pdf: function(chart){
if (chart == 'bar'){
var canvas = document.querySelector('#myChart');
}
else if (chart == 'pie') {
var canvas = document.querySelector('#attendanceChart');
}

//creates image
var canvasImg = canvas.toDataURL("image/jpeg", 1.0);
var doc = new jsPDF('landscape');
doc.setFontSize(20);
doc.addImage(canvasImg, 'JPEG', 10, 10, 280, 150 );
doc.save('report.pdf');
},
})
// View adding to the registry
core.view_registry.add('hr_dashboard_view', HrDashboardView);
return HrDashboardView
});


4
Avatar
Zrušit
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
Using with_context in super call turns into infinite call in odoo Vyřešeno
odooV8 odoo8.0
Avatar
Avatar
Avatar
2
led 20
16274
How to call a wizard from js in odoo
javascript odoo9.0
Avatar
Avatar
2
říj 19
13127
Edit inherited field definition in odoo 8 Vyřešeno
odooV8 odoo8.0
Avatar
Avatar
Avatar
Avatar
Avatar
16
srp 19
11626
display field depending the value of another field in the view (odoo 8) Vyřešeno
odooV8 odoo8.0
Avatar
Avatar
1
led 19
6176
Hide print in menu bar
odooV8 odoo8.0
Avatar
Avatar
5
čvn 18
11720
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now