{"action":"created","comment":{"url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/pulls/comments/28667170","id":28667170,"diff_hunk":"@@ -23,6 +25,106 @@ class Product:\n     \"Product extension for Nereid\"\n     __name__ = \"product.product\"\n \n+    display_available_quantity = fields.Boolean(\n+        \"Display Available Quantity On Website?\"\n+    )\n+\n+    start_displaying_qty_digits = fields.Function(\n+        fields.Integer('Start Quantity Digits'),\n+        getter='on_change_with_start_displaying_qty_digits'\n+    )\n+\n+    start_displaying_available_quantity = fields.Numeric(\n+        'Start Quantity', digits=(16, Eval('start_displaying_qty_digits', 2)),\n+        states={\n+            'invisible': ~Bool(Eval('display_available_quantity')),\n+        }, depends=[\n+            'display_available_quantity', 'start_displaying_qty_digits'\n+        ],\n+        help=\"To display quantity on website\"\n+    )\n+\n+    warehouse_quantity = fields.Numeric(\n+        'Warehouse Quantity', digits=(16, 4),\n+        help=\"Quantity required in warehouse for orders\"\n+    )\n+\n+    is_eligible_to_buy = fields.Function(\n+        fields.Boolean(\"Is Eligible For Purchase?\"),\n+        getter=\"get_is_eligible_to_buy\"\n+    )\n+\n+    show_quantity_on_website = fields.Function(\n+        fields.Boolean(\"Show Quantity on Website?\"),\n+        getter=\"get_show_quantity_on_website\"\n+    )\n+\n+    @classmethod\n+    def __setup__(cls):\n+        super(Product, cls).__setup__()\n+\n+        cls._error_messages.update({\n+            'start_displaying_positive': (\n+                'This quantity should be always be positive'\n+            ),\n+        })\n+\n+    @classmethod\n+    def validate(cls, records):\n+        \"\"\"\n+        Validation method\n+        \"\"\"\n+        super(Product, cls).validate(records)\n+\n+        for record in records:\n+            record.validate_start_display_quantity()\n+\n+    def validate_start_display_quantity(self):\n+        \"\"\"\n+        This method validates that `start_displaying_available_quantity` is\n+        always positive.\n+        \"\"\"\n+        if self.start_displaying_available_quantity and \\\n+                self.start_displaying_available_quantity < 0:\n+            self.raise_user_error('start_displaying_positive')\n+\n+    @fields.depends('_parent_template')\n+    def on_change_with_start_displaying_qty_digits(self, name=None):\n+        \"\"\"\n+        Getter for start_displaying_qty_digits\n+        \"\"\"\n+        return self.template.default_uom.digits or \\\n+            self.default_start_displaying_qty_digits()","path":"product.py","position":82,"original_position":82,"commit_id":"5d9ee984501a1e41acf0f5f5fd3cda062c51c11c","original_commit_id":"5d9ee984501a1e41acf0f5f5fd3cda062c51c11c","user":{"login":"tarunbhardwaj","id":3259423,"avatar_url":"https://avatars.githubusercontent.com/u/3259423?v=3","gravatar_id":"","url":"https://api.github.com/users/tarunbhardwaj","html_url":"https://github.com/tarunbhardwaj","followers_url":"https://api.github.com/users/tarunbhardwaj/followers","following_url":"https://api.github.com/users/tarunbhardwaj/following{/other_user}","gists_url":"https://api.github.com/users/tarunbhardwaj/gists{/gist_id}","starred_url":"https://api.github.com/users/tarunbhardwaj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tarunbhardwaj/subscriptions","organizations_url":"https://api.github.com/users/tarunbhardwaj/orgs","repos_url":"https://api.github.com/users/tarunbhardwaj/repos","events_url":"https://api.github.com/users/tarunbhardwaj/events{/privacy}","received_events_url":"https://api.github.com/users/tarunbhardwaj/received_events","type":"User","site_admin":false},"body":"use directly 2","created_at":"2015-04-20T07:00:31Z","updated_at":"2015-04-20T07:00:31Z","html_url":"https://github.com/openlabs/nereid-cart-b2c/pull/97#discussion_r28667170","pull_request_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/pulls/97","_links":{"self":{"href":"https://api.github.com/repos/openlabs/nereid-cart-b2c/pulls/comments/28667170"},"html":{"href":"https://github.com/openlabs/nereid-cart-b2c/pull/97#discussion_r28667170"},"pull_request":{"href":"https://api.github.com/repos/openlabs/nereid-cart-b2c/pulls/97"}}},"pull_request":{"url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/pulls/97","id":33529843,"html_url":"https://github.com/openlabs/nereid-cart-b2c/pull/97","diff_url":"https://github.com/openlabs/nereid-cart-b2c/pull/97.diff","patch_url":"https://github.com/openlabs/nereid-cart-b2c/pull/97.patch","issue_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/issues/97","number":97,"state":"open","locked":false,"title":"Added fields to Product for available quantity manipulation #7588","user":{"login":"PritishC","id":1412833,"avatar_url":"https://avatars.githubusercontent.com/u/1412833?v=3","gravatar_id":"","url":"https://api.github.com/users/PritishC","html_url":"https://github.com/PritishC","followers_url":"https://api.github.com/users/PritishC/followers","following_url":"https://api.github.com/users/PritishC/following{/other_user}","gists_url":"https://api.github.com/users/PritishC/gists{/gist_id}","starred_url":"https://api.github.com/users/PritishC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PritishC/subscriptions","organizations_url":"https://api.github.com/users/PritishC/orgs","repos_url":"https://api.github.com/users/PritishC/repos","events_url":"https://api.github.com/users/PritishC/events{/privacy}","received_events_url":"https://api.github.com/users/PritishC/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-04-17T09:57:32Z","updated_at":"2015-04-20T07:00:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"805e9ef038ce65c76e80f271e42c20cc5e475d0f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/pulls/97/commits","review_comments_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/pulls/97/comments","review_comment_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/issues/97/comments","statuses_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/statuses/5d9ee984501a1e41acf0f5f5fd3cda062c51c11c","head":{"label":"PritishC:feature/task-7588","ref":"feature/task-7588","sha":"5d9ee984501a1e41acf0f5f5fd3cda062c51c11c","user":{"login":"PritishC","id":1412833,"avatar_url":"https://avatars.githubusercontent.com/u/1412833?v=3","gravatar_id":"","url":"https://api.github.com/users/PritishC","html_url":"https://github.com/PritishC","followers_url":"https://api.github.com/users/PritishC/followers","following_url":"https://api.github.com/users/PritishC/following{/other_user}","gists_url":"https://api.github.com/users/PritishC/gists{/gist_id}","starred_url":"https://api.github.com/users/PritishC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PritishC/subscriptions","organizations_url":"https://api.github.com/users/PritishC/orgs","repos_url":"https://api.github.com/users/PritishC/repos","events_url":"https://api.github.com/users/PritishC/events{/privacy}","received_events_url":"https://api.github.com/users/PritishC/received_events","type":"User","site_admin":false},"repo":{"id":28076829,"name":"nereid-cart-b2c","full_name":"PritishC/nereid-cart-b2c","owner":{"login":"PritishC","id":1412833,"avatar_url":"https://avatars.githubusercontent.com/u/1412833?v=3","gravatar_id":"","url":"https://api.github.com/users/PritishC","html_url":"https://github.com/PritishC","followers_url":"https://api.github.com/users/PritishC/followers","following_url":"https://api.github.com/users/PritishC/following{/other_user}","gists_url":"https://api.github.com/users/PritishC/gists{/gist_id}","starred_url":"https://api.github.com/users/PritishC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PritishC/subscriptions","organizations_url":"https://api.github.com/users/PritishC/orgs","repos_url":"https://api.github.com/users/PritishC/repos","events_url":"https://api.github.com/users/PritishC/events{/privacy}","received_events_url":"https://api.github.com/users/PritishC/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/PritishC/nereid-cart-b2c","description":"Shopping Cart Module for Tryton Nereid eCommerce Platform","fork":true,"url":"https://api.github.com/repos/PritishC/nereid-cart-b2c","forks_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/forks","keys_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/teams","hooks_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/hooks","issue_events_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/issues/events{/number}","events_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/events","assignees_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/assignees{/user}","branches_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/branches{/branch}","tags_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/tags","blobs_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/git/refs{/sha}","trees_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/statuses/{sha}","languages_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/languages","stargazers_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/stargazers","contributors_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/contributors","subscribers_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/subscribers","subscription_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/subscription","commits_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/commits{/sha}","git_commits_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/git/commits{/sha}","comments_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/comments{/number}","issue_comment_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/issues/comments{/number}","contents_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/contents/{+path}","compare_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/merges","archive_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/downloads","issues_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/issues{/number}","pulls_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/pulls{/number}","milestones_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/milestones{/number}","notifications_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/labels{/name}","releases_url":"https://api.github.com/repos/PritishC/nereid-cart-b2c/releases{/id}","created_at":"2014-12-16T08:05:19Z","updated_at":"2014-12-16T08:05:19Z","pushed_at":"2015-04-18T14:45:35Z","git_url":"git://github.com/PritishC/nereid-cart-b2c.git","ssh_url":"git@github.com:PritishC/nereid-cart-b2c.git","clone_url":"https://github.com/PritishC/nereid-cart-b2c.git","svn_url":"https://github.com/PritishC/nereid-cart-b2c","homepage":"","size":500,"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":"develop"}},"base":{"label":"openlabs:develop","ref":"develop","sha":"71366117d64441157a1097edb3464ba856236f52","user":{"login":"openlabs","id":777983,"avatar_url":"https://avatars.githubusercontent.com/u/777983?v=3","gravatar_id":"","url":"https://api.github.com/users/openlabs","html_url":"https://github.com/openlabs","followers_url":"https://api.github.com/users/openlabs/followers","following_url":"https://api.github.com/users/openlabs/following{/other_user}","gists_url":"https://api.github.com/users/openlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/openlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openlabs/subscriptions","organizations_url":"https://api.github.com/users/openlabs/orgs","repos_url":"https://api.github.com/users/openlabs/repos","events_url":"https://api.github.com/users/openlabs/events{/privacy}","received_events_url":"https://api.github.com/users/openlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":2084399,"name":"nereid-cart-b2c","full_name":"openlabs/nereid-cart-b2c","owner":{"login":"openlabs","id":777983,"avatar_url":"https://avatars.githubusercontent.com/u/777983?v=3","gravatar_id":"","url":"https://api.github.com/users/openlabs","html_url":"https://github.com/openlabs","followers_url":"https://api.github.com/users/openlabs/followers","following_url":"https://api.github.com/users/openlabs/following{/other_user}","gists_url":"https://api.github.com/users/openlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/openlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openlabs/subscriptions","organizations_url":"https://api.github.com/users/openlabs/orgs","repos_url":"https://api.github.com/users/openlabs/repos","events_url":"https://api.github.com/users/openlabs/events{/privacy}","received_events_url":"https://api.github.com/users/openlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openlabs/nereid-cart-b2c","description":"Shopping Cart Module for Tryton Nereid eCommerce Platform","fork":false,"url":"https://api.github.com/repos/openlabs/nereid-cart-b2c","forks_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/forks","keys_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/teams","hooks_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/hooks","issue_events_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/issues/events{/number}","events_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/events","assignees_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/assignees{/user}","branches_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/branches{/branch}","tags_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/tags","blobs_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/git/refs{/sha}","trees_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/statuses/{sha}","languages_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/languages","stargazers_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/stargazers","contributors_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/contributors","subscribers_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/subscribers","subscription_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/subscription","commits_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/commits{/sha}","git_commits_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/git/commits{/sha}","comments_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/comments{/number}","issue_comment_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/issues/comments{/number}","contents_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/contents/{+path}","compare_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/merges","archive_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/downloads","issues_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/issues{/number}","pulls_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/pulls{/number}","milestones_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/milestones{/number}","notifications_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/labels{/name}","releases_url":"https://api.github.com/repos/openlabs/nereid-cart-b2c/releases{/id}","created_at":"2011-07-21T16:24:36Z","updated_at":"2015-04-14T05:27:30Z","pushed_at":"2015-04-18T14:45:35Z","git_url":"git://github.com/openlabs/nereid-cart-b2c.git","ssh_url":"git@github.com:openlabs/nereid-cart-b2c.git","clone_url":"https://github.com/openlabs/nereid-cart-b2c.git","svn_url":"https://github.com/openlabs/nereid-cart-b2c","homepage":"","size":1395,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":6,"forks":20,"open_issues":6,"watchers":2,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/openlabs/nereid-cart-b2c/pulls/97"},"html":{"href":"https://github.com/openlabs/nereid-cart-b2c/pull/97"},"issue":{"href":"https://api.github.com/repos/openlabs/nereid-cart-b2c/issues/97"},"comments":{"href":"https://api.github.com/repos/openlabs/nereid-cart-b2c/issues/97/comments"},"review_comments":{"href":"https://api.github.com/repos/openlabs/nereid-cart-b2c/pulls/97/comments"},"review_comment":{"href":"https://api.github.com/repos/openlabs/nereid-cart-b2c/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openlabs/nereid-cart-b2c/pulls/97/commits"},"statuses":{"href":"https://api.github.com/repos/openlabs/nereid-cart-b2c/statuses/5d9ee984501a1e41acf0f5f5fd3cda062c51c11c"}}}}