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