Commit 24fc11d0 by François C.

Add origin for every shift_registration modifications made outside Odoo interface

parent 8a020cf0
Pipeline #2132 passed with stage
in 1 minute 30 seconds
...@@ -427,7 +427,7 @@ def delete_shift_registration(request): ...@@ -427,7 +427,7 @@ def delete_shift_registration(request):
# Note: 'upcoming_registration_count' in res.partner won't change because the _compute method # Note: 'upcoming_registration_count' in res.partner won't change because the _compute method
# in odoo counts canceled shift registrations. # in odoo counts canceled shift registrations.
m = CagetteShift() m = CagetteShift()
res["cancel_shift"] = m.cancel_shift([shift_registration_id]) res["cancel_shift"] = m.cancel_shift([shift_registration_id], origin='bdm')
if shift_is_makeup is True: if shift_is_makeup is True:
fields = { fields = {
......
...@@ -69,7 +69,6 @@ urlpatterns = [ ...@@ -69,7 +69,6 @@ urlpatterns = [
url(r'^admin/manage_attached/delete_pair$', admin.delete_pair), url(r'^admin/manage_attached/delete_pair$', admin.delete_pair),
url(r'^get_makeups_members$', admin.get_makeups_members), url(r'^get_makeups_members$', admin.get_makeups_members),
url(r'^update_members_makeups$', admin.update_members_makeups), url(r'^update_members_makeups$', admin.update_members_makeups),
url(r'^delete_shift_registration$', admin.delete_shift_registration),
url(r'^get_member_info/(\d+)$', admin.get_member_info), url(r'^get_member_info/(\d+)$', admin.get_member_info),
url(r'^get_attached_members$', admin.get_attached_members), url(r'^get_attached_members$', admin.get_attached_members),
] ]
...@@ -210,9 +210,10 @@ class CagetteShift(models.Model): ...@@ -210,9 +210,10 @@ class CagetteShift(models.Model):
coop_logger.error("Model affect shift nobody found : %s", str(cond)) coop_logger.error("Model affect shift nobody found : %s", str(cond))
return response return response
def cancel_shift(self, idsRegisteur): def cancel_shift(self, idsRegisteur, origin='memberspace'):
"""Annule un shift""" """Annule un shift"""
fieldsDatas = { "related_shift_state": 'cancel', fieldsDatas = { "related_shift_state": 'cancel',
"origin": origin,
"state": 'cancel'} "state": 'cancel'}
return self.o_api.update('shift.registration', idsRegisteur, fieldsDatas) return self.o_api.update('shift.registration', idsRegisteur, fieldsDatas)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment