Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WMS][12.0] Add stock_putaway_abc_move_location_dest_constraint - alpha version #700

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
19 changes: 19 additions & 0 deletions stock_putaway_abc_move_location_dest_constraint/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
{
"name": "Stock Move Location Dest Constraint ABC",
"summary": "Constrain location dest matching ABC classification",
"version": "12.0.1.0.0",
"development_status": "Alpha",
"category": "Warehouse Management",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"author": "Camptocamp, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"auto_install": True,
"depends": [
"stock_move_location_dest_constraint_base",
"stock_putaway_abc"
],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import product_strategy
from . import stock_location
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
from odoo import api, models
from odoo.exceptions import ValidationError


class StockPutawayRule(models.Model):

_inherit = 'stock.putaway.rule'

@api.multi
def validate_abc_locations(self, locations):
res = super().validate_abc_locations(locations)
product = None
if self.product_id:
product = self.product_id
checked_locations = self.env['stock.location']
for loc in res:
try:
loc.check_move_dest_constraint(product=product)
except ValidationError:
continue
checked_locations |= loc
return checked_locations
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
from odoo import models


class StockLocation(models.Model):

_inherit = 'stock.location'

def check_move_dest_constraint(self, line=None, product=None):
# As stock.putaway.rule.location_out_id is not required when
# stock_putaway_abc is installed, we check here that this method
# is called on an existing stock.location to avoid error on ensure_one
# in stock_move_location_dest_constraint_base
if not self:
return False
return super().check_move_dest_constraint(line=line, product=product)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Akim Juillerat <akim.juillerat@camptocamp.com>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module allows to validate ABC locations according to constraints installed
by modules restricting location destination on stock move lines.