Community mailing list archives


Add new models to models.js

Same Motion S.A.C, Carlos Rodriguez
- 02 مارس, 2016 11:44:27

Hello community,

How can I propperly extend the models.js of the Point Of Sale (v9) in order to add a new model?

Need to do it using another js (ie, mymodels.js) I have tried with the following code:


odoo.define('point_of_sale_extension', function (require) {

"use strict";

var Model = require('web.DataModel');

var core = require('web.core');

var QWeb = core.qweb;

var _t = core._t;

var module = require('point_of_sale.DB');

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

var models = pos_model.PosModel.prototype.models;

var modscreen = require('point_of_sale.screens');

models.push ([


model: 'x_pos_promotions',

fields: ['x_name', 'x_promo_type', 'x_from_date', 'x_to_date', 'x_buy_qty', 'x_get_qty', 'x_discount', 'x_get_product'],

domain: null,

loaded: function(self, promotions){



}, {

model: 'x_pos_promotions_line',

fields: ['x_buy_product','x_promotion_id'],

domain: null,

loaded: function(self, promotions_line){






Best regards,

Carlos Rodríguez Rossi