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.

1

Default Customer on POS

By
Néstor Gómez Muñoz
on 1/21/15, 4:08 PM 1,839 views

In a Point of Sale, by default appears 'Unknown Customer' as client name, so we click on that name, appears a list of customers and select the desired customer to finaly click on the Set Customer button. This is for each sale.

Do you know a way to preset a default customer, say 'Generic Client' avoiding having to select it each time?

I already try on pos.xml, but can only change the name whith out affecting the object.

Regards.

My solucion: Add a field x_default_client, on pos.config model and modified form view to add that field. There I can define which partner will be. On point_of_sale module, on static/src/js/models.js, I added the line this.set_default_client(order) on function 'add_new_order()' and defined that new function 'set_default_client(order)' where is searched the partner using x_default= order.pos.config.x_default_client and setting default_client = this.db.get_partner_by_id(x_default[0]) Some more code to validate and so.

Néstor Gómez Muñoz
on 2/10/15, 12:58 PM
0
Jairo Quezada
On 1/5/16, 1:50 AM

Good evening, I'm using Odoo 8 and I would like to facilitate me the code of the solution to establish a customer default at the point of sale .Thank you

--Excerpt from OCB/addons/point_of_sale/static/src/js/models.js, with aproximated line numbers: 460 //creates a new empty order and sets it as the current order 461 add_new_order: function(){ 462 var order = new module.Order({pos:this}); 463 this.get('orders').add(order); 464 this.set('selectedOrder', order); 465 this.set_default_client(order); 466 }, 467 468 // set default client from pos.config 469 set_default_client: function(order) { 470 var default_client; 471 var x_default = order.pos.config.x_default_client; 472 var client_id; 473 if (x_default) { 474 client_id=parseInt(x_default[0]); 475 } 476 default_client = this.db.get_partner_by_id(client_id); 477 if (default_client) { 478 order.set_client(default_client); 479 } 480 },

Néstor Gómez Muñoz
on 1/5/16, 12:57 PM

Thanks for the help. Very thoughtful of you. Now I'm trying to enable the physical taclado with the post, trying to jquery.hotkeys.js, any ideas for a case? Yelizariev POS_Keyboard module only enables the keypad.

Jairo Quezada
on 1/12/16, 9:45 PM

Olá Néstor, I've attempted to follow your instructions to set a default customer for each of my three POS. I managed to create a new field x_default_client and checked that it in fact exists using pgAdmin, I successfully added the field to the form view pos.config and I also added the code to C:\Program Files (x86)\Odoo 8.0-20150511\server\openerp\addons\point_of_sale\static\src\js\models.js However, I have created a client called "Indiferenciado" that has partner_id=30 and I set the x_default_client to 30 on all Points of sale, but they still default to "Unknown Customer" when I open a POS session. What might I be doing wrong?

Daniel Holden
on 1/29/16, 10:50 AM

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

2 follower(s)

Stats

Asked: 1/21/15, 4:08 PM
Seen: 1839 times
Last updated: 1/5/16, 1:50 AM