From 5c815ae3a76281a863d10d64bfc1f7902b89559f Mon Sep 17 00:00:00 2001 From: mreficent Date: Wed, 3 Jul 2019 14:21:56 +0200 Subject: [PATCH] [MIG] procurement_auto_create_group: Migration to 12.0 --- procurement_auto_create_group/README.rst | 20 +++++++++---------- procurement_auto_create_group/__init__.py | 2 ++ procurement_auto_create_group/__manifest__.py | 8 ++++---- .../models/__init__.py | 4 +++- .../models/procurement_group.py | 7 +++---- .../{procurement_rule.py => stock_rule.py} | 7 +++---- .../readme/DESCRIPTION.rst | 8 ++++---- .../readme/USAGE.rst | 2 +- .../static/description/index.html | 6 +++--- .../tests/__init__.py | 2 ++ .../tests/test_auto_create.py | 17 ++++++++-------- .../views/procurement_view.xml | 8 ++++---- 12 files changed, 48 insertions(+), 43 deletions(-) rename procurement_auto_create_group/models/{procurement_rule.py => stock_rule.py} (70%) diff --git a/procurement_auto_create_group/README.rst b/procurement_auto_create_group/README.rst index e47649cdb..d9422ff9c 100644 --- a/procurement_auto_create_group/README.rst +++ b/procurement_auto_create_group/README.rst @@ -14,26 +14,26 @@ Procurement Auto Create Group :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github - :target: https://github.com/OCA/stock-logistics-warehouse/tree/11.0/procurement_auto_create_group + :target: https://github.com/OCA/stock-logistics-warehouse/tree/12.0/procurement_auto_create_group :alt: OCA/stock-logistics-warehouse .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-11-0/stock-logistics-warehouse-11-0-procurement_auto_create_group + :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-procurement_auto_create_group :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/153/11.0 + :target: https://runbot.odoo-community.org/runbot/153/12.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| This module allows the system to propose automatically new procurement groups -when procuring. +during the procurement run. This capability is important when you want to make sure that all the stock -moves resulting from this procurement will never be mixed with moves from +moves resulting from a procurement run will never be mixed with moves from other groups in stock transfers. -The stock transfers resulting from the execution of these procurements will -only contain stock moves created from that procurement. +The stock transfers resulting from the procurement run will +only contain stock moves created in that run. **Table of contents** @@ -55,7 +55,7 @@ Configuration Usage ===== -#. Create a new procurement and make sure that it determines a pull rule +#. Run a new procurement and make sure that it determines a pull rule with the option 'Auto-create Procurement Group' set. #. When the procurement rule is executed, a procurement group with format 'PG/000001' will be created. @@ -66,7 +66,7 @@ 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -97,6 +97,6 @@ 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. -This module is part of the `OCA/stock-logistics-warehouse `_ project on GitHub. +This module is part of the `OCA/stock-logistics-warehouse `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/procurement_auto_create_group/__init__.py b/procurement_auto_create_group/__init__.py index 0650744f6..4b76c7b2d 100644 --- a/procurement_auto_create_group/__init__.py +++ b/procurement_auto_create_group/__init__.py @@ -1 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + from . import models diff --git a/procurement_auto_create_group/__manifest__.py b/procurement_auto_create_group/__manifest__.py index 15e878f3d..6e4c49c07 100644 --- a/procurement_auto_create_group/__manifest__.py +++ b/procurement_auto_create_group/__manifest__.py @@ -1,16 +1,16 @@ # Copyright 2017 Eficent Business and IT Consulting Services, S.L. -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "Procurement Auto Create Group", - "version": "11.0.1.0.0", + "version": "12.0.1.0.0", "development_status": "Production/Stable", "license": "AGPL-3", "summary": "Allows to configure the system to propose automatically new " - "procurement groups in procurement orders.", + "procurement groups during the procurement run.", "author": "Eficent," "Odoo Community Association (OCA)", "website": "https://github.com/OCA/stock-logistics-warehouse", - "category": "Warehouse Management", + "category": "Warehouse", "depends": [ "stock", ], diff --git a/procurement_auto_create_group/models/__init__.py b/procurement_auto_create_group/models/__init__.py index d470e2b5f..e2b84e34a 100644 --- a/procurement_auto_create_group/models/__init__.py +++ b/procurement_auto_create_group/models/__init__.py @@ -1,2 +1,4 @@ -from . import procurement_rule +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import stock_rule from . import procurement_group diff --git a/procurement_auto_create_group/models/procurement_group.py b/procurement_auto_create_group/models/procurement_group.py index 4491208b1..0034edf8b 100644 --- a/procurement_auto_create_group/models/procurement_group.py +++ b/procurement_auto_create_group/models/procurement_group.py @@ -1,6 +1,5 @@ -# -*- coding: utf-8 -*- # Copyright 2017 Eficent Business and IT Consulting Services, S.L. -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import api, models, _ from odoo.exceptions import UserError @@ -26,7 +25,7 @@ class ProcurementGroup(models.Model): name = self.env['ir.sequence'].next_by_code( 'procurement.group') or False if not name: - raise UserError(_('No sequence defined for procurement group')) + raise UserError(_('No sequence defined for procurement group.')) return { - 'name': name + 'name': name, } diff --git a/procurement_auto_create_group/models/procurement_rule.py b/procurement_auto_create_group/models/stock_rule.py similarity index 70% rename from procurement_auto_create_group/models/procurement_rule.py rename to procurement_auto_create_group/models/stock_rule.py index 3a38a899d..d92c20fc6 100644 --- a/procurement_auto_create_group/models/procurement_rule.py +++ b/procurement_auto_create_group/models/stock_rule.py @@ -1,12 +1,11 @@ -# -*- coding: utf-8 -*- # Copyright 2017 Eficent Business and IT Consulting Services, S.L. -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import api, fields, models -class ProcurementRule(models.Model): - _inherit = 'procurement.rule' +class StockRule(models.Model): + _inherit = 'stock.rule' auto_create_group = fields.Boolean(string='Auto-create Procurement Group') diff --git a/procurement_auto_create_group/readme/DESCRIPTION.rst b/procurement_auto_create_group/readme/DESCRIPTION.rst index 897e9271c..44f626612 100644 --- a/procurement_auto_create_group/readme/DESCRIPTION.rst +++ b/procurement_auto_create_group/readme/DESCRIPTION.rst @@ -1,9 +1,9 @@ This module allows the system to propose automatically new procurement groups -when procuring. +during the procurement run. This capability is important when you want to make sure that all the stock -moves resulting from this procurement will never be mixed with moves from +moves resulting from a procurement run will never be mixed with moves from other groups in stock transfers. -The stock transfers resulting from the execution of these procurements will -only contain stock moves created from that procurement. +The stock transfers resulting from the procurement run will +only contain stock moves created in that run. diff --git a/procurement_auto_create_group/readme/USAGE.rst b/procurement_auto_create_group/readme/USAGE.rst index 37c8da1e5..e21466128 100644 --- a/procurement_auto_create_group/readme/USAGE.rst +++ b/procurement_auto_create_group/readme/USAGE.rst @@ -1,4 +1,4 @@ -#. Create a new procurement and make sure that it determines a pull rule +#. Run a new procurement and make sure that it determines a pull rule with the option 'Auto-create Procurement Group' set. #. When the procurement rule is executed, a procurement group with format 'PG/000001' will be created. diff --git a/procurement_auto_create_group/static/description/index.html b/procurement_auto_create_group/static/description/index.html index 838dd2737..3c3f15066 100644 --- a/procurement_auto_create_group/static/description/index.html +++ b/procurement_auto_create_group/static/description/index.html @@ -367,7 +367,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Production/Stable License: AGPL-3 OCA/stock-logistics-warehouse Translate me on Weblate Try me on Runbot

+

Production/Stable License: AGPL-3 OCA/stock-logistics-warehouse Translate me on Weblate Try me on Runbot

This module allows the system to propose automatically new procurement groups when procuring.

This capability is important when you want to make sure that all the stock @@ -416,7 +416,7 @@ format ‘PG/000001’ will be created.

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.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -441,7 +441,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

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.

-

This module is part of the OCA/stock-logistics-warehouse project on GitHub.

+

This module is part of the OCA/stock-logistics-warehouse project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/procurement_auto_create_group/tests/__init__.py b/procurement_auto_create_group/tests/__init__.py index eb02eb3bb..682e89fd7 100644 --- a/procurement_auto_create_group/tests/__init__.py +++ b/procurement_auto_create_group/tests/__init__.py @@ -1 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + from . import test_auto_create diff --git a/procurement_auto_create_group/tests/test_auto_create.py b/procurement_auto_create_group/tests/test_auto_create.py index 33e390266..1c25b171d 100644 --- a/procurement_auto_create_group/tests/test_auto_create.py +++ b/procurement_auto_create_group/tests/test_auto_create.py @@ -1,14 +1,15 @@ -# © 2017 Eficent Business and IT Consulting Services S.L. -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# Copyright 2017 Eficent Business and IT Consulting Services S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo.tests.common import TransactionCase class TestProcurementAutoCreateGroup(TransactionCase): - def setUp(self, *args, **kwargs): - super(TestProcurementAutoCreateGroup, self).setUp(*args, **kwargs) + + def setUp(self): + super(TestProcurementAutoCreateGroup, self).setUp() self.group_obj = self.env['procurement.group'] - self.rule_obj = self.env['procurement.rule'] + self.rule_obj = self.env['stock.rule'] self.route_obj = self.env['stock.location.route'] self.move_obj = self.env['stock.move'] self.product_obj = self.env['product.product'] @@ -26,7 +27,7 @@ class TestProcurementAutoCreateGroup(TransactionCase): 'name': 'rule with autocreate', 'route_id': route_auto.id, 'auto_create_group': True, - 'action': 'move', + 'action': 'pull_push', 'warehouse_id': self.warehouse.id, 'picking_type_id': picking_type_id, 'location_id': self.location.id, @@ -39,7 +40,7 @@ class TestProcurementAutoCreateGroup(TransactionCase): 'name': 'rule with no autocreate', 'route_id': route_no_auto.id, 'auto_create_group': False, - 'action': 'move', + 'action': 'pull_push', 'warehouse_id': self.warehouse.id, 'picking_type_id': picking_type_id, 'location_id': self.location.id, @@ -87,7 +88,7 @@ class TestProcurementAutoCreateGroup(TransactionCase): self.assertTrue(move.group_id, "Procurement Group not assigned.") def test_03_onchange_method(self): - """Test onchange method for procurement rule.""" + """Test onchange method for stock rule.""" proc_rule = self.rule_1 self.assertTrue(proc_rule.auto_create_group) proc_rule.write({'group_propagation_option': 'none'}) diff --git a/procurement_auto_create_group/views/procurement_view.xml b/procurement_auto_create_group/views/procurement_view.xml index 2eeaa26ac..e524a47d2 100644 --- a/procurement_auto_create_group/views/procurement_view.xml +++ b/procurement_auto_create_group/views/procurement_view.xml @@ -1,10 +1,10 @@ - - procurement.rule.form - procurement_auto_create_group - procurement.rule - + + stock.rule.form - procurement_auto_create_group + stock.rule +