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

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

pos
By
JC
on 3/22/14, 4:19 AM 1,380 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.

2

JC

--JC--
807
| 5 1 8
Kuala Lumpur, Malaysia
--JC--

 

JC
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)
EXAMPLE:
return self.fetch(
'product.product',
[ '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'],
[['sale_ok','=',true],['available_in_pos','=',true]],
{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)
EXAMPLE:
else if( mode === 'price'){

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

order.getSelectedLine().set_unit_price(val);
}

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 :-)

Abhishek
on 4/7/14, 11:00 PM

No problem.

JC
on 4/8/14, 12:43 AM
0
ahmad
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.

JC
on 4/8/14, 12:49 AM

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

ahmad
on 4/15/14, 6:27 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

0 follower(s)

Stats

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