[IMP] point_of_sale: check constraint at session creation

The constraints could be bypassed if a user set a jourmal/account/location to
the pos.config and, then, modifies the location configuration.

Checking the value of current_session_id makes sure the constraints is triggered
also when the session is created.

Prevents workarounds such as explained at #26641
This commit is contained in:
Martin Trigaux
2018-09-13 09:49:35 +00:00
parent 6caeed1fd7
commit 6dacb3269d
@@ -437,6 +437,11 @@ class PosConfig(models.Model):
"""
self.ensure_one()
if not self.current_session_id:
self._check_company_location()
self._check_company_journal()
self._check_company_invoice_journal()
self._check_company_payment()
self._check_currencies()
self.current_session_id = self.env['pos.session'].create({
'user_id': self.env.uid,
'config_id': self.id