Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sms_ovh/models/iap_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from odoo import api, models, fields, _
from odoo.exceptions import UserError


class IapAccount(models.Model):
_inherit = 'iap.account'

Expand All @@ -11,4 +12,5 @@ class IapAccount(models.Model):
ovh_application_secret = fields.Char('Application secret')
ovh_consumer_key = fields.Char('Consumer key')
ovh_sms_account = fields.Char('SMS account')
ovh_sms_api_user = fields.Char('SMS API user', help='It can be empty if you do not use OVH API User')
ovh_sender = fields.Char('Sender')
5 changes: 4 additions & 1 deletion sms_ovh/models/sms_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ def _sanitize_numbers(numbers):
application_key=account.ovh_application_key,
application_secret=account.ovh_application_secret,
consumer_key=account.ovh_consumer_key,)
url = '/sms/%s/jobs/' % account.ovh_sms_account
if account.ovh_sms_api_user:
url = '/sms/%s/users/%s/jobs/' % (account.ovh_sms_account, account.ovh_sms_api_user)
else:
url = '/sms/%s/jobs/' % account.ovh_sms_account
result_send = client.post(url,
charset='UTF-8',
coding='7bit',
Expand Down
1 change: 1 addition & 0 deletions sms_ovh/views/sms_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<field name="ovh_application_secret"/>
<field name="ovh_consumer_key"/>
<field name="ovh_sms_account"/>
<field name="ovh_sms_api_user"/>
<field name="ovh_sender"/>
</group>
</xpath>
Expand Down