From 0a7633c11ea0956894088d6b742fc9ce251fb896 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 14 Nov 2014 16:51:13 +0100 Subject: [PATCH 1/2] [FIX] purchase: keep PO currency on picking The delivery of a purchase order was not keeping the currency and cost price from the purchase order for the reception. This was problematic for orders where the invoice was generated from the picking (Invoicing Control: Based on incoming shipments). The currency of the purchase order was kept while the cost was the one in the company's currency. It's better to keep the currency of the purchase order to make the invoice as it's usually the one expected (and not convert everything to the currency of the company). opw 615555 --- addons/purchase/stock.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/addons/purchase/stock.py b/addons/purchase/stock.py index e8ea8f8f067..c211f39e719 100644 --- a/addons/purchase/stock.py +++ b/addons/purchase/stock.py @@ -147,6 +147,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: From 922a52dcde24749aa3e640a940be462b85c075dd Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 14 Nov 2014 17:57:10 +0100 Subject: [PATCH 2/2] [FIX] web: date autocompletion should not harcode 'date' But should use date or datetime according to the widget type This fix is related to 69d60465ee67969d72210a61a9e23204d037378a --- addons/web/static/src/js/search.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 89cf5521db1..d2db5b55213 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -1497,10 +1497,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);