size
int64 0
304k
| ext
stringclasses 1
value | lang
stringclasses 1
value | branch
stringclasses 1
value | content
stringlengths 0
304k
| avg_line_length
float64 0
238
| max_line_length
int64 0
304k
|
---|---|---|---|---|---|---|
1,206 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class CopyVerificationLines(models.TransientModel):
"""Copy Verification Lines."""
_name = "copy.verification.lines"
_description = "Copy Verification Lines"
audit_src = fields.Many2one("mgmtsystem.audit", "Choose audit")
def copyVerificationLines(self):
# Copy verification lines from the chosen audit to the current one
audit_proxy = self.env[self._context.get("active_model")]
verification_line_proxy = self.env["mgmtsystem.verification.line"]
audit_id = self._context.get("active_id")
src_id = self.read(["audit_src"])[0]["audit_src"][0]
for line in audit_proxy.browse(src_id).line_ids:
verification_line_proxy.create(
{
"seq": line.seq,
"name": line.name,
"audit_id": audit_id,
"procedure_id": line.procedure_id.id,
"is_conformed": False,
}
)
return {"type": "ir.actions.act_window_close"}
| 38.903226 | 1,206 |
6,376 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
class MgmtsystemAudit(models.Model):
"""Model class that manage audit."""
_name = "mgmtsystem.audit"
_description = "Audit"
_inherit = ["mail.thread", "mail.activity.mixin"]
name = fields.Char()
reference = fields.Char(size=64, required=True, readonly=True, default="NEW")
date = fields.Datetime()
line_ids = fields.One2many(
"mgmtsystem.verification.line", "audit_id", "Verification List"
)
number_of_audits = fields.Integer("# of audits", readonly=True, default=1)
number_of_nonconformities = fields.Integer(
store=True,
compute="_compute_number_of_nonconformities",
)
number_of_questions_in_verification_list = fields.Integer(
store=True,
compute="_compute_number_of_questions_in_verification_list",
)
number_of_improvements_opportunity = fields.Integer(
"Number of improvements Opportunities",
store=True,
compute="_compute_number_of_improvement_opportunities",
)
days_since_last_update = fields.Integer(
store=True,
compute="_compute_days_since_last_update",
)
closing_date = fields.Datetime(readonly=True)
number_of_days_to_close = fields.Integer(
"# of days to close",
store=True,
compute="_compute_number_of_days_to_close",
)
user_id = fields.Many2one("res.users", "Audit Manager")
auditor_user_ids = fields.Many2many(
"res.users",
"mgmtsystem_auditor_user_rel",
"user_id",
"mgmtsystem_audit_id",
"Auditors",
)
auditee_user_ids = fields.Many2many(
"res.users",
"mgmtsystem_auditee_user_rel",
"user_id",
"mgmtsystem_audit_id",
"Auditees",
)
strong_points = fields.Html()
to_improve_points = fields.Html("Points To Improve")
imp_opp_ids = fields.Many2many(
"mgmtsystem.action",
"mgmtsystem_audit_imp_opp_rel",
"mgmtsystem_action_id",
"mgmtsystem_audit_id",
"Improvement Opportunities",
)
nonconformity_ids = fields.Many2many(
"mgmtsystem.nonconformity", string="Nonconformities"
)
state = fields.Selection(
[("open", "Open"), ("done", "Closed")], default="open", required=True
)
system_id = fields.Many2one("mgmtsystem.system", "System")
company_id = fields.Many2one(
"res.company", "Company", default=lambda self: self.env.company
)
@api.depends("nonconformity_ids")
def _compute_number_of_nonconformities(self):
"""Count number of nonconformities."""
for audit in self:
audit.number_of_nonconformities = len(audit.nonconformity_ids)
@api.depends("imp_opp_ids")
def _compute_number_of_improvement_opportunities(self):
"""Count number of improvements Opportunities."""
for audit in self:
audit.number_of_improvements_opportunity = len(audit.imp_opp_ids)
@api.depends("line_ids")
def _compute_number_of_questions_in_verification_list(self):
for audit in self:
audit.number_of_questions_in_verification_list = len(audit.line_ids)
@api.depends("write_date")
def _compute_days_since_last_update(self):
for audit in self:
audit.days_since_last_update = audit._elapsed_days(
audit.create_date, audit.write_date
)
@api.depends("closing_date")
def _compute_number_of_days_to_close(self):
for audit in self:
audit.number_of_days_to_close = audit._elapsed_days(
audit.create_date, audit.closing_date
)
@api.model
def _elapsed_days(self, dt1_text, dt2_text):
res = 0
if dt1_text and dt2_text:
dt1 = fields.Datetime.from_string(dt1_text)
dt2 = fields.Datetime.from_string(dt2_text)
res = (dt2 - dt1).days
return res
@api.model
def create(self, vals):
"""Audit creation."""
vals.update(
{"reference": self.env["ir.sequence"].next_by_code("mgmtsystem.audit")}
)
audit_id = super(MgmtsystemAudit, self).create(vals)
return audit_id
def button_close(self):
"""When Audit is closed, post a message to followers' chatter."""
self.message_post(body=_("Audit closed"))
return self.write({"state": "done", "closing_date": fields.Datetime.now()})
def get_action_url(self):
"""
Return a short link to the audit form view
eg. http://localhost:8069/?db=prod#id=1&model=mgmtsystem.audit
"""
base_url = self.env["ir.config_parameter"].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 get_lines_by_procedure(self):
p = []
for line in self.line_ids:
if line.procedure_id.id:
procedure_name = line.procedure_id.name
else:
procedure_name = _("Undefined")
p.append(
{
"id": line.id,
"procedure": procedure_name,
"name": line.name,
"yes_no": "Yes / No",
}
)
p = sorted(p, key=lambda k: k["procedure"])
proc_line = False
q = []
proc_name = ""
for i in range(len(p)):
if proc_name != p[i]["procedure"]:
proc_line = True
if proc_line:
q.append(
{
"id": p[i]["id"],
"procedure": p[i]["procedure"],
"name": "",
"yes_no": "",
}
)
proc_line = False
proc_name = p[i]["procedure"]
q.append(
{
"id": p[i]["id"],
"procedure": "",
"name": p[i]["name"],
"yes_no": "Yes / No",
}
)
return q
| 33.036269 | 6,376 |
420 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class MgmtsystemNonconformity(models.Model):
"""Class use to add audit_ids association to MgmtsystemNonconformity."""
_inherit = "mgmtsystem.nonconformity"
audit_ids = fields.Many2many("mgmtsystem.audit", string="Related Audits")
| 35 | 420 |
727 |
py
|
PYTHON
|
15.0
|
from odoo import fields, models
class MgmtsystemVerificationLine(models.Model):
"""Class to manage verification's Line."""
_name = "mgmtsystem.verification.line"
_description = "Verification Line"
_order = "seq"
name = fields.Char("Question", required=True)
audit_id = fields.Many2one(
"mgmtsystem.audit", "Audit", ondelete="cascade", index=True
)
procedure_id = fields.Many2one(
"document.page", "Procedure", ondelete="restrict", index=True
)
is_conformed = fields.Boolean(default=False)
comments = fields.Text()
seq = fields.Integer("Sequence")
company_id = fields.Many2one(
"res.company", "Company", default=lambda self: self.env.company
)
| 31.608696 | 727 |
1,229 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Hazard",
"version": "15.0.1.0.0",
"author": "Savoir-faire Linux, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/management-system",
"license": "AGPL-3",
"category": "Management System",
"depends": ["mgmtsystem", "hr"],
"data": [
"security/ir.model.access.csv",
"security/mgmtsystem_hazard_security.xml",
"views/mgmtsystem_hazard.xml",
"views/mgmtsystem_hazard_origin.xml",
"views/mgmtsystem_hazard_type.xml",
"views/mgmtsystem_hazard_probability.xml",
"views/mgmtsystem_hazard_severity.xml",
"views/mgmtsystem_hazard_usage.xml",
"views/mgmtsystem_hazard_control_measure.xml",
"views/mgmtsystem_hazard_test.xml",
],
"demo": [
"demo/mgmtsystem_hazard_hazard.xml",
"demo/mgmtsystem_hazard_origin.xml",
"demo/mgmtsystem_hazard_probability.xml",
"demo/mgmtsystem_hazard_severity.xml",
"demo/mgmtsystem_hazard_type.xml",
"demo/mgmtsystem_hazard_usage.xml",
],
"installable": True,
}
| 37.242424 | 1,229 |
636 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class MgmtsystemHazardControlMeasure(models.Model):
_name = "mgmtsystem.hazard.control_measure"
_description = "Control Measure of hazard"
name = fields.Char("Control Measure", required=True, translate=True)
responsible_user_id = fields.Many2one("res.users", "Responsible", required=True)
comments = fields.Text()
hazard_id = fields.Many2one(
"mgmtsystem.hazard", "Hazard", ondelete="cascade", required=False, index=True
)
| 39.75 | 636 |
525 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class MgmtsystemHazardHazard(models.Model):
_name = "mgmtsystem.hazard.hazard"
_description = "Hazard"
company_id = fields.Many2one(
"res.company", "Company", required=True, default=lambda self: self.env.company
)
name = fields.Char("Hazard", required=True, translate=True)
description = fields.Text(translate=True)
| 35 | 525 |
521 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class MgmtsystemHazardOrigin(models.Model):
_name = "mgmtsystem.hazard.origin"
_description = "Origin of hazard"
company_id = fields.Many2one(
"res.company", "Company", required=True, default=lambda self: self.env.company
)
name = fields.Char("Origin", required=True, translate=True)
description = fields.Text()
| 34.733333 | 521 |
1,552 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class MgmtsystemHazard(models.Model):
"""Hazards of the health and safety management system"""
_name = "mgmtsystem.hazard"
_description = __doc__
_inherit = ["mail.thread"]
name = fields.Char(required=True, translate=True)
type_id = fields.Many2one("mgmtsystem.hazard.type", "Type", required=True)
hazard_id = fields.Many2one("mgmtsystem.hazard.hazard", "Hazard", required=True)
origin_id = fields.Many2one("mgmtsystem.hazard.origin", "Origin", required=True)
department_id = fields.Many2one("hr.department", "Department", required=True)
responsible_user_id = fields.Many2one("res.users", "Responsible", required=True)
analysis_date = fields.Date("Date", required=True)
probability_id = fields.Many2one("mgmtsystem.hazard.probability", "Probability")
severity_id = fields.Many2one("mgmtsystem.hazard.severity", "Severity")
usage_id = fields.Many2one("mgmtsystem.hazard.usage", "Occupation / Usage")
acceptability = fields.Boolean()
justification = fields.Text()
control_measure_ids = fields.One2many(
"mgmtsystem.hazard.control_measure", "hazard_id", "Control Measures"
)
test_ids = fields.One2many(
"mgmtsystem.hazard.test", "hazard_id", "Implementation Tests"
)
company_id = fields.Many2one(
"res.company", "Company", default=lambda s: s.env.user.company_id
)
| 45.647059 | 1,552 |
657 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class MgmtsystemHazardTest(models.Model):
_name = "mgmtsystem.hazard.test"
_description = "Implementation Tests of hazard"
name = fields.Char("Test", required=True, translate=True)
responsible_user_id = fields.Many2one("res.users", "Responsible", required=True)
review_date = fields.Date(required=True)
executed = fields.Boolean()
hazard_id = fields.Many2one(
"mgmtsystem.hazard", "Hazard", ondelete="cascade", required=False, index=True
)
| 38.647059 | 657 |
513 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class MgmtsystemHazardType(models.Model):
_name = "mgmtsystem.hazard.type"
_description = "Type of Hazard"
company_id = fields.Many2one(
"res.company", "Company", required=True, default=lambda self: self.env.company
)
name = fields.Char("Type", required=True, translate=True)
description = fields.Text()
| 34.2 | 513 |
572 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class MgmtsystemHazardUsage(models.Model):
_name = "mgmtsystem.hazard.usage"
_description = "Usage of hazard"
company_id = fields.Many2one(
"res.company", "Company", required=True, default=lambda self: self.env.company
)
name = fields.Char("Occupation / Usage", required=True, translate=True)
value = fields.Integer(required=True)
description = fields.Text()
| 35.75 | 572 |
602 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class MgmtsystemHazardSeverity(models.Model):
_name = "mgmtsystem.hazard.severity"
_description = "Severity of hazard"
company_id = fields.Many2one(
"res.company", "Company", required=True, default=lambda self: self.env.company
)
name = fields.Char("Severity", required=True, translate=True)
value = fields.Integer(required=True)
description = fields.Text(required=False, translate=False)
| 37.625 | 602 |
614 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class MgmtsystemHazardProbability(models.Model):
_name = "mgmtsystem.hazard.probability"
_description = "Probability of hazard"
company_id = fields.Many2one(
"res.company", "Company", required=True, default=lambda self: self.env.company
)
name = fields.Char("Probability", required=True, translate=True)
value = fields.Integer(required=True)
description = fields.Text(required=False, translate=False)
| 38.375 | 614 |
920 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Hazard Risk",
"version": "15.0.1.0.0",
"author": "Savoir-faire Linux, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/management-system",
"license": "AGPL-3",
"category": "Management System",
"depends": ["mgmtsystem_hazard", "hr"],
"data": [
"security/ir.model.access.csv",
"security/mgmtsystem_hazard_security.xml",
"data/mgmtsystem_hazard_risk_computation.xml",
"data/mgmtsystem_hazard_risk_type.xml",
"views/mgmtsystem_hazard.xml",
"views/mgmtsystem_hazard_risk_type.xml",
"views/mgmtsystem_hazard_risk_computation.xml",
"views/mgmtsystem_hazard_residual_risk.xml",
"views/res_config_settings_views.xml",
],
"installable": True,
}
| 40 | 920 |
3,219 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from datetime import datetime
from odoo import tools
from odoo.tests import common
DATE_FORMAT = tools.DEFAULT_SERVER_DATE_FORMAT
class TestMgmtsystemHazard(common.TransactionCase):
"""
Unit Test For mgmtsystem.hazard model
"""
def test_hazard_risk(self):
"""
Test Hazard Risk creation
:return: (None)
"""
type_rec = self.env.ref("mgmtsystem_hazard.type_ohsas_position")
hazard_rec = self.env.ref("mgmtsystem_hazard.hazard_spilling")
origin_rec = self.env.ref("mgmtsystem_hazard.origin_ignition_gas")
department_rec = self.env["hr.department"].create({"name": "Department 01"})
r_type_rec = self.env.ref("mgmtsystem_hazard_risk.risk_type_physical")
record = self.env["mgmtsystem.hazard"].create(
{
"name": "Hazard Test 01",
"type_id": type_rec.id,
"hazard_id": hazard_rec.id,
"origin_id": origin_rec.id,
"department_id": department_rec.id,
"responsible_user_id": self.env.user.id,
"analysis_date": datetime.now().strftime(DATE_FORMAT),
"risk_type_id": r_type_rec.id,
}
)
self.assertEqual(record.name, "Hazard Test 01")
self.assertEqual(record.risk, False)
def test_hazard_risk_computation_a_time_b_time_c(self):
"""
Test the hazard risk computation A * B * C
:return: (None)
"""
# A * B * C
computation_risk = self.env.ref(
"mgmtsystem_hazard_risk" ".risk_computation_a_times_b_times_c"
)
self.env.user.company_id.risk_computation_id = computation_risk
type_rec = self.env.ref("mgmtsystem_hazard.type_ohsas_position")
hazard_rec = self.env.ref("mgmtsystem_hazard.hazard_spilling")
origin_rec = self.env.ref("mgmtsystem_hazard.origin_ignition_gas")
department_rec = self.env["hr.department"].create({"name": "Department 01"})
# Probability = 2
probability_rec = self.env.ref("mgmtsystem_hazard.probability_maybe")
# Severity = 3
severity_rec = self.env.ref("mgmtsystem_hazard.severity_heavy")
# Usage = 5
usage_rec = self.env.ref("mgmtsystem_hazard.usage_very_high")
r_type_rec = self.env.ref("mgmtsystem_hazard_risk.risk_type_physical")
record = self.env["mgmtsystem.hazard"].create(
{
"name": "Hazard Test 02",
"type_id": type_rec.id,
"hazard_id": hazard_rec.id,
"origin_id": origin_rec.id,
"department_id": department_rec.id,
"responsible_user_id": self.env.user.id,
"analysis_date": datetime.now().strftime(DATE_FORMAT),
"probability_id": probability_rec.id,
"severity_id": severity_rec.id,
"usage_id": usage_rec.id,
"risk_type_id": r_type_rec.id,
}
)
self.assertEqual(record.risk, 30) # 2 * 3 * 5
| 38.783133 | 3,219 |
1,484 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
from .common import _parse_risk_formula
class MgmtsystemHazardResidualRisk(models.Model):
_name = "mgmtsystem.hazard.residual_risk"
_description = "Residual Risks of hazard"
name = fields.Char(size=50, required=True, translate=True)
probability_id = fields.Many2one(
"mgmtsystem.hazard.probability", "Probability", required=True
)
severity_id = fields.Many2one(
"mgmtsystem.hazard.severity", "Severity", required=True
)
usage_id = fields.Many2one("mgmtsystem.hazard.usage", "Occupation / Usage")
acceptability = fields.Boolean()
justification = fields.Text()
hazard_id = fields.Many2one(
"mgmtsystem.hazard", "Hazard", ondelete="cascade", index=True
)
@api.depends("probability_id", "severity_id", "usage_id")
def _compute_risk(self):
for record in self:
if record.probability_id and record.severity_id and record.usage_id:
record.risk = _parse_risk_formula(
record.env.company.risk_computation_id.name,
record.probability_id.value,
record.severity_id.value,
record.usage_id.value,
)
else:
record.risk = False
risk = fields.Integer(compute=_compute_risk)
| 37.1 | 1,484 |
1,111 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
from .common import _parse_risk_formula
class MgmtsystemHazard(models.Model):
_inherit = "mgmtsystem.hazard"
risk_type_id = fields.Many2one(
"mgmtsystem.hazard.risk.type", "Risk Type", required=True
)
risk = fields.Integer(compute="_compute_risk")
residual_risk_ids = fields.One2many(
"mgmtsystem.hazard.residual_risk", "hazard_id", "Residual Risk Evaluations"
)
@api.depends("probability_id", "severity_id", "usage_id")
def _compute_risk(self):
for hazard in self:
if hazard.probability_id and hazard.severity_id and hazard.usage_id:
hazard.risk = _parse_risk_formula(
self.env.company.risk_computation_id.name,
hazard.probability_id.value,
hazard.severity_id.value,
hazard.usage_id.value,
)
else:
hazard.risk = False
| 35.83871 | 1,111 |
543 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class MgmtsystemHazardRiskComputation(models.Model):
_name = "mgmtsystem.hazard.risk.computation"
_description = "Computation Risk"
company_id = fields.Many2one(
"res.company", "Company", required=True, default=lambda self: self.env.company
)
name = fields.Char("Computation Risk", size=50, required=True)
description = fields.Text()
| 36.2 | 543 |
610 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _
from odoo.exceptions import UserError
from odoo.tools.safe_eval import safe_eval
def _parse_risk_formula(formula, a, b, c):
"""Calculate the risk replacing the variables A, B, C into the formula."""
if not formula:
raise UserError(
_("You must define the company's risk computing formula. Go to settings")
)
f = formula.replace("A", str(a)).replace("B", str(b)).replace("C", str(c))
return safe_eval(f)
| 38.125 | 610 |
380 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2020 Guadaltech Soluciones Tecnológicas (<http://www.guadaltech.es>).
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class ResCompany(models.Model):
_inherit = "res.company"
risk_computation_id = fields.Many2one(
"mgmtsystem.hazard.risk.computation", string="Risk Computation"
)
| 31.583333 | 379 |
545 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class MgmtsystemHazardRiskType(models.Model):
_name = "mgmtsystem.hazard.risk.type"
_description = "Risk type of the hazard"
company_id = fields.Many2one(
"res.company", "Company", required=True, default=lambda self: self.env.company
)
name = fields.Char("Risk Type", size=50, required=True, translate=True)
description = fields.Text()
| 36.333333 | 545 |
333 |
py
|
PYTHON
|
15.0
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"
risk_computation_id = fields.Many2one(
related="company_id.risk_computation_id", string="Risk formula", readonly=False
)
| 30.272727 | 333 |
735 |
py
|
PYTHON
|
15.0
|
# Copyright 2019 Marcelo Frare (Ass. PNLUG - Gruppo Odoo <http://odoo.pnlug.it>)
# Copyright 2019 Stefano Consolaro (Ass. PNLUG - Gruppo Odoo <http://odoo.pnlug.it>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
{
"name": "Management System - Action Efficacy",
"summary": "Add information on the application of the Action.",
"version": "15.0.1.0.0",
"development_status": "Beta",
"author": "Associazione PNLUG - Gruppo Odoo, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/management-system",
"license": "AGPL-3",
"category": "Management System",
"depends": ["mgmtsystem_action"],
"data": ["views/mgmtsystem_action_views.xml"],
"installable": True,
}
| 43.235294 | 735 |
826 |
py
|
PYTHON
|
15.0
|
# Copyright 2019 Marcelo Frare (Ass. PNLUG - Gruppo Odoo <http://odoo.pnlug.it>)
# Copyright 2019 Stefano Consolaro (Ass. PNLUG - Gruppo Odoo <http://odoo.pnlug.it>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import _
from odoo.exceptions import ValidationError
from odoo.tests import common
class TestActionEfficacy(common.TransactionCase):
def test_change_efficacy(self):
record = self.env["mgmtsystem.action"].search([])[0]
record.efficacy_value = 50
record._onchange_efficacy_value()
self.assertEqual(50, record.efficacy_value)
with self.assertRaises(ValidationError) as e:
record.efficacy_value = 200
record._onchange_efficacy_value()
self.assertIn(_("Rating must be between 0 and 100"), str(e.exception))
| 35.913043 | 826 |
1,166 |
py
|
PYTHON
|
15.0
|
# Copyright 2019 Marcelo Frare (Ass. PNLUG - Gruppo Odoo <http://odoo.pnlug.it>)
# Copyright 2019 Stefano Consolaro (Ass. PNLUG - Gruppo Odoo <http://odoo.pnlug.it>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
class MgmtsystemAction(models.Model):
"""
Extend actions adding fields for record efficacy informations with changes tracking
"""
_inherit = "mgmtsystem.action"
# new fileds
# value of efficacy
efficacy_value = fields.Integer(
"Rating",
help="0:not effective | 50:efficacy not complete | 100: effective",
track_visibility=True,
)
# user in charge of evaluation
efficacy_user_id = fields.Many2one(
"res.users",
"Inspector",
track_visibility=True,
)
# notes on the efficacy
efficacy_description = fields.Text("Notes")
@api.onchange("efficacy_value")
def _onchange_efficacy_value(self):
if self.efficacy_value < 0 or self.efficacy_value > 100:
raise ValidationError(_("Rating must be between 0 and 100"))
return
| 32.388889 | 1,166 |
550 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Quality Manual",
"version": "15.0.1.0.0",
"category": "Management System",
"author": "OpenERP SA, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/management-system",
"license": "AGPL-3",
"depends": ["document_page"],
"data": ["data/document_page.xml"],
"installable": True,
"auto_install": False,
"images": ["images/wiki_pages_quality_manual.jpeg"],
}
| 34.375 | 550 |
839 |
py
|
PYTHON
|
15.0
|
# Copyright 2019 Marcelo Frare (Ass. PNLUG - Gruppo Odoo <http://odoo.pnlug.it>)
# Copyright 2019 Stefano Consolaro (Ass. PNLUG - Gruppo Odoo <http://odoo.pnlug.it>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Management System - Nonconformity MRP",
"summary": "Bridge module between mrp and mgmsystem",
"version": "15.0.1.0.0",
"development_status": "Beta",
"author": "Associazione PNLUG - Gruppo Odoo, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/management-system",
"license": "AGPL-3",
"category": "Management System",
"depends": [
"mgmtsystem_nonconformity",
"mrp",
],
"data": [
"views/mgmtsystem_nonconformity_views.xml",
],
"application": False,
"installable": True,
"auto_install": True,
}
| 34.958333 | 839 |
532 |
py
|
PYTHON
|
15.0
|
# Copyright 2019 Marcelo Frare (Ass. PNLUG - Gruppo Odoo <http://odoo.pnlug.it>)
# Copyright 2019 Stefano Consolaro (Ass. PNLUG - Gruppo Odoo <http://odoo.pnlug.it>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
class MgmtsystemMgmMRP(models.Model):
"""
Extend nonconformity adding fields for workcenter
"""
_inherit = ["mgmtsystem.nonconformity"]
# new fields
# workcenter reference
workcenter_id = fields.Many2one("mrp.workcenter", "Workcenter")
| 31.294118 | 532 |
585 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Document Management - Wiki - Work Instructions",
"version": "15.0.1.0.0",
"author": "Savoir-faire Linux,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/management-system",
"license": "AGPL-3",
"category": "Management System",
"depends": ["document_page", "mgmtsystem"],
"data": ["data/document_page.xml", "views/document_page_work_instructions.xml"],
"installable": True,
}
| 41.785714 | 585 |
683 |
py
|
PYTHON
|
15.0
|
# © 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Health and Safety Management System",
"version": "15.0.1.0.0",
"author": "Savoir-faire Linux,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/management-system",
"license": "AGPL-3",
"category": "Management System",
"depends": [
"mgmtsystem_manual",
"mgmtsystem_audit",
"document_page_health_safety_manual",
"mgmtsystem_review",
"mgmtsystem_hazard_risk",
],
"data": ["data/health_safety.xml"],
"installable": True,
"application": True,
}
| 34.1 | 682 |
1,398 |
py
|
PYTHON
|
15.0
|
##############################################################################
#
# 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/>.
#
##############################################################################
{
"name": "Information Security Management System Manual",
"version": "15.0.1.0.0",
"author": "Savoir-faire Linux, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/management-system",
"license": "AGPL-3",
"category": "Generic Modules/Others",
"depends": ["mgmtsystem_manual"],
"data": ["data/information_security_manual.xml"],
"demo": [],
"installable": True,
}
| 45.096774 | 1,398 |
1,002 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Management System - Action",
"version": "15.0.1.0.0",
"author": "Savoir-faire Linux, " "Camptocamp, " "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/management-system",
"license": "AGPL-3",
"category": "Management System",
"depends": ["mgmtsystem", "mail"],
"data": [
"data/mgmtsystem_action_stage.xml",
"data/automated_reminder.xml",
"data/email_template.xml",
"security/ir.model.access.csv",
"security/mgmtsystem_action_security.xml",
"data/action_sequence.xml",
"views/mgmtsystem_action.xml",
"views/mgmtsystem_action_stage.xml",
"views/mgmtsystem_action_tag.xml",
"reports/mgmtsystem_action_report.xml",
"views/menus.xml",
],
"demo": ["demo/mgmtsystem_action.xml"],
"installable": True,
}
| 37.111111 | 1,002 |
3,795 |
py
|
PYTHON
|
15.0
|
import time
from datetime import datetime, timedelta
import mock
from odoo import exceptions
from odoo.tests import common
def freeze_time(dt):
mock_time = mock.Mock()
mock_time.return_value = time.mktime(dt.timetuple())
return mock_time
class TestModelAction(common.SavepointCase):
"""Test class for mgmtsystem_action."""
@classmethod
def setUpClass(cls):
super().setUpClass()
# disable tracking test suite wise
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
cls.record = cls.env["mgmtsystem.action"].create(
{"name": "SampleAction", "type_action": "immediate"}
)
def _assert_date_equal(self, val, expected=None):
expected = expected or datetime.now()
self.assertEqual(tuple(val.timetuple())[:5], tuple(expected.timetuple())[:5])
def test_create_action(self):
"""Test object creation."""
stage = self.env.ref("mgmtsystem_action.stage_open")
self.assertEqual(self.record.name, "SampleAction")
self.assertNotEqual(self.record.reference, "NEW")
self.assertEqual(self.record.type_action, "immediate")
self.assertEqual(self.record.stage_id.name, "Draft")
self.assertEqual(self.record.stage_id.is_starting, True)
self.assertFalse(self.record.date_open)
self.record.stage_id = stage
self._assert_date_equal(self.record.date_open)
def test_case_close(self):
"""Test object close state."""
stage = self.env.ref("mgmtsystem_action.stage_open")
stage_new = self.env.ref("mgmtsystem_action.stage_draft")
self.record.stage_id = stage
stage = self.env.ref("mgmtsystem_action.stage_close")
self.record.stage_id = stage
self._assert_date_equal(self.record.date_closed)
try:
self.record.write({"stage_id": stage_new.id})
except exceptions.ValidationError:
self.assertTrue(True)
stage = self.env.ref("mgmtsystem_action.stage_close")
try:
self.record.write({"stage_id": stage.id})
except exceptions.ValidationError:
self.assertTrue(True)
def test_get_action_url(self):
"""Test if action url start with http."""
url = self.record.get_action_url()
self.assertEqual(url.startswith("http"), True)
self.assertIn("&id={}&model={}".format(self.record.id, self.record._name), url)
def test_process_reminder_queue(self):
"""Check if process_reminder_queue work when days reminder are 10."""
ten_days_date = datetime.now().date() + timedelta(days=10)
self.record.write(
{
"date_deadline": ten_days_date, # 10 days from now
"stage_id": self.env.ref("mgmtsystem_action.stage_open").id,
}
)
with mock.patch("time.time", freeze_time(ten_days_date)):
tmpl_model = self.env["mail.template"]
with mock.patch.object(type(tmpl_model), "send_mail") as mocked:
self.env["mgmtsystem.action"].process_reminder_queue()
mocked.assert_called_with(self.record.id)
def test_stage_groups(self):
"""Check if stage_groups return all stages."""
stage_ids = self.env["mgmtsystem.action.stage"].search([])
stages_found = self.record._stage_groups(stage_ids)
state = len(stage_ids) == len(stages_found[0])
self.assertFalse(state)
def test_send_mail(self):
"""Check if mail send action work."""
tmpl_model = self.env["mail.template"]
with mock.patch.object(type(tmpl_model), "send_mail") as mocked:
self.record.send_mail_for_action()
mocked.assert_called_with(self.record.id, force_send=True)
| 39.947368 | 3,795 |
755 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class MgmtSystemActionStage(models.Model):
_name = "mgmtsystem.action.stage"
_description = "Action Stage"
_order = "sequence, id"
name = fields.Char("Stage Name", required=True, translate=True)
description = fields.Text(translate=True)
sequence = fields.Integer(default=100)
fold = fields.Boolean(
"Folded in Kanban",
help="This stage is folded in the kanban view when there are "
"no records in that stage to display.",
)
is_starting = fields.Boolean("Starting stage")
is_ending = fields.Boolean("Ending stage")
| 35.952381 | 755 |
472 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class MgmtsystemActionTag(models.Model):
_name = "mgmtsystem.action.tag"
_description = "Action Tags"
name = fields.Char(required=True)
color = fields.Integer(string="Color Index", default=10)
_sql_constraints = [("name_uniq", "unique (name)", "Tag name already exists !")]
| 33.714286 | 472 |
6,073 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from datetime import datetime, timedelta
from odoo import _, api, exceptions, fields, models
class MgmtsystemAction(models.Model):
_name = "mgmtsystem.action"
_inherit = ["mail.thread", "mail.activity.mixin"]
_description = "Action"
_order = "priority desc, sequence, id desc"
name = fields.Char("Subject", required=True)
system_id = fields.Many2one("mgmtsystem.system", "System")
company_id = fields.Many2one(
"res.company", "Company", default=lambda self: self.env.company
)
active = fields.Boolean(default=True)
priority = fields.Selection(
[("0", "Low"), ("1", "Normal")], default="0", index=True
)
sequence = fields.Integer(
index=True,
default=10,
help="Gives the sequence order when displaying a list of actions.",
)
date_deadline = fields.Date("Deadline")
date_open = fields.Datetime("Opening Date", readonly=True)
date_closed = fields.Datetime("Closed Date", readonly=True)
number_of_days_to_open = fields.Integer(
"# of days to open", compute="_compute_number_of_days_to_open", store=True
)
number_of_days_to_close = fields.Integer(
"# of days to close", compute="_compute_number_of_days_to_close", store=True
)
reference = fields.Char(required=True, readonly=True, default=lambda self: _("New"))
user_id = fields.Many2one(
"res.users",
"Responsible",
default=lambda self: self._default_owner(),
required=True,
)
description = fields.Html()
type_action = fields.Selection(
[
("immediate", "Immediate Action"),
("correction", "Corrective Action"),
("prevention", "Preventive Action"),
("improvement", "Improvement Opportunity"),
],
"Response Type",
required=True,
)
stage_id = fields.Many2one(
"mgmtsystem.action.stage",
"Stage",
tracking=True,
index=True,
copy=False,
default=lambda self: self._default_stage(),
group_expand="_stage_groups",
)
tag_ids = fields.Many2many("mgmtsystem.action.tag", string="Tags")
def _default_owner(self):
return self.env.user
def _default_stage(self):
return self.env["mgmtsystem.action.stage"].search(
[("is_starting", "=", True)], limit=1
)
@api.model
def _elapsed_days(self, dt1_text, dt2_text):
res = 0
if dt1_text and dt2_text:
res = (dt1_text - dt2_text).days
return res
@api.depends("date_open", "create_date")
def _compute_number_of_days_to_open(self):
for action in self:
action.number_of_days_to_open = action._elapsed_days(
action.create_date, action.date_open
)
@api.depends("date_closed", "create_date")
def _compute_number_of_days_to_close(self):
for action in self:
action.number_of_days_to_close = action._elapsed_days(
action.create_date, action.date_closed
)
@api.model
def _stage_groups(self, stages=None, domain=None, order=None):
return self.env["mgmtsystem.action.stage"].search([], order=order)
@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
@api.constrains("stage_id")
def _check_stage_id(self):
for rec in self:
# Do not allow to bring back actions to draft
if rec.date_open and rec.stage_id.is_starting:
raise exceptions.ValidationError(
_("We cannot bring back the action to draft stage")
)
# If stage is changed, the action is opened
if not rec.date_open and not rec.stage_id.is_starting:
rec.date_open = fields.Datetime.now()
# If stage is ending, set closed date
if not rec.date_closed and rec.stage_id.is_ending:
rec.date_closed = fields.Datetime.now()
def send_mail_for_action(self, force_send=True):
template = self.env.ref("mgmtsystem_action.email_template_new_action_reminder")
for action in self:
template.send_mail(action.id, force_send=force_send)
return True
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
@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_action.stage_close")
actions = self.search(
[("stage_id", "!=", stage_close.id), ("date_deadline", "=", cur_date)]
)
if actions:
template = self.env.ref(
"mgmtsystem_action.action_email_template_reminder_action"
)
for action in actions:
template.send_mail(action.id)
return True
return False
@api.model
def _get_stage_open(self):
return self.env.ref("mgmtsystem_action.stage_open")
def case_open(self):
"""Opens case."""
# TODO smk: is this used?
return self.write({"active": True, "stage_id": self._get_stage_open().id})
| 36.365269 | 6,073 |
3,432 |
py
|
PYTHON
|
15.0
|
from odoo import fields, models, tools
class MgmtsystemtActionReport(models.Model):
"""Management System Action Report."""
_name = "mgmtsystem.action.report"
_auto = False
_description = "Management System Action Report"
_rec_name = "id"
# Compute data
number_of_actions = fields.Integer("# of actions", readonly=True)
age = fields.Integer(readonly=True)
number_of_days_to_open = fields.Integer("# of days to open", readonly=True)
number_of_days_to_close = fields.Integer("# of days to close", readonly=True)
number_of_exceedings_days = fields.Integer("# of exceedings days", readonly=True)
# Grouping view
type_action = fields.Selection(
[
("immediate", "Immediate Action"),
("correction", "Corrective Action"),
("prevention", "Preventive Action"),
("improvement", "Improvement Opportunity"),
],
"Response Type",
)
create_date = fields.Datetime(readonly=True, index=True)
date_open = fields.Datetime("Opening Date", readonly=True, index=True)
date_closed = fields.Datetime("Close Date", readonly=True, index=True)
date_deadline = fields.Date("Deadline", readonly=True, index=True)
user_id = fields.Many2one("res.users", "User", readonly=True)
stage_id = fields.Many2one("mgmtsystem.action.stage", "Stage", readonly=True)
system_id = fields.Many2one("mgmtsystem.system", "System", readonly=True)
def _query(
self, with_clause="", fields="", where_clause="", groupby="", from_clause=""
):
with_ = ("WITH %s" % with_clause) if with_clause else ""
select_ = (
"""
m.id,
m.date_closed as date_closed,
m.date_deadline as date_deadline,
m.date_open as date_open,
m.user_id,
m.stage_id,
m.system_id,
m.type_action as type_action,
m.create_date as create_date,
m.number_of_days_to_open as number_of_days_to_open,
m.number_of_days_to_close as number_of_days_to_close,
avg(extract('epoch' from (current_date-m.create_date))
)/(3600*24) as age,
avg(extract('epoch' from (m.date_closed - m.date_deadline))
)/(3600*24) as number_of_exceedings_days,
count(*) AS number_of_actions %s
"""
% fields
)
from_ = (
"""
mgmtsystem_action m
%s
"""
% from_clause
)
where_ = ("WHERE %s" % where_clause) if where_clause else ""
groupby_ = """
m.user_id,m.system_id, m.stage_id, m.date_open,
m.create_date,m.type_action,m.date_deadline,
m.date_closed, m.id, m.number_of_days_to_open,
m.number_of_days_to_close %s
""" % (
groupby
)
return "{} (SELECT {} FROM {} {} GROUP BY {})".format(
with_, select_, from_, where_, groupby_
)
def init(self):
"""Display a pivot view of action."""
tools.drop_view_if_exists(self._cr, "mgmtsystem_action_report")
self.env.cr.execute( # pylint: disable=E8103
"CREATE or REPLACE VIEW {} as ({})".format(self._table, self._query())
)
| 37.304348 | 3,432 |
613 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Management System - Manual",
"version": "15.0.1.0.0",
"author": "Savoir-faire Linux,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/management-system",
"license": "AGPL-3",
"category": "Management System",
"depends": ["document_page", "mgmtsystem"],
"data": [
"data/mgmtsystem_manual.xml",
"views/mgmtsystem_manual.xml",
"views/document_page.xml",
],
"installable": True,
}
| 34.055556 | 613 |
284 |
py
|
PYTHON
|
15.0
|
# Copyright 2019 Odoo Community Association
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
class MgmtSystemManual(models.Model):
_inherit = "mgmtsystem.system"
manual_id = fields.Many2one("document.page", string="Manual")
| 28.4 | 284 |
768 |
py
|
PYTHON
|
15.0
|
# Copyright 2019 Marcelo Frare (Ass. PNLUG - Gruppo Odoo <http://odoo.pnlug.it>)
# Copyright 2019 Stefano Consolaro (Ass. PNLUG - Gruppo Odoo <http://odoo.pnlug.it>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Management System - Nonconformity HR",
"summary": "Bridge module between hr and mgmsystem and",
"version": "15.0.1.0.0",
"author": "Associazione PNLUG - Gruppo Odoo, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/management-system",
"license": "AGPL-3",
"category": "Management System",
"depends": ["hr", "mgmtsystem_nonconformity"],
"data": ["views/mgmtsystem_nonconformity_views.xml"],
"application": False,
"installable": True,
"auto_install": True,
}
| 42.666667 | 768 |
415 |
py
|
PYTHON
|
15.0
|
# Copyright 2019 Marcelo Frare (Ass. PNLUG - Gruppo Odoo <http://odoo.pnlug.it>)
# Copyright 2019 Stefano Consolaro (Ass. PNLUG - Gruppo Odoo <http://odoo.pnlug.it>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
class MgmtsystemMgmHR(models.Model):
_inherit = ["mgmtsystem.nonconformity"]
department_id = fields.Many2one("hr.department", "Department")
| 37.727273 | 415 |
563 |
py
|
PYTHON
|
15.0
|
# Copyright 2020 - TODAY, Escodoo
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Mgmtsystem Nonconformity Repair",
"summary": """
Bridge module between Repair and Non Conformities""",
"version": "15.0.1.0.0",
"license": "AGPL-3",
"author": "Escodoo,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/management-system",
"depends": [
"mgmtsystem_nonconformity",
"repair",
],
"data": [
"views/mgmtsystem_nonconformity.xml",
],
"demo": [],
}
| 28.15 | 563 |
2,556 |
py
|
PYTHON
|
15.0
|
from odoo.tests import common
class TestRepairOrder(common.TransactionCase):
def setUp(self):
super().setUp()
self.product = self.env["product.product"].create(
{
"name": "Product Test",
"uom_id": self.env.ref("uom.product_uom_unit").id,
"uom_po_id": self.env.ref("uom.product_uom_unit").id,
}
)
self.location_id = self.env["stock.location"].create(
{
"name": "Test Location",
"usage": "internal",
"location_id": self.env.ref("stock.stock_location_stock").id,
}
)
self.repair_order = self.env["repair.order"].create(
{
"name": "Test Repair Order",
"product_id": self.product.id,
"product_uom": self.product.uom_id.id,
"location_id": self.location_id.id,
}
)
self.user = self.env["res.users"].create(
{
"name": "Test User",
"login": "testuser",
"email": "[email protected]",
"password": "password",
}
)
self.user2 = self.env["res.users"].create(
{
"name": "Test User2",
"login": "testuser2",
"email": "[email protected]",
"password": "password",
}
)
self.partner = self.env["res.partner"].create({"name": "Test Partner"})
self.request1 = self.env["mgmtsystem.nonconformity"].create(
{
"name": "Request 1",
"partner_id": self.partner.id,
"responsible_user_id": self.user.id,
"manager_user_id": self.user2.id,
"description": "desc1",
}
)
self.request2 = self.env["mgmtsystem.nonconformity"].create(
{
"name": "Request 2",
"partner_id": self.partner.id,
"responsible_user_id": self.user.id,
"manager_user_id": self.user2.id,
"description": "desc1",
}
)
self.repair_order.mgmtsystem_nonconformity_ids += self.request1
self.repair_order.mgmtsystem_nonconformity_ids += self.request2
def test_compute_mgmtsystem_nonconformity_count(self):
self.repair_order._compute_mgmtsystem_nonconformity_count()
assert self.repair_order.mgmtsystem_nonconformity_count == 2
| 32.769231 | 2,556 |
310 |
py
|
PYTHON
|
15.0
|
# Copyright 2020 - TODAY, Marcel Savegnago - Escodoo
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class MgmtsystemNonconformity(models.Model):
_inherit = "mgmtsystem.nonconformity"
repair_order_id = fields.Many2one("repair.order", "Repair Order")
| 31 | 310 |
723 |
py
|
PYTHON
|
15.0
|
# Copyright 2020 - TODAY, Marcel Savegngo - Escodoo
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class RepairOrder(models.Model):
_inherit = "repair.order"
mgmtsystem_nonconformity_ids = fields.One2many(
"mgmtsystem.nonconformity", "repair_order_id", string="Non-Conformities"
)
mgmtsystem_nonconformity_count = fields.Integer(
compute="_compute_mgmtsystem_nonconformity_count", string="# Non-Conformities"
)
@api.depends("mgmtsystem_nonconformity_ids")
def _compute_mgmtsystem_nonconformity_count(self):
for rec in self:
rec.mgmtsystem_nonconformity_count = len(rec.mgmtsystem_nonconformity_ids)
| 34.428571 | 723 |
100 |
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667 | 100 |
100 |
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667 | 100 |
100 |
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667 | 100 |
100 |
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667 | 100 |
100 |
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667 | 100 |
100 |
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667 | 100 |
2,305 |
py
|
PYTHON
|
15.0
|
import setuptools
with open('VERSION.txt', 'r') as f:
version = f.read().strip()
setuptools.setup(
name="odoo-addons-oca-management-system",
description="Meta package for oca-management-system Odoo addons",
version=version,
install_requires=[
'odoo-addon-document_page_environment_manual>=15.0dev,<15.1dev',
'odoo-addon-document_page_environmental_aspect>=15.0dev,<15.1dev',
'odoo-addon-document_page_health_safety_manual>=15.0dev,<15.1dev',
'odoo-addon-document_page_procedure>=15.0dev,<15.1dev',
'odoo-addon-document_page_quality_manual>=15.0dev,<15.1dev',
'odoo-addon-document_page_work_instruction>=15.0dev,<15.1dev',
'odoo-addon-mgmtsystem>=15.0dev,<15.1dev',
'odoo-addon-mgmtsystem_action>=15.0dev,<15.1dev',
'odoo-addon-mgmtsystem_action_efficacy>=15.0dev,<15.1dev',
'odoo-addon-mgmtsystem_action_template>=15.0dev,<15.1dev',
'odoo-addon-mgmtsystem_audit>=15.0dev,<15.1dev',
'odoo-addon-mgmtsystem_claim>=15.0dev,<15.1dev',
'odoo-addon-mgmtsystem_environment>=15.0dev,<15.1dev',
'odoo-addon-mgmtsystem_hazard>=15.0dev,<15.1dev',
'odoo-addon-mgmtsystem_hazard_risk>=15.0dev,<15.1dev',
'odoo-addon-mgmtsystem_health_safety>=15.0dev,<15.1dev',
'odoo-addon-mgmtsystem_info_security_manual>=15.0dev,<15.1dev',
'odoo-addon-mgmtsystem_manual>=15.0dev,<15.1dev',
'odoo-addon-mgmtsystem_nonconformity>=15.0dev,<15.1dev',
'odoo-addon-mgmtsystem_nonconformity_hr>=15.0dev,<15.1dev',
'odoo-addon-mgmtsystem_nonconformity_mrp>=15.0dev,<15.1dev',
'odoo-addon-mgmtsystem_nonconformity_product>=15.0dev,<15.1dev',
'odoo-addon-mgmtsystem_nonconformity_quality_control_oca>=15.0dev,<15.1dev',
'odoo-addon-mgmtsystem_nonconformity_repair>=15.0dev,<15.1dev',
'odoo-addon-mgmtsystem_nonconformity_type>=15.0dev,<15.1dev',
'odoo-addon-mgmtsystem_partner>=15.0dev,<15.1dev',
'odoo-addon-mgmtsystem_quality>=15.0dev,<15.1dev',
'odoo-addon-mgmtsystem_review>=15.0dev,<15.1dev',
'odoo-addon-mgmtsystem_survey>=15.0dev,<15.1dev',
],
classifiers=[
'Programming Language :: Python',
'Framework :: Odoo',
'Framework :: Odoo :: 15.0',
]
)
| 50.108696 | 2,305 |
100 |
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667 | 100 |
100 |
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667 | 100 |
100 |
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667 | 100 |
100 |
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667 | 100 |
100 |
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667 | 100 |
100 |
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667 | 100 |
100 |
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667 | 100 |
100 |
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667 | 100 |
100 |
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667 | 100 |
100 |
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667 | 100 |
100 |
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667 | 100 |
100 |
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667 | 100 |
100 |
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667 | 100 |
100 |
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667 | 100 |
100 |
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667 | 100 |
100 |
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667 | 100 |
100 |
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667 | 100 |
100 |
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667 | 100 |
100 |
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667 | 100 |
100 |
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667 | 100 |
100 |
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667 | 100 |
100 |
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667 | 100 |
100 |
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667 | 100 |
1,719 |
py
|
PYTHON
|
15.0
|
##############################################################################
#
# 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/>.
#
##############################################################################
{
"name": "Management System - Claim",
"version": "15.0.1.0.0",
"author": "Savoir-faire Linux,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/management-system",
"license": "AGPL-3",
"category": "Management System",
"depends": ["mgmtsystem", "crm_claim"],
"data": [
"security/ir.model.access.csv",
"security/mgmtsystem_claim_security.xml",
"data/claim_sequence.xml",
"data/mgmtsystem_claim_stage.xml",
"data/email_template.xml",
"data/automated_reminder.xml",
"views/menus.xml",
"views/mgmtsystem_claim.xml",
"views/mgmtsystem_claim_stage.xml",
"views/res_partner_views.xml",
],
"installable": True,
}
| 41.926829 | 1,719 |
3,119 |
py
|
PYTHON
|
15.0
|
import time
from datetime import datetime, timedelta
import mock
from odoo.tests import common
def freeze_time(dt):
mock_time = mock.Mock()
mock_time.return_value = time.mktime(dt.timetuple())
return mock_time
class TestModelClaim(common.SavepointCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
cls.claim = cls.env["mgmtsystem.claim"].create(
{
"name": "Test Claim",
"team_id": cls.env.ref("sales_team.salesteam_website_sales").id,
}
)
cls.partner = cls.env["res.partner"].create(
{
"name": "Partner Claim",
"email": "[email protected]",
"phone": "1234567890",
}
)
cls.claim_categ = cls.env.ref("crm_claim.categ_claim1")
cls.sales_team = cls.claim_categ.team_id
def test_create_claim(self):
self.assertNotEqual(self.claim.team_id, self.sales_team)
self.assertTrue(self.claim.stage_id.id)
self.claim.partner_id = self.partner
self.claim.onchange_partner_id()
self.assertEqual(self.claim.email_from, self.partner.email)
self.assertEqual(self.claim.partner_phone, self.partner.phone)
self.assertEqual(self.partner.mgmtsystem_claim_count, 1)
self.claim.categ_id = self.claim_categ
self.claim.onchange_categ_id()
self.assertEqual(self.claim.team_id, self.sales_team)
tmpl_model = self.env["mail.template"]
with mock.patch.object(type(tmpl_model), "send_mail") as mocked:
new_claim = self.claim.copy()
new_claim.refresh()
self.assertEqual(new_claim.stage_id.id, 1)
self.assertIn("copy", new_claim.name)
self.assertTrue(new_claim.stage_id.id)
self.assertEqual(self.partner.mgmtsystem_claim_count, 2)
mocked.assert_called_with(new_claim.id, force_send=True)
def test_process_reminder_queue(self):
"""Check if process_reminder_queue work when days reminder are 10."""
ten_days_date = datetime.now().date() + timedelta(days=10)
self.claim.write(
{
"date_deadline": ten_days_date, # 10 days from now
"stage_id": self.env.ref("mgmtsystem_action.stage_open").id,
}
)
with mock.patch("time.time", freeze_time(ten_days_date)):
tmpl_model = self.env["mail.template"]
with mock.patch.object(type(tmpl_model), "send_mail") as mocked:
self.env["mgmtsystem.claim"].process_reminder_queue()
mocked.assert_called_with(self.claim.id)
def test_send_mail_for_action(self):
"""Check if send_mail_for_action work is called"""
tmpl_model = self.env["mail.template"]
with mock.patch.object(type(tmpl_model), "send_mail") as mocked:
self.claim.send_mail_for_action(force_send=True)
mocked.assert_called_with(self.claim.id, force_send=True)
| 39.987179 | 3,119 |
3,485 |
py
|
PYTHON
|
15.0
|
##############################################################################
#
# 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
| 38.296703 | 3,485 |
1,571 |
py
|
PYTHON
|
15.0
|
##############################################################################
#
# 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.",
)
| 41.342105 | 1,571 |
1,120 |
py
|
PYTHON
|
15.0
|
# 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)
| 40 | 1,120 |
559 |
py
|
PYTHON
|
15.0
|
# Copyright 2019 Stefano Consolaro (Ass. PNLUG - Gruppo Odoo <http://odoo.pnlug.it>)
{
"name": "Management System - Partner",
"summary": "Add Management System reference on Partner's Contacts.",
"version": "15.0.1.0.0",
"development_status": "Beta",
"author": "Associazione PNLUG - Gruppo Odoo, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/management-system",
"license": "AGPL-3",
"category": "Management System",
"depends": [
"mail",
"contacts",
],
"installable": True,
}
| 32.882353 | 559 |
451 |
py
|
PYTHON
|
15.0
|
# Copyright 2019 Stefano Consolaro (Ass. PNLUG - Gruppo Odoo <http://odoo.pnlug.it>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
class ResPartner(models.Model):
"""
Extend res.partner with contact info for communications on quality
"""
_inherit = ["res.partner"]
# type for manage quality contact
type = fields.Selection(selection_add=[("quality", "Quality Address")])
| 30.066667 | 451 |
631 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Document Management - Wiki - Procedures",
"version": "15.0.1.0.0",
"author": "Savoir-faire Linux, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/management-system",
"license": "AGPL-3",
"category": "Management System",
"depends": ["document_page", "mgmtsystem"],
"data": ["data/document_page_procedure.xml", "views/document_page_procedure.xml"],
"demo": ["demo/document_page_procedure.xml"],
"installable": True,
}
| 42.066667 | 631 |
771 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Management System - Review",
"version": "15.0.1.0.0",
"author": "Savoir-faire Linux, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/management-system",
"license": "AGPL-3",
"category": "Management System",
"depends": ["mgmtsystem_nonconformity", "mgmtsystem_survey"],
"data": [
"security/ir.model.access.csv",
"security/mgmtsystem_review_security.xml",
"data/ir_sequence.xml",
"views/mgmtsystem_review.xml",
"views/res_users.xml",
"report/review.xml",
"report/report.xml",
],
"installable": True,
}
| 35.045455 | 771 |
483 |
py
|
PYTHON
|
15.0
|
from odoo import fields
from odoo.tests import common
class TestModelReview(common.TransactionCase):
"""Test class for mgmtsystem_review."""
def test_create_review(self):
"""Test object creation."""
record = self.env["mgmtsystem.review"].create(
{"name": "SampleReview", "date": fields.Datetime.now()}
)
self.assertEqual(record.name, "SampleReview")
record.button_close()
self.assertEqual(record.state, "done")
| 30.1875 | 483 |
869 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class MgmtsystemReviewLine(models.Model):
_name = "mgmtsystem.review.line"
_description = "Review Line"
name = fields.Char("Title", size=300, required=True)
type = fields.Selection([("action", "Action"), ("nonconformity", "Nonconformity")])
action_id = fields.Many2one("mgmtsystem.action", "Action", index=True)
nonconformity_id = fields.Many2one(
"mgmtsystem.nonconformity", "Nonconformity", index=True
)
decision = fields.Text()
review_id = fields.Many2one(
"mgmtsystem.review", "Review", ondelete="cascade", index=True
)
company_id = fields.Many2one(
"res.company", "Company", default=lambda self: self.env.company
)
| 37.782609 | 869 |
1,633 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class MgmtsystemReview(models.Model):
_name = "mgmtsystem.review"
_inherit = ["mail.thread", "mail.activity.mixin"]
_description = "Review"
name = fields.Char(size=50, required=True)
reference = fields.Char(size=64, required=True, readonly=True, default="NEW")
date = fields.Datetime(required=True)
user_ids = fields.Many2many(
"res.users",
"mgmtsystem_review_user_rel",
"user_id",
"mgmtsystem_review_id",
"Participants",
)
response_ids = fields.Many2many(
"survey.user_input",
"mgmtsystem_review_response_rel",
"response_id",
"mgmtsystem_review_id",
"Survey Answers",
)
policy = fields.Html()
changes = fields.Html()
line_ids = fields.One2many("mgmtsystem.review.line", "review_id", "Lines")
conclusion = fields.Html()
state = fields.Selection(
[("open", "Open"), ("done", "Closed")],
readonly=True,
default="open",
tracking=True,
)
company_id = fields.Many2one(
"res.company", "Company", default=lambda self: self.env.company
)
@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
vals["reference"] = self.env["ir.sequence"].next_by_code(
"mgmtsystem.review"
)
return super().create(vals_list)
def button_close(self):
return self.write({"state": "done"})
| 30.811321 | 1,633 |
706 |
py
|
PYTHON
|
15.0
|
# Copyright 2019 Marcelo Frare (Ass. PNLUG - Gruppo Odoo <http://odoo.pnlug.it>)
# Copyright 2019 Stefano Consolaro (Ass. PNLUG - Gruppo Odoo <http://odoo.pnlug.it>)
{
"name": "Management System - Nonconformity Product",
"summary": "Bridge module between Product and Management System.",
"version": "15.0.1.0.0",
"development_status": "Beta",
"author": "Associazione PNLUG - Gruppo Odoo, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/management-system",
"license": "AGPL-3",
"category": "Management System",
"depends": ["product", "mgmtsystem_nonconformity"],
"data": ["views/mgmtsystem_nonconformity_views.xml"],
"installable": True,
}
| 44.125 | 706 |
463 |
py
|
PYTHON
|
15.0
|
# Copyright 2019 Marcelo Frare (Ass. PNLUG - Gruppo Odoo <http://odoo.pnlug.it>)
# Copyright 2019 Stefano Consolaro (Ass. PNLUG - Gruppo Odoo <http://odoo.pnlug.it>)
from odoo import fields, models
class MgmtsystemNonconformity(models.Model):
"""
Extend nonconformity adding fields for product
"""
_inherit = ["mgmtsystem.nonconformity"]
# new fields
# product reference
product_id = fields.Many2one("product.product", "Product")
| 28.9375 | 463 |
1,404 |
py
|
PYTHON
|
15.0
|
##############################################################################
#
# 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/>.
#
##############################################################################
{
"name": "Document Management - Wiki - Environment Manual",
"version": "15.0.1.0.0",
"author": "Savoir-faire Linux,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/management-system",
"license": "AGPL-3",
"category": "Generic Modules/Others",
"depends": ["mgmtsystem_manual"],
"data": ["data/document_page_environment_manual.xml"],
"demo": [],
"installable": True,
}
| 45.290323 | 1,404 |
676 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Management System",
"version": "15.0.1.0.1",
"author": "Savoir-faire Linux,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/management-system",
"license": "AGPL-3",
"category": "Management System",
"depends": ["base"],
"data": [
"security/mgmtsystem_security.xml",
"security/ir.model.access.csv",
"views/menus.xml",
"views/mgmtsystem_system.xml",
"views/res_config.xml",
],
"installable": True,
"application": True,
}
| 32.190476 | 676 |
451 |
py
|
PYTHON
|
15.0
|
# Copyright 2012 Savoir-faire Linux <http://www.savoirfairelinux.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests import common
class TestModelAction(common.TransactionCase):
def test_create_system(self):
record = self.env["mgmtsystem.system"].create({"name": "SampleSystem"})
self.assertEqual(record.name, "SampleSystem")
self.assertEqual(record.company_id.id, self.env.company.id)
| 37.583333 | 451 |
429 |
py
|
PYTHON
|
15.0
|
# Copyright 2012 Savoir-faire Linux <http://www.savoirfairelinux.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class MgmtSystemSystem(models.Model):
_name = "mgmtsystem.system"
_description = "System"
name = fields.Char("System", required=True)
company_id = fields.Many2one(
"res.company", "Company", default=lambda self: self.env.company
)
| 28.6 | 429 |
4,215 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class MgmtsystemConfigSettings(models.TransientModel):
"""This class is used to activate management system Applications."""
_inherit = "res.config.settings"
# Systems
module_mgmtsystem_quality = fields.Boolean(
"Quality Tools",
help="Provide quality management tools.\n"
"- This installs the module mgmtsystem_quality.",
)
module_mgmtsystem_environment = fields.Boolean(
"Environment",
help="Provide environment management tools.\n"
"- This installs the module mgmtsystem_environment.",
)
module_mgmtsystem_health_safety = fields.Boolean(
"Hygiene & Safety",
help="Provide health and safety management tools.\n"
"- This installs the module mgmtsystem_health_safety.",
)
module_mgmtsystem_information_security = fields.Boolean(
"Information Security",
help="Provide information security tools.\n"
"- This installs the module mgmtsystem_information_security.",
)
# Applications
module_mgmtsystem_action = fields.Boolean(
"Actions",
help="Provide actions and improvement opportunities tools.\n"
"- This installs the module mgmtsystem_action.",
)
module_mgmtsystem_nonconformity = fields.Boolean(
"Nonconformities",
help="Provide non conformity tools.\n"
"- This installs the module mgmtsystem_nonconformity.",
)
module_mgmtsystem_claim = fields.Boolean(
"Claims",
help="Provide claim tools.\n" "- This installs the module mgmtsystem_claim.",
)
module_mgmtsystem_audit = fields.Boolean(
"Audits",
help="Provide audit tools.\n" "- This installs the module mgmtsystem_audit.",
)
module_mgmtsystem_review = fields.Boolean(
"Reviews",
help="Provide review tools.\n" "- This installs the module mgmtsystem_review.",
)
# Manuals
module_document_page_quality_manual = fields.Boolean(
"Quality Manual Template",
help="Provide a quality manual template.\n"
"- This installs the module document_page_quality_manual.",
)
module_document_page_environment_manual = fields.Boolean(
"Environment Manual Template",
help="Provide an environment manual template.\n"
"- This installs the module mgmtsystem_environment_manual.",
)
module_mgmtsystem_health_safety_manual = fields.Boolean(
"Health & Safety Manual Template",
help="Provide a health and safety manual template.\n"
"- This installs the module mgmtsystem_health_safety_manual.",
)
module_information_security_manual = fields.Boolean(
"Information Security Manual Template",
help="Provide an information security manual.\n"
"- This installs the module information_security_manual.",
)
# Documentation
module_document_page_procedure = fields.Boolean(
"Procedures",
help="Provide procedures category.\n"
"- This installs the module document_page_procedure.",
)
module_document_page_environmental_aspect = fields.Boolean(
"Environmental Aspects",
help="Provide Environmental Aspect category.\n"
"- This installs the module mgmtsystem_environmental_aspect.",
)
module_mgmtsystem_hazard = fields.Boolean(
"Hazards",
help="Provide Hazards.\n" "- This installs the module mgmtsystem_hazard.",
)
module_mgmtsystem_security_event = fields.Boolean(
"Feared Events",
help="Provide Feared Events.\n"
"- This installs the module mgmtsystem_security_event.",
)
module_document_page_approval = fields.Boolean(
"Document Page Approval",
help="Provide document approval and history. \n"
"- This installs the module document_page_approval.",
)
module_document_page_work_instruction = fields.Boolean(
"Work Instructions",
help="Provide Work Instructions category.\n"
"- This installs the module document_page_work_instruction.",
)
| 38.669725 | 4,215 |
716 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Quality Management System",
"summary": "Manage your quality management system",
"version": "15.0.1.0.0",
"author": "Savoir-faire Linux, " "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/management-system",
"license": "AGPL-3",
"category": "Management System",
"depends": [
"mgmtsystem_manual",
"mgmtsystem_audit",
"document_page_quality_manual",
"mgmtsystem_review",
],
"data": ["data/mgmtsystem_system.xml"],
"installable": True,
"maintainers": ["max3903"],
}
| 35.8 | 716 |
1,380 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Management System - Nonconformity",
"version": "15.0.1.1.0",
"author": "Savoir-faire Linux, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/management-system",
"license": "AGPL-3",
"category": "Management System",
"depends": ["mgmtsystem_action", "document_page_procedure"],
"data": [
"security/ir.model.access.csv",
"security/mgmtsystem_nonconformity_security.xml",
"views/mgmtsystem_nonconformity.xml",
"views/mgmtsystem_origin.xml",
"views/mgmtsystem_cause.xml",
"views/mgmtsystem_severity.xml",
"views/mgmtsystem_action.xml",
"views/mgmtsystem_nonconformity_stage.xml",
"data/sequence.xml",
"data/mgmtsystem_nonconformity_severity.xml",
"data/mgmtsystem_nonconformity_origin.xml",
"data/mgmtsystem_nonconformity_cause.xml",
"data/mgmtsystem_nonconformity_stage.xml",
"data/mail_message_subtype.xml",
"reports/mgmtsystem_nonconformity_report.xml",
],
"demo": [
"demo/mgmtsystem_nonconformity_origin.xml",
"demo/mgmtsystem_nonconformity_cause.xml",
"demo/mgmtsystem_nonconformity.xml",
],
"installable": True,
}
| 40.588235 | 1,380 |
3,683 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.exceptions import ValidationError
from odoo.tests import common
class TestModelNonConformity(common.TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.nc_model = cls.env["mgmtsystem.nonconformity"]
cls.partner = cls.env["res.partner"].search([])[0]
cls.nc_test = cls.nc_model.create(
{
"partner_id": cls.partner.id,
"manager_user_id": cls.env.user.id,
"description": "description",
"responsible_user_id": cls.env.user.id,
}
)
action_vals = {"name": "An Action", "type_action": "immediate"}
action1 = cls.nc_model.action_ids.create(action_vals)
cls.nc_test.immediate_action_id = action1
def test_stage_group(self):
"""Group by Stage shows all stages"""
group_stages = self.nc_test.read_group(
domain=[], fields=["stage_id"], groupby=["stage_id"]
)
num_stages = len(self.nc_model.stage_id.search([]))
self.assertEqual(len(group_stages), num_stages)
def test_reset_kanban_state(self):
"""Reset Kanban State on Stage change"""
self.nc_test.kanban_state = "done"
self.nc_test.stage_id = self.env.ref("mgmtsystem_nonconformity.stage_analysis")
self.assertEqual(self.nc_test.kanban_state, "normal")
def test_open_validation(self):
"""Don't allow approving/In Progress action comments"""
open_stage = self.env.ref("mgmtsystem_nonconformity.stage_open")
with self.assertRaises(ValidationError):
self.nc_test.stage_id = open_stage
def test_done_validation(self):
"""Don't allow closing an NC without evaluation comments"""
done_stage = self.env.ref("mgmtsystem_nonconformity.stage_done")
self.nc_test.action_comments = "OK!"
with self.assertRaises(ValidationError):
self.nc_test.stage_id = done_stage
def test_done_actions_validation(self):
"""Don't allow closing an NC with open actions"""
done_stage = self.env.ref("mgmtsystem_nonconformity.stage_done")
self.nc_test.immediate_action_id.stage_id = self.env.ref(
"mgmtsystem_action.stage_open"
)
self.nc_test.evaluation_comments = "OK!"
with self.assertRaises(ValidationError):
self.nc_test.stage_id = done_stage
def test_state_transition(self):
"""Close and reopen Nonconformity"""
self.nc_test.action_comments = "OK!"
self.nc_test.stage_id = self.env.ref("mgmtsystem_nonconformity.stage_open")
self.assertEqual(
self.nc_test.immediate_action_id.stage_id,
self.env.ref("mgmtsystem_action.stage_open"),
"Plan Approval starts Actions",
)
self.nc_test.immediate_action_id.stage_id = self.env.ref(
"mgmtsystem_action.stage_open"
)
self.nc_test.evaluation_comments = "OK!"
self.nc_test.immediate_action_id.stage_id = self.env.ref(
"mgmtsystem_action.stage_close"
)
self.nc_test.stage_id = self.env.ref("mgmtsystem_nonconformity.stage_done")
self.assertEqual(self.nc_test.state, "done")
self.assertTrue(self.nc_test.closing_date, "Set close date on Done")
self.nc_test.stage_id = self.env.ref("mgmtsystem_nonconformity.stage_open")
self.assertEqual(self.nc_test.state, "open")
self.assertFalse(self.nc_test.closing_date, "Reset close date on reopen")
| 42.825581 | 3,683 |
1,364 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests import common
class TestModelOrigin(common.TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.record = cls.env["mgmtsystem.nonconformity.origin"].create(
{"name": "TestOrigin"}
)
cls.record2 = cls.env["mgmtsystem.nonconformity.origin"].create(
{"name": "test2", "parent_id": cls.record.id}
)
cls.record3 = cls.env["mgmtsystem.nonconformity.origin"].create(
{"name": "test3", "parent_id": cls.record2.id}
)
def test_create_origin(self):
self.assertNotEqual(self.record.id, 0)
self.assertNotEqual(self.record.id, None)
def test_name_get(self):
name_assoc = self.record.name_get()
self.assertEqual(name_assoc[0][1], "TestOrigin")
self.assertEqual(name_assoc[0][0], self.record.id)
name_assoc = self.record2.name_get()
self.assertEqual(name_assoc[0][1], "TestOrigin / test2")
self.assertEqual(name_assoc[0][0], self.record2.id)
name_assoc = self.record3.name_get()
self.assertEqual(name_assoc[0][1], "TestOrigin / test2 / test3")
self.assertEqual(name_assoc[0][0], self.record3.id)
| 37.888889 | 1,364 |
1,812 |
py
|
PYTHON
|
15.0
|
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import exceptions
from odoo.tests import common
class TestModelCause(common.TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.record = cls.env["mgmtsystem.nonconformity.cause"].create(
{"name": "TestCause"}
)
cls.record2 = cls.env["mgmtsystem.nonconformity.cause"].create(
{"name": "test2", "parent_id": cls.record.id}
)
cls.record3 = cls.env["mgmtsystem.nonconformity.cause"].create(
{"name": "test3", "parent_id": cls.record2.id}
)
def test_create_cause(self):
self.assertNotEqual(self.record.id, 0)
self.assertNotEqual(self.record.id, None)
def test_name_get(self):
name_assoc = self.record.name_get()
self.assertEqual(name_assoc[0][1], "TestCause")
self.assertEqual(name_assoc[0][0], self.record.id)
name_assoc = self.record2.name_get()
self.assertEqual(name_assoc[0][1], "TestCause / test2")
self.assertEqual(name_assoc[0][0], self.record2.id)
name_assoc = self.record3.name_get()
self.assertEqual(name_assoc[0][1], "TestCause / test2 / test3")
self.assertEqual(name_assoc[0][0], self.record3.id)
def test_recursion(self):
parent = self.env["mgmtsystem.nonconformity.cause"].create(
{"name": "ParentCause"}
)
child = self.env["mgmtsystem.nonconformity.cause"].create(
{"name": "ChildCause", "parent_id": parent.id}
)
# no recursion
with self.assertRaises(exceptions.UserError), self.cr.savepoint():
parent.write({"parent_id": child.id})
| 37.75 | 1,812 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.