[IMP] stock: Hide transit locations
All transit locations were set as active by default, confusing some users. There are now set as active only when when a ressuply route is created between some warehouses TaskID: 1873106
This commit is contained in:
committed by
Dharmraj Jhala
parent
d0392a2f15
commit
c8c500c64d
@@ -52,6 +52,7 @@
|
||||
<field name="location_id" ref="stock_location_locations_virtual"/>
|
||||
<field name="usage">transit</field>
|
||||
<field name="company_id"></field>
|
||||
<field name="active" eval="False"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
|
||||
@@ -35,6 +35,7 @@ class Company(models.Model):
|
||||
'usage': 'transit',
|
||||
'location_id': parent_location and parent_location.id or False,
|
||||
'company_id': company.id,
|
||||
'active': False
|
||||
})
|
||||
|
||||
company.write({'internal_transit_location_id': location.id})
|
||||
|
||||
@@ -238,13 +238,16 @@ class Warehouse(models.Model):
|
||||
('active', '=', False)
|
||||
])
|
||||
if existing_route:
|
||||
existing_route.write({'active': True})
|
||||
existing_route.toggle_active()
|
||||
else:
|
||||
warehouse.create_resupply_routes(to_add)
|
||||
if to_remove:
|
||||
Route.search([('supplied_wh_id', '=', warehouse.id), ('supplier_wh_id', 'in', to_remove.ids)]).write({'active': False})
|
||||
# TDE FIXME: shouldn't we remove stock rules also ? because this could make them global (not sure)
|
||||
|
||||
to_disable_route_ids = Route.search([
|
||||
('supplied_wh_id', '=', warehouse.id),
|
||||
('supplier_wh_id', 'in', to_remove.ids),
|
||||
('active', '=', True)
|
||||
])
|
||||
to_disable_route_ids.toggle_active()
|
||||
return res
|
||||
|
||||
@api.model
|
||||
@@ -586,6 +589,7 @@ class Warehouse(models.Model):
|
||||
transit_location = internal_transit_location if supplier_wh.company_id == self.company_id else external_transit_location
|
||||
if not transit_location:
|
||||
continue
|
||||
transit_location.active = True
|
||||
output_location = supplier_wh.lot_stock_id if supplier_wh.delivery_steps == 'ship_only' else supplier_wh.wh_output_stock_loc_id
|
||||
# Create extra MTO rule (only for 'ship only' because in the other cases MTO rules already exists)
|
||||
if supplier_wh.delivery_steps == 'ship_only':
|
||||
|
||||
@@ -17,7 +17,9 @@ class StockMove(SavepointCase):
|
||||
cls.transit_location = cls.env['stock.location'].search([
|
||||
('company_id', '=', cls.env.company.id),
|
||||
('usage', '=', 'transit'),
|
||||
('active', '=', False)
|
||||
], limit=1)
|
||||
cls.transit_location.active = True
|
||||
cls.uom_unit = cls.env.ref('uom.product_uom_unit')
|
||||
cls.uom_dozen = cls.env.ref('uom.product_uom_dozen')
|
||||
cls.product = cls.env['product.product'].create({
|
||||
|
||||
@@ -153,7 +153,6 @@
|
||||
<field name="name">Locations</field>
|
||||
<field name="res_model">stock.location</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form,qweb</field>
|
||||
<field name="view_id" ref="view_location_tree2"/>
|
||||
<field name="search_view_id" ref="view_location_search"/>
|
||||
|
||||
@@ -641,7 +641,9 @@ class TestStockValuation(SavepointCase):
|
||||
transit_location = self.env['stock.location'].search([
|
||||
('company_id', '=', self.env.company.id),
|
||||
('usage', '=', 'transit'),
|
||||
('active', '=', False)
|
||||
], limit=1)
|
||||
transit_location.active = True
|
||||
move8 = self.env['stock.move'].create({
|
||||
'name': 'Send 10 units in transit',
|
||||
'location_id': self.stock_location.id,
|
||||
|
||||
Reference in New Issue
Block a user