diff --git a/mrp_workcenter_hierarchical/README.rst b/mrp_workcenter_hierarchical/README.rst index 9e2514ac3..c2b5afa83 100644 --- a/mrp_workcenter_hierarchical/README.rst +++ b/mrp_workcenter_hierarchical/README.rst @@ -1,17 +1,85 @@ -Description +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +=========================== +MRP Workcenter Hierarchical +=========================== + +* Add the possibility to define a parent workcenter to a workcenter + +Installation +============ + +Just install this module. + +Configuration +============= + +To visualize features offered by this module, you need to: + + * go to Settings > Configuration > Manufacturing + * in the section Manufacturing Order / Planning, + check "Manage routings and work orders" and Validate + +Usage +===== + +To use this module, you need to go to: + + * Manufacturing > Configuration > Workcenter Hierarchical + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/129/9.0 + +.. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt +.. branch is "8.0" for example + +Known issues / Roadmap +====================== + +* ... + +Bug Tracker =========== -See __openerp__.py +Bugs are tracked on `GitHub Issues +`_. 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 +`_. -Define your workcenter groups ------------------------------ +Credits +======= - .. image:: static/description/group.png - :alt: Define your workcenter groups on Odoo ERP +Images +------ +* Odoo Community Association: `Icon `_. -Attach a group to your workcenter ---------------------------------- +Contributors +------------ + +* David BEAL +* Sébastien BEAU +* Thibault REY + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit https://odoo-community.org. - .. image:: static/description/workc.png - :alt: Attach a group to your workcenter with Odoo ERP diff --git a/mrp_workcenter_hierarchical/__init__.py b/mrp_workcenter_hierarchical/__init__.py index d6571b201..f605ba5bb 100644 --- a/mrp_workcenter_hierarchical/__init__.py +++ b/mrp_workcenter_hierarchical/__init__.py @@ -1,22 +1,6 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Copyright (C) All Rights Reserved 2015 Akretion -# @author David BEAL -# -# 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 . -# -############################################################################### +# © 2016 Akretion (http://www.akretion.com) +# David BEAL +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import workcenter diff --git a/mrp_workcenter_hierarchical/__openerp__.py b/mrp_workcenter_hierarchical/__openerp__.py index 5ef023c3e..cc30e602f 100644 --- a/mrp_workcenter_hierarchical/__openerp__.py +++ b/mrp_workcenter_hierarchical/__openerp__.py @@ -1,84 +1,17 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Copyright (C) All Rights Reserved 2015 Akretion -# @author David BEAL -# -# 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 . -# -############################################################################### - +# © 2016 Akretion (http://www.akretion.com) +# David BEAL +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { 'name': 'MRP Workcenter Hierarchical', - 'version': '0.5', + 'version': '9.0.1.0.0', 'author': 'Akretion,Odoo Community Association (OCA)', 'summary': "Organise Workcenters by section", 'category': 'Manufacturing', 'depends': [ 'mrp_operations', ], - 'description': """ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :alt: License - -MRP Workcenter Hierarchical -=============================== - -* Add the possibility to define a parent workcenter to a workcenter - -Configuration -============= - -To visualize features offered by this module, you need to: - - * go to Settings > Configuration > Manufacturing - * in the section Manufacturing Order / Planning, - check "Manage routings and work orders" and Validate - -Usage -===== - -To use this module, you need to go to: - - * Manufacturing > Configuration > Workcenter Hierarchical - - -Credits -======= - -Contributors ------------- - -* David BEAL -* Sébastien BEAU - -Maintainer ----------- - -.. image:: http://odoo-community.org/logo.png - :alt: Odoo Community Association - :target: http://odoo-community.org - -This module is maintained by the OCA. - -OCA, or the Odoo Community Association, is a nonprofit organization -whose mission is to support the collaborative development of Odoo features -and promote its widespread use. - -To contribute to this module, please visit http://odoo-community.org. -""", 'website': 'http://www.akretion.com/', 'data': [ 'workcenter_view.xml', diff --git a/mrp_workcenter_hierarchical/i18n/mrp_workcenter_group.pot b/mrp_workcenter_hierarchical/i18n/mrp_workcenter_group.pot deleted file mode 100644 index b404fd8d9..000000000 --- a/mrp_workcenter_hierarchical/i18n/mrp_workcenter_group.pot +++ /dev/null @@ -1,62 +0,0 @@ -# Translation of OpenERP Server. -# This file contains the translation of the following modules: -# * mrp_workcenter_group -# -msgid "" -msgstr "" -"Project-Id-Version: OpenERP Server 7.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-03-19 10:15+0000\n" -"PO-Revision-Date: 2015-03-19 10:15+0000\n" -"Last-Translator: <>\n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: \n" - -#. module: mrp_workcenter_group -#: field:workcenter.group,active:0 -msgid "Active" -msgstr "" - -#. module: mrp_workcenter_group -#: view:mrp.workcenter:0 -#: field:mrp.workcenter,workcenter_group_id:0 -#: view:workcenter.group:0 -msgid "Group" -msgstr "" - -#. module: mrp_workcenter_group -#: view:workcenter.group:0 -#: field:workcenter.group,workcenter_ids:0 -msgid "Linked Workcenters" -msgstr "" - -#. module: mrp_workcenter_group -#: field:workcenter.group,name:0 -msgid "Name" -msgstr "" - -#. module: mrp_workcenter_group -#: field:workcenter.group,sequence:0 -msgid "Sequence" -msgstr "" - -#. module: mrp_workcenter_group -#: code:_description:0 -#: model:ir.model,name:mrp_workcenter_group.model_mrp_workcenter -#, python-format -msgid "Work Center" -msgstr "" - -#. module: mrp_workcenter_group -#: code:_description:0 -#: model:ir.actions.act_window,name:mrp_workcenter_group.act_open_workcenter_group_view -#: model:ir.model,name:mrp_workcenter_group.model_workcenter_group -#: model:ir.ui.menu,name:mrp_workcenter_group.menu_mrp_workcenter_group -#: view:workcenter.group:0 -#, python-format -msgid "Workcenter Groups" -msgstr "" - diff --git a/mrp_workcenter_hierarchical/static/description/group.png b/mrp_workcenter_hierarchical/static/description/group.png deleted file mode 100644 index f61dcd097..000000000 Binary files a/mrp_workcenter_hierarchical/static/description/group.png and /dev/null differ diff --git a/mrp_workcenter_hierarchical/static/description/index.html b/mrp_workcenter_hierarchical/static/description/index.html deleted file mode 100644 index 3b1eb19c4..000000000 --- a/mrp_workcenter_hierarchical/static/description/index.html +++ /dev/null @@ -1,22 +0,0 @@ - -
- -
-

Workcenter Groups

-

An OCA module : validated by Odoo community experts

-

By Akretion

-
- -

Workcenter Groups

- - - - -

Define your workcenter groups



Attach a group to your workcenter



- - - -
diff --git a/mrp_workcenter_hierarchical/static/description/workc.png b/mrp_workcenter_hierarchical/static/description/workc.png deleted file mode 100644 index d20197176..000000000 Binary files a/mrp_workcenter_hierarchical/static/description/workc.png and /dev/null differ diff --git a/mrp_workcenter_hierarchical/tests/__init__.py b/mrp_workcenter_hierarchical/tests/__init__.py index f1f7bc77c..ccccde2c7 100644 --- a/mrp_workcenter_hierarchical/tests/__init__.py +++ b/mrp_workcenter_hierarchical/tests/__init__.py @@ -1 +1,6 @@ +# -*- coding: utf-8 -*- +# © 2016 Akretion (http://www.akretion.com) +# David BEAL +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + from . import test_compute_level diff --git a/mrp_workcenter_hierarchical/tests/test_compute_level.py b/mrp_workcenter_hierarchical/tests/test_compute_level.py index 22d305945..b28cde6f9 100644 --- a/mrp_workcenter_hierarchical/tests/test_compute_level.py +++ b/mrp_workcenter_hierarchical/tests/test_compute_level.py @@ -1,5 +1,11 @@ +# -*- coding: utf-8 -*- +# © 2016 Akretion (http://www.akretion.com) +# David BEAL +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + from openerp.tests.common import TransactionCase + class ComputeParentLevel(TransactionCase): def test_compute_parent_level0(self): workcenter = self.env['mrp.workcenter'].create({ @@ -8,51 +14,65 @@ class ComputeParentLevel(TransactionCase): 'capacity_per_cycle': 5, 'time_cycle': 1, 'time_start': 0.1, - 'time_stop': 0.1, + 'time_stop': 0.1, 'time_efficiency': 0.87, 'product_id': self.env.ref('product.product_assembly').id, 'costs_hour': 0, - 'costs_hour_account_id': self.env.ref('mrp.account_assembly_hours').id, + 'costs_hour_account_id': self.env.ref( + 'mrp.account_assembly_hours').id, 'costs_cycle': 0.05, - 'costs_cycle_account_id': self.env.ref('mrp.account_assembly_cycle').id, + 'costs_cycle_account_id': self.env.ref( + 'mrp.account_assembly_cycle').id, }) - workcenter_child = self.env.ref('mrp_workcenter_hierarchical.mrp_workcenter_A') + workcenter_child = self.env.ref( + 'mrp_workcenter_hierarchical.mrp_workcenter_A') workcenter_child.write({'parent_id': workcenter.id}) self.assertEqual(workcenter.parent_level_1_id, workcenter) - + def test_compute_parent_level1(self): - workcenter_child = self.env.ref('mrp_workcenter_hierarchical.mrp_workcenter_E') - workcenter_parent = self.env.ref('mrp_workcenter_hierarchical.mrp_workcenter_top') + workcenter_child = self.env.ref( + 'mrp_workcenter_hierarchical.mrp_workcenter_E') + workcenter_parent = self.env.ref( + 'mrp_workcenter_hierarchical.mrp_workcenter_top') workcenter_child.write({'parent_id': workcenter_parent.id}) self.assertEqual(workcenter_child.parent_level_1_id, workcenter_parent) def test_compute_parent_level2(self): - workcenter_child = self.env.ref('mrp_workcenter_hierarchical.mrp_workcenter_A') - workcenter_parent1 = self.env.ref('mrp_workcenter_hierarchical.mrp_workcenter_top') + workcenter_child = self.env.ref( + 'mrp_workcenter_hierarchical.mrp_workcenter_A') + workcenter_parent1 = self.env.ref( + 'mrp_workcenter_hierarchical.mrp_workcenter_top') workcenter_parent2 = self.env.ref('mrp.mrp_workcenter_0') - workcenter_child.write({'parent_id': workcenter_parent2.id}) - import pdb; pdb.set_trace() - self.assertEqual(workcenter_child.parent_level_2_id, workcenter_parent2) - self.assertEqual(workcenter_child.parent_level_1_id, workcenter_parent1) + self.assertEqual( + workcenter_child.parent_level_2_id, workcenter_parent2) + self.assertEqual( + workcenter_child.parent_level_1_id, workcenter_parent1) def test_compute_parent_level3(self): - workcenter_child = self.env.ref('mrp_workcenter_hierarchical.mrp_workcenter_B') - workcenter_parent1 = self.env.ref('mrp_workcenter_hierarchical.mrp_workcenter_top') - workcenter_parent2 = self.env.ref('mrp_workcenter_hierarchical.mrp_workcenter_2') - workcenter_parent3 = self.env.ref('mrp_workcenter_hierarchical.mrp_workcenter_A') + workcenter_child = self.env.ref( + 'mrp_workcenter_hierarchical.mrp_workcenter_B') + workcenter_parent1 = self.env.ref( + 'mrp_workcenter_hierarchical.mrp_workcenter_top') + workcenter_parent2 = self.env.ref( + 'mrp_workcenter_hierarchical.mrp_workcenter_2') + workcenter_parent3 = self.env.ref( + 'mrp_workcenter_hierarchical.mrp_workcenter_A') workcenter_child.write({'parent_id': workcenter_parent3.id}) - self.assertEqual(workcenter_child.parent_level_3_id, workcenter_parent3) - self.assertEqual(workcenter_child.parent_level_2_id, workcenter_parent2) - self.assertEqual(workcenter_child.parent_level_1_id, workcenter_parent1) - + self.assertEqual( + workcenter_child.parent_level_3_id, workcenter_parent3) + self.assertEqual( + workcenter_child.parent_level_2_id, workcenter_parent2) + self.assertEqual( + workcenter_child.parent_level_1_id, workcenter_parent1) + def test_compute_parent_level3(self): - workcenter_child = self.env.ref('mrp_workcenter_hierarchical.mrp_workcenter_C') - workcenter_parent1 = self.env.ref('mrp_workcenter_hierarchical.mrp_workcenter_top') - workcenter_parent2 = self.env.ref('mrp_workcenter_hierarchical.mrp_workcenter_2') - workcenter_parent3 = self.env.ref('mrp_workcenter_hierarchical.mrp_workcenter_A') - workcenter_parent4 = self.env.ref('mrp_workcenter_hierarchical.mrp_workcenter_B') + workcenter_child = self.env.ref( + 'mrp_workcenter_hierarchical.mrp_workcenter_C') + workcenter_parent3 = self.env.ref( + 'mrp_workcenter_hierarchical.mrp_workcenter_A') + workcenter_parent4 = self.env.ref( + 'mrp_workcenter_hierarchical.mrp_workcenter_B') workcenter_parent4.write({'parent_id': workcenter_parent3.id}) workcenter_child.write({'parent_id': workcenter_parent4.id}) self.assertEqual(workcenter_child.parent_id, workcenter_parent4) - diff --git a/mrp_workcenter_hierarchical/workcenter.py b/mrp_workcenter_hierarchical/workcenter.py index e9d036450..30d4ed68b 100644 --- a/mrp_workcenter_hierarchical/workcenter.py +++ b/mrp_workcenter_hierarchical/workcenter.py @@ -1,33 +1,17 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Author: David BEAL -# Copyright 2015 Akretion -# -# 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 . -# -############################################################################## - +# © 2016 Akretion (http://www.akretion.com) +# David BEAL +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from openerp import api, fields, models + class MrpWorkcenter(models.Model): _inherit = 'mrp.workcenter' _order = 'parent_left' _parent_store = True - - parent_id = fields.Many2one('mrp.workcenter', string='Parent') + + parent_id = fields.Many2one('mrp.workcenter', string='Parent') child_ids = fields.One2many( 'mrp.workcenter', 'parent_id', @@ -47,9 +31,9 @@ class MrpWorkcenter(models.Model): compute='_compute_parent_level', string='Parent Level 3', store=True) - parent_left=fields.Integer(select=1) - parent_right=fields.Integer(select=1) - + parent_left = fields.Integer(select=1) + parent_right = fields.Integer(select=1) + @api.multi def _get_parent_ids(self): self.ensure_one() @@ -59,7 +43,7 @@ class MrpWorkcenter(models.Model): else: ids = [] return ids - + @api.multi @api.depends('parent_id.parent_id.parent_id', 'child_ids') def _compute_parent_level(self): @@ -70,8 +54,9 @@ class MrpWorkcenter(models.Model): for workcenter in self: parent_ids = workcenter._get_parent_ids() - workcenter.parent_level_1_id = get_next_level(parent_ids, workcenter) - workcenter.parent_level_2_id = get_next_level(parent_ids, workcenter) - workcenter.parent_level_3_id = get_next_level(parent_ids, workcenter) - - + workcenter.parent_level_1_id = get_next_level( + parent_ids, workcenter) + workcenter.parent_level_2_id = get_next_level( + parent_ids, workcenter) + workcenter.parent_level_3_id = get_next_level( + parent_ids, workcenter)