Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyectos
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

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

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
overridev15
3228 Vistas
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
Descartar
Tung Thanh Pham

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

¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Registrarse
Publicaciones relacionadas Respuestas Vistas Actividad
Override report_invoice_document Resuelto
report override v15
Avatar
Avatar
1
mar 23
4596
How to inherit js function in odoo v15.
js override v15
Avatar
1
ago 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
5971
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
3055
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y estar totalmente integrado.

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