90 lines
4.1 KiB
Diff
90 lines
4.1 KiB
Diff
diff -r a698c3447267 trytond/trytond/modules/stock/location.py
|
|
--- a/trytond/trytond/modules/stock/location.py Fri Jul 08 09:25:58 2016 +0200
|
|
+++ b/trytond/trytond/modules/stock/location.py Fri Jul 08 09:53:56 2016 +0200
|
|
@@ -63,7 +63,7 @@
|
|
'required': Equal(Eval('type'), 'warehouse'),
|
|
},
|
|
domain=[
|
|
- ('type', '=', 'storage'),
|
|
+ ('type', 'in', ['storage', 'view']),
|
|
['OR',
|
|
('parent', 'child_of', [Eval('id')]),
|
|
('parent', '=', None),
|
|
@@ -137,9 +137,12 @@
|
|
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,))
|
|
|
|
diff -r a698c3447267 trytond/trytond/modules/stock/move.py
|
|
--- a/trytond/trytond/modules/stock/move.py Fri Jul 08 09:25:58 2016 +0200
|
|
+++ b/trytond/trytond/modules/stock/move.py Fri Jul 08 09:53:56 2016 +0200
|
|
@@ -27,6 +27,12 @@
|
|
'readonly': In(Eval('state'), ['cancel', 'assigned', 'done']),
|
|
}
|
|
DEPENDS = ['state']
|
|
+LOCATION_DOMAIN = [
|
|
+ If(Eval('state').in_(['staging', 'draft', 'cancel']),
|
|
+ ('type', 'not in', ['warehouse']),
|
|
+ ('type', 'not in', ['warehouse', 'view'])),
|
|
+ ]
|
|
+LOCATION_DEPENDS = ['state']
|
|
|
|
|
|
class StockMixin:
|
|
@@ -176,11 +182,11 @@
|
|
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,
|
|
diff -r a698c3447267 trytond/trytond/modules/stock/shipment.py
|
|
--- a/trytond/trytond/modules/stock/shipment.py Fri Jul 08 09:25:58 2016 +0200
|
|
+++ b/trytond/trytond/modules/stock/shipment.py Fri Jul 08 09:53:56 2016 +0200
|
|
@@ -503,7 +503,7 @@
|
|
required=True, states={
|
|
'readonly': Or(Not(Equal(Eval('state'), 'draft')),
|
|
Bool(Eval('moves', [0]))),
|
|
- }, domain=[('type', '=', 'storage')],
|
|
+ }, domain=[('type', 'in', ['storage', 'view'])],
|
|
depends=['state'])
|
|
to_location = fields.Many2One('stock.location', "To Location",
|
|
required=True, states={
|
|
@@ -1821,14 +1821,14 @@
|
|
Bool(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': Or(Not(Equal(Eval('state'), 'draft')),
|
|
Bool(Eval('moves', [0]))),
|
|
}, domain=[
|
|
- ('type', 'in', ['storage', 'lost_found']),
|
|
+ ('type', 'in', ['view', 'storage', 'lost_found']),
|
|
], depends=['state'])
|
|
transit_location = fields.Function(fields.Many2One('stock.location',
|
|
'Transit Location'), 'on_change_with_transit_location')
|