[FIX] point_of_sale: permit accountant to change lock date

Accountant who change the lock date is not always a pos user, and then
cannot read pos sessions.

closes odoo/odoo#42156

X-original-commit: 8c6aa24525eca434b6f85b56c10c45b33cc05a43
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
This commit is contained in:
Nicolas Seinlet
2019-12-17 11:10:30 +00:00
parent 00a341f467
commit 6b751f12f3
+1 -1
View File
@@ -19,7 +19,7 @@ class ResCompany(models.Model):
would trigger an error message saying that the period has been locked when
trying to close them.
"""
pos_session_model = self.env['pos.session']
pos_session_model = self.env['pos.session'].sudo()
for record in self:
sessions_in_period = pos_session_model.search([('state', '!=', 'closed'), '|', ('start_at', '<=', record.period_lock_date), ('start_at', '<=', record.fiscalyear_lock_date)])
if sessions_in_period: