{"action":"created","comment":{"url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/pulls/comments/52563632","id":52563632,"diff_hunk":"@@ -0,0 +1,478 @@\n+# -*- coding: utf-8 -*-\n+# © 2015 Eficent Business and IT Consulting Services S.L.\n+# - Jordi Ballester Alomar\n+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).\n+from openerp import api, fields, models, _\n+import openerp.addons.decimal_precision as dp\n+import time\n+from openerp.exceptions import Warning as UserError\n+\n+_STATES = [\n+    ('draft', 'Draft'),\n+    ('posted', 'Posted'),\n+    ('cancel', 'Cancelled')]\n+\n+\n+class StockInventoryRevaluation(models.Model):\n+\n+    _name = 'stock.inventory.revaluation'\n+    _description = 'Inventory revaluation'\n+\n+    @api.model\n+    def _default_journal(self):\n+        res = self.env['account.journal'].search([('type', '=', 'general')])\n+        return res and res[0] or False\n+\n+    name = fields.Char('Reference',\n+                       help=\"Reference for the journal entry\",\n+                       readonly=True,\n+                       required=True,\n+                       states={'draft': [('readonly', False)]},\n+                       default='/')\n+\n+    revaluation_type = fields.Selection(\n+        [('price_change', 'Price Change'),\n+         ('inventory_value', 'Inventory Debit/Credit')],\n+        string=\"Revaluation Type\",\n+        readonly=True, required=True,\n+        default='price_change',\n+        help=\"'Price Change': You can re-valuate inventory values by Changing \"\n+             \"the price for a specific product. The inventory price is \"\n+             \"changed and inventory value is recalculated according to the \"\n+             \"new price.\\n \"\n+             \"'Inventory Debit/Credit': Changing the value of the inventory. \"\n+             \"The quantity of inventory remains unchanged, resulting in a \"\n+             \"change in the price\",\n+        states={'draft': [('readonly', False)]})\n+\n+    remarks = fields.Text('Remarks',\n+                          help=\"Displays by default Inventory Revaluation. \"","path":"stock_inventory_revaluation/models/stock_inventory_revaluation.py","position":49,"original_position":49,"commit_id":"a1c8462b157b02308ce6d38afbd5b621a21f0f91","original_commit_id":"a1c8462b157b02308ce6d38afbd5b621a21f0f91","user":{"login":"elicoidal","id":7600613,"avatar_url":"https://avatars.githubusercontent.com/u/7600613?v=3","gravatar_id":"","url":"https://api.github.com/users/elicoidal","html_url":"https://github.com/elicoidal","followers_url":"https://api.github.com/users/elicoidal/followers","following_url":"https://api.github.com/users/elicoidal/following{/other_user}","gists_url":"https://api.github.com/users/elicoidal/gists{/gist_id}","starred_url":"https://api.github.com/users/elicoidal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elicoidal/subscriptions","organizations_url":"https://api.github.com/users/elicoidal/orgs","repos_url":"https://api.github.com/users/elicoidal/repos","events_url":"https://api.github.com/users/elicoidal/events{/privacy}","received_events_url":"https://api.github.com/users/elicoidal/received_events","type":"User","site_admin":false},"body":"By default Inventory Revaluation.","created_at":"2016-02-11T04:31:19Z","updated_at":"2016-02-11T04:31:19Z","html_url":"https://github.com/OCA/stock-logistics-warehouse/pull/118#discussion_r52563632","pull_request_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/pulls/118","_links":{"self":{"href":"https://api.github.com/repos/OCA/stock-logistics-warehouse/pulls/comments/52563632"},"html":{"href":"https://github.com/OCA/stock-logistics-warehouse/pull/118#discussion_r52563632"},"pull_request":{"href":"https://api.github.com/repos/OCA/stock-logistics-warehouse/pulls/118"}}},"pull_request":{"url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/pulls/118","id":58931421,"html_url":"https://github.com/OCA/stock-logistics-warehouse/pull/118","diff_url":"https://github.com/OCA/stock-logistics-warehouse/pull/118.diff","patch_url":"https://github.com/OCA/stock-logistics-warehouse/pull/118.patch","issue_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/issues/118","number":118,"state":"open","locked":false,"title":"[ADD] stock_inventory_revaluation","user":{"login":"jbeficent","id":7683926,"avatar_url":"https://avatars.githubusercontent.com/u/7683926?v=3","gravatar_id":"","url":"https://api.github.com/users/jbeficent","html_url":"https://github.com/jbeficent","followers_url":"https://api.github.com/users/jbeficent/followers","following_url":"https://api.github.com/users/jbeficent/following{/other_user}","gists_url":"https://api.github.com/users/jbeficent/gists{/gist_id}","starred_url":"https://api.github.com/users/jbeficent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbeficent/subscriptions","organizations_url":"https://api.github.com/users/jbeficent/orgs","repos_url":"https://api.github.com/users/jbeficent/repos","events_url":"https://api.github.com/users/jbeficent/events{/privacy}","received_events_url":"https://api.github.com/users/jbeficent/received_events","type":"User","site_admin":false},"body":"===================================\r\nStock Account Inventory Revaluation\r\n===================================\r\n\r\nIf your company runs a perpetual inventory system, you may need to perform\r\ninventory revaluation.\r\n\r\nYou can re-valuate inventory values by:\r\n\r\n* Changing the price for a specific product. The inventory price is changed\r\n  and inventory value is recalculated according to the new price. In case of\r\n  real price, you can select which quants you want to change the price on.\r\n\r\n* Changing the value of the inventory. The quantity of inventory remains\r\n  unchanged, resulting in a change in the price.\r\n\r\n\r\n\r\nConfiguration\r\n=============\r\n\r\n\r\n* Go to *Inventory / Configuration / Products / Product Categories* and\r\n  define, for each category, a Valuation Increase Account and a Valuation\r\n  Decrease Account. These accounts will be used as contra-accounts to the\r\n  Stock Valuation Account during the inventory re-valuation.\r\n\r\n\r\nUsage\r\n=====\r\n\r\n* Go to *Inventory / Inventory Control / Inventory Revaluation / Products*\r\n  to create a new Inventory Revaluation.","created_at":"2016-02-10T18:21:17Z","updated_at":"2016-02-11T04:31:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"73538220474b476b5603aa988616279927bd6922","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/pulls/118/commits","review_comments_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/pulls/118/comments","review_comment_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/issues/118/comments","statuses_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/statuses/a1c8462b157b02308ce6d38afbd5b621a21f0f91","head":{"label":"Eficent:8.0-stock_inventory_revaluation","ref":"8.0-stock_inventory_revaluation","sha":"a1c8462b157b02308ce6d38afbd5b621a21f0f91","user":{"login":"Eficent","id":7718403,"avatar_url":"https://avatars.githubusercontent.com/u/7718403?v=3","gravatar_id":"","url":"https://api.github.com/users/Eficent","html_url":"https://github.com/Eficent","followers_url":"https://api.github.com/users/Eficent/followers","following_url":"https://api.github.com/users/Eficent/following{/other_user}","gists_url":"https://api.github.com/users/Eficent/gists{/gist_id}","starred_url":"https://api.github.com/users/Eficent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Eficent/subscriptions","organizations_url":"https://api.github.com/users/Eficent/orgs","repos_url":"https://api.github.com/users/Eficent/repos","events_url":"https://api.github.com/users/Eficent/events{/privacy}","received_events_url":"https://api.github.com/users/Eficent/received_events","type":"Organization","site_admin":false},"repo":{"id":46787116,"name":"stock-logistics-warehouse","full_name":"Eficent/stock-logistics-warehouse","owner":{"login":"Eficent","id":7718403,"avatar_url":"https://avatars.githubusercontent.com/u/7718403?v=3","gravatar_id":"","url":"https://api.github.com/users/Eficent","html_url":"https://github.com/Eficent","followers_url":"https://api.github.com/users/Eficent/followers","following_url":"https://api.github.com/users/Eficent/following{/other_user}","gists_url":"https://api.github.com/users/Eficent/gists{/gist_id}","starred_url":"https://api.github.com/users/Eficent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Eficent/subscriptions","organizations_url":"https://api.github.com/users/Eficent/orgs","repos_url":"https://api.github.com/users/Eficent/repos","events_url":"https://api.github.com/users/Eficent/events{/privacy}","received_events_url":"https://api.github.com/users/Eficent/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Eficent/stock-logistics-warehouse","description":"Odoo Warehouse Management Addons","fork":true,"url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse","forks_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/forks","keys_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/teams","hooks_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/hooks","issue_events_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/issues/events{/number}","events_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/events","assignees_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/assignees{/user}","branches_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/branches{/branch}","tags_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/tags","blobs_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/git/refs{/sha}","trees_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/statuses/{sha}","languages_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/languages","stargazers_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/stargazers","contributors_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/contributors","subscribers_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/subscribers","subscription_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/subscription","commits_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/commits{/sha}","git_commits_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/git/commits{/sha}","comments_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/comments{/number}","issue_comment_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/issues/comments{/number}","contents_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/contents/{+path}","compare_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/merges","archive_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/downloads","issues_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/issues{/number}","pulls_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/pulls{/number}","milestones_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/milestones{/number}","notifications_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/labels{/name}","releases_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/releases{/id}","deployments_url":"https://api.github.com/repos/Eficent/stock-logistics-warehouse/deployments","created_at":"2015-11-24T11:23:19Z","updated_at":"2015-11-24T11:23:21Z","pushed_at":"2016-02-10T19:13:04Z","git_url":"git://github.com/Eficent/stock-logistics-warehouse.git","ssh_url":"git@github.com:Eficent/stock-logistics-warehouse.git","clone_url":"https://github.com/Eficent/stock-logistics-warehouse.git","svn_url":"https://github.com/Eficent/stock-logistics-warehouse","homepage":"","size":1670,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"9.0"}},"base":{"label":"OCA:8.0","ref":"8.0","sha":"3947c6ddb933cac1cc8b8f3369ca3c26461f6e6a","user":{"login":"OCA","id":7600578,"avatar_url":"https://avatars.githubusercontent.com/u/7600578?v=3","gravatar_id":"","url":"https://api.github.com/users/OCA","html_url":"https://github.com/OCA","followers_url":"https://api.github.com/users/OCA/followers","following_url":"https://api.github.com/users/OCA/following{/other_user}","gists_url":"https://api.github.com/users/OCA/gists{/gist_id}","starred_url":"https://api.github.com/users/OCA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OCA/subscriptions","organizations_url":"https://api.github.com/users/OCA/orgs","repos_url":"https://api.github.com/users/OCA/repos","events_url":"https://api.github.com/users/OCA/events{/privacy}","received_events_url":"https://api.github.com/users/OCA/received_events","type":"Organization","site_admin":false},"repo":{"id":20891354,"name":"stock-logistics-warehouse","full_name":"OCA/stock-logistics-warehouse","owner":{"login":"OCA","id":7600578,"avatar_url":"https://avatars.githubusercontent.com/u/7600578?v=3","gravatar_id":"","url":"https://api.github.com/users/OCA","html_url":"https://github.com/OCA","followers_url":"https://api.github.com/users/OCA/followers","following_url":"https://api.github.com/users/OCA/following{/other_user}","gists_url":"https://api.github.com/users/OCA/gists{/gist_id}","starred_url":"https://api.github.com/users/OCA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OCA/subscriptions","organizations_url":"https://api.github.com/users/OCA/orgs","repos_url":"https://api.github.com/users/OCA/repos","events_url":"https://api.github.com/users/OCA/events{/privacy}","received_events_url":"https://api.github.com/users/OCA/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OCA/stock-logistics-warehouse","description":"Odoo Warehouse Management Addons","fork":false,"url":"https://api.github.com/repos/OCA/stock-logistics-warehouse","forks_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/forks","keys_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/teams","hooks_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/hooks","issue_events_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/issues/events{/number}","events_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/events","assignees_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/assignees{/user}","branches_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/branches{/branch}","tags_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/tags","blobs_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/git/refs{/sha}","trees_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/statuses/{sha}","languages_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/languages","stargazers_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/stargazers","contributors_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/contributors","subscribers_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/subscribers","subscription_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/subscription","commits_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/commits{/sha}","git_commits_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/git/commits{/sha}","comments_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/comments{/number}","issue_comment_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/issues/comments{/number}","contents_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/contents/{+path}","compare_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/merges","archive_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/downloads","issues_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/issues{/number}","pulls_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/pulls{/number}","milestones_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/milestones{/number}","notifications_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/labels{/name}","releases_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/releases{/id}","deployments_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/deployments","created_at":"2014-06-16T16:08:03Z","updated_at":"2016-01-27T14:35:59Z","pushed_at":"2016-02-10T19:13:06Z","git_url":"git://github.com/OCA/stock-logistics-warehouse.git","ssh_url":"git@github.com:OCA/stock-logistics-warehouse.git","clone_url":"https://github.com/OCA/stock-logistics-warehouse.git","svn_url":"https://github.com/OCA/stock-logistics-warehouse","homepage":"","size":1939,"stargazers_count":23,"watchers_count":23,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":83,"mirror_url":null,"open_issues_count":39,"forks":83,"open_issues":39,"watchers":23,"default_branch":"9.0"}},"_links":{"self":{"href":"https://api.github.com/repos/OCA/stock-logistics-warehouse/pulls/118"},"html":{"href":"https://github.com/OCA/stock-logistics-warehouse/pull/118"},"issue":{"href":"https://api.github.com/repos/OCA/stock-logistics-warehouse/issues/118"},"comments":{"href":"https://api.github.com/repos/OCA/stock-logistics-warehouse/issues/118/comments"},"review_comments":{"href":"https://api.github.com/repos/OCA/stock-logistics-warehouse/pulls/118/comments"},"review_comment":{"href":"https://api.github.com/repos/OCA/stock-logistics-warehouse/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OCA/stock-logistics-warehouse/pulls/118/commits"},"statuses":{"href":"https://api.github.com/repos/OCA/stock-logistics-warehouse/statuses/a1c8462b157b02308ce6d38afbd5b621a21f0f91"}}}}