Skip to Content
Menu
This question has been flagged
1 Reply
5938 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

Avatar
Discard
Best Answer

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 !!

Avatar
Discard
Author

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

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

Related Posts Replies Views Activity
6
Feb 21
14272
2
Jul 19
5866
1
Oct 16
4056
1
Jun 16
2462
1
Apr 16
2668