Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
grindtildeath committed Sep 18, 2020
1 parent 769f67c commit c50a29d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion stock_putaway_rule/models/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ def action_view_related_putaway_rules(self):
('product_id', '=', self.id),
('category_id', '=', self.product_tmpl_id.categ_id.id),
]
return self.env['product.template']._get_action_view_related_putaway_rules(domain)
return self.env[
'product.template'
]._get_action_view_related_putaway_rules(domain)


class ProductTemplate(models.Model):
Expand Down
2 changes: 1 addition & 1 deletion stock_putaway_rule/models/product_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def filter_rules(self, product=None, category=None):

def select_putaway(self):
"""Select a putaway location to return"""
return self[0]
return self[0] if len(self) > 1 else self

def _get_destination_location(self):
return self.location_out_id
6 changes: 4 additions & 2 deletions stock_putaway_rule/models/stock_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ def get_putaway_strategy(self, product):
while current_location and not putaway_location:
# Looking for a putaway about the product.
putaway_location = current_location._get_putaway_rule_location(
product=product
product=product,
)
if putaway_location:
break
# If not product putaway found, we're looking with category so.
categ = product.categ_id
while categ:
putaway_location = current_location._get_putaway_rule_location(
category=categ
category=categ,
)
if putaway_location:
break
Expand Down

0 comments on commit c50a29d

Please sign in to comment.