Skip to content

Commit

Permalink
[17.0][UPD] deltatech_stock_inventory
Browse files Browse the repository at this point in the history
  • Loading branch information
VoicuStefan2001 committed Jan 20, 2025
1 parent 0594916 commit 267027c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion deltatech_stock_inventory/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"name": "Stock Inventory",
"summary": "Inventory Old Method",
"version": "17.0.2.3.1",
"version": "17.0.2.3.2",
"author": "Terrabit, Dorin Hongu",
"website": "https://www.terrabit.ro",
"category": "Warehouse",
Expand Down
17 changes: 17 additions & 0 deletions deltatech_stock_inventory/models/stock_quant.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,20 @@ def _get_inventory_move_values(self, qty, location_id, location_dest_id, package
values["inventory_id"] = self.inventory_id.id
values["name"] = self.inventory_note or values["name"]
return values

@api.model
def default_get(self, fields_list):
defaults = super().default_get(fields_list)
product_id = self.env.context.get("default_product_id") # Default product_id retrieved from context

if product_id: # if there is a product in context
product = self.env["product.product"].browse(product_id) # get the product
putaway_rules = self.env["stock.putaway.rule"].search(
[("product_id", "=", product.id)]
) # get the first putaway rule for the product
if putaway_rules: # should I check if the location is already in the lines?
defaults["location_id"] = putaway_rules[
0
].location_out_id.id # set the location_id to the location_out_id of the putaway rule

return defaults

0 comments on commit 267027c

Please sign in to comment.