[MERGE] forward port of branch 7.0 up to 922a52d
authorDenis Ledoux <dle@odoo.com>
Fri, 14 Nov 2014 16:59:00 +0000 (17:59 +0100)
committerDenis Ledoux <dle@odoo.com>
Fri, 14 Nov 2014 16:59:00 +0000 (17:59 +0100)
addons/purchase/stock.py
addons/web/static/src/js/search.js

index ccd7c56..bae6d1c 100644 (file)
@@ -146,6 +146,16 @@ class stock_partial_picking(osv.osv_memory):
                 return {'cost': cost, 'currency': company_currency}
         return super(stock_partial_picking, self)._product_cost_for_average_update(cr, uid, move)
 
+    def _partial_move_for(self, cr, uid, move, context=None):
+        partial_move = super(stock_partial_picking, self)._partial_move_for(cr, uid, move, context=context)
+        if move.picking_id.purchase_id and move.purchase_line_id:
+            pur_currency = move.purchase_line_id.order_id.currency_id.id
+            partial_move.update({
+                'currency': pur_currency,
+                'cost': move.purchase_line_id.price_unit
+            })
+        return partial_move
+
     def __get_help_text(self, cursor, user, picking_id, context=None):
         picking = self.pool.get('stock.picking').browse(cursor, user, picking_id, context=context)
         if picking.purchase_id:
index 9f11fdf..6e2f3f8 100644 (file)
@@ -1521,10 +1521,18 @@ instance.web.search.DateField = instance.web.search.Field.extend(/** @lends inst
         return instance.web.date_to_str(facetValue.get('value'));
     },
     complete: function (needle) {
+        var d;
         try {
-            var d = instance.web.str_to_date(instance.web.parse_value(needle, {'widget': 'date'}));
+            var t = (this.attrs && this.attrs.type === 'datetime') ? 'datetime' : 'date';
+            var v = instance.web.parse_value(needle, {'widget': t});
+            if (t === 'datetime'){
+                d = instance.web.str_to_datetime(v);
+            }
+            else{
+                d = instance.web.str_to_date(v);
+            }
         } catch (e) {
-            return false;
+            // pass
         }
         if (!d) { return $.when(null); }
         var date_string = instance.web.format_value(d, this.attrs);