Search code examples
odoo-8odoopos

How Receipt Ref gets its value when a pos order is placed


In odoo 8,there is a field named Receipt Ref (technical name pos_referance. I want to know about how this value is created. For eg: If pos_referance is 27574-004-04-0003 , what does 27574 , 004 , 04 and 0003stands for ?


Solution

  • This number is generated from the JavaScript file located at addons/point_of_sale/static/src/js/models.js

    In this file you can find one model names "Order", inside this model one method is there which is responsible for this sequence. Please have a look below for that method.

    generateUniqueId: function() {
           function zero_pad(num,size){
                var s = ""+num;
                while (s.length < size) {
                    s = "0" + s;
                }
                return s;
            }
            return zero_pad(this.pos.pos_session.id,5) +'-'+
                   zero_pad(this.pos.pos_session.login_number,3) +'-'+
                   zero_pad(this.sequence_number,4);
    },