53 lines
2.0 KiB
Diff
53 lines
2.0 KiB
Diff
|
diff -r 4c5035111f5f trytond/trytond/modules/stock/move.py
|
||
|
--- a/trytond/trytond/modules/stock/move.py Thu Sep 14 17:48:18 2017 +0200
|
||
|
+++ b/trytond/trytond/modules/stock/move.py Fri Sep 15 09:19:22 2017 +0200
|
||
|
@@ -1,6 +1,7 @@
|
||
|
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||
|
# this repository contains the full copyright notices and license terms.
|
||
|
import datetime
|
||
|
+import hashlib
|
||
|
import operator
|
||
|
from decimal import Decimal
|
||
|
from functools import partial
|
||
|
@@ -189,11 +190,13 @@
|
||
|
| Eval('shipment'))
|
||
|
}, depends=['state', 'shipment'],
|
||
|
select=True)
|
||
|
- effective_date = fields.Date("Effective Date", readonly=True, select=True,
|
||
|
+ effective_date = fields.Date("Effective Date", select=True,
|
||
|
states={
|
||
|
'required': Eval('state') == 'done',
|
||
|
+ 'readonly': (Eval('state').in_(['cancel', 'done'])
|
||
|
+ | Eval('shipment')),
|
||
|
},
|
||
|
- depends=['state'])
|
||
|
+ depends=['state', 'shipment'])
|
||
|
state = fields.Selection([
|
||
|
('staging', 'Staging'),
|
||
|
('draft', 'Draft'),
|
||
|
@@ -737,12 +740,18 @@
|
||
|
types = cls.check_origin_types()
|
||
|
if not types:
|
||
|
return
|
||
|
- for move in moves:
|
||
|
- if ((move.from_location.type in types
|
||
|
- or move.to_location.type in types)
|
||
|
- and not move.origin):
|
||
|
- cls.raise_user_warning('%s.done' % move,
|
||
|
- 'no_origin', move.rec_name)
|
||
|
+
|
||
|
+ def no_origin(move):
|
||
|
+ return ((move.from_location.type in types) ^
|
||
|
+ (move.to_location.type in types)
|
||
|
+ and not move.origin)
|
||
|
+ moves = filter(no_origin, moves)
|
||
|
+ if moves:
|
||
|
+ names = ', '.join(m.rec_name for m in moves[:5])
|
||
|
+ if len(moves) > 5:
|
||
|
+ names += '...'
|
||
|
+ warning_name = '%s.done' % hashlib.md5(str(moves)).hexdigest()
|
||
|
+ cls.raise_user_warning(warning_name, 'no_origin', names)
|
||
|
|
||
|
def pick_product(self, location_quantities):
|
||
|
"""
|