Odoo Help


How are orders saved to the database point_of_sale touchscreen?

on 6/10/14, 2:53 AM 1,113 views

I am trying to trace how orders from touchscreen interface of the point of sale module are saved to database but to no avail. I have tracked the process but don't understand how these scripts saves order/s to the database.

file: addons/point_of_sale/static/src/js/db.js

* save: function(store,data){
            var str_data = JSON.stringify(data);
            localStorage[this.name + '_' + store] = JSON.stringify(data);
            this.cache[store] = data;

*In a series of function calls this was the last called. But I don't understand how this script would save data to the database. Is this the function that saves or is there anything else involved in the process.


Thierry Godin

--Thierry Godin--
| 8 7 8
Collegien, France
--Thierry Godin--


Thierry Godin
On 6/10/14, 6:02 AM

Hi ,


In V7, this is the _flush() function  in static/js/model.js around line 275 :

        _flush: function(index){
            var self = this;
            var orders = this.db.get_orders();

            var order  = orders[index];
            //try to push an order to the server
            // shadow : true is to prevent a spinner to appear in case of timeout
            (new instance.web.Model('pos.order')).call('create_from_ui',[[order]],undefined,{ shadow:true })
                .fail(function(unused, event){
                    //don't show error popup if it fails
                    console.error('Failed to send order:',order);
                    //remove from db if success

Hope this helps.

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 platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 6/10/14, 2:53 AM
Seen: 1113 times
Last updated: 3/16/15, 8:10 AM