Allow to use view location on staging and draft moves
issue4912 review24321002
This commit is contained in:
1 parent
f6b10b766e
commit
8507f1660f
4 files changed
+21
-11
No files matched your search
@@ -1,3 +1,4 @@
|
||||
* Allow to use view location on staging and draft moves
|
||||
* Add picking location on warehouse
|
||||
* Always compute expected quantity in inventory
|
||||
* Allow to change the destination of internal shipment's moves
|
||||
|
||||
+7
-4
@@ -85,7 +85,7 @@ class Location(ModelSQL, ModelView):
|
||||
'required': Eval('type') == 'warehouse',
|
||||
},
|
||||
domain=[
|
||||
('type', '=', 'storage'),
|
||||
('type', 'in', ['storage', 'view']),
|
||||
['OR',
|
||||
('parent', 'child_of', [Eval('id')]),
|
||||
('parent', '=', None)]],
|
||||
@@ -175,9 +175,12 @@ class Location(ModelSQL, ModelView):
|
||||
invalid_move_types = ['warehouse', 'view']
|
||||
Move = Pool().get('stock.move')
|
||||
if (self.type in invalid_move_types
|
||||
and Move.search(['OR',
|
||||
('to_location', '=', self.id),
|
||||
('from_location', '=', self.id),
|
||||
and Move.search([
|
||||
['OR',
|
||||
('to_location', '=', self.id),
|
||||
('from_location', '=', self.id),
|
||||
],
|
||||
('state', 'not in', ['staging', 'draft']),
|
||||
])):
|
||||
self.raise_user_error('invalid_type_for_moves', (self.rec_name,))
|
||||
|
||||
|
||||
@@ -25,6 +25,12 @@ STATES = {
|
||||
'readonly': Eval('state').in_(['cancel', 'assigned', 'done']),
|
||||
}
|
||||
DEPENDS = ['state']
|
||||
LOCATION_DOMAIN = [
|
||||
If(Eval('state').in_(['staging', 'draft']),
|
||||
('type', 'not in', ['warehouse']),
|
||||
('type', 'not in', ['warehouse', 'view'])),
|
||||
]
|
||||
LOCATION_DEPENDS = ['state']
|
||||
|
||||
|
||||
class StockMixin:
|
||||
@@ -174,11 +180,11 @@ class Move(Workflow, ModelSQL, ModelView):
|
||||
internal_quantity = fields.Float('Internal Quantity', readonly=True,
|
||||
required=True)
|
||||
from_location = fields.Many2One("stock.location", "From Location",
|
||||
select=True, required=True, states=STATES, depends=DEPENDS,
|
||||
domain=[('type', 'not in', ('warehouse', 'view'))])
|
||||
select=True, required=True, states=STATES,
|
||||
depends=DEPENDS + LOCATION_DEPENDS, domain=LOCATION_DOMAIN)
|
||||
to_location = fields.Many2One("stock.location", "To Location", select=True,
|
||||
required=True, states=STATES, depends=DEPENDS,
|
||||
domain=[('type', 'not in', ('warehouse', 'view'))])
|
||||
required=True, states=STATES,
|
||||
depends=DEPENDS + LOCATION_DEPENDS, domain=LOCATION_DOMAIN)
|
||||
shipment = fields.Reference('Shipment', selection='get_shipment',
|
||||
readonly=True, select=True)
|
||||
origin = fields.Reference('Origin', selection='get_origin', select=True,
|
||||
|
||||
+3
-3
@@ -505,7 +505,7 @@ class ShipmentInReturn(Workflow, ModelSQL, ModelView):
|
||||
from_location = fields.Many2One('stock.location', "From Location",
|
||||
required=True, states={
|
||||
'readonly': (Eval('state') != 'draft') | Eval('moves', [0]),
|
||||
}, domain=[('type', '=', 'storage')],
|
||||
}, domain=[('type', 'in', ['storage', 'view'])],
|
||||
depends=['state'])
|
||||
to_location = fields.Many2One('stock.location', "To Location",
|
||||
required=True, states={
|
||||
@@ -1771,13 +1771,13 @@ class ShipmentInternal(Workflow, ModelSQL, ModelView):
|
||||
'readonly': (Eval('state') != 'draft') | Eval('moves', [0]),
|
||||
},
|
||||
domain=[
|
||||
('type', 'in', ['storage', 'lost_found']),
|
||||
('type', 'in', ['view', 'storage', 'lost_found']),
|
||||
], depends=['state'])
|
||||
to_location = fields.Many2One('stock.location', "To Location",
|
||||
required=True, states={
|
||||
'readonly': (Eval('state') != 'draft') | Eval('moves', [0]),
|
||||
}, domain=[
|
||||
('type', 'in', ['storage', 'lost_found']),
|
||||
('type', 'in', ['view', 'storage', 'lost_found']),
|
||||
], depends=['state'])
|
||||
moves = fields.One2Many('stock.move', 'shipment', 'Moves',
|
||||
states={
|
||||
|
||||
Reference in new issue
Block a user