Skip to content

Commit

Permalink
[MIG] stock_picking_operation_quick_change: Migration to v13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosRoca13 committed May 20, 2021
1 parent 7d9a32b commit 39d2d3a
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 43 deletions.
16 changes: 10 additions & 6 deletions stock_picking_operation_quick_change/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ Stock Picking Operation Quick Change
: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--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-workflow/tree/12.0/stock_picking_operation_quick_change
:target: https://github.com/OCA/stock-logistics-workflow/tree/13.0/stock_picking_operation_quick_change
:alt: OCA/stock-logistics-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-workflow-12-0/stock-logistics-workflow-12-0-stock_picking_operation_quick_change
:target: https://translation.odoo-community.org/projects/stock-logistics-workflow-13-0/stock-logistics-workflow-13-0-stock_picking_operation_quick_change
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/154/12.0
:target: https://runbot.odoo-community.org/runbot/154/13.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -52,7 +52,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-workflow/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-workflow/issues/new?body=module:%20stock_picking_operation_quick_change%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20stock_picking_operation_quick_change%0Aversion:%2013.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.

Expand All @@ -67,7 +67,11 @@ Authors
Contributors
~~~~~~~~~~~~

* Sergio Teruel <[email protected]>
* `Tecnativa <https://www.tecnativa.com>`_:

* Sergio Teruel
* Carlos Roca

* Lois Rilo <[email protected]>

Maintainers
Expand All @@ -83,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
promote its widespread use.

This module is part of the `OCA/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/12.0/stock_picking_operation_quick_change>`_ project on GitHub.
This module is part of the `OCA/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/13.0/stock_picking_operation_quick_change>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
8 changes: 4 additions & 4 deletions stock_picking_operation_quick_change/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# © 2017 Sergio Teruel <[email protected]>
# Copyright 2017 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

{
"name": "Stock Picking Operation Quick Change",
"summary": "Change location of all picking operations",
"version": "12.0.1.0.0",
"version": "13.0.1.0.0",
"category": "Warehouse",
"website": "https://github.com/OCA/stock-logistics-workflow",
"author": "Tecnativa, " "Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"depends": ["stock",],
"data": ["wizards/stock_picking_wizard_view.xml", "views/stock_picking_view.xml",],
"depends": ["stock"],
"data": ["wizards/stock_picking_wizard_view.xml", "views/stock_picking_view.xml"],
}
6 changes: 5 additions & 1 deletion stock_picking_operation_quick_change/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
* Sergio Teruel <[email protected]>
* `Tecnativa <https://www.tecnativa.com>`_:

* Sergio Teruel
* Carlos Roca

* Lois Rilo <[email protected]>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Stock Picking Operation Quick Change</title>
<style type="text/css">

Expand Down Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Stock Picking Operation Quick Change</h1>
!! This file is generated by oca-gen-addon-readme !!
!! 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/stock-logistics-workflow/tree/12.0/stock_picking_operation_quick_change"><img alt="OCA/stock-logistics-workflow" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--workflow-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-workflow-12-0/stock-logistics-workflow-12-0-stock_picking_operation_quick_change"><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/154/12.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/stock-logistics-workflow/tree/13.0/stock_picking_operation_quick_change"><img alt="OCA/stock-logistics-workflow" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--workflow-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-workflow-13-0/stock-logistics-workflow-13-0-stock_picking_operation_quick_change"><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/154/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module extends standard WMS to allow change destination location for all
picking operations.</p>
<p><strong>Table of contents</strong></p>
Expand Down Expand Up @@ -401,7 +401,7 @@ <h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20stock_picking_operation_quick_change%0Aversion:%2012.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-workflow/issues/new?body=module:%20stock_picking_operation_quick_change%0Aversion:%2013.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>
</div>
<div class="section" id="credits">
Expand All @@ -415,7 +415,11 @@ <h2><a class="toc-backref" href="#id4">Authors</a></h2>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id5">Contributors</a></h2>
<ul class="simple">
<li>Sergio Teruel &lt;<a class="reference external" href="mailto:sergio.teruel&#64;tecnativa.com">sergio.teruel&#64;tecnativa.com</a>&gt;</li>
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Sergio Teruel</li>
<li>Carlos Roca</li>
</ul>
</li>
<li>Lois Rilo &lt;<a class="reference external" href="mailto:lois.rilo&#64;eficent.com">lois.rilo&#64;eficent.com</a>&gt;</li>
</ul>
</div>
Expand All @@ -426,7 +430,7 @@ <h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/tree/12.0/stock_picking_operation_quick_change">OCA/stock-logistics-workflow</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/tree/13.0/stock_picking_operation_quick_change">OCA/stock-logistics-workflow</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>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# © 2017 Sergio Teruel <[email protected]>
# Copyright 2017 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.exceptions import UserError
Expand All @@ -7,14 +7,14 @@

class TestOperationQuickChange(TransactionCase):
def setUp(self):
super(TestOperationQuickChange, self).setUp()
super().setUp()
self.Location = self.env["stock.location"]
self.PickingType = self.env["stock.picking.type"]
self.Picking = self.env["stock.picking"]
self.Product = self.env["product.template"]
self.Wizard = self.env["stock.picking.operation.wizard"]
self.warehouse = self.env["stock.warehouse"].create(
{"name": "warehouse - test", "code": "WH-TEST",}
{"name": "warehouse - test", "code": "WH-TEST"}
)

# self.warehouse.lot_stock_id.id
Expand All @@ -26,7 +26,7 @@ def setUp(self):
"standard_price": 100.00,
}
)
self.qty_on_hand(self.product.product_variant_ids[:1])
self.qty_on_hand(self.product.product_variant_ids)
self.product2 = self.Product.create(
{
"name": "Product2 - Test",
Expand All @@ -35,12 +35,10 @@ def setUp(self):
"standard_price": 100.00,
}
)
self.qty_on_hand(self.product2.product_variant_ids[:1])
self.customer = self.env["res.partner"].create(
{"name": "Customer - test", "customer": True,}
)
self.qty_on_hand(self.product2.product_variant_ids)
self.customer = self.env["res.partner"].create({"name": "Customer - test"})
self.picking_type = self.PickingType.search(
[("warehouse_id", "=", self.warehouse.id), ("code", "=", "outgoing"),]
[("warehouse_id", "=", self.warehouse.id), ("code", "=", "outgoing")]
)
self.picking = self.Picking.create(
{
Expand All @@ -54,7 +52,7 @@ def setUp(self):
0,
{
"name": self.product.name,
"product_id": self.product.product_variant_ids[:1].id,
"product_id": self.product.product_variant_ids.id,
"product_uom_qty": 20.0,
"product_uom": self.product.uom_id.id,
},
Expand All @@ -64,7 +62,7 @@ def setUp(self):
0,
{
"name": self.product.name,
"product_id": self.product2.product_variant_ids[:1].id,
"product_id": self.product2.product_variant_ids.id,
"product_uom_qty": 60.0,
"product_uom": self.product.uom_id.id,
},
Expand All @@ -74,14 +72,26 @@ def setUp(self):
)

def qty_on_hand(self, product):
stock_change_obj = self.env["stock.change.product.qty"]
vals = {
"product_id": product.id,
"new_quantity": 200.0,
"location_id": self.warehouse.lot_stock_id.id,
}
wiz = stock_change_obj.create(vals)
wiz.change_product_qty()
wiz = self.env["stock.inventory"].create(
{
"name": "Stock Inventory",
"product_ids": [(4, product.id, 0)],
"line_ids": [
(
0,
0,
{
"product_id": product.id,
"product_uom_id": product.uom_id.id,
"product_qty": 200,
"location_id": self.warehouse.lot_stock_id.id,
},
),
],
}
)
wiz.action_start()
wiz.action_validate()

def test_picking_operation_change_location_dest_all(self):
self.picking.action_assign()
Expand All @@ -93,7 +103,7 @@ def test_picking_operation_change_location_dest_all(self):
)
wiz = self.Wizard.with_context(
active_model=self.picking._name, active_ids=self.picking.ids,
).create({"new_location_dest_id": new_location_dest_id.id, "change_all": True,})
).create({"new_location_dest_id": new_location_dest_id.id, "change_all": True})
move_lines = self.picking.mapped("move_line_ids")
self.assertEqual(wiz.location_dest_id, self.picking.location_dest_id)
self.assertEqual(wiz.old_location_dest_id, move_lines[:1].location_dest_id)
Expand Down Expand Up @@ -142,6 +152,6 @@ def test_picking_operation_change_location_dest_failed(self):
)
wiz = self.Wizard.with_context(
active_model=self.picking._name, active_ids=self.picking.ids,
).create({"new_location_dest_id": new_location_dest_id.id, "change_all": True,})
).create({"new_location_dest_id": new_location_dest_id.id, "change_all": True})
with self.assertRaises(UserError):
wiz.action_apply()
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2017 Sergio Teruel <[email protected]>
<!-- Copyright 2017 Tecnativa - Sergio Teruel
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="view_picking_form" model="ir.ui.view">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# © 2017 Sergio Teruel <[email protected]>
# Copyright 2017 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import _, api, fields, models
Expand All @@ -14,7 +14,7 @@ def _prepare_default_values(self, picking):

@api.model
def default_get(self, fields):
res = super(StockPickingOperationWizard, self).default_get(fields)
res = super().default_get(fields)
active_model = self.env.context["active_model"]
active_ids = self.env.context["active_ids"] or []
picking = self.env[active_model].browse(active_ids)
Expand Down Expand Up @@ -83,7 +83,6 @@ def check_allowed_pickings(self, pickings):
)
)

@api.multi
def action_apply(self):
stock_picking_obj = self.env["stock.picking"]
pickings = stock_picking_obj.browse(self.env.context["active_ids"])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2017 Sergio Teruel <[email protected]>
<!-- Copyright 2017 Tecnativa - Sergio Teruel
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<!-- wizard view -->
Expand Down Expand Up @@ -48,7 +48,6 @@
<field name="name">Change Operation Destination Location</field>
<field name="res_model">stock.picking.operation.wizard</field>
<field name="view_mode">form</field>
<field name="view_type">form</field>
<field name="target">new</field>
</record>
</odoo>

0 comments on commit 39d2d3a

Please sign in to comment.