Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

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

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

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

Naroči se

Get notified when there's activity on this post

This question has been flagged
overridev15
3235 Prikazi
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
Opusti
Tung Thanh Pham

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

Enjoying the discussion? Don't just read, join in!

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

Prijavi
Related Posts Odgovori Prikazi Aktivnost
Override report_invoice_document Solved
report override v15
Avatar
Avatar
1
mar. 23
4596
How to inherit js function in odoo v15.
js override v15
Avatar
1
avg. 22
48
I need to update a field value in a field in another model in odoo15
python override v15
Avatar
Avatar
1
jul. 22
5975
Prevent navigation if records are not save
v15
Avatar
Avatar
Avatar
2
okt. 25
3142
Creating user creates duplicated partner_id
v15
Avatar
Avatar
1
sep. 25
3062
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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