mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
MIG mrp_workcenter_hierarchical: migration v14.0
This commit is contained in:
@@ -14,19 +14,18 @@ MRP Workcenter Hierarchical
|
|||||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||||
:alt: License: AGPL-3
|
:alt: License: AGPL-3
|
||||||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github
|
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github
|
||||||
:target: https://github.com/OCA/manufacture/tree/9.0/mrp_workcenter_hierarchical
|
:target: https://github.com/OCA/manufacture/tree/14.0/mrp_workcenter_hierarchical
|
||||||
:alt: OCA/manufacture
|
:alt: OCA/manufacture
|
||||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||||
:target: https://translation.odoo-community.org/projects/manufacture-9-0/manufacture-9-0-mrp_workcenter_hierarchical
|
:target: https://translation.odoo-community.org/projects/manufacture-14-0/manufacture-14-0-mrp_workcenter_hierarchical
|
||||||
:alt: Translate me on Weblate
|
:alt: Translate me on Weblate
|
||||||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
||||||
:target: https://runbot.odoo-community.org/runbot/129/9.0
|
:target: https://runbot.odoo-community.org/runbot/129/14.0
|
||||||
:alt: Try me on Runbot
|
:alt: Try me on Runbot
|
||||||
|
|
||||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||||
|
|
||||||
|
Allow to define a parent workcenter to a workcenter
|
||||||
* Add the possibility to define a parent workcenter to a workcenter
|
|
||||||
|
|
||||||
**Table of contents**
|
**Table of contents**
|
||||||
|
|
||||||
@@ -36,18 +35,17 @@ MRP Workcenter Hierarchical
|
|||||||
Configuration
|
Configuration
|
||||||
=============
|
=============
|
||||||
|
|
||||||
To visualize features offered by this module, you need to:
|
Activate workcenters:
|
||||||
|
* Manufacturing > Configuration > Settings > Configuration
|
||||||
* go to Settings > Configuration > Manufacturing
|
* Check Work Orders and save
|
||||||
* in the section Manufacturing Order / Planning,
|
|
||||||
check "Manage routings and work orders" and Validate
|
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
=====
|
=====
|
||||||
|
|
||||||
To use this module, you need to go to:
|
* Go to Manufacturing > Configuration > Work Centers
|
||||||
|
* Set parent field on workcenters
|
||||||
|
|
||||||
* Manufacturing > Configuration > Workcenter Hierarchical
|
../static/src/img/img1.png
|
||||||
|
|
||||||
Bug Tracker
|
Bug Tracker
|
||||||
===========
|
===========
|
||||||
@@ -55,7 +53,7 @@ Bug Tracker
|
|||||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/manufacture/issues>`_.
|
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.
|
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
|
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:%20mrp_workcenter_hierarchical%0Aversion:%209.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
`feedback <https://github.com/OCA/manufacture/issues/new?body=module:%20mrp_workcenter_hierarchical%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||||
|
|
||||||
Do not contact contributors directly about support or help with technical issues.
|
Do not contact contributors directly about support or help with technical issues.
|
||||||
|
|
||||||
@@ -89,6 +87,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
|
|||||||
mission is to support the collaborative development of Odoo features and
|
mission is to support the collaborative development of Odoo features and
|
||||||
promote its widespread use.
|
promote its widespread use.
|
||||||
|
|
||||||
This module is part of the `OCA/manufacture <https://github.com/OCA/manufacture/tree/9.0/mrp_workcenter_hierarchical>`_ project on GitHub.
|
This module is part of the `OCA/manufacture <https://github.com/OCA/manufacture/tree/14.0/mrp_workcenter_hierarchical>`_ project on GitHub.
|
||||||
|
|
||||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||||
|
|||||||
@@ -1,5 +1 @@
|
|||||||
# © 2016 Akretion (http://www.akretion.com)
|
from . import models
|
||||||
# David BEAL <david.beal@akretion.com>
|
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
||||||
|
|
||||||
from . import model
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
# © 2016 Akretion (http://www.akretion.com)
|
# 2016 Akretion (http://www.akretion.com)
|
||||||
# David BEAL <david.beal@akretion.com>
|
# David BEAL <david.beal@akretion.com>
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
{
|
{
|
||||||
"name": "MRP Workcenter Hierarchical",
|
"name": "MRP Workcenter Hierarchical",
|
||||||
"version": "14.0.0.0.0",
|
"version": "14.0.1.0.0",
|
||||||
"author": "Akretion,Odoo Community Association (OCA)",
|
"author": "Akretion,Odoo Community Association (OCA)",
|
||||||
"summary": "Organise Workcenters by section",
|
"summary": "Organise Workcenters by section",
|
||||||
"category": "Manufacturing",
|
"category": "Manufacturing",
|
||||||
|
|||||||
@@ -1,96 +1,39 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<openerp>
|
<odoo>
|
||||||
<data noupdate="0">
|
|
||||||
<record id="mrp_workcenter_top" model="mrp.workcenter">
|
<record id="workc_12345" model="mrp.workcenter">
|
||||||
<field name="name">Assembly 1</field>
|
<field name="name">12345</field>
|
||||||
<field name="calendar_id" ref="resource.timesheet_group1" />
|
</record>
|
||||||
<field name="capacity_per_cycle">5</field>
|
<record id="workc_1234" model="mrp.workcenter">
|
||||||
<field name="time_cycle">1</field>
|
<field name="name">1234</field>
|
||||||
<field name="time_start">0.1</field>
|
<field name="parent_id" ref="workc_12345" />
|
||||||
<field name="time_stop">0.1</field>
|
</record>
|
||||||
<field name="time_efficiency">0.87</field>
|
<record id="workc_123" model="mrp.workcenter">
|
||||||
<field name="product_id" ref="product.product_assembly" />
|
<field name="name">123</field>
|
||||||
<field name="costs_hour">0.1</field>
|
<field name="parent_id" ref="workc_1234" />
|
||||||
<field name="costs_hour_account_id" ref="mrp.account_assembly_hours" />
|
</record>
|
||||||
<field name="costs_cycle">0.05</field>
|
<record id="workc_12" model="mrp.workcenter">
|
||||||
<field name="costs_cycle_account_id" ref="mrp.account_assembly_cycle" />
|
<field name="name">12</field>
|
||||||
</record>
|
<field name="parent_id" ref="workc_123" />
|
||||||
<record id="mrp_workcenter_2" model="mrp.workcenter">
|
</record>
|
||||||
<field name="name">Assembly workshop 2</field>
|
<record id="workc_1" model="mrp.workcenter">
|
||||||
<field name="calendar_id" ref="resource.timesheet_group1" />
|
<field name="name">1</field>
|
||||||
<field name="capacity_per_cycle">5</field>
|
<field name="parent_id" ref="workc_12" />
|
||||||
<field name="time_cycle">1</field>
|
</record>
|
||||||
<field name="time_start">0.1</field>
|
|
||||||
<field name="time_stop">0.1</field>
|
|
||||||
<field name="time_efficiency">0.87</field>
|
<record id="mrp_workcenter_tree_view_demo" model="ir.ui.view">
|
||||||
<field name="product_id" ref="product.product_assembly" />
|
<!-- This view is only pedagocical purpose on demo -->
|
||||||
<field name="costs_hour">0.1</field>
|
<field name="model">mrp.workcenter</field>
|
||||||
<field name="costs_hour_account_id" ref="mrp.account_assembly_hours" />
|
<field name="inherit_id" ref="mrp.mrp_workcenter_tree_view" />
|
||||||
<field name="costs_cycle">0.05</field>
|
<field name="arch" type="xml">
|
||||||
<field name="costs_cycle_account_id" ref="mrp.account_assembly_cycle" />
|
<field name="parent_id" position="after">
|
||||||
<field name="parent_id" ref="mrp_workcenter_top" />
|
<field name="parent_level_1_id" />
|
||||||
</record>
|
<field name="parent_level_2_id" />
|
||||||
<record id="mrp_workcenter_A" model="mrp.workcenter">
|
<field name="parent_level_3_id" />
|
||||||
<field name="name">Assembly A</field>
|
</field>
|
||||||
<field name="calendar_id" ref="resource.timesheet_group1" />
|
</field>
|
||||||
<field name="capacity_per_cycle">5</field>
|
</record>
|
||||||
<field name="time_cycle">1</field>
|
|
||||||
<field name="time_start">0.1</field>
|
|
||||||
<field name="time_stop">0.1</field>
|
</odoo>
|
||||||
<field name="time_efficiency">0.87</field>
|
|
||||||
<field name="product_id" ref="product.product_assembly" />
|
|
||||||
<field name="costs_hour">0.1</field>
|
|
||||||
<field name="costs_hour_account_id" ref="mrp.account_assembly_hours" />
|
|
||||||
<field name="costs_cycle">0.05</field>
|
|
||||||
<field name="costs_cycle_account_id" ref="mrp.account_assembly_cycle" />
|
|
||||||
<field name="parent_id" ref="mrp_workcenter_2" />
|
|
||||||
</record>
|
|
||||||
<record id="mrp_workcenter_B" model="mrp.workcenter">
|
|
||||||
<field name="name">Assembly B</field>
|
|
||||||
<field name="calendar_id" ref="resource.timesheet_group1" />
|
|
||||||
<field name="capacity_per_cycle">5</field>
|
|
||||||
<field name="time_cycle">1</field>
|
|
||||||
<field name="time_start">0.1</field>
|
|
||||||
<field name="time_stop">0.1</field>
|
|
||||||
<field name="time_efficiency">0.87</field>
|
|
||||||
<field name="product_id" ref="product.product_assembly" />
|
|
||||||
<field name="costs_hour">0.1</field>
|
|
||||||
<field name="costs_hour_account_id" ref="mrp.account_assembly_hours" />
|
|
||||||
<field name="costs_cycle">0.05</field>
|
|
||||||
<field name="costs_cycle_account_id" ref="mrp.account_assembly_cycle" />
|
|
||||||
<field name="parent_id" ref="mrp_workcenter_2" />
|
|
||||||
</record>
|
|
||||||
<record id="mrp_workcenter_C" model="mrp.workcenter">
|
|
||||||
<field name="name">Assembly C</field>
|
|
||||||
<field name="calendar_id" ref="resource.timesheet_group1" />
|
|
||||||
<field name="capacity_per_cycle">5</field>
|
|
||||||
<field name="time_cycle">1</field>
|
|
||||||
<field name="time_start">0.1</field>
|
|
||||||
<field name="time_stop">0.1</field>
|
|
||||||
<field name="time_efficiency">0.87</field>
|
|
||||||
<field name="product_id" ref="product.product_assembly" />
|
|
||||||
<field name="costs_hour">0.1</field>
|
|
||||||
<field name="costs_hour_account_id" ref="mrp.account_assembly_hours" />
|
|
||||||
<field name="costs_cycle">0.05</field>
|
|
||||||
<field name="costs_cycle_account_id" ref="mrp.account_assembly_cycle" />
|
|
||||||
<field name="parent_id" ref="mrp.mrp_workcenter_0" />
|
|
||||||
</record>
|
|
||||||
<record id="mrp_workcenter_E" model="mrp.workcenter">
|
|
||||||
<field name="name">Assembly E</field>
|
|
||||||
<field name="calendar_id" ref="resource.timesheet_group1" />
|
|
||||||
<field name="capacity_per_cycle">5</field>
|
|
||||||
<field name="time_cycle">1</field>
|
|
||||||
<field name="time_start">0.1</field>
|
|
||||||
<field name="time_stop">0.1</field>
|
|
||||||
<field name="time_efficiency">0.87</field>
|
|
||||||
<field name="product_id" ref="product.product_assembly" />
|
|
||||||
<field name="costs_hour">0.1</field>
|
|
||||||
<field name="costs_hour_account_id" ref="mrp.account_assembly_hours" />
|
|
||||||
<field name="costs_cycle">0.05</field>
|
|
||||||
<field name="costs_cycle_account_id" ref="mrp.account_assembly_cycle" />
|
|
||||||
</record>
|
|
||||||
<record id="mrp.mrp_workcenter_0" model="mrp.workcenter">
|
|
||||||
<field name="parent_id" ref="mrp_workcenter_top" />
|
|
||||||
</record>
|
|
||||||
</data>
|
|
||||||
</openerp>
|
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
# © 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
|
|
||||||
1
mrp_workcenter_hierarchical/models/__init__.py
Normal file
1
mrp_workcenter_hierarchical/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from . import mrp_workcenter
|
||||||
@@ -1,39 +1,41 @@
|
|||||||
# © 2016 Akretion (http://www.akretion.com)
|
# 2016 Akretion (http://www.akretion.com)
|
||||||
# David BEAL <david.beal@akretion.com>
|
# David BEAL <david.beal@akretion.com>
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from openerp import api, fields, models
|
from odoo import api, fields, models
|
||||||
|
|
||||||
|
|
||||||
class MrpWorkcenter(models.Model):
|
class MrpWorkcenter(models.Model):
|
||||||
_inherit = "mrp.workcenter"
|
_inherit = "mrp.workcenter"
|
||||||
_order = "parent_left"
|
_parent_name = "parent_id"
|
||||||
_parent_store = True
|
_parent_store = True
|
||||||
|
|
||||||
parent_id = fields.Many2one("mrp.workcenter", string="Parent")
|
parent_id = fields.Many2one(
|
||||||
child_ids = fields.One2many("mrp.workcenter", "parent_id", string="Children")
|
comodel_name="mrp.workcenter", string="Parent", index=True
|
||||||
|
)
|
||||||
|
parent_path = fields.Char(index=True)
|
||||||
|
child_ids = fields.One2many(
|
||||||
|
comodel_name="mrp.workcenter", inverse_name="parent_id", string="Children"
|
||||||
|
)
|
||||||
parent_level_1_id = fields.Many2one(
|
parent_level_1_id = fields.Many2one(
|
||||||
"mrp.workcenter",
|
comodel_name="mrp.workcenter",
|
||||||
compute="_compute_parent_level",
|
compute="_compute_parent_level",
|
||||||
string="Parent Level 1",
|
string="Parent Level 1",
|
||||||
store=True,
|
store=True,
|
||||||
)
|
)
|
||||||
parent_level_2_id = fields.Many2one(
|
parent_level_2_id = fields.Many2one(
|
||||||
"mrp.workcenter",
|
comodel_name="mrp.workcenter",
|
||||||
compute="_compute_parent_level",
|
compute="_compute_parent_level",
|
||||||
string="Parent Level 2",
|
string="Parent Level 2",
|
||||||
store=True,
|
store=True,
|
||||||
)
|
)
|
||||||
parent_level_3_id = fields.Many2one(
|
parent_level_3_id = fields.Many2one(
|
||||||
"mrp.workcenter",
|
comodel_name="mrp.workcenter",
|
||||||
compute="_compute_parent_level",
|
compute="_compute_parent_level",
|
||||||
string="Parent Level 3",
|
string="Parent Level 3",
|
||||||
store=True,
|
store=True,
|
||||||
)
|
)
|
||||||
parent_left = fields.Integer(select=True)
|
|
||||||
parent_right = fields.Integer(select=True)
|
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def _get_parent_ids(self):
|
def _get_parent_ids(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
if self.parent_id:
|
if self.parent_id:
|
||||||
@@ -43,7 +45,6 @@ class MrpWorkcenter(models.Model):
|
|||||||
ids = []
|
ids = []
|
||||||
return ids
|
return ids
|
||||||
|
|
||||||
@api.multi
|
|
||||||
@api.depends("parent_id.parent_id.parent_id", "child_ids")
|
@api.depends("parent_id.parent_id.parent_id", "child_ids")
|
||||||
def _compute_parent_level(self):
|
def _compute_parent_level(self):
|
||||||
def get_next_level(parent_ids, workcenter):
|
def get_next_level(parent_ids, workcenter):
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
To visualize features offered by this module, you need to:
|
Activate workcenters:
|
||||||
|
* Manufacturing > Configuration > Settings > Configuration
|
||||||
* go to Settings > Configuration > Manufacturing
|
* Check Work Orders and save
|
||||||
* in the section Manufacturing Order / Planning,
|
|
||||||
check "Manage routings and work orders" and Validate
|
|
||||||
|
|||||||
@@ -1,2 +1 @@
|
|||||||
|
Allow to define a parent workcenter to a workcenter
|
||||||
* Add the possibility to define a parent workcenter to a workcenter
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
To use this module, you need to go to:
|
* Go to Manufacturing > Configuration > Work Centers
|
||||||
|
* Set parent field on workcenters
|
||||||
|
|
||||||
* Manufacturing > Configuration > Workcenter Hierarchical
|
../static/src/img/img1.png
|
||||||
|
|||||||
@@ -367,10 +367,8 @@ ul.auto-toc {
|
|||||||
!! This file is generated by oca-gen-addon-readme !!
|
!! This file is generated by oca-gen-addon-readme !!
|
||||||
!! changes will be overwritten. !!
|
!! changes will be overwritten. !!
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/manufacture/tree/9.0/mrp_workcenter_hierarchical"><img alt="OCA/manufacture" src="https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/manufacture-9-0/manufacture-9-0-mrp_workcenter_hierarchical"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/129/9.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/manufacture/tree/14.0/mrp_workcenter_hierarchical"><img alt="OCA/manufacture" src="https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/manufacture-14-0/manufacture-14-0-mrp_workcenter_hierarchical"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/129/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||||
<ul class="simple">
|
<p>Allow to define a parent workcenter to a workcenter</p>
|
||||||
<li>Add the possibility to define a parent workcenter to a workcenter</li>
|
|
||||||
</ul>
|
|
||||||
<p><strong>Table of contents</strong></p>
|
<p><strong>Table of contents</strong></p>
|
||||||
<div class="contents local topic" id="contents">
|
<div class="contents local topic" id="contents">
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
@@ -387,22 +385,24 @@ ul.auto-toc {
|
|||||||
</div>
|
</div>
|
||||||
<div class="section" id="configuration">
|
<div class="section" id="configuration">
|
||||||
<h1><a class="toc-backref" href="#id1">Configuration</a></h1>
|
<h1><a class="toc-backref" href="#id1">Configuration</a></h1>
|
||||||
<p>To visualize features offered by this module, you need to:</p>
|
<dl class="docutils">
|
||||||
<blockquote>
|
<dt>Activate workcenters:</dt>
|
||||||
<ul class="simple">
|
<dd><ul class="first last simple">
|
||||||
<li>go to Settings > Configuration > Manufacturing</li>
|
<li>Manufacturing > Configuration > Settings > Configuration</li>
|
||||||
<li>in the section Manufacturing Order / Planning,
|
<li>Check Work Orders and save</li>
|
||||||
check “Manage routings and work orders” and Validate</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</blockquote>
|
</dd>
|
||||||
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="usage">
|
<div class="section" id="usage">
|
||||||
<h1><a class="toc-backref" href="#id2">Usage</a></h1>
|
<h1><a class="toc-backref" href="#id2">Usage</a></h1>
|
||||||
<p>To use this module, you need to go to:</p>
|
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li>Manufacturing > Configuration > Workcenter Hierarchical</li>
|
<li>Go to Manufacturing > Configuration > Work Centers</li>
|
||||||
|
<li>Set parent field on workcenters</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<blockquote>
|
||||||
|
../static/src/img/img1.png</blockquote>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="bug-tracker">
|
<div class="section" id="bug-tracker">
|
||||||
@@ -410,7 +410,7 @@ check “Manage routings and work orders” and Validate</li>
|
|||||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/manufacture/issues">GitHub Issues</a>.
|
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/manufacture/issues">GitHub Issues</a>.
|
||||||
In case of trouble, please check there if your issue has already been reported.
|
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
|
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||||
<a class="reference external" href="https://github.com/OCA/manufacture/issues/new?body=module:%20mrp_workcenter_hierarchical%0Aversion:%209.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
<a class="reference external" href="https://github.com/OCA/manufacture/issues/new?body=module:%20mrp_workcenter_hierarchical%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="credits">
|
<div class="section" id="credits">
|
||||||
@@ -437,7 +437,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
|||||||
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||||
mission is to support the collaborative development of Odoo features and
|
mission is to support the collaborative development of Odoo features and
|
||||||
promote its widespread use.</p>
|
promote its widespread use.</p>
|
||||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/manufacture/tree/9.0/mrp_workcenter_hierarchical">OCA/manufacture</a> project on GitHub.</p>
|
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/manufacture/tree/14.0/mrp_workcenter_hierarchical">OCA/manufacture</a> project on GitHub.</p>
|
||||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
BIN
mrp_workcenter_hierarchical/static/src/img/img1.png
Normal file
BIN
mrp_workcenter_hierarchical/static/src/img/img1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 64 KiB |
@@ -2,73 +2,17 @@
|
|||||||
# David BEAL <david.beal@akretion.com>
|
# David BEAL <david.beal@akretion.com>
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from openerp.tests.common import TransactionCase
|
from odoo.tests.common import TransactionCase
|
||||||
|
|
||||||
|
|
||||||
class ComputeParentLevel(TransactionCase):
|
class ComputeParentLevel(TransactionCase):
|
||||||
def test_compute_parent_level0(self):
|
def test_compute_low_level_workcenter(self):
|
||||||
workcenter = self.env["mrp.workcenter"].create(
|
workcenter = self.env["mrp.workcenter"].create({"name": "any"})
|
||||||
{
|
|
||||||
"name": "New Assembly",
|
|
||||||
"calendar_id": self.env.ref("resource.timesheet_group1").id,
|
|
||||||
"capacity_per_cycle": 5,
|
|
||||||
"time_cycle": 1,
|
|
||||||
"time_start": 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_cycle": 0.05,
|
|
||||||
"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.write({"parent_id": workcenter.id})
|
|
||||||
self.assertEqual(workcenter.parent_level_1_id, workcenter)
|
|
||||||
|
|
||||||
def test_compute_parent_level1(self):
|
def get_record(string):
|
||||||
workcenter_child = self.env.ref("mrp_workcenter_hierarchical.mrp_workcenter_E")
|
return self.env.ref("mrp_workcenter_hierarchical.%s" % string)
|
||||||
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.write({"parent_id": get_record("workc_12").id})
|
||||||
workcenter_child = self.env.ref("mrp_workcenter_hierarchical.mrp_workcenter_A")
|
assert workcenter.parent_level_3_id == get_record("workc_123")
|
||||||
workcenter_parent1 = self.env.ref(
|
assert workcenter.parent_level_2_id == get_record("workc_1234")
|
||||||
"mrp_workcenter_hierarchical.mrp_workcenter_top"
|
assert workcenter.parent_level_1_id == get_record("workc_12345")
|
||||||
)
|
|
||||||
workcenter_parent2 = self.env.ref("mrp.mrp_workcenter_0")
|
|
||||||
workcenter_child.write({"parent_id": workcenter_parent2.id})
|
|
||||||
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.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)
|
|
||||||
|
|
||||||
def test_compute_parent_level3_bis(self):
|
|
||||||
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)
|
|
||||||
|
|||||||
@@ -1,44 +1,54 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<openerp>
|
<odoo>
|
||||||
<data>
|
<record id="view_mrp_workcenter_search" model="ir.ui.view">
|
||||||
<!--Workcenters-->
|
<field name="model">mrp.workcenter</field>
|
||||||
<record id="view_mrp_workcenter_search" model="ir.ui.view">
|
<field name="inherit_id" ref="mrp.view_mrp_workcenter_search" />
|
||||||
<field name="model">mrp.workcenter</field>
|
<field name="arch" type="xml">
|
||||||
<field name="inherit_id" ref="mrp.view_mrp_workcenter_search" />
|
<xpath expr="//group/filter" position="before">
|
||||||
<field name="arch" type="xml">
|
<filter
|
||||||
<xpath expr="//group/filter" position="before">
|
string="Parent Level 1"
|
||||||
<filter
|
domain="[]"
|
||||||
string="Parent Level 1"
|
name="group_by_level_1"
|
||||||
domain="[]"
|
context="{'group_by':'parent_level_1_id'}"
|
||||||
name="group_by_level_1"
|
/>
|
||||||
context="{'group_by':'parent_level_1_id'}"
|
<filter
|
||||||
/>
|
string="Parent Level 2"
|
||||||
<filter
|
domain="[]"
|
||||||
string="Parent Level 2"
|
name="group_by_level_2"
|
||||||
domain="[]"
|
context="{'group_by':'parent_level_2_id'}"
|
||||||
name="group_by_level_2"
|
/>
|
||||||
context="{'group_by':'parent_level_2_id'}"
|
<filter
|
||||||
/>
|
string="Parent Level 3"
|
||||||
<filter
|
domain="[]"
|
||||||
string="Parent Level 3"
|
name="group_by_level_3"
|
||||||
domain="[]"
|
context="{'group_by':'parent_level_3_id'}"
|
||||||
name="group_by_level_3"
|
/>
|
||||||
context="{'group_by':'parent_level_3_id'}"
|
</xpath>
|
||||||
/>
|
</field>
|
||||||
</xpath>
|
</record>
|
||||||
|
|
||||||
|
<record id="mrp_workcenter_view" model="ir.ui.view">
|
||||||
|
<field name="model">mrp.workcenter</field>
|
||||||
|
<field name="inherit_id" ref="mrp.mrp_workcenter_view" />
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="name" position="after">
|
||||||
|
<field name="parent_id" />
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</field>
|
||||||
<record id="mrp_workcenter_view" model="ir.ui.view">
|
</record>
|
||||||
<field name="model">mrp.workcenter</field>
|
|
||||||
<field name="inherit_id" ref="mrp.mrp_workcenter_view" />
|
<record id="mrp_workcenter_tree_view" model="ir.ui.view">
|
||||||
<field name="arch" type="xml">
|
<field name="model">mrp.workcenter</field>
|
||||||
<field name="active" position="after">
|
<field name="inherit_id" ref="mrp.mrp_workcenter_tree_view" />
|
||||||
<field name="parent_id" />
|
<field name="arch" type="xml">
|
||||||
</field>
|
<field name="company_id" position="before">
|
||||||
|
<field name="parent_id" />
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</field>
|
||||||
<record id="mrp.mrp_workcenter_action" model="ir.actions.act_window">
|
</record>
|
||||||
<field name="context">{'search_default_group_by_level_1': 1}</field>
|
|
||||||
</record>
|
<record id="mrp.mrp_workcenter_action" model="ir.actions.act_window">
|
||||||
</data>
|
<field name="context">{'search_default_group_by_level_1': 1}</field>
|
||||||
</openerp>
|
</record>
|
||||||
|
|
||||||
|
</odoo>
|
||||||
|
|||||||
Reference in New Issue
Block a user