-
-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[16.0][ADD] sms_alternative_provider, sms_messagebird #327
base: 16.0
Are you sure you want to change the base?
Conversation
@sebastienbeau This is an attempt to produce something a step up from what you have done with |
|
||
_name = "ir.sms.gateway" | ||
_order = "sequence" | ||
_desc = "SMS gateway provider" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be _description
.
|
||
def _handle_results(self, results, unlink_failed=False, unlink_sent=True): | ||
""" | ||
Write state of sms.sms objects based on results |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be nice to describe here which results are passed.
Also, are any of the original message key/value pairs passed? Would be handy to be able to rely on that.
'id': sms.sms id,
'number': phone number,
'content': sms content,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I now pass the whole list of messages as passed to _send, seems most general to me
another discussion point: Given that basically all modules that mess with sms at all override sms.api#_send_sms_batch and/or sms.sms#_postprocess_iap_sent_sms, it's crucial that the overrides of sms_alternative_provider come after any other override. I'm of a mind to patch into loading the module graph and inject a dependency on sms_alternative_provider for every module that depends on sms if sms_alternative_provider is installed. Do you agree, or should we leave this to glue modules to be done on a per case basis? |
I'm not quite sure of this TBH: let's say someone wanted to use That's not a very likely scenario, but in other cases, if I would override Could you give an example use case where someone would want this? |
sms_ovh_http works in both cases, so that's not a good example. sms_masked_content would have a problem, but that's handled accidentally right because modules on the same level (=same dependencies, both depend just on sms) are sorted alphabetically. So if you had another module also just depending on sms, but named |
Ah... right. Yes. Well your dependency idea does sound like a nice solution, so IMO you can go for it! |
ja hmm, i didn't think this through: at the point we can patch something, a module that we want to depend on ours might already be loaded, meaning its overrides are already incorporated into the models in the registry (odoo doesn't load the python code any more before actually loading the module). So we'd have to rebuild those models, remove the module from the module graph and have it reloaded afterwards. that's a very heavy operation for a theoretical problem, so I suggest we stash this idea for now. |
This module allows configuring multiple providers for sending SMS.
By restricting providers to country or area codes, you can ie have Odoo pick different providers for different countries.