{"action":"created","issue":{"url":"https://api.github.com/repos/Vauxoo/addons-vauxoo/issues/965","repository_url":"https://api.github.com/repos/Vauxoo/addons-vauxoo","labels_url":"https://api.github.com/repos/Vauxoo/addons-vauxoo/issues/965/labels{/name}","comments_url":"https://api.github.com/repos/Vauxoo/addons-vauxoo/issues/965/comments","events_url":"https://api.github.com/repos/Vauxoo/addons-vauxoo/issues/965/events","html_url":"https://github.com/Vauxoo/addons-vauxoo/pull/965","id":156314276,"number":965,"title":"[REF] stock_location_code: Revert to original warehouse value, because other customer use this way","user":{"login":"moylop260","id":6644187,"avatar_url":"https://avatars.githubusercontent.com/u/6644187?v=3","gravatar_id":"","url":"https://api.github.com/users/moylop260","html_url":"https://github.com/moylop260","followers_url":"https://api.github.com/users/moylop260/followers","following_url":"https://api.github.com/users/moylop260/following{/other_user}","gists_url":"https://api.github.com/users/moylop260/gists{/gist_id}","starred_url":"https://api.github.com/users/moylop260/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moylop260/subscriptions","organizations_url":"https://api.github.com/users/moylop260/orgs","repos_url":"https://api.github.com/users/moylop260/repos","events_url":"https://api.github.com/users/moylop260/events{/privacy}","received_events_url":"https://api.github.com/users/moylop260/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-05-23T16:46:41Z","updated_at":"2016-05-23T18:35:22Z","closed_at":"2016-05-23T17:52:29Z","pull_request":{"url":"https://api.github.com/repos/Vauxoo/addons-vauxoo/pulls/965","html_url":"https://github.com/Vauxoo/addons-vauxoo/pull/965","diff_url":"https://github.com/Vauxoo/addons-vauxoo/pull/965.diff","patch_url":"https://github.com/Vauxoo/addons-vauxoo/pull/965.patch"},"body":"This changed by the following comment: https://github.com/Vauxoo/addons-vauxoo/pull/929#issuecomment-219173136 based on HU#962 - CA#5\r\n\r\nBut this module is used with other customer and need the previous way.\r\n\r\nResult: [barcode] name (warehouse)\r\n<img width=\"448\" alt=\"screen shot 2016-05-23 at 12 21 28 pm\" src=\"https://cloud.githubusercontent.com/assets/6644187/15478610/e9c88c64-20e0-11e6-9e46-c5f60a1619c6.png\">\r\n\r\nResult of tests:\r\n<img width=\"1280\" alt=\"screen shot 2016-05-23 at 12 23 08 pm\" src=\"https://cloud.githubusercontent.com/assets/6644187/15478644/20671952-20e1-11e6-8818-dc474757090f.png\">\r\n\r\n\r\nThe real diff `git diff vauxoo/8.0..vauxoo-dev/8.0-ref-location-get-name-moy` is:\r\n```diff\r\ndiff --git a/stock_location_code/model/stock.py b/stock_location_code/model/stock.py\r\nindex cbd935c..4a2b260 100644\r\n--- a/stock_location_code/model/stock.py\r\n+++ b/stock_location_code/model/stock.py\r\n@@ -46,7 +46,8 @@ class StockLocation(models.Model):\r\n     _inherit = 'stock.location'\r\n\r\n     # barcode is between [] e.g. \"[1234] location1\"\r\n-    barcode_re = re.compile(r'\\[(?P<barcode>.*?)\\]')\r\n+    barcode_re = re.compile(r'^\\[(?P<barcode>.*?)\\]')\r\n+    warehouse_re = re.compile(r' \\((?P<wh>.*?)\\)$')\r\n\r\n     @api.model\r\n     def name_search(self, name, args=None, operator='ilike', limit=100):\r\n@@ -59,6 +60,7 @@ class StockLocation(models.Model):\r\n             barcode = re_search.group('barcode') if re_search else name\r\n             recs = self.search([('loc_barcode', '=', barcode)] + args,\r\n                                limit=limit)\r\n+            # TODO: Search by warehouse too with self.warehouse_re\r\n         res = recs.name_get() or super(StockLocation, self).name_search(\r\n             name, args=args, operator=operator, limit=limit)\r\n         return res\r\n@@ -70,7 +72,14 @@ class StockLocation(models.Model):\r\n         concatenates the code and warehouse to a location if they exist.\r\n         Visually, it's better to know which owns the warehouse location.\r\n         \"\"\"\r\n-        name = super(StockLocation, self)._name_get(location)\r\n         barcode = \"[%(barcode)s]\" % {'barcode': location.loc_barcode} \\\r\n             if location.loc_barcode else ''\r\n-        return barcode + ' ' + name if barcode else name\r\n+        # TODO: Add fields.function to get warehouse. get_warehouse is too slow\r\n+        # TODO: Add a parameters for a location path name or a wh_name\r\n+        warehouse = self.env['stock.warehouse'].browse(\r\n+            self.get_warehouse(location))\r\n+        wh_name = \"(%(warehouse)s)\" % {'warehouse': warehouse.name} \\\r\n+            if warehouse else ''\r\n+        items = [barcode.strip(), location.name.strip(), wh_name.strip()]\r\n+        new_name = ' '.join(item for item in items if item)\r\n+        return new_name\r\n```"},"comment":{"url":"https://api.github.com/repos/Vauxoo/addons-vauxoo/issues/comments/221056637","html_url":"https://github.com/Vauxoo/addons-vauxoo/pull/965#issuecomment-221056637","issue_url":"https://api.github.com/repos/Vauxoo/addons-vauxoo/issues/965","id":221056637,"user":{"login":"dsabrinarg","id":7597456,"avatar_url":"https://avatars.githubusercontent.com/u/7597456?v=3","gravatar_id":"","url":"https://api.github.com/users/dsabrinarg","html_url":"https://github.com/dsabrinarg","followers_url":"https://api.github.com/users/dsabrinarg/followers","following_url":"https://api.github.com/users/dsabrinarg/following{/other_user}","gists_url":"https://api.github.com/users/dsabrinarg/gists{/gist_id}","starred_url":"https://api.github.com/users/dsabrinarg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsabrinarg/subscriptions","organizations_url":"https://api.github.com/users/dsabrinarg/orgs","repos_url":"https://api.github.com/users/dsabrinarg/repos","events_url":"https://api.github.com/users/dsabrinarg/events{/privacy}","received_events_url":"https://api.github.com/users/dsabrinarg/received_events","type":"User","site_admin":false},"created_at":"2016-05-23T18:35:21Z","updated_at":"2016-05-23T18:35:21Z","body":"👍  thanks @moylop260 "}}
{"actor":{"display_login":"dsabrinarg"}}