Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add missing order number field to email order payload (#8287)
L3str4nge0b8697e46deb
diff --git a/saleor/order/notifications.py b/saleor/order/notifications.pyindex 8b3d382dd9..410ad5c550 100644--- a/saleor/order/notifications.py+++ b/saleor/order/notifications.py@@ -231,6 +231,7 @@ def get_default_order_payload(order: "Order", redirect_url: str = ""):order_payload = model_to_dict(order, fields=ORDER_MODEL_FIELDS)order_payload.update({+ "number": order.id,"channel_slug": order.channel.slug,"created": str(order.created),"shipping_price_net_amount": order.shipping_price_net_amount,diff --git a/saleor/order/tests/test_notifications.py b/saleor/order/tests/test_notifications.pyindex 24e5f052df..f455dc3b01 100644--- a/saleor/order/tests/test_notifications.py+++ b/saleor/order/tests/test_notifications.py@@ -26,6 +26,7 @@ def test_get_custom_order_payload(order):assert expected_payload == {"order": {"id": expected_payload["order"]["id"],+ "number": expected_payload["order"]["id"],"private_metadata": {},"metadata": {},"status": "unfulfilled",@@ -228,6 +229,7 @@ def test_get_default_order_payload(order_line):],"channel_slug": order.channel.slug,"id": order.id,+ "number": order.id,"token": order.token,"created": str(order.created),"display_gross_prices": order.display_gross_prices,diff --git a/saleor/plugins/admin_email/constants.py b/saleor/plugins/admin_email/constants.pyindex 52e32a2e15..66e6f6e92c 100644--- a/saleor/plugins/admin_email/constants.py+++ b/saleor/plugins/admin_email/constants.py@@ -34,7 +34,7 @@ CSV_EXPORT_FAILED_SUBJECT_FIELD = "csv_export_failed_subject"STAFF_PASSWORD_RESET_SUBJECT_FIELD = "staff_password_reset_subject"-STAFF_ORDER_CONFIRMATION_DEFAULT_SUBJECT = "Order {{ order.id }} details"+STAFF_ORDER_CONFIRMATION_DEFAULT_SUBJECT = "Order {{ order.number }} details"SET_STAFF_PASSWORD_DEFAULT_SUBJECT = "Set password e-mail"CSV_PRODUCT_EXPORT_SUCCESS_DEFAULT_SUBJECT = "Export products data"CSV_EXPORT_FAILED_DEFAULT_SUBJECT = "Export products data"diff --git a/saleor/plugins/user_email/constants.py b/saleor/plugins/user_email/constants.pyindex dfb5f454e4..e5507e341a 100644--- a/saleor/plugins/user_email/constants.py+++ b/saleor/plugins/user_email/constants.py@@ -84,13 +84,15 @@ ACCOUNT_CHANGE_EMAIL_CONFIRM_DEFAULT_SUBJECT = "Email change e-mail"ACCOUNT_CHANGE_EMAIL_REQUEST_DEFAULT_SUBJECT = "Email change e-mail"ACCOUNT_PASSWORD_RESET_DEFAULT_SUBJECT = "Password reset e-mail"INVOICE_READY_DEFAULT_SUBJECT = "Invoice"-ORDER_CONFIRMATION_DEFAULT_SUBJECT = "Order #{{ order.id }} details"-ORDER_CONFIRMED_DEFAULT_SUBJECT = "Order #{{ order.id }} confirmed"+ORDER_CONFIRMATION_DEFAULT_SUBJECT = "Order #{{ order.number }} details"+ORDER_CONFIRMED_DEFAULT_SUBJECT = "Order #{{ order.number }} confirmed"ORDER_FULFILLMENT_CONFIRMATION_DEFAULT_SUBJECT = (- "Your order {{ id }} has been fulfilled"+ "Your order {{ order.number }} has been fulfilled")-ORDER_FULFILLMENT_UPDATE_DEFAULT_SUBJECT = "Shipping update for order {{ order.id }}"-ORDER_PAYMENT_CONFIRMATION_DEFAULT_SUBJECT = "Order {{ order.id }} payment details"-ORDER_CANCELED_DEFAULT_SUBJECT = "Order {{ order.id }} canceled"-ORDER_REFUND_CONFIRMATION_DEFAULT_SUBJECT = "Order {{ order.id }} refunded"+ORDER_FULFILLMENT_UPDATE_DEFAULT_SUBJECT = (+ "Shipping update for order {{ order.number }}"+)+ORDER_PAYMENT_CONFIRMATION_DEFAULT_SUBJECT = "Order {{ order.number }} payment details"+ORDER_CANCELED_DEFAULT_SUBJECT = "Order {{ order.number }} canceled"+ORDER_REFUND_CONFIRMATION_DEFAULT_SUBJECT = "Order {{ order.number }} refunded"SEND_GIFT_CARD_DEFAULT_SUBJECT = "Gift card for {{ site_name }}"diff --git a/saleor/plugins/user_email/default_email_templates/order_cancel.html b/saleor/plugins/user_email/default_email_templates/order_cancel.htmlindex 41571b8736..6e3ccc69ec 100644--- a/saleor/plugins/user_email/default_email_templates/order_cancel.html+++ b/saleor/plugins/user_email/default_email_templates/order_cancel.html@@ -5,7 +5,7 @@<title></title>- <!--[if !mso]><!-- -->+ <!--[if !mso]><!--><meta http-equiv="X-UA-Compatible" content="IE=edge"><!--<![endif]--><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">@@ -57,19 +57,13 @@}</style></head>- <body>+ <body style="word-spacing:normal;"><div style>- <!--[if mso | IE]>- <table- align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600"- >- <tr>- <td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;">- <![endif]-->+ <!--[if mso | IE]><table align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]--><div style="margin:0px auto;max-width:600px;">@@ -78,47 +72,35 @@<tbody><tr><td style="direction: ltr; font-size: 0px; padding: 20px 0; text-align: center;" align="center">- <!--[if mso | IE]>- <table role="presentation" border="0" cellpadding="0" cellspacing="0">-- <tr>-- <td- class="" style="vertical-align:top;width:600px;"- >- <![endif]-->+ <!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td class="" style="vertical-align:top;width:600px;" ><![endif]--><div class="mj-column-per-100 mj-outlook-group-fix" style="font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;"><table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align:top;" width="100%">+ <tbody>- <tr>- <td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">+ <tr>+ <td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;"><div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">Hi!</div>- </td>- </tr>+ </td>+ </tr>- <tr>- <td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">+ <tr>+ <td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">Your order #{{order.id}} has been canceled.</div>+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">Your order #{{order.number}} has been canceled.</div>- </td>- </tr>+ </td>+ </tr>+ </tbody></table></div>- <!--[if mso | IE]>- </td>-- </tr>-- </table>- <![endif]-->+ <!--[if mso | IE]></td></tr></table><![endif]--></td></tr></tbody>@@ -127,17 +109,7 @@</div>- <!--[if mso | IE]>- </td>- </tr>- </table>-- <table- align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600"- >- <tr>- <td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;">- <![endif]-->+ <!--[if mso | IE]></td></tr></table><table align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]--><div style="margin:0px auto;max-width:600px;">@@ -146,39 +118,27 @@<tbody><tr><td style="direction: ltr; font-size: 0px; padding: 20px 0; text-align: center;" align="center">- <!--[if mso | IE]>- <table role="presentation" border="0" cellpadding="0" cellspacing="0">-- <tr>-- <td- class="" style="vertical-align:top;width:600px;"- >- <![endif]-->+ <!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td class="" style="vertical-align:top;width:600px;" ><![endif]--><div class="mj-column-per-100 mj-outlook-group-fix" style="font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;"><table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align:top;" width="100%">+ <tbody>- <tr>- <td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">+ <tr>+ <td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;"><div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">This is an automatically generated e-mail, please do not reply.</div>- </td>- </tr>+ </td>+ </tr>+ </tbody></table></div>- <!--[if mso | IE]>- </td>-- </tr>-- </table>- <![endif]-->+ <!--[if mso | IE]></td></tr></table><![endif]--></td></tr></tbody>@@ -187,17 +147,7 @@</div>- <!--[if mso | IE]>- </td>- </tr>- </table>-- <table- align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600"- >- <tr>- <td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;">- <![endif]-->+ <!--[if mso | IE]></td></tr></table><table align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]--><div style="background:#F2F2F2;background-color:#F2F2F2;margin:0px auto;max-width:600px;">@@ -206,39 +156,27 @@<tbody><tr><td style="direction: ltr; font-size: 0px; padding: 20px 0; text-align: center;" align="center">- <!--[if mso | IE]>- <table role="presentation" border="0" cellpadding="0" cellspacing="0">-- <tr>-- <td- class="" style="vertical-align:top;width:600px;"- >- <![endif]-->+ <!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td class="" style="vertical-align:top;width:600px;" ><![endif]--><div class="mj-column-per-100 mj-outlook-group-fix" style="font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;"><table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align:top;" width="100%">+ <tbody>- <tr>- <td align="center" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">+ <tr>+ <td align="center" style="font-size: 0px; padding: 10px 25px; word-break: break-word;"><div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">Sincerely, {{ site_name }}</div>- </td>- </tr>+ </td>+ </tr>+ </tbody></table></div>- <!--[if mso | IE]>- </td>-- </tr>-- </table>- <![endif]-->+ <!--[if mso | IE]></td></tr></table><![endif]--></td></tr></tbody>@@ -247,17 +185,7 @@</div>- <!--[if mso | IE]>- </td>- </tr>- </table>-- <table- align="center" border="0" cellpadding="0" cellspacing="0" class="no-display-outlook" style="width:600px;" width="600"- >- <tr>- <td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;">- <![endif]-->+ <!--[if mso | IE]></td></tr></table><table align="center" border="0" cellpadding="0" cellspacing="0" class="no-display-outlook" style="width:600px;" width="600" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]--><div class="no-display" style="display: none; margin: 0px auto; max-width: 600px;">@@ -266,22 +194,15 @@<tbody><tr><td style="direction: ltr; font-size: 0px; padding: 20px 0; text-align: center;" align="center">- <!--[if mso | IE]>- <table role="presentation" border="0" cellpadding="0" cellspacing="0">-- <tr>-- <td- class="" style="vertical-align:top;width:600px;"- >- <![endif]-->+ <!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td class="" style="vertical-align:top;width:600px;" ><![endif]--><div class="mj-column-per-100 mj-outlook-group-fix" style="font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;"><table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align:top;" width="100%">+ <tbody>- <tr>- <td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">+ <tr>+ <td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;"><div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#if order}}<script type="application/ld+json">@@ -289,20 +210,15 @@</script>{{/if}}</div>- </td>- </tr>+ </td>+ </tr>+ </tbody></table></div>- <!--[if mso | IE]>- </td>-- </tr>-- </table>- <![endif]-->+ <!--[if mso | IE]></td></tr></table><![endif]--></td></tr></tbody>@@ -311,11 +227,7 @@</div>- <!--[if mso | IE]>- </td>- </tr>- </table>- <![endif]-->+ <!--[if mso | IE]></td></tr></table><![endif]--></div>