Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add "manage_checkouts" permission to Checkout model
Mateusz Dereniowski2bcca329ae84
diff --git a/saleor/checkout/migrations/0022_auto_20191219_1137.py b/saleor/checkout/migrations/0022_auto_20191219_1137.pynew file mode 100644index 0000000000..073b79ce74--- /dev/null+++ b/saleor/checkout/migrations/0022_auto_20191219_1137.py@@ -0,0 +1,18 @@+# Generated by Django 2.2.7 on 2019-12-19 17:37++from django.db import migrations+++class Migration(migrations.Migration):++ dependencies = [("checkout", "0021_django_price_2")]++ operations = [+ migrations.AlterModelOptions(+ name="checkout",+ options={+ "ordering": ("-last_change",),+ "permissions": (("manage_checkouts", "Manage checkouts"),),+ },+ )+ ]diff --git a/saleor/checkout/models.py b/saleor/checkout/models.pyindex 4711dad131..449b2be96d 100644--- a/saleor/checkout/models.py+++ b/saleor/checkout/models.py@@ -8,11 +8,13 @@ from django.contrib.postgres.fields import JSONFieldfrom django.core.validators import MinValueValidatorfrom django.db import modelsfrom django.utils.encoding import smart_str+from django.utils.translation import pgettext_lazyfrom django_prices.models import MoneyFieldfrom prices import Moneyfrom ..account.models import Addressfrom ..core.models import ModelWithMetadata+from ..core.permissions import CheckoutPermissionsfrom ..core.taxes import zero_moneyfrom ..core.weight import zero_weightfrom ..giftcard.models import GiftCard@@ -93,6 +95,12 @@ class Checkout(ModelWithMetadata):class Meta:ordering = ("-last_change",)+ permissions = (+ (+ CheckoutPermissions.MANAGE_CHECKOUTS.codename,+ pgettext_lazy("Permission description", "Manage checkouts"),+ ),+ )def __repr__(self):return "Checkout(quantity=%s)" % (self.quantity,)