Skip to content

OLD 7.0 2015 08 18

Xavier Brochard edited this page Oct 29, 2021 · 1 revision

Conflict:

diff --cc addons/stock/stock.py
index ba72101,276e24b..0000000
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@@ -629,20 -629,17 +629,27 @@@ class stock_picking(osv.osv)
              res[pick]['min_date'] = dt1
              res[pick]['max_date'] = dt2
          return res
 +    
 +    def _get_stock_move_changes(self, cr, uid, ids, context=None):
 +        '''Return the ids of pickings that should change, due to changes
 +        in stock moves.'''
 +        move_pool = self.pool['stock.move']
 +        picking_ids = set()
 +        for move_obj in move_pool.browse(cr, uid, ids, context=context):
 +            if move_obj.picking_id:
 +                picking_ids.add(move_obj.picking_id.id)
 +        return list(picking_ids)
  
+     def _get_pickings(self, cr, uid, ids, context=None):
+         res = set()
+         for move in self.browse(cr, uid, ids, context=context):
+             if move.picking_id and not move.picking_id.min_date < move.date_expected < move.picking_id.max_date:
+                 res.add(move.picking_id.id)
+         return list(res)
+ 
      def create(self, cr, user, vals, context=None):
          if ('name' not in vals) or (vals.get('name')=='/'):
 -            seq_obj_name =  self._name
 +            seq_obj_name =  'stock.picking.%s' % vals.get('type', 'internal')
              vals['name'] = self.pool.get('ir.sequence').get(cr, user, seq_obj_name)
          new_id = super(stock_picking, self).create(cr, user, vals, context)
          return new_id
@@@ -674,31 -671,12 +681,40 @@@
              * Transferred: has been processed, can't be modified or cancelled anymore\n
              * Cancelled: has been cancelled, can't be confirmed anymore"""
          ),
++<<<<<<< HEAD
 +        'min_date': fields.function(
 +            get_min_max_date,
 +            fnct_inv=_set_minimum_date, multi='min_max_date',
 +            store={
 +                'stock.move': (
 +                    _get_stock_move_changes,
 +                    ['date_expected'], 10,
 +                )
 +            },
 +            type='datetime', string='Scheduled Time', select=True,
 +            help="Scheduled time for the shipment to be processed"
 +        ),
 +        'date': fields.datetime('Creation Date', help="Creation date, usually the time of the order.", select=True, states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}),
 +        'date_done': fields.datetime('Date of Transfer', help="Date of Completion", states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}),
 +        'max_date': fields.function(
 +            get_min_max_date,
 +            fnct_inv=_set_maximum_date, multi='min_max_date',
 +            store={
 +                'stock.move': (
 +                    _get_stock_move_changes,
 +                    ['date_expected'], 10,
 +                )
 +            },
 +            type='datetime', string='Max. Expected Date', select=True
 +        ),
++=======
+         'min_date': fields.function(get_min_max_date, fnct_inv=_set_minimum_date, multi="min_max_date",
+                  store={'stock.move': (_get_pickings, ['date_expected', 'picking_id'], 20)}, type='datetime', string='Scheduled Time', select=1, help="Scheduled time for the shipment to be processed"),
+         'date': fields.datetime('Creation Date', help="Creation date, usually the time of the order.", select=True, states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}),
+         'date_done': fields.datetime('Date of Transfer', help="Date of Completion", states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}),
+         'max_date': fields.function(get_min_max_date, fnct_inv=_set_maximum_date, multi="min_max_date",
+                  store={'stock.move': (_get_pickings, ['date_expected', 'picking_id'], 20)}, type='datetime', string='Max. Expected Date', select=2),
++>>>>>>> odoo/7.0
          'move_lines': fields.one2many('stock.move', 'picking_id', 'Internal Moves', states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}),
          'product_id': fields.related('move_lines', 'product_id', type='many2one', relation='product.product', string='Product'),
          'auto_picking': fields.boolean('Auto-Picking', states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}),

resolved by reverting https://github.com/OCA/OCB/commit/d90d2085 in https://github.com/OCA/OCB/commit/e70c207 and merging https://github.com/odoo/odoo/commit/607114ff00576380c45a5b7a2c1391ee914c7238 in https://github.com/odoo/odoo/commit/847c887407d29a28cca7eff55544218b785274ef by @hbrunn