[14.0][MIG] stock_request_submit (Version 13.0 to 14.0)

[MIG] Prettier

[MIG] Rename uninstall_hook.py to hooks.py

[MIG] Added Uninstall Hook Test

[IMP] Black
This commit is contained in:
Patrick Wilson
2021-05-13 15:52:37 -06:00
parent 9f92167b65
commit e69e85f57d
9 changed files with 41 additions and 27 deletions

View File

@@ -14,13 +14,13 @@ Stock Request Submit
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-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/13.0/stock_request_submit
:target: https://github.com/OCA/stock-logistics-warehouse/tree/14.0/stock_request_submit
: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-13-0/stock-logistics-warehouse-13-0-stock_request_submit
: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/13.0
:target: https://runbot.odoo-community.org/runbot/153/14.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -41,7 +41,7 @@ Bug Tracker
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.
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:%20stock_request_submit%0Aversion:%2013.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:%20stock_request_submit%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.
@@ -77,6 +77,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 <https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_request_submit>`_ project on GitHub.
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/14.0/stock_request_submit>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -1,2 +1,2 @@
from . import models
from .uninstall_hook import uninstall_hook
from .hooks import uninstall_hook

View File

@@ -5,9 +5,9 @@
{
"name": "Stock Request Submit",
"summary": "Add submit state on Stock Requests",
"version": "13.0.1.0.0",
"version": "14.0.1.0.0",
"license": "LGPL-3",
"website": "https://github.com/stock-logistics-warehouse",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"author": "Open Source Integrators, Odoo Community Association (OCA)",
"category": "Warehouse Management",
"depends": ["stock_request"],

View File

@@ -1,6 +1,7 @@
# Copyright 2019 Open Source Integrators
# Copyright 2019-2020 ForgeFlow S.L. (https://www.forgeflow.com)
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import fields, models

View File

@@ -1,6 +1,7 @@
# Copyright 2019 Open Source Integrators
# Copyright 2019-2020 ForgeFlow S.L. (https://www.forgeflow.com)
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import models

View File

@@ -1,15 +1,16 @@
# Copyright 2017-2020 ForgeFlow S.L. (https://www.forgeflow.com)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0).
from odoo import fields
from odoo.addons.stock_request.tests import test_stock_request
from ..hooks import uninstall_hook
class TestStockRequestSubmit(test_stock_request.TestStockRequest):
def setUp(self):
super().setUp()
def test_stock_request_submit(self):
expected_date = fields.Datetime.now()
vals = {
"company_id": self.main_company.id,
@@ -32,15 +33,28 @@ class TestStockRequestSubmit(test_stock_request.TestStockRequest):
)
],
}
self.order = self.request_order.with_user(self.stock_request_user).create(vals)
self.stock_request = self.order.stock_request_ids
order = self.request_order.with_user(self.stock_request_user).create(vals)
stock_request = order.stock_request_ids
def test_stock_request_submit(self):
self.product.route_ids = [(6, 0, self.route.ids)]
order.action_submit()
self.assertEqual(order.state, "submitted")
self.assertEqual(stock_request.state, "submitted")
order.action_confirm()
self.assertEqual(order.state, "open")
self.assertEqual(stock_request.state, "open")
self.order.action_submit()
self.assertEqual(self.order.state, "submitted")
self.assertEqual(self.stock_request.state, "submitted")
self.order.action_confirm()
self.assertEqual(self.order.state, "open")
self.assertEqual(self.stock_request.state, "open")
def test_uninstall_hook(self):
# Check state before uninstall
self.product.route_ids = [(6, 0, self.route.ids)]
self.order.action_submit()
self.assertEqual(self.order.state, "submitted")
self.assertEqual(self.stock_request.state, "submitted")
# Uninstall this module
uninstall_hook(self.cr, self.registry)
# Check state after uninstall
self.assertEqual(self.order.state, "draft")
self.assertEqual(self.stock_request.state, "draft")

View File

@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Copyright 2019 Open Source Integrators
Copyright 2019-2020 ForgeFlow S.L. (https://www.forgeflow.com)
License LGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<!-- Copyright 2019 Open Source Integrators
Copyright 2019-2020 ForgeFlow S.L. (https://www.forgeflow.com)
License LGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<record model="ir.ui.view" id="stock_request_order_form">
<field name="name">stock.request.order.form</field>
<field name="model">stock.request.order</field>

View File

@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Copyright 2019 Open Source Integrators
Copyright 2019-2020 ForgeFlow S.L. (https://www.forgeflow.com)
License LGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<!-- Copyright 2019 Open Source Integrators
Copyright 2019-2020 ForgeFlow S.L. (https://www.forgeflow.com)
License LGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<record id="view_stock_request_form" model="ir.ui.view">
<field name="name">stock.request.form</field>
<field name="model">stock.request</field>