Initial commit: Mail packages

This commit is contained in:
Ernad Husremovic 2025-08-29 15:20:51 +02:00
commit 4e53507711
1948 changed files with 751201 additions and 0 deletions

View file

@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import project_task_type
from . import project_task
from . import project_stage
from . import project

View file

@ -0,0 +1,28 @@
# -*- 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

View file

@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class ProjectProjectStage(models.Model):
_inherit = 'project.project.stage'
sms_template_id = fields.Many2one('sms.template', string="SMS Template",
domain=[('model', '=', 'project.project')],
help="If set, an SMS Text Message will be automatically sent to the customer when the project reaches this stage.")

View file

@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class ProjectTask(models.Model):
_inherit = "project.task"
def _send_sms(self):
for task in self:
if task.partner_id and task.stage_id and task.stage_id.sms_template_id:
task._message_sms_with_template(
template=task.stage_id.sms_template_id,
partner_ids=task.partner_id.ids,
)
@api.model_create_multi
def create(self, vals_list):
tasks = super().create(vals_list)
tasks._send_sms()
return tasks
def write(self, vals):
res = super().write(vals)
if 'stage_id' in vals:
# sudo as sms template model is protected
self.sudo()._send_sms()
return res

View file

@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class ProjectTaskType(models.Model):
_inherit = "project.task.type"
sms_template_id = fields.Many2one('sms.template', string="SMS Template",
domain=[('model', '=', 'project.task')],
help="If set, an SMS Text Message will be automatically sent to the customer when the task reaches this stage.")