Odoo Help


How to add price validation in POS ,to pop up a warning when the price is less than the cost ?

on 3/22/14, 4:19 AM 2,067 views

In brief I wish to find the following answers: 1) How to add cost price to POS local database ? 2) How to add a function to validate the selling price against the cost price in POS ?

I have look everywhere but can't find where to add the cost price in order to pass it down to local database when POS session is created. For POS session I guess changes should be made in models.js in static/src/js folder but I am not sure

Appreciate If someone could give me a light in this. I could not find any developer guide for POS. if there is any please send me the link . Thanks in advance.



| 5 2 8
Kuala Lumpur, Malaysia


On 3/22/14, 11:12 PM

I have found the anwser
WHERE: addons/point_of_sale/static/src/js

WHAT: to add product cost to POS session
WHERE: models.js
HOW: look for product.product and add standard_price (in bold)
return self.fetch(
[ 'standard_price' ,'name', 'list_price','price','pos_categ_id', 'taxes_id', 'ean13', 'default_code',
'to_weight', 'uom_id', 'uos_id', 'uos_coeff', 'mes_type', 'description_sale', 'description'],
{pricelist: self.get('shop').pricelist_id[0]} // context for price

WHAT: to display warning when selling price is less than cost
WHERE: In widgets.js
HOW: look for mode == 'price' add alert in the example below. (highlighted in bold)
else if( mode === 'price'){

if (val < order.getSelectedLine().product.get('standard_price')){
alert( "Warning Price lower than cost");


might be it's working

Atul Kumar jain
on 3/23/14, 3:44 AM

Thanks bro !!! Its helped me in some similar kind of need. Thanks again :-)

on 4/7/14, 11:00 PM

No problem.

on 4/8/14, 12:43 AM
On 4/7/14, 8:30 AM

hi there.

is this code working? because i tried it already, and nothing pops up.


The code is simple but only for experience users, try to troubleshoot yourself, for example place the alert somewhere else to display the value captured. test the condition by placing the alert inside and outside the condition.

on 4/8/14, 12:49 AM

thanks. i thought the code is for the pos backend, but it actually for the frontend pos.

on 4/15/14, 6:27 AM

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

0 follower(s)


Asked: 3/22/14, 4:19 AM
Seen: 2067 times
Last updated: 3/16/15, 8:10 AM