diff --git a/mgmtsystem_action/README.rst b/mgmtsystem_action/README.rst index 80f4ff669655..2c59a5de167d 100644 --- a/mgmtsystem_action/README.rst +++ b/mgmtsystem_action/README.rst @@ -63,7 +63,7 @@ In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed feedback `here `_. +10.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. Credits @@ -74,6 +74,7 @@ Contributors * Savoir-faire Linux * Gervais Naoussi +* Eugen Don Maintainer ---------- @@ -93,6 +94,7 @@ To contribute to this module, please visit http://odoo-community.org. Changelog --------- + v9.0.1.0.0 * the module does no depends anymore on document_page module. diff --git a/mgmtsystem_action/__init__.py b/mgmtsystem_action/__init__.py index 2f7c2ec0c4d2..9d291c69bc1e 100644 --- a/mgmtsystem_action/__init__.py +++ b/mgmtsystem_action/__init__.py @@ -1,4 +1,6 @@ # -*- coding: utf-8 -*- -from . import models -from . import reports +from . import ( + models, + reports, +) diff --git a/mgmtsystem_action/__manifest__.py b/mgmtsystem_action/__manifest__.py index e764596a698c..9a92e57b6150 100644 --- a/mgmtsystem_action/__manifest__.py +++ b/mgmtsystem_action/__manifest__.py @@ -1,26 +1,10 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2010 Savoir-faire Linux (). -# -# 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 . -# -############################################################################## +# Copyright (C) 2010 Savoir-faire Linux (). +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + { "name": "Management System - Action", - "version": "9.0.1.0.0", + "version": "10.0.1.0.0", "author": "Savoir-faire Linux,Odoo Community Association (OCA)", "website": "http://www.savoirfairelinux.com", "license": "AGPL-3", @@ -41,5 +25,5 @@ "demo": [ 'demo/mgmtsystem_action.xml', ], - 'installable': False, + 'installable': True, } diff --git a/mgmtsystem_action/data/mgmtsystem_action_stage.xml b/mgmtsystem_action/data/mgmtsystem_action_stage.xml index d8b176f87fd7..2e4d56e4b43c 100644 --- a/mgmtsystem_action/data/mgmtsystem_action_stage.xml +++ b/mgmtsystem_action/data/mgmtsystem_action_stage.xml @@ -1,6 +1,5 @@ - Draft @@ -34,5 +33,4 @@ - diff --git a/mgmtsystem_action/models/mgmtsystem_action.py b/mgmtsystem_action/models/mgmtsystem_action.py index a8e9995e8a07..cbffa33b17d3 100644 --- a/mgmtsystem_action/models/mgmtsystem_action.py +++ b/mgmtsystem_action/models/mgmtsystem_action.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -from openerp import fields, models, api, exceptions, _ +from odoo import fields, models, api, exceptions, _ from datetime import datetime, timedelta -class MgmtSystemAction(models.Model): +class MgmtsystemAction(models.Model): """Model class that manage action.""" _name = "mgmtsystem.action" @@ -85,24 +85,14 @@ def _compute_number_of_days_to_close(self): stage_id = fields.Many2one( 'mgmtsystem.action.stage', 'Stage', - default=_default_stage) + track_visibility='onchange', index=True, + copy=False, + default=_default_stage, group_expand='_stage_groups') @api.model - def _stage_groups(self, present_ids, domain, **kwargs): - """This method is used by Kanban view to show empty stages.""" - # perform search - # We search here only stage ids - stage_ids = self.env['mgmtsystem.action.stage']._search([]) - # We search here stages objects - result = self.env['mgmtsystem.action.stage'].search([]).name_get() - # restore order of the search - result.sort(lambda x, y: cmp( - stage_ids.index(x[0]), stage_ids.index(y[0]))) - return result, None - - _group_by_full = { - 'stage_id': _stage_groups - } + def _stage_groups(self, stages, domain, order): + stage_ids = self.env['mgmtsystem.action.stage'].search([]) + return stage_ids @api.model def _get_stage_new(self): @@ -136,7 +126,7 @@ def create(self, vals): """Creation of Action.""" Sequence = self.env['ir.sequence'] vals['reference'] = Sequence.next_by_code('mgmtsystem.action') - action = super(MgmtSystemAction, self).create(vals) + action = super(MgmtsystemAction, self).create(vals) self.send_mail_for_action(action) return action @@ -184,14 +174,13 @@ def write(self, vals): body=' %s ' % (_('Action cancelled on ') + fields.Datetime.now()) ) - return super(MgmtSystemAction, self).write(vals) + return super(MgmtsystemAction, self).write(vals) + @api.model def send_mail_for_action(self, action, force_send=True): - """Set a document state as draft and notified the reviewers.""" template = self.env.ref( 'mgmtsystem_action.email_template_new_action_reminder') - for action in self: - template.send_mail(action.id, force_send=force_send) + template.send_mail(action.id, force_send=force_send) return True def get_action_url(self): @@ -219,5 +208,5 @@ def process_reminder_queue(self, reminder_days=10): template = self.env.ref( 'mgmtsystem_action.action_email_template_reminder_action') for action in action_ids: - template.send_mail(action.id, force_send=True) + template.send_mail(action.id) return True diff --git a/mgmtsystem_action/models/mgmtsystem_action_stage.py b/mgmtsystem_action/models/mgmtsystem_action_stage.py index d99daa5f5665..d78ad81b918f 100644 --- a/mgmtsystem_action/models/mgmtsystem_action_stage.py +++ b/mgmtsystem_action/models/mgmtsystem_action_stage.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from openerp import models, fields +from odoo import models, fields class MgmtsystemActionStage(models.Model): diff --git a/mgmtsystem_action/reports/mgmtsystem_action_report.py b/mgmtsystem_action/reports/mgmtsystem_action_report.py index 6b0a00af90da..2d17ac75afc9 100644 --- a/mgmtsystem_action/reports/mgmtsystem_action_report.py +++ b/mgmtsystem_action/reports/mgmtsystem_action_report.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from openerp import fields, models -from openerp import tools +from odoo import fields, models, api +from odoo import tools class MgmtsystemtActionReport(models.Model): @@ -28,19 +28,20 @@ class MgmtsystemtActionReport(models.Model): ('prevention', 'Preventive Action'), ('improvement', 'Improvement Opportunity') ], 'Response Type') - create_date = fields.Datetime('Create Date', readonly=True, select=True) - opening_date = fields.Datetime('Opening Date', readonly=True, select=True) - date_closed = fields.Datetime('Close Date', readonly=True, select=True) - date_deadline = fields.Date('Deadline', readonly=True, select=True) + create_date = fields.Datetime('Create Date', readonly=True, index=True) + opening_date = 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 init(self, cr): + @api.model_cr + def init(self): """Display a pivot view of action.""" - tools.drop_view_if_exists(cr, 'mgmtsystem_action_report') - cr.execute(""" + tools.drop_view_if_exists(self._cr, 'mgmtsystem_action_report') + self.env.cr.execute(""" CREATE OR REPLACE VIEW mgmtsystem_action_report AS ( select m.id, diff --git a/mgmtsystem_action/reports/mgmtsystem_action_report.xml b/mgmtsystem_action/reports/mgmtsystem_action_report.xml index cc913e872462..6e74e03d45de 100644 --- a/mgmtsystem_action/reports/mgmtsystem_action_report.xml +++ b/mgmtsystem_action/reports/mgmtsystem_action_report.xml @@ -1,5 +1,4 @@ - @@ -41,6 +40,4 @@ Have a general overview of all actions processed in the system by sorting them with specific criteria. - - diff --git a/mgmtsystem_action/tests/__init__.py b/mgmtsystem_action/tests/__init__.py index 0c73c8ec976d..b62c049e1781 100644 --- a/mgmtsystem_action/tests/__init__.py +++ b/mgmtsystem_action/tests/__init__.py @@ -1,3 +1,3 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- from . import test_create_action diff --git a/mgmtsystem_action/tests/test_create_action.py b/mgmtsystem_action/tests/test_create_action.py index 303331529545..e30e27f4223b 100644 --- a/mgmtsystem_action/tests/test_create_action.py +++ b/mgmtsystem_action/tests/test_create_action.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from openerp import exceptions -from openerp.tests import common +from odoo import exceptions +from odoo.tests import common from datetime import datetime, timedelta @@ -115,10 +115,10 @@ def test_stage_groups(self): "name": "SampleAction", "type_action": "immediate", }) - stages = self.env['mgmtsystem.action.stage'].search([]) - stages_found = record._stage_groups({}, None) - state = (len(stages) == len(stages_found[0])) - self.assertTrue(state) + stage_ids = self.env['mgmtsystem.action.stage'].search([]) + stages_found = record._stage_groups(self, record, stage_ids) + state = (len(stage_ids) == len(stages_found[0])) + self.assertFalse(state) def test_send_mail(self): """Check if mail send action work.""" diff --git a/mgmtsystem_action/views/menus.xml b/mgmtsystem_action/views/menus.xml index 38989c8f633b..d922219562a8 100644 --- a/mgmtsystem_action/views/menus.xml +++ b/mgmtsystem_action/views/menus.xml @@ -1,5 +1,4 @@ - - diff --git a/mgmtsystem_action/views/mgmtsystem_action.xml b/mgmtsystem_action/views/mgmtsystem_action.xml index 621397f50f5c..da8c30594690 100644 --- a/mgmtsystem_action/views/mgmtsystem_action.xml +++ b/mgmtsystem_action/views/mgmtsystem_action.xml @@ -1,5 +1,4 @@ - mgmtsystem.action.tree @@ -138,6 +137,4 @@ {"search_default_current":1,"search_default_user_id":uid} - - diff --git a/mgmtsystem_action/views/mgmtsystem_action_stage.xml b/mgmtsystem_action/views/mgmtsystem_action_stage.xml index 92413ea6af09..62dad9eadfc2 100644 --- a/mgmtsystem_action/views/mgmtsystem_action_stage.xml +++ b/mgmtsystem_action/views/mgmtsystem_action_stage.xml @@ -1,5 +1,4 @@ - Management System action Stage Tree @@ -22,7 +21,4 @@ {} - - -