Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Configurable logo path, descriptions
Tomasz Szymanski0ee5f1deea7f
diff --git a/saleor/graphql/invoice/mutations.py b/saleor/graphql/invoice/mutations.pyindex 65f78d85b5..dc68eb9fef 100644--- a/saleor/graphql/invoice/mutations.py+++ b/saleor/graphql/invoice/mutations.py@@ -16,7 +16,7 @@ from ..order.types import Orderclass RequestInvoice(ModelMutation):class Meta:- description = "Request an invoice for the order."+ description = "Request an invoice for the order using plugin."model = models.Invoicepermissions = (OrderPermissions.MANAGE_ORDERS,)error_type_class = InvoiceError@@ -27,7 +27,8 @@ class RequestInvoice(ModelMutation):required=True, description="ID of the order related to invoice.")number = graphene.String(- required=False, description="Invoice number (optional)."+ required=False,+ description="Invoice number, if not provided it will be generated.",)@classmethod@@ -90,7 +91,7 @@ class CreateInvoice(ModelMutation):)class Meta:- description = "Creates an invoice."+ description = "Creates a ready to send invoice."model = models.Invoicepermissions = (OrderPermissions.MANAGE_ORDERS,)error_type_class = InvoiceErrordiff --git a/saleor/graphql/invoice/types.py b/saleor/graphql/invoice/types.pyindex 95d4cfb511..aeec941f55 100644--- a/saleor/graphql/invoice/types.py+++ b/saleor/graphql/invoice/types.py@@ -7,7 +7,7 @@ from ..meta.types import ObjectWithMetadataclass Invoice(CountableDjangoObjectType):- url = graphene.String()+ url = graphene.String(description="URL to download an invoice.")class Meta:description = "Represents an Invoice."diff --git a/saleor/plugins/invoicing/plugin.py b/saleor/plugins/invoicing/plugin.pyindex eda00cde9f..0a28551e76 100644--- a/saleor/plugins/invoicing/plugin.py+++ b/saleor/plugins/invoicing/plugin.py@@ -26,7 +26,10 @@ class InvoicingPlugin(BasePlugin):file_content, creation_date = generate_invoice_pdf(invoice)invoice.created = creation_dateinvoice.update_invoice(number=generate_invoice_number())- invoice.invoice_file.save(f"{uuid4()}.pdf", ContentFile(file_content))+ invoice.invoice_file.save(+ f"invoice-{invoice.number}-order-{order.id}-{uuid4()}.pdf",+ ContentFile(file_content),+ )invoice.status = JobStatus.SUCCESSinvoice.save(update_fields=[diff --git a/saleor/plugins/invoicing/utils.py b/saleor/plugins/invoicing/utils.pyindex 580ae50dbc..daedf304d7 100644--- a/saleor/plugins/invoicing/utils.py+++ b/saleor/plugins/invoicing/utils.py@@ -57,7 +57,7 @@ def get_product_limit_first_page(products):def generate_invoice_pdf(invoice):- logo_path = static_finders.find("images/logo.svg")+ logo_path = static_finders.find(settings.INVOICE_LOGO_PATH)font_path = os.path.join(settings.PROJECT_ROOT, "templates", "invoices", "inter.ttf")diff --git a/saleor/settings.py b/saleor/settings.pyindex 32eb58d13d..57c968089d 100644--- a/saleor/settings.py+++ b/saleor/settings.py@@ -557,3 +557,5 @@ REDIS_URL = os.environ.get("REDIS_URL")if REDIS_URL:CACHE_URL = os.environ.setdefault("CACHE_URL", REDIS_URL)CACHES = {"default": django_cache_url.config()}++INVOICE_LOGO_PATH = os.environ.get("INVOICE_LOGO_PATH", "images/logo.svg")