summaryrefslogtreecommitdiff
path: root/addons/sms/models
diff options
context:
space:
mode:
authorRaphael Collet <rco@odoo.com>2019-08-19 15:04:22 +0000
committerRaphael Collet <rco@odoo.com>2019-08-22 10:05:52 +0000
commit8918bbbb5e0e3ac70b89470dd79b9717f3b67ab6 (patch)
tree2c3f3bac03ccd1065a0f0e280c4d0f6a84d502da /addons/sms/models
parent723a2682bc5c9ae0af821bb461b0121818882dd9 (diff)
[IMP] fields: do not trigger recomputations on transient models from regular models
This is a performance optimization: modifying a regular record will not trigger some recomputation on a transient record. Most transient records are simply waiting to be garbage-collected, so there is no need to keep their fields up-to-date. closes odoo/odoo#35909 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Diffstat (limited to 'addons/sms/models')
-rw-r--r--addons/sms/models/mail_notification.py19
1 files changed, 0 insertions, 19 deletions
diff --git a/addons/sms/models/mail_notification.py b/addons/sms/models/mail_notification.py
index 6ab3dbecff3..c45981ea0b0 100644
--- a/addons/sms/models/mail_notification.py
+++ b/addons/sms/models/mail_notification.py
@@ -16,22 +16,3 @@ class Notification(models.Model):
('sms_credit', 'Insufficient Credit'),
('sms_server', 'Server Error')]
)
- # Though this is an interesting case:
- # On sms.resend.recipient, partner_id depends on mail.notification.partner_id as it is defined as a related
- # fields.Many2one('res.partner', 'Partner', related='notification_id.res_partner_id', readonly=True)
- # The below is to add an inverse to the many2one sms.resend.recipient.notification_id
- # so it maintains a list of sms.resend.recipient.partner_id to invalidate
- # when modifying the partner_id of mail.notification. Otherwise the ORM has to do a plain search to find the sms.resend.recipient
- # which have as notification id the one that has been modified
- # Though:
- # - We already discussed the matter it would rather be more interesting to do this automatically for these cases,
- # with a kind of virtual one2many the developer/user doesn't know about,
- # so the developer doesnt have to create it himself for this technical/performance reason
- # - In this case, the modified happens on the creation of the mail.notification, and has it has just been created it
- # would be quite safe to assume there was no `sms.resend.recipient` and we could have avoided the search,
- # even without this virtual/technical one2many.
- # - Besides, its a wizard, and we also discussed the possibility to stop the modified when going from a regular model to a transient model
- # meaning when we update something on the record on which is based the wizard
- # e.g. a related to the invoice name, something like that,
- # we let the modified do its change when we specifically change the invoice on the wizard, but not when changing the name on the invoice
- sms_resend_recipient_ids = fields.One2many('sms.resend.recipient', 'notification_id', strong='SMS recipients to resend')