Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Nekilnojamasis turtas
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Konsultavimas
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Maistas
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Saulės energijos sistemos
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Kiti
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

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

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

any help to Downgrade js file from v9 to v8

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
javascriptodooV8odoo8.0odoo9.0
5080 Rodiniai
Portretas
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
Portretas
Atmesti
Enjoying the discussion? Don't just read, join in!

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

Registracija
Related Posts Replies Rodiniai Veikla
Using with_context in super call turns into infinite call in odoo Solved
odooV8 odoo8.0
Portretas
Portretas
Portretas
2
saus. 20
16241
How to call a wizard from js in odoo
javascript odoo9.0
Portretas
Portretas
2
spal. 19
13103
Edit inherited field definition in odoo 8 Solved
odooV8 odoo8.0
Portretas
Portretas
Portretas
Portretas
Portretas
16
rugp. 19
11588
display field depending the value of another field in the view (odoo 8) Solved
odooV8 odoo8.0
Portretas
Portretas
1
saus. 19
6159
Hide print in menu bar
odooV8 odoo8.0
Portretas
Portretas
5
birž. 18
11687
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة 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 yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

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