Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Managament
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Producție
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

any help to Downgrade js file from v9 to v8

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
javascriptodooV8odoo8.0odoo9.0
4995 Vizualizări
Imagine profil
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
Imagine profil
Abandonează
Enjoying the discussion? Don't just read, join in!

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

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
Using with_context in super call turns into infinite call in odoo Rezolvat
odooV8 odoo8.0
Imagine profil
Imagine profil
Imagine profil
2
ian. 20
16112
How to call a wizard from js in odoo
javascript odoo9.0
Imagine profil
Imagine profil
2
oct. 19
13038
Edit inherited field definition in odoo 8 Rezolvat
odooV8 odoo8.0
Imagine profil
Imagine profil
Imagine profil
Imagine profil
Imagine profil
16
aug. 19
11498
display field depending the value of another field in the view (odoo 8) Rezolvat
odooV8 odoo8.0
Imagine profil
Imagine profil
1
ian. 19
6096
Hide print in menu bar
odooV8 odoo8.0
Imagine profil
Imagine profil
5
iun. 18
11605
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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