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.

0

How to inherit / modify point of sale pages & create restrictions?

By
Yenthe
on 7/27/15, 8:40 AM 938 views

Hi guys,

Since a while I've been tinkering around in the point_of_sale module. I have no good knowledge about the JS library that is used in the point of sale and so I lack some knowledge. I want to accomplish a few things but I have no clue how and there really is no documentation about point of sale modifications despite the blogpost about Thierry.

What I want to do:

When the point of sale opens I want to directly show the screen to select a customer. A customer has to be filled in before this view can be exited. I've found out the views are defined in point_of_sale/static/src/xml/pos.xml and the template for selecting a customer is 'ClientDetails'. How do I trigger this view to open directly and how can I make sure it has to be filled in before any other view will open? (the product overview page)

Secondly when a person selects a product in the point of sale there need to happen some checks:

  • The product has to be in a product category (pos.category model) that is set in the many2many that I've added on the customer (res.partner model):

     class aa_maatwerk_vzw(models.Model):
        _inherit = 'res.partner'
        product_category_ids = fields.Many2many('pos.category', 'product_template_rel', 'product_id', 'category_id', 'Categories')

  • They can only buy xx items per month per category. The max amount per month is set on the model pos.category. The sum of all already bought products cannot be higher than the limit per month on the category:

     class aa_maatwerk_vzw_produt(models.Model):
        _inherit = 'pos.category'
        MaxAmountMonthly = fields.Integer('# pieces/month', help="Max number of products buyable on this category for this month.")

So how can I build in limits checking against categories, quantities, earlier made orders, ...? I'd really like to know how I can do these checks on a product click and how I can secure it. For example when a condition is not met a pop-up should show a message "Monthly quota reached" for example.

Could anybody give me some ideas / help in the good way? All the knowledge that I gain will be used to create a blog post about how to inherit/modify the point of sale. This way other people benefit from this too! So any help is welcome!

Thanks,
Yenthe

4

Parikshit

--Parikshit--
939
| 6 3 8
Ahmedabad, India
--Parikshit--

Working as an OpenERP/Odoo developer both experience in web and addons. you can contact me at:

E-mail : parikshitvaghasiya@gmail.com

Blog : parikshitvaghasiya.blogspot.in

Stackoverflow : http://stackoverflow.com/users/5089106/parikshit-vaghasiya

Parikshit
On 8/31/15, 2:17 AM

Hello,

This will help you.
First you have to inherit widget and widget method in your module like this :

module.PosWidget.include{(
build_widgets: function() {
var self = this;
this.screen_selector = new module.ScreenSelector({
pos: this.pos, screen_set:{ 'products': this.product_screen,
'payment' : this.payment_screen, 'scale': this.scale_screen, 'receipt' : this.receipt_screen, 'clientlist': this.clientlist_screen, }, popup_set:{ 'error': this.error_popup, 'error-barcode': this.error_barcode_popup, 'error-traceback': this.error_traceback_popup, 'confirm': this.confirm_popup, 'unsent-orders': this.unsent_orders_popup, }, default_screen: 'clientlist', #here you select your default screen default_mode: 'cashier', });
};
)}; 

For second change you have to add field in models.js where all fields and models are added, after addind field you have to defind and show field in xml file and extend that template in your module. For more Customization you can contact me on parikshitvaghasiya@gmail.com. 

Thank you !!

Thanks for this, I'm sure it will be a nice start! +1

Yenthe
on 9/1/15, 3:21 AM

if my answer is helpful to you Please accept answer. thank you!!

Parikshit
on 9/10/15, 2:18 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

1 follower(s)

Stats

Asked: 7/27/15, 8:40 AM
Seen: 938 times
Last updated: 9/10/15, 3:21 AM