diff --git a/mrp_operations_start_without_material/README.rst b/mrp_operations_start_without_material/README.rst index fbb4a1041..c7455a67f 100644 --- a/mrp_operations_start_without_material/README.rst +++ b/mrp_operations_start_without_material/README.rst @@ -1,15 +1,84 @@ .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :alt: License: AGPL-3 + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +===================================== MRP Operations start without material ===================================== This module allows to start WO without having the material assigned. +Installation +============ + +To install this module, you need to: + +1. Clone the branch 8.0 of the repository https://github.com/OCA/manufacture +2. Add the path to this repository in your configuration (addons-path) +3. Update the module list +4. Go to menu *Setting -> Modules -> Local Modules* +5. Search For *MRP Operations start without material* +6. Install the module + +Usage +===== + +To configure operation can be started without material, you need to: + +1. Go to menu *Manufacture -> Configuration -> Routings* +2. Open/create routing data +3. Open/create one of the routing operation +4. Activate *Init without material* option + +After configuration, everytime that operation create, user can start work order without +material assign. + +To start work order without material assigned, you need to: + +1. Go to menu *Manufacture -> Manufacture -> Workorder* +2. Open/create work order +3. Activate *Init without material* option + +.. 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/8.0 + + +Bug Tracker +=========== + +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. + Credits ======= +Images +------ + +* Odoo Community Association: `Icon `_. + Contributors ------------ + * Daniel Campos -* Pedro M. Baeza +* Pedro M. Baeza * Ana Juaristi +* OpenSynergy Indonesia + +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. diff --git a/mrp_operations_start_without_material/__init__.py b/mrp_operations_start_without_material/__init__.py index ad6c8186c..a17731ef5 100644 --- a/mrp_operations_start_without_material/__init__.py +++ b/mrp_operations_start_without_material/__init__.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- -############################################################################## -# For copyright and license notices, see __openerp__.py file in root directory -############################################################################## +# © 2015 Daniel Campos +# © 2015 Pedro M. Baeza +# © 2015 Ana Juaristi +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import models diff --git a/mrp_operations_start_without_material/__openerp__.py b/mrp_operations_start_without_material/__openerp__.py index 1b89d1b98..1f5874ed7 100644 --- a/mrp_operations_start_without_material/__openerp__.py +++ b/mrp_operations_start_without_material/__openerp__.py @@ -1,30 +1,18 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# 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 General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see http://www.gnu.org/licenses/. -# -############################################################################## +# © 2015 Daniel Campos +# © 2015 Pedro M. Baeza +# © 2015 Ana Juaristi +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { - 'name': 'MRP Operations start without material', - 'version': '8.0.1.0.1', - 'author': 'OdooMRP team', - 'contributors': ["Daniel Campos ", - "Pedro M. Baeza ", - "Ana Juaristi "], - 'website': 'http://www.odoomrp.com', - "depends": ['mrp_operations_extension'], + "name": "MRP Operations start without material", + "version": "8.0.1.0.1", + "author": "Tecnativa," + "AvanzOSC," + "OdooMRP Team," + "Odoo Community Association (OCA)", + "website": "http://www.odoomrp.com", + "depends": ["mrp_operations_extension"], "category": "Manufacturing", "data": ['views/mrp_routing_view.xml', 'views/mrp_production_view.xml' diff --git a/mrp_operations_start_without_material/models/__init__.py b/mrp_operations_start_without_material/models/__init__.py index 59e4d535f..354b09fdc 100644 --- a/mrp_operations_start_without_material/models/__init__.py +++ b/mrp_operations_start_without_material/models/__init__.py @@ -1,7 +1,8 @@ # -*- coding: utf-8 -*- -############################################################################## -# For copyright and license notices, see __openerp__.py file in root directory -############################################################################## +# © 2015 Daniel Campos +# © 2015 Pedro M. Baeza +# © 2015 Ana Juaristi +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import mrp_routing from . import mrp_production diff --git a/mrp_operations_start_without_material/models/mrp_bom.py b/mrp_operations_start_without_material/models/mrp_bom.py index 13c2ac01d..54aace5cc 100644 --- a/mrp_operations_start_without_material/models/mrp_bom.py +++ b/mrp_operations_start_without_material/models/mrp_bom.py @@ -1,7 +1,8 @@ # -*- coding: utf-8 -*- -############################################################################## -# For copyright and license notices, see __openerp__.py file in root directory -############################################################################## +# © 2015 Daniel Campos +# © 2015 Pedro M. Baeza +# © 2015 Ana Juaristi +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import models, api diff --git a/mrp_operations_start_without_material/models/mrp_production.py b/mrp_operations_start_without_material/models/mrp_production.py index 825d79e91..14c7055b1 100644 --- a/mrp_operations_start_without_material/models/mrp_production.py +++ b/mrp_operations_start_without_material/models/mrp_production.py @@ -1,7 +1,8 @@ # -*- coding: utf-8 -*- -############################################################################## -# For copyright and license notices, see __openerp__.py file in root directory -############################################################################## +# © 2015 Daniel Campos +# © 2015 Pedro M. Baeza +# © 2015 Ana Juaristi +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import models, fields diff --git a/mrp_operations_start_without_material/models/mrp_routing.py b/mrp_operations_start_without_material/models/mrp_routing.py index 699457532..298067a08 100644 --- a/mrp_operations_start_without_material/models/mrp_routing.py +++ b/mrp_operations_start_without_material/models/mrp_routing.py @@ -1,7 +1,8 @@ # -*- coding: utf-8 -*- -############################################################################## -# For copyright and license notices, see __openerp__.py file in root directory -############################################################################## +# © 2015 Daniel Campos +# © 2015 Pedro M. Baeza +# © 2015 Ana Juaristi +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import models, fields diff --git a/mrp_operations_start_without_material/static/description/icon.png b/mrp_operations_start_without_material/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/mrp_operations_start_without_material/static/description/icon.png differ diff --git a/mrp_operations_start_without_material/tests/__init__.py b/mrp_operations_start_without_material/tests/__init__.py new file mode 100644 index 000000000..22b50e4a3 --- /dev/null +++ b/mrp_operations_start_without_material/tests/__init__.py @@ -0,0 +1,8 @@ +# -*- coding: utf-8 -*- +# © 2015 Daniel Campos +# © 2015 Pedro M. Baeza +# © 2015 Ana Juaristi +# © 2016 OpenSynergy Indonesia +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import test_mrp_operation diff --git a/mrp_operations_start_without_material/tests/test_mrp_operation.py b/mrp_operations_start_without_material/tests/test_mrp_operation.py new file mode 100644 index 000000000..4fe48c30f --- /dev/null +++ b/mrp_operations_start_without_material/tests/test_mrp_operation.py @@ -0,0 +1,81 @@ +# -*- coding: utf-8 -*- +# © 2015 Daniel Campos +# © 2015 Pedro M. Baeza +# © 2015 Ana Juaristi +# © 2016 OpenSynergy Indonesia +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openerp.tests.common import TransactionCase +from datetime import datetime +from openerp import exceptions + + +class TestOperation(TransactionCase): + + def setUp(self, *args, **kwargs): + result = super(TestOperation, self).setUp(*args, **kwargs) + + self.obj_production = self.env["mrp.production"] + + self.location = self.env.ref("stock.stock_location_14") + self.bom = self.env.ref("mrp.mrp_bom_11") + self.routing = self.env.ref("mrp.mrp_routing_1") + self.product = self.env.ref("product.product_product_4b") + self.routing_wc = self.env.ref("mrp.mrp_routing_workcenter_4") + # self.routning_wc.write({"init_without_material": True}) + + self.prod_data = { + "date_planned": datetime.now().strftime("%Y-%m-%d %H:%M:%S"), + "location_dest_id": self.location.id, + "location_src_id": self.location.id, + "product_id": self.product.id, + "product_qty": 1.0, + "product_uom": self.product.uom_id.id, + "bom_id": self.bom.id, + "routing_id": self.routing.id, + } + + return result + + def test_1(self): + production = self.obj_production.create(self.prod_data) + production.signal_workflow("button_confirm") + + # MO should be in Confirm state + self.assertEqual( + production.state, + "confirmed") + + # MO should have equal operation as routing workcenter + self.assertEqual( + len(production.workcenter_lines), + len(self.routing.workcenter_lines)) + + wo = production.workcenter_lines[0] + + # WO can not start without material + with self.assertRaises(exceptions.Warning): + wo.signal_workflow("button_start_working") + + def test_2(self): + self.routing.workcenter_lines.write({ + "init_without_material": True}) + production = self.obj_production.create(self.prod_data) + production.signal_workflow("button_confirm") + # MO should be in Confirm state + self.assertEqual( + production.state, + "confirmed") + + # MO should have equal operation as routing workcenter + self.assertEqual( + len(production.workcenter_lines), + len(self.routing.workcenter_lines)) + + wo = production.workcenter_lines[0] + wo.signal_workflow("button_start_working") + + # WO should start + self.assertEqual( + wo.state, + "startworking")