Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Validations
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Épicerie
    • Quincaillerie
    • Magasin de jouets
    Food & Hospitality
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • Brewery
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Trades
    • Bricoleur
    • Matériel informatique et support
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Browse all Industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenez partenaire
    • Services for Partners
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide

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

  • CRM
  • e-Commerce
  • Comptabilité
  • Inventaire
  • PoS
  • Projet
  • MRP
All apps
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

How To Override JS in odoo 15? Original Code Does not return models

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
overridev15
3229 Vues
Avatar
Zaw Naing Linn
"
odoo.define('pos_hr.employees', function (require) {
"use strict";

var models = require('point_of_sale.models');

models.load_models([{
model: 'hr.employee',
fields: ['name', 'id', 'user_id'],
domain: function(self){
console.log('ODOO ORIGINLA CODE 1111111111')
return self.config.employee_ids.length > 0
? [
'&',
['company_id', '=', self.config.company_id[0]],
'|',
['user_id', '=', self.user.id],
['id', 'in', self.config.employee_ids],
]
: [['company_id', '=', self.config.company_id[0]]];
},
loaded: function(self, employees) {
if (self.config.module_pos_hr) {
self.employees = employees;
self.employee_by_id = {};
self.employees.forEach(function(employee) {
self.employee_by_id[employee.id] = employee;
var hasUser = self.users.some(function(user) {
if (user.id === employee.user_id[0]) {
employee.role = user.role;
return true;
}
return false;
});
if (!hasUser) {
employee.role = 'cashier';
}
});
}
}
}]);

var posmodel_super = models.PosModel.prototype;
models.PosModel = models.PosModel.extend({
after_load_server_data: function() {
return posmodel_super.after_load_server_data.apply(this, arguments).then(() => {
// Value starts at false when module_pos_hr is true.
this
.hasLoggedIn = !this.config.module_pos_hr;
});
},
load_server_data: function () {
var self = this;
return posmodel_super.load_server_data.apply(this, arguments).then(function () {
var employee_ids = _.map(self.employees, function(employee){return employee.id;});
var records = self.rpc({
model: 'hr.employee',
method: 'get_barcodes_and_pin_hashed',
args: [employee_ids],
});
return records.then(function (employee_data) {
self.employees.forEach(function (employee) {
var data = _.findWhere(employee_data, {'id': employee.id});
if (data !== undefined){
employee.barcode = data.barcode;
employee.pin = data.pin;
}
});
});
});
},
set_cashier: function(employee) {
posmodel_super.set_cashier.apply(this, arguments);
const selectedOrder = this.get_order();
if (selectedOrder && !selectedOrder.get_orderlines().length) {
// Order without lines can be considered to be un-owned by any employee.
// We set the employee on that order to the currently set employee.
selectedOrder.employee = employee;
}
}
});

var super_order_model = models.Order.prototype;
models.Order = models.Order.extend({
initialize: function (attributes, options) {
super_order_model.initialize.apply(this, arguments);
if (!options.json) {
this.employee = this.pos.get_cashier();
}
},
init_from_JSON: function (json) {
super_order_model.init_from_JSON.apply(this, arguments);
if (this.pos.config.module_pos_hr) {
this.employee = this.pos.employee_by_id[json.employee_id];
}
},
export_as_JSON: function () {
const json = super_order_model.export_as_JSON.apply(this, arguments);
if (this.pos.config.module_pos_hr) {
json.employee_id = this.employee ? this.employee.id : false;
}
return json;
},
});
return models; ===>ODOO ORIGINAL CODE DOES NOT RETURN MODELS .THIS IS INSERTED MY RETURN CODE
});
I would like to override this pos function .This function does not have return action.So Override method does not work .Help Me
0
Avatar
Ignorer
Tung Thanh Pham

Hi Linn, have you figured it out how to do it without return?
Thank you in advanced!

Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
Override report_invoice_document Résolu
report override v15
Avatar
Avatar
1
mars 23
4596
How to inherit js function in odoo v15.
js override v15
Avatar
1
août 22
48
I need to update a field value in a field in another model in odoo15
python override v15
Avatar
Avatar
1
juil. 22
5973
Prevent navigation if records are not save
v15
Avatar
Avatar
Avatar
2
oct. 25
3142
Creating user creates duplicated partner_id
v15
Avatar
Avatar
1
sept. 25
3057
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenez partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة 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 est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

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