{"action":"closed","issue":{"url":"https://api.github.com/repos/django-oscar/django-oscar/issues/2031","repository_url":"https://api.github.com/repos/django-oscar/django-oscar","labels_url":"https://api.github.com/repos/django-oscar/django-oscar/issues/2031/labels{/name}","comments_url":"https://api.github.com/repos/django-oscar/django-oscar/issues/2031/comments","events_url":"https://api.github.com/repos/django-oscar/django-oscar/issues/2031/events","html_url":"https://github.com/django-oscar/django-oscar/issues/2031","id":144718909,"number":2031,"title":"Basket threshold not consistently enforced","user":{"login":"anziem","id":15231879,"avatar_url":"https://avatars.githubusercontent.com/u/15231879?v=3","gravatar_id":"","url":"https://api.github.com/users/anziem","html_url":"https://github.com/anziem","followers_url":"https://api.github.com/users/anziem/followers","following_url":"https://api.github.com/users/anziem/following{/other_user}","gists_url":"https://api.github.com/users/anziem/gists{/gist_id}","starred_url":"https://api.github.com/users/anziem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anziem/subscriptions","organizations_url":"https://api.github.com/users/anziem/orgs","repos_url":"https://api.github.com/users/anziem/repos","events_url":"https://api.github.com/users/anziem/events{/privacy}","received_events_url":"https://api.github.com/users/anziem/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/django-oscar/django-oscar/labels/%E2%98%81%20Bug","name":"☁ Bug","color":"F8C1C1"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-03-30T21:00:14Z","updated_at":"2016-08-13T06:05:44Z","closed_at":"2016-08-13T06:05:44Z","body":"oscar's is_quantity_allowed bases its answer on the basket's num_items before an update and the quantity in the proposed update. This is flawed because if you're updating the quantity for a line, it is double-counting the previous quantity for the line.\r\n\r\nSteps to reproduce bug:\r\n0) Set OSCAR_MAX_BASKET_QUANTITY_THRESHOLD in your settings to any number - say, 10.\r\n1) add a single item to your cart.\r\n2) update the quantity to be something less than the threshold, say 5\r\n3) try to update the quantity to something more than threshold - current quantity - say, 6\r\nResult:\r\nQuantity: 6\r\nError message: \"Due to technical limitations we are not able to ship more than 10 items in an order.\"\r\n\r\nRelevant code: \r\n\r\n\r\n        if basket_threshold:\r\n            total_basket_quantity = self.num_items\r\n            max_allowed = basket_threshold - total_basket_quantity\r\n            if qty > max_allowed:\r\n                return False, _(\r\n                    \"Due to technical limitations we are not able \"\r\n                    \"to ship more than %(threshold)d items in one order.\") \\\r\n                    % {'threshold': basket_threshold}\r\n\r\nin oscar/apps/basket/abstract_models.py\r\n![basket___flyshop_-_welcome_to_surround_video_](https://cloud.githubusercontent.com/assets/15231879/14157409/dd1edfda-f698-11e5-85b4-fd066cfef05d.png)\r\n"}}
{"actor":{"display_login":"mvantellingen"}}