[MIG] procurement_auto_create_group: Migration to 12.0

This commit is contained in:
mreficent
2019-07-03 14:21:56 +02:00
committed by davidborromeo
parent cc535f804e
commit 5c815ae3a7
12 changed files with 48 additions and 43 deletions

View File

@@ -14,26 +14,26 @@ Procurement Auto Create Group
: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%2Fstock--logistics--warehouse-lightgray.png?logo=github .. |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 :alt: OCA/stock-logistics-warehouse
.. |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/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 :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/153/11.0 :target: https://runbot.odoo-community.org/runbot/153/12.0
:alt: Try me on Runbot :alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
This module allows the system to propose automatically new procurement groups 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 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. other groups in stock transfers.
The stock transfers resulting from the execution of these procurements will The stock transfers resulting from the procurement run will
only contain stock moves created from that procurement. only contain stock moves created in that run.
**Table of contents** **Table of contents**
@@ -55,7 +55,7 @@ Configuration
Usage 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. with the option 'Auto-create Procurement Group' set.
#. When the procurement rule is executed, a procurement group with #. When the procurement rule is executed, a procurement group with
format 'PG/000001' will be created. format 'PG/000001' will be created.
@@ -66,7 +66,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-warehouse/issues>`_. Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-warehouse/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/stock-logistics-warehouse/issues/new?body=module:%20procurement_auto_create_group%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. `feedback <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20procurement_auto_create_group%0Aversion:%2012.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.
@@ -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 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/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/11.0/procurement_auto_create_group>`_ project on GitHub. This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/12.0/procurement_auto_create_group>`_ 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.

View File

@@ -1 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import models from . import models

View File

@@ -1,16 +1,16 @@
# Copyright 2017 Eficent Business and IT Consulting Services, S.L. # 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", "name": "Procurement Auto Create Group",
"version": "11.0.1.0.0", "version": "12.0.1.0.0",
"development_status": "Production/Stable", "development_status": "Production/Stable",
"license": "AGPL-3", "license": "AGPL-3",
"summary": "Allows to configure the system to propose automatically new " "summary": "Allows to configure the system to propose automatically new "
"procurement groups in procurement orders.", "procurement groups during the procurement run.",
"author": "Eficent," "author": "Eficent,"
"Odoo Community Association (OCA)", "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-warehouse", "website": "https://github.com/OCA/stock-logistics-warehouse",
"category": "Warehouse Management", "category": "Warehouse",
"depends": [ "depends": [
"stock", "stock",
], ],

View File

@@ -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 from . import procurement_group

View File

@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Eficent Business and IT Consulting Services, S.L. # 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 import api, models, _
from odoo.exceptions import UserError from odoo.exceptions import UserError
@@ -26,7 +25,7 @@ class ProcurementGroup(models.Model):
name = self.env['ir.sequence'].next_by_code( name = self.env['ir.sequence'].next_by_code(
'procurement.group') or False 'procurement.group') or False
if not name: if not name:
raise UserError(_('No sequence defined for procurement group')) raise UserError(_('No sequence defined for procurement group.'))
return { return {
'name': name 'name': name,
} }

View File

@@ -1,12 +1,11 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Eficent Business and IT Consulting Services, S.L. # 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 from odoo import api, fields, models
class ProcurementRule(models.Model): class StockRule(models.Model):
_inherit = 'procurement.rule' _inherit = 'stock.rule'
auto_create_group = fields.Boolean(string='Auto-create Procurement Group') auto_create_group = fields.Boolean(string='Auto-create Procurement Group')

View File

@@ -1,9 +1,9 @@
This module allows the system to propose automatically new procurement groups 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 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. other groups in stock transfers.
The stock transfers resulting from the execution of these procurements will The stock transfers resulting from the procurement run will
only contain stock moves created from that procurement. only contain stock moves created in that run.

View File

@@ -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. with the option 'Auto-create Procurement Group' set.
#. When the procurement rule is executed, a procurement group with #. When the procurement rule is executed, a procurement group with
format 'PG/000001' will be created. format 'PG/000001' will be created.

View File

@@ -367,7 +367,7 @@ 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="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.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/stock-logistics-warehouse/tree/11.0/procurement_auto_create_group"><img alt="OCA/stock-logistics-warehouse" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-11-0/stock-logistics-warehouse-11-0-procurement_auto_create_group"><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/153/11.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="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.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/stock-logistics-warehouse/tree/12.0/procurement_auto_create_group"><img alt="OCA/stock-logistics-warehouse" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-procurement_auto_create_group"><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/153/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module allows the system to propose automatically new procurement groups <p>This module allows the system to propose automatically new procurement groups
when procuring.</p> when procuring.</p>
<p>This capability is important when you want to make sure that all the stock <p>This capability is important when you want to make sure that all the stock
@@ -416,7 +416,7 @@ format PG/000001 will be created.</li>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues">GitHub Issues</a>. <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/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/stock-logistics-warehouse/issues/new?body=module:%20procurement_auto_create_group%0Aversion:%2011.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/stock-logistics-warehouse/issues/new?body=module:%20procurement_auto_create_group%0Aversion:%2012.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">
@@ -441,7 +441,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/stock-logistics-warehouse/tree/11.0/procurement_auto_create_group">OCA/stock-logistics-warehouse</a> project on GitHub.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/12.0/procurement_auto_create_group">OCA/stock-logistics-warehouse</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>

View File

@@ -1 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import test_auto_create from . import test_auto_create

View File

@@ -1,14 +1,15 @@
# © 2017 Eficent Business and IT Consulting Services S.L. # 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.tests.common import TransactionCase from odoo.tests.common import TransactionCase
class TestProcurementAutoCreateGroup(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.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.route_obj = self.env['stock.location.route']
self.move_obj = self.env['stock.move'] self.move_obj = self.env['stock.move']
self.product_obj = self.env['product.product'] self.product_obj = self.env['product.product']
@@ -26,7 +27,7 @@ class TestProcurementAutoCreateGroup(TransactionCase):
'name': 'rule with autocreate', 'name': 'rule with autocreate',
'route_id': route_auto.id, 'route_id': route_auto.id,
'auto_create_group': True, 'auto_create_group': True,
'action': 'move', 'action': 'pull_push',
'warehouse_id': self.warehouse.id, 'warehouse_id': self.warehouse.id,
'picking_type_id': picking_type_id, 'picking_type_id': picking_type_id,
'location_id': self.location.id, 'location_id': self.location.id,
@@ -39,7 +40,7 @@ class TestProcurementAutoCreateGroup(TransactionCase):
'name': 'rule with no autocreate', 'name': 'rule with no autocreate',
'route_id': route_no_auto.id, 'route_id': route_no_auto.id,
'auto_create_group': False, 'auto_create_group': False,
'action': 'move', 'action': 'pull_push',
'warehouse_id': self.warehouse.id, 'warehouse_id': self.warehouse.id,
'picking_type_id': picking_type_id, 'picking_type_id': picking_type_id,
'location_id': self.location.id, 'location_id': self.location.id,
@@ -87,7 +88,7 @@ class TestProcurementAutoCreateGroup(TransactionCase):
self.assertTrue(move.group_id, "Procurement Group not assigned.") self.assertTrue(move.group_id, "Procurement Group not assigned.")
def test_03_onchange_method(self): def test_03_onchange_method(self):
"""Test onchange method for procurement rule.""" """Test onchange method for stock rule."""
proc_rule = self.rule_1 proc_rule = self.rule_1
self.assertTrue(proc_rule.auto_create_group) self.assertTrue(proc_rule.auto_create_group)
proc_rule.write({'group_propagation_option': 'none'}) proc_rule.write({'group_propagation_option': 'none'})

View File

@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<record model="ir.ui.view" id="view_procurement_rule_form"> <record model="ir.ui.view" id="view_stock_rule_form">
<field name="name">procurement.rule.form - procurement_auto_create_group</field> <field name="name">stock.rule.form - procurement_auto_create_group</field>
<field name="model">procurement.rule</field> <field name="model">stock.rule</field>
<field name="inherit_id" ref="stock.view_procurement_rule_form"/> <field name="inherit_id" ref="stock.view_stock_rule_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="group_propagation_option" position="after"> <field name="group_propagation_option" position="after">
<field name="auto_create_group" <field name="auto_create_group"