diff --git a/issue6764.diff b/issue6764.diff new file mode 100644 index 0000000..14da042 --- /dev/null +++ b/issue6764.diff @@ -0,0 +1,52 @@ +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): + """ diff --git a/series b/series index 113daad..b9d4969 100644 --- a/series +++ b/series @@ -58,3 +58,4 @@ issue5877.diff # [trytond] - Improve ModelStorage.search_count by using no order statement_of_account.diff # [account] - remove context and show all lines on general_ledger_lines issue6371.diff # [stock] - Do not set effective_date on assign issue5891.diff # [stock] - Allow using view locations in cancelled stock moves +issue6764.diff # [stock] - Setting initial stock