[FIX] fix comment done by the community

This commit is contained in:
Thibault Rey
2016-03-28 18:02:06 +02:00
committed by David Beal
parent 23a0071fef
commit 525104d947
10 changed files with 153 additions and 242 deletions

View File

@@ -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
<https://github.com/OCA/manufacture/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
<https://github.com/OCA/
manufacture/issues/new?body=module:%20
mrp_workcenter_hierarchical%0Aversion:%20
9.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Define your workcenter groups
-----------------------------
Credits
=======
.. image:: static/description/group.png
:alt: Define your workcenter groups on Odoo ERP
Images
------
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Attach a group to your workcenter
---------------------------------
Contributors
------------
* David BEAL <david.beal@akretion.com>
* Sébastien BEAU <sebastien.beau@akretion.com>
* Thibault REY <thibault.rey@akretion.com>
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

View File

@@ -1,22 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) All Rights Reserved 2015 Akretion
# @author David BEAL <david.beal@akretion.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/>.
#
###############################################################################
# © 2016 Akretion (http://www.akretion.com)
# David BEAL <david.beal@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import workcenter

View File

@@ -1,84 +1,17 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) All Rights Reserved 2015 Akretion
# @author David BEAL <david.beal@akretion.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/>.
#
###############################################################################
# © 2016 Akretion (http://www.akretion.com)
# David BEAL <david.beal@akretion.com>
# 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 <david.beal@akretion.com>
* Sébastien BEAU <sebastien.beau@akretion.com>
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',

View File

@@ -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 ""

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

View File

@@ -1,22 +0,0 @@
<section class="oe_container oe_website_only">
<div class="oe_row oe_more_spaced">
<h3 class="oe_slogan">Workcenter Groups</h3>
<h3 class="oe_slogan"><a href="http://odoo-community.org/">An OCA module</a> : validated by Odoo community experts</h3>
<h4 class="oe_slogan"><a href="http://www.akretion.com/fr">By Akretion</a></h4>
<div class="oe_span6">
<h2>Workcenter Groups</h2>
<table>
<tr><td><h3>Define your workcenter groups</h3><div class="oe_row_img oe_centered"><img class="oe_picture" width="80%" src="group.png"></div><br/><br/></td></tr>
<tr><td><h3>Attach a group to your workcenter</h3><div class="oe_row_img oe_centered"><img class="oe_picture" src="workc.png"></div><br/><br/></td></tr>
</table>
<div class="oe_row oe_centeralign oe_more_space">
<a href="http://www.akretion.com/contact" class="oe_button oe_big">Contact us</a><br>
<a href="https://github.com/OCA/manufacture/tree/7.0" class="oe_button oe_big">Access to the code</a>
</div>
</section>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -1 +1,6 @@
# -*- coding: utf-8 -*-
# © 2016 Akretion (http://www.akretion.com)
# David BEAL <david.beal@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import test_compute_level

View File

@@ -1,5 +1,11 @@
# -*- coding: utf-8 -*-
# © 2016 Akretion (http://www.akretion.com)
# David BEAL <david.beal@akretion.com>
# 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)

View File

@@ -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 <http://www.gnu.org/licenses/>.
#
##############################################################################
# © 2016 Akretion (http://www.akretion.com)
# David BEAL <david.beal@akretion.com>
# 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)