Browse Source

Merge pull request #70 from nicolasj77/working_mode_not_saved_first_time

[FIX] beesdoo_shift: fix first registration shift
pull/72/head
Houssine BAKKALI 6 years ago
committed by GitHub
parent
commit
55435c55f2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      beesdoo_shift/wizard/subscribe.py

14
beesdoo_shift/wizard/subscribe.py

@ -121,10 +121,16 @@ class Subscribe(models.TransientModel):
if self.reset_compensation_counter: if self.reset_compensation_counter:
data['sc'] = 0 data['sc'] = 0
status_id = self.env['cooperative.status'].search([('cooperator_id', '=', self.cooperator_id.id)])
coop_status_obj = self.env['cooperative.status']
status_id = coop_status_obj.search(
[('cooperator_id', '=', self.cooperator_id.id)])
if status_id: if status_id:
status_id.sudo().write(data) status_id.sudo().write(data)
else: else:
self.env['cooperative.status'].sudo().create(data)
status_id = coop_status_obj.sudo().create(data)
# Normally the write method is not necessary here.
# But it does not work without it. You have to make 2 registration
# to a shift to keep information like "Worker mode, session info
# ,...
status_id.sudo().write(data)
return True
Loading…
Cancel
Save