Initial commit: OCA Technical packages (595 packages)

This commit is contained in:
Ernad Husremovic 2025-08-29 15:43:03 +02:00
commit 2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions

View file

@ -0,0 +1,23 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2015 - present Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import mgmtsystem_claim_stage
from . import mgmtsystem_claim
from . import res_partner

View file

@ -0,0 +1,91 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from datetime import datetime, timedelta
from odoo import _, api, fields, models
class MgmtsystemClaim(models.Model):
_name = "mgmtsystem.claim"
_description = "Claim for Management System"
_inherit = "crm.claim"
reference = fields.Char(required=True, readonly=True, default="NEW")
message_ids = fields.One2many(
"mail.message", "res_id", "Messages", domain=[("model", "=", _name)]
)
company_id = fields.Many2one(
"res.company", "Company", default=lambda self: self.env.company
)
stage_id = fields.Many2one(
"mgmtsystem.claim.stage", "Stage", default=lambda self: self.get_default_stage()
)
@api.model
def get_default_stage(self):
return self.env["mgmtsystem.claim.stage"].search([])[0].id
@api.model_create_multi
def create(self, vals_list):
for one_vals in vals_list:
if one_vals.get("reference", _("New")) == _("New"):
Sequence = self.env["ir.sequence"]
one_vals["reference"] = Sequence.next_by_code("mgmtsystem.action")
actions = super().create(vals_list)
actions.send_mail_for_action()
return actions
def get_action_url(self):
"""Return action url to be used in email templates."""
base_url = (
self.env["ir.config_parameter"]
.sudo()
.get_param("web.base.url", default="http://localhost:8069")
)
url = ("{}/web#db={}&id={}&model={}").format(
base_url, self.env.cr.dbname, self.id, self._name
)
return url
def send_mail_for_action(self, force_send=True):
template = self.env.ref("mgmtsystem_claim.email_template_new_claim_reminder")
for action in self:
template.send_mail(action.id, force_send=force_send)
return True
@api.model
def process_reminder_queue(self, reminder_days=10):
"""Notify user when we are 10 days close to a deadline."""
cur_date = datetime.now().date() + timedelta(days=reminder_days)
stage_close = self.env.ref("mgmtsystem_claim.stage_close")
actions = self.search(
[("stage_id", "!=", stage_close.id), ("date_deadline", "=", cur_date)]
)
if actions:
template = self.env.ref(
"mgmtsystem_claim.email_template_remain_claim_reminder"
)
for action in actions:
template.send_mail(action.id)
return True
return False

View file

@ -0,0 +1,38 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2015 - present Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from odoo import fields, models
class MgmtsystemClaimStage(models.Model):
_name = "mgmtsystem.claim.stage"
_description = "Claim stages for Management system"
_inherit = "crm.claim.stage"
_order = "sequence"
team_ids = fields.Many2many(
comodel_name="crm.team",
relation="crm_team_mgmtsystem_claim_stage_rel",
column1="stage_id",
column2="team_id",
string="Teams",
help="Link between stages and sales teams. When set, this limitate "
"the current stage to the selected sales teams.",
)

View file

@ -0,0 +1,28 @@
# Copyright 2015-2017 Odoo S.A.
# Copyright 2017 Tecnativa - Vicent Cubells
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from odoo import api, fields, models
class ResPartner(models.Model):
_inherit = "res.partner"
mgmtsystem_claim_count = fields.Integer(
string="# Mgmt Claims", compute="_compute_mgmtsystem_claim_count"
)
mgmtsystem_claim_ids = fields.One2many(
comodel_name="mgmtsystem.claim", inverse_name="partner_id"
)
@api.depends("claim_ids", "child_ids", "child_ids.claim_ids")
def _compute_mgmtsystem_claim_count(self):
partners = self | self.mapped("child_ids")
partner_data = self.env["mgmtsystem.claim"].read_group(
[("partner_id", "in", partners.ids)], ["partner_id"], ["partner_id"]
)
mapped_data = {m["partner_id"][0]: m["partner_id_count"] for m in partner_data}
for partner in self:
partner.mgmtsystem_claim_count = mapped_data.get(partner.id, 0)
for child in partner.child_ids:
partner.mgmtsystem_claim_count += mapped_data.get(child.id, 0)