Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • 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
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

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

Odoberať

Get notified when there's activity on this post

This question has been flagged
overridev15
3206 Zobrazenia
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
Zrušiť
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!

Registrácia
Related Posts Replies Zobrazenia Aktivita
Override report_invoice_document Solved
report override v15
Avatar
Avatar
1
mar 23
4592
How to inherit js function in odoo v15.
js override v15
Avatar
1
aug 22
48
I need to update a field value in a field in another model in odoo15
python override v15
Avatar
Avatar
1
júl 22
5964
Prevent navigation if records are not save
v15
Avatar
Avatar
Avatar
2
okt 25
3137
Creating user creates duplicated partner_id
v15
Avatar
Avatar
1
sep 25
3052
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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