Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

[POS] push the new variable in the cache with .js file

By
Gael Torrecillas
on 1/12/16, 8:40 AM 390 views

Hello


I develop addon for Point Of Sale (POS), but I have one problem.

for each product, my .js loads floor_sale_price_total. Defined in other addon, so it's in database.

With debug mode of my navigator, I see that my .js loads this attribute.

But my .xml says "undefined"(or hasn't number), if I change attribute 'floor_sale_price_total' by 'price' (attribute in the models.js of Point of Sale), I see the price of ech article.

So my problem is in my .js but I don't know where it's.



my .js

odoo.define('pos_min_price.PosModel', function(require){

"use strict";

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

    models.load_models({

        model: 'product.product',

fields: ['floor_sale_price_total'],

domain:[['sale_ok','=',true],['available_in_pos','=',true]],

context: function(self){ return {'floor_sale_price': self.floor_sale_price_total}},

loaded: function(self, products){

$.each(products, function(){

$.extend(self.db.get_product_by_id(this.id) || {}, this)

            });

        }

    })

})

0
Mind And Go
On 1/31/16, 4:18 PM

Hi Gael, apparently, in the pos_cache module, there is a set of values defined as the filed to be loaded in cache.

Maybe you could find the way to add new fields to this part.


regards

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 1/12/16, 8:40 AM
Seen: 390 times
Last updated: 1/31/16, 4:20 PM