Reviewers: ,
Description:
stock: Sync planned date of supplier shipment only for later
Please review this at http://codereview.tryton.org/797002/
Affected files:
M shipment.py
Index: shipment.py
===================================================================
--- a/shipment.py
+++ b/shipment.py
@@ -2,6 +2,8 @@
#this repository contains the full copyright notices and license terms.
import operator
import itertools
+import datetime
+
from trytond.model import Workflow, ModelView, ModelSQL, fields
from trytond.modules.company import CompanyReport
from trytond.wizard import Wizard, StateTransition, StateView,
StateAction, \
@@ -310,12 +312,14 @@
incoming_date, inventory_date = dates
Move.write([m for m in shipment.incoming_moves
if (m.state not in ('assigned', 'done', 'cancel')
- and m.planned_date != incoming_date)], {
+ and ((m.planned_date or datetime.date.max)
+ < (incoming_date or datetime.date.max)))], {
'planned_date': incoming_date,
})
Move.write([m for m in shipment.inventory_moves
if (m.state not in ('assigned', 'done', 'cancel')
- and m.planned_date != inventory_date)], {
+ and ((m.planned_date or datetime.date.max)
+ < (inventory_date or datetime.date.max)))], {
'planned_date': inventory_date,
})