From bec80227d981f9da26dd3e6bb58b15c31893045c Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 4 Oct 2013 12:52:18 +0200 Subject: [PATCH] [FIX] account_voucher, product, stock: use selection widgets for magic context fields, to pass IDs in the context instead of strings Many2one fields resolve to strings when used as `self` within the @context or @filter_domain attributes of a search field, because they must be able to support partial matches, e.g. search for "Sto" to match "Stock". In many case the code was not prepared to accept string for the magic context values, so the magic fields now caused crashes. The widget="selection" attribute was dropped during the search view cleanup for 7.0, without noticing this unfortunate side-effect, at revision: addons 7.0 revno 7142 revid:qdp-launchpad@openerp.com-20120731150358-jqd3eoz06imzlx01 lp bug: https://launchpad.net/bugs/1192484 fixed bzr revid: odo@openerp.com-20131004105218-edvb5ewduqar3x88 --- addons/account_voucher/account_voucher_view.xml | 2 +- addons/account_voucher/voucher_payment_receipt_view.xml | 4 ++-- addons/account_voucher/voucher_sales_purchase_view.xml | 4 ++-- addons/product/product_view.xml | 2 +- addons/stock/product_view.xml | 4 ++-- addons/stock/stock.py | 2 ++ 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/addons/account_voucher/account_voucher_view.xml b/addons/account_voucher/account_voucher_view.xml index 4674d62b6a0..41d3c6fc1f6 100644 --- a/addons/account_voucher/account_voucher_view.xml +++ b/addons/account_voucher/account_voucher_view.xml @@ -130,7 +130,7 @@ - + diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml index 5d259772363..1169d5ef7c3 100644 --- a/addons/account_voucher/voucher_payment_receipt_view.xml +++ b/addons/account_voucher/voucher_payment_receipt_view.xml @@ -12,7 +12,7 @@ - + @@ -35,7 +35,7 @@ - + diff --git a/addons/account_voucher/voucher_sales_purchase_view.xml b/addons/account_voucher/voucher_sales_purchase_view.xml index dc732129803..e35061e1836 100644 --- a/addons/account_voucher/voucher_sales_purchase_view.xml +++ b/addons/account_voucher/voucher_sales_purchase_view.xml @@ -11,7 +11,7 @@ - + @@ -33,7 +33,7 @@ - + diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml index 0ce5382cbef..d20f91b217f 100644 --- a/addons/product/product_view.xml +++ b/addons/product/product_view.xml @@ -15,7 +15,7 @@ - + diff --git a/addons/stock/product_view.xml b/addons/stock/product_view.xml index 594843eff8d..9bb68824487 100644 --- a/addons/stock/product_view.xml +++ b/addons/stock/product_view.xml @@ -8,8 +8,8 @@ - - + + diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 14aea05c579..6008ce7ab5f 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -75,6 +75,8 @@ class stock_location(osv.osv): _parent_order = 'posz,name' _order = 'parent_left' + # TODO: implement name_search() in a way that matches the results of name_get! + def name_get(self, cr, uid, ids, context=None): # always return the full hierarchical name res = self._complete_name(cr, uid, ids, 'complete_name', None, context=context)