Files
odoo_source/addons/project_sms/models/project_project.py
T
Hansun (hale) 7618380c46 [FIX] project_sms: fix sms failure
1. Install Contacts, Projects
2. Settings - Register account for SMS
3. Add the account with credit for IAP service with debug mode on
4. Create a Contact with mobile number and country from step 2
5. Go to Projects
- create a project and stages
- create SMS templates under Configuration
- under Task Stages, add sms template to each stages of the project
- on the task created, set the customer to what you created on step 3
- move the task from a stage to another

Issue:
- Lognote shows failed state when it is sent successfully
- On Settings/Technical/Discuss/Messages, record is duplicated

Resolve by:
- partiallly revert commit https://github.com/odoo/odoo/commit/5de1b941ce580253a21f0e4f6da0a8ca818f26b3

opw-3251410

closes odoo/odoo#118391

X-original-commit: c1a7e3c20244f45d49496db7d506bbf0fd96472a
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-04-13 05:07:55 +02:00

29 lines
838 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class ProjectProject(models.Model):
_inherit = "project.project"
def _send_sms(self):
for project in self:
if project.partner_id and project.stage_id and project.stage_id.sms_template_id:
project._message_sms_with_template(
template=project.stage_id.sms_template_id,
partner_ids=project.partner_id.ids,
)
@api.model_create_multi
def create(self, vals_list):
projects = super().create(vals_list)
projects._send_sms()
return projects
def write(self, vals):
res = super().write(vals)
if 'stage_id' in vals:
self._send_sms()
return res