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
|
||||
# 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
|
||||
|
||||
|
||||
@@ -27,9 +27,7 @@ class StockInventory(models.Model):
|
||||
]
|
||||
)
|
||||
if putaway_line:
|
||||
putaway_line.write(
|
||||
{"fixed_location_id": inventory_line.location_id.id}
|
||||
)
|
||||
putaway_line.write({"fixed_location_id": inventory_line.location_id.id})
|
||||
else:
|
||||
putaway_line_obj.create(
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
* Pierrick Brun <pierrick.brun@akretion.com>
|
||||
* David Beal <david.beal@akretion.com>
|
||||
* Sébastien Beau <sebastien.beau@akretion.com>
|
||||
* Kevin Khao <kevin.khao@akretion.com>
|
||||
* Kevin Khao <kevin.khao@akretion.com>
|
||||
|
||||
@@ -1 +1 @@
|
||||
Synchronize a Product Putaway Location from an inventory. Note that this module assumes that there is a one-to-one correspondence between the location and putaway strategy, and if the location currently has no putaway strategy, an error will be raised.
|
||||
Synchronize a Product Putaway Location from an inventory. Note that this module assumes that there is a one-to-one correspondence between the location and putaway strategy, and if the location currently has no putaway strategy, an error will be raised.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# Copyright Akretion
|
||||
# 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.tests.common import TransactionCase
|
||||
|
||||
|
||||
class TestGeneratePutaway(TransactionCase):
|
||||
@@ -28,27 +28,21 @@ class TestGeneratePutaway(TransactionCase):
|
||||
self.irrelevant_location = ref("stock.stock_location_customers")
|
||||
|
||||
def test_error_not_validated(self):
|
||||
putaway = self.env["product.putaway"].create(
|
||||
{"name": "Putaway example"}
|
||||
)
|
||||
putaway = self.env["product.putaway"].create({"name": "Putaway example"})
|
||||
self.inventory.putaway_strategy_id = putaway
|
||||
self.inventory.action_cancel_draft()
|
||||
with self.assertRaises(ValidationError):
|
||||
self.inventory.action_generate_putaway_strategy()
|
||||
|
||||
def test_error_location_has_no_putaway_strategy(self):
|
||||
self.inventory_location.putaway_strategy_id = self.env[
|
||||
"product.putaway"
|
||||
]
|
||||
self.inventory_location.putaway_strategy_id = self.env["product.putaway"]
|
||||
self.inventory.action_start()
|
||||
self.inventory.action_validate()
|
||||
with self.assertRaises(ValidationError):
|
||||
self.inventory.action_generate_putaway_strategy()
|
||||
|
||||
def test_putaway_line_location_update(self):
|
||||
putaway = self.env["product.putaway"].create(
|
||||
{"name": "Putaway example"}
|
||||
)
|
||||
putaway = self.env["product.putaway"].create({"name": "Putaway example"})
|
||||
putaway_line_1 = self.env["stock.fixed.putaway.strat"].create(
|
||||
{
|
||||
"putaway_id": putaway.id,
|
||||
@@ -65,9 +59,7 @@ class TestGeneratePutaway(TransactionCase):
|
||||
)
|
||||
|
||||
def test_putaway_line_location_create(self):
|
||||
putaway = self.env["product.putaway"].create(
|
||||
{"name": "Putaway example"}
|
||||
)
|
||||
putaway = self.env["product.putaway"].create({"name": "Putaway example"})
|
||||
self.inventory_location.putaway_strategy_id = putaway
|
||||
self.inventory.action_start()
|
||||
self.inventory.action_validate()
|
||||
@@ -75,6 +67,4 @@ class TestGeneratePutaway(TransactionCase):
|
||||
putaway_line = putaway.product_location_ids.filtered(
|
||||
lambda r: r.product_id == self.inventory_line_1_product
|
||||
)
|
||||
self.assertEqual(
|
||||
putaway_line.fixed_location_id, self.inventory_line_1_location
|
||||
)
|
||||
self.assertEqual(putaway_line.fixed_location_id, self.inventory_line_1_location)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="action_generate_putaway_strategy" model="ir.actions.server">
|
||||
<field name="name">Generate putaway strategies</field>
|
||||
<field name="model_id" ref="model_stock_inventory"/>
|
||||
<field name="binding_model_id" ref="stock.model_stock_inventory"/>
|
||||
<field name="model_id" ref="model_stock_inventory" />
|
||||
<field name="binding_model_id" ref="stock.model_stock_inventory" />
|
||||
<field name="state">code</field>
|
||||
<field name="code">
|
||||
records.action_generate_putaway_strategy()
|
||||
|
||||
Reference in New Issue
Block a user