mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[IMP] stock_generate_putaway_from_inventory: black, isort, prettier
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
../../../../stock_generate_putaway_from_inventory
|
||||||
6
setup/stock_generate_putaway_from_inventory/setup.py
Normal file
6
setup/stock_generate_putaway_from_inventory/setup.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import setuptools
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
|
setup_requires=['setuptools-odoo'],
|
||||||
|
odoo_addon=True,
|
||||||
|
)
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
# © 2018 Akretion
|
# © 2018 Akretion
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from odoo import models, _
|
from odoo import _, models
|
||||||
from odoo.exceptions import ValidationError
|
from odoo.exceptions import ValidationError
|
||||||
|
|
||||||
|
|
||||||
@@ -27,9 +27,7 @@ class StockInventory(models.Model):
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
if putaway_line:
|
if putaway_line:
|
||||||
putaway_line.write(
|
putaway_line.write({"fixed_location_id": inventory_line.location_id.id})
|
||||||
{"fixed_location_id": inventory_line.location_id.id}
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
putaway_line_obj.create(
|
putaway_line_obj.create(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
# Copyright Akretion
|
# Copyright Akretion
|
||||||
# License AGPL-3.0 or later (https://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.exceptions import ValidationError
|
from odoo.exceptions import ValidationError
|
||||||
|
from odoo.tests.common import TransactionCase
|
||||||
|
|
||||||
|
|
||||||
class TestGeneratePutaway(TransactionCase):
|
class TestGeneratePutaway(TransactionCase):
|
||||||
@@ -28,27 +28,21 @@ class TestGeneratePutaway(TransactionCase):
|
|||||||
self.irrelevant_location = ref("stock.stock_location_customers")
|
self.irrelevant_location = ref("stock.stock_location_customers")
|
||||||
|
|
||||||
def test_error_not_validated(self):
|
def test_error_not_validated(self):
|
||||||
putaway = self.env["product.putaway"].create(
|
putaway = self.env["product.putaway"].create({"name": "Putaway example"})
|
||||||
{"name": "Putaway example"}
|
|
||||||
)
|
|
||||||
self.inventory.putaway_strategy_id = putaway
|
self.inventory.putaway_strategy_id = putaway
|
||||||
self.inventory.action_cancel_draft()
|
self.inventory.action_cancel_draft()
|
||||||
with self.assertRaises(ValidationError):
|
with self.assertRaises(ValidationError):
|
||||||
self.inventory.action_generate_putaway_strategy()
|
self.inventory.action_generate_putaway_strategy()
|
||||||
|
|
||||||
def test_error_location_has_no_putaway_strategy(self):
|
def test_error_location_has_no_putaway_strategy(self):
|
||||||
self.inventory_location.putaway_strategy_id = self.env[
|
self.inventory_location.putaway_strategy_id = self.env["product.putaway"]
|
||||||
"product.putaway"
|
|
||||||
]
|
|
||||||
self.inventory.action_start()
|
self.inventory.action_start()
|
||||||
self.inventory.action_validate()
|
self.inventory.action_validate()
|
||||||
with self.assertRaises(ValidationError):
|
with self.assertRaises(ValidationError):
|
||||||
self.inventory.action_generate_putaway_strategy()
|
self.inventory.action_generate_putaway_strategy()
|
||||||
|
|
||||||
def test_putaway_line_location_update(self):
|
def test_putaway_line_location_update(self):
|
||||||
putaway = self.env["product.putaway"].create(
|
putaway = self.env["product.putaway"].create({"name": "Putaway example"})
|
||||||
{"name": "Putaway example"}
|
|
||||||
)
|
|
||||||
putaway_line_1 = self.env["stock.fixed.putaway.strat"].create(
|
putaway_line_1 = self.env["stock.fixed.putaway.strat"].create(
|
||||||
{
|
{
|
||||||
"putaway_id": putaway.id,
|
"putaway_id": putaway.id,
|
||||||
@@ -65,9 +59,7 @@ class TestGeneratePutaway(TransactionCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def test_putaway_line_location_create(self):
|
def test_putaway_line_location_create(self):
|
||||||
putaway = self.env["product.putaway"].create(
|
putaway = self.env["product.putaway"].create({"name": "Putaway example"})
|
||||||
{"name": "Putaway example"}
|
|
||||||
)
|
|
||||||
self.inventory_location.putaway_strategy_id = putaway
|
self.inventory_location.putaway_strategy_id = putaway
|
||||||
self.inventory.action_start()
|
self.inventory.action_start()
|
||||||
self.inventory.action_validate()
|
self.inventory.action_validate()
|
||||||
@@ -75,6 +67,4 @@ class TestGeneratePutaway(TransactionCase):
|
|||||||
putaway_line = putaway.product_location_ids.filtered(
|
putaway_line = putaway.product_location_ids.filtered(
|
||||||
lambda r: r.product_id == self.inventory_line_1_product
|
lambda r: r.product_id == self.inventory_line_1_product
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(putaway_line.fixed_location_id, self.inventory_line_1_location)
|
||||||
putaway_line.fixed_location_id, self.inventory_line_1_location
|
|
||||||
)
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0" ?>
|
||||||
<openerp>
|
<openerp>
|
||||||
<data>
|
<data>
|
||||||
<record id="action_generate_putaway_strategy" model="ir.actions.server">
|
<record id="action_generate_putaway_strategy" model="ir.actions.server">
|
||||||
<field name="name">Generate putaway strategies</field>
|
<field name="name">Generate putaway strategies</field>
|
||||||
<field name="model_id" ref="model_stock_inventory"/>
|
<field name="model_id" ref="model_stock_inventory" />
|
||||||
<field name="binding_model_id" ref="stock.model_stock_inventory"/>
|
<field name="binding_model_id" ref="stock.model_stock_inventory" />
|
||||||
<field name="state">code</field>
|
<field name="state">code</field>
|
||||||
<field name="code">
|
<field name="code">
|
||||||
records.action_generate_putaway_strategy()
|
records.action_generate_putaway_strategy()
|
||||||
|
|||||||
Reference in New Issue
Block a user