Skip to content

Commit

Permalink
[FIX]: sock_customer_deposit: default location dest when activate cus…
Browse files Browse the repository at this point in the history
…tomer deposit

In operation type is setting location stock in default location dest if activate deposit in warehouse after deactivate.

@moduon MT-6918
  • Loading branch information
EmilioPascual committed Aug 9, 2024
1 parent 44d6c88 commit c0e1458
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
11 changes: 7 additions & 4 deletions stock_customer_deposit/models/stock_warehouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,18 +180,20 @@ def _update_customer_deposit_name_and_code(self, new_name=False, new_code=False)
warehouse.customer_deposit_type_id.sequence_id.write(sequence_data)

def _get_customer_deposit_picking_type_update_values(self):
customer_loc, supplier_loc = self._get_partner_locations()
return {
"active": self.use_customer_deposits,
"assign_owner": False,
"assign_owner": True,
"code": "internal",
"use_create_lots": False,
"use_existing_lots": True,
"default_location_src_id": self.lot_stock_id.id,
"default_location_dest_id": customer_loc.id,
"default_location_dest_id": self.lot_stock_id.id,
"barcode": self.code.replace(" ", "").upper() + "-DEPOSIT",
"show_reserved": False,
"show_operations": True,
}

def _get_customer_deposit_picking_type_create_values(self, max_sequence):
customer_loc, supplier_loc = self._get_partner_locations()
return {
"code": "internal",
"name": _("Customer Deposit"),
Expand All @@ -204,6 +206,7 @@ def _get_customer_deposit_picking_type_create_values(self, max_sequence):
"show_reserved": False,
"show_operations": True,
"sequence_code": "DEPOSIT",
"barcode": self.code.replace(" ", "").upper() + "-DEPOSIT",
"company_id": self.company_id.id,
}, max_sequence + 1

Expand Down
18 changes: 17 additions & 1 deletion stock_customer_deposit/tests/test_stock_warehouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,21 @@ def test_warehouse_activate_customer_deposit(self):
self.assertFalse(warehouse.customer_deposit_type_id.active)
self.assertFalse(warehouse.customer_deposit_route_id.active)
warehouse.write({"use_customer_deposits": True})
self.assertTrue(operation_type.active)
self.assertRecordValues(
operation_type,
[
{
"active": True,
"code": "internal",
"use_create_lots": False,
"use_existing_lots": True,
"assign_owner": True,
"default_location_src_id": warehouse.lot_stock_id.id,
"default_location_dest_id": warehouse.lot_stock_id.id,
"show_reserved": False,
"show_operations": True,
"barcode": "TST-DEPOSIT",
},
],
)
self.assertTrue(route.active)

0 comments on commit c0e1458

Please sign in to comment.