|
@ -28,7 +28,9 @@ class SubscriptionRequestService(Component): |
|
|
""" |
|
|
""" |
|
|
|
|
|
|
|
|
def get(self, _id): |
|
|
def get(self, _id): |
|
|
sr = self.env["subscription.request"].browse(_id) |
|
|
|
|
|
|
|
|
sr = self.env["subscription.request"].search( |
|
|
|
|
|
[("external_id", "=", _id)] |
|
|
|
|
|
) |
|
|
if sr: |
|
|
if sr: |
|
|
return self._to_dict(sr) |
|
|
return self._to_dict(sr) |
|
|
else: |
|
|
else: |
|
@ -63,7 +65,9 @@ class SubscriptionRequestService(Component): |
|
|
|
|
|
|
|
|
def update(self, _id, **params): |
|
|
def update(self, _id, **params): |
|
|
params = self._prepare_update(params) |
|
|
params = self._prepare_update(params) |
|
|
sr = self.env["subscription.request"].browse(_id) |
|
|
|
|
|
|
|
|
sr = self.env["subscription.request"].search( |
|
|
|
|
|
[("external_id", "=", _id)] |
|
|
|
|
|
) |
|
|
if not sr: |
|
|
if not sr: |
|
|
raise wrapJsonException( |
|
|
raise wrapJsonException( |
|
|
NotFound(_("No subscription request for id %s") % _id) |
|
|
NotFound(_("No subscription request for id %s") % _id) |
|
@ -73,8 +77,9 @@ class SubscriptionRequestService(Component): |
|
|
|
|
|
|
|
|
def _to_dict(self, sr): |
|
|
def _to_dict(self, sr): |
|
|
sr.ensure_one() |
|
|
sr.ensure_one() |
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
|
"id": sr.id, |
|
|
|
|
|
|
|
|
"id": sr.get_external_id(), |
|
|
"name": sr.name, |
|
|
"name": sr.name, |
|
|
"email": sr.email, |
|
|
"email": sr.email, |
|
|
"state": sr.state, |
|
|
"state": sr.state, |
|
|