mirror of
https://github.com/bringout/oca-ocb-mail.git
synced 2026-04-24 01:22:03 +02:00
19.0 vanilla
This commit is contained in:
parent
5df8c07b59
commit
daa394e8b0
2114 changed files with 564841 additions and 299642 deletions
27
odoo-bringout-oca-ocb-sms/sms/wizard/sms_account_phone.py
Normal file
27
odoo-bringout-oca-ocb-sms/sms/wizard/sms_account_phone.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import fields, models, _
|
||||
from odoo.addons.sms.tools.sms_api import ERROR_MESSAGES, SmsApi
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
class SmsAccountPhone(models.TransientModel):
|
||||
_name = 'sms.account.phone'
|
||||
_description = 'SMS Account Registration Phone Number Wizard'
|
||||
|
||||
account_id = fields.Many2one('iap.account', required=True)
|
||||
phone_number = fields.Char(required=True)
|
||||
|
||||
def action_send_verification_code(self):
|
||||
status = SmsApi(self.env, self.account_id)._send_verification_sms(self.phone_number)['state']
|
||||
if status != 'success':
|
||||
raise ValidationError(ERROR_MESSAGES.get(status, ERROR_MESSAGES['unknown_error']))
|
||||
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new',
|
||||
'name': _('Register Account'),
|
||||
'view_mode': 'form',
|
||||
'res_model': 'sms.account.code',
|
||||
'context': {'default_account_id': self.account_id.id},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue