Commits

Simone Deponti  committed 4580dec

Polished new document generation feature.

  • Participants
  • Parent commits 161daec

Comments (0)

Files changed (17)

File docs/configuration.txt

 
     Whether or not SSL should be enabled for the checkout modules.
 
+  ``'DOCUMENT_CONVERTER'``
+
+    :default: ``'shipping.views.HTMLDocument'``
+
+    Which document generation system to use. See :ref:`documents_settings`.
+
 2. In addition to the Satchmo specific settings, there are some Django settings you will want to make sure are properly set:
 
     - Make sure that your ``DATABASES['default']['ENGINE']`` variable is also set correctly.
 The ``L10N_SETTINGS`` variable also allows you to control whether or not translation fields
 should be displayed in the admin. In the example above, they will be disabled. The default is ``True``
 
+.. index::
+   single: settings; PDF
+   single: settings; documents
+
+.. _documents_settings:
+
+Setting up document generation
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. versionchanged: 0.9.3
+
+Satchmo is able to generate a various range of *documents*
+that generally need to be printed on plain old paper
+or on an equivalent electronic format
+(such as :abbr:`PDF (Portable Document Format)`).
+
+Examples of these documents are invoices,
+packing slips and shipping labels
+(although the system can be adapted to much more than this).
+
+By default, Satchmo renders these documents as normal HTML pages,
+which have been slightly optimized for direct printing
+(i.e. from the browser).
+
+Should this not be enough for you,
+Satchmo also includes two (optional) ways
+to export said documents in :abbr:`PDF (Portable Document Format)`:
+one based on trml2pdf_ and the other based on wkhtml2pdf_.
+
+Which system to use is controlled by the ``'DOCUMENT_CONVERTER'`` key
+within the ``SATCHMO_SETTINGS`` dictionary,
+which should contain
+the full dotted path of the *document converter* to use.
+
+wkhtmltopdf
+"""""""""""
+
+wkhtmltopdf_ is a program that contains a statically compiled,
+headless WebKit rendering engine
+(which is the basis of succesful browsers
+such as Safari, Google Chrome,
+and the default browsers on the two most popular mobile platforms).
+
+Installing it is as simple as downloading and unzipping the release
+for the platform you are using.
+After doing that, keep note of the directory where you have unzipped
+the release, and then enable it in your settings file.
+
+To do the latter, set the ``'DOCUMENT_CONVERTER'`` key
+within ``SATCHMO_SETTINGS`` dictionary
+to ``'shipping.views.WKHTMLDocument'``.
+Then you must tell Satchmo where the wkhtmltopdf_ binary can be found,
+by adding a ``'WKHTML2PDF_BINARIES'`` key in the dictionary,
+whose value is another dictionary
+where the keys are the operating system categories
+as reported by ``sys.platform``
+and the values are the absolute paths to the corresponding wkhtmltopdf_
+binary.
+
+.. Note::
+   You are **not required** to fill in a key for each platform:
+   the key of the platform you are on is sufficient.
+
+The values for the keys can be obtained by looking at the documentation
+for the core module ``sys``,
+but here is a quick,
+non authoritative and incomplete list:
+
+    * ``linux2`` for Linux (``linux`` on Python 3.3 and above)
+    * ``darwin`` for Mac OS X
+    * ``win32`` for Windows
+
+Therefore, if you are on a Linux machine you will do::
+
+    SATCHMO_SETTINGS = {
+        ...
+        'DOCUMENT_CONVERTER': 'shipping.views.WKHTMLDocument',
+        'WKHTML2PDF_BINARIES': {
+            'linux2': '/path/to/wkhtmltopdf-i386'
+        },
+        ...
+    }
+
+While on Mac OS X you will do::
+
+    SATCHMO_SETTINGS = {
+        ...
+        'DOCUMENT_CONVERTER': 'shipping.views.WKHTMLDocument',
+        'WKHTML2PDF_BINARIES': {
+            'darwin': '/path/to/wkhtmltopdf'
+        },
+        ...
+    }
+
+.. _document_settings_trml2pdf:
+
+trml2pdf
+""""""""
+
+If you wish to use trml2pdf_, you must first install Reportlab
+(based on the description for your OS
+`here <http://www.reportlab.com/software/opensource/rl-toolkit/download/>`_)
+and then trml2pdf_ itself::
+
+    pip install http://www.satchmoproject.com/snapshots/trml2pdf-1.2.tar.gz
+
+Then you must set the ``'DOCUMENT_CONVERTER'`` key
+within ``SATCHMO_SETTINGS`` dictionary
+to ``'shipping.views.TRMLDocument'``.
+
+Customizing templates
+"""""""""""""""""""""
+
+If you wish to customize templates,
+keep in mind that they are located in ``shop/docs/html``
+within the ``shop`` application
+for HTML templates
+(used by the default HTML generator, and by the wkhtmltopdf_ one)
+and within ``shop/docs/rml``
+for the trml2pdf_ ones.
+
+Developing your own
+"""""""""""""""""""
+
+If you wish to develop your own *document converter*, take a look at
+``shipping.views`` and implement a class with the same methods as
+``HTMLDocument``.
+
+You will then be able to activate it by setting ``'DOCUMENT_CONVERTER'``
+to your class *full dotted name*
+(e.g. ``'my.module.converter.MyDocument``)
+
 .. Note::
     If you use a unicode character, you'll need to have an encoding at the top
     of your settings.py file::
 
 .. _Authorize.net: http://www.authorize.net/
 .. _Mailman: http://www.gnu.org/software/mailman/
+.. _trml2pdf: http://pypi.python.org/pypi/trml2pdf/
+.. _wkhtmltopdf: http://code.google.com/p/wkhtmltopdf/

File docs/new_installation.txt

 #. Install required dependencies (this may vary based on your OS of choice)::
 
         pip install pycrypto
-        pip install http://www.satchmoproject.com/snapshots/trml2pdf-1.2.tar.gz
         pip install pyyaml
 
 #. Install Python Imaging Library. There are multiple options for installing
 
        sudo apt-get install python-imaging
 
-#. Install Reportlab based on the description for your OS `here <http://www.reportlab.com/software/opensource/rl-toolkit/download/>`_
-
 #. Install django-threaded-multihost::
 
         pip install django-threaded-multihost

File docs/release-notes-0-9-3.txt

  * Added Paypal Payflowpro payment module
  * Updated all templates to use `Django static files <https://docs.djangoproject.com/en/dev/howto/static-files/>`_
  * Send email to gift certificate recipients
+ * Rewritted PDF (document) generation, removed trml2pdf and Reportlab dependencies: please see :ref:`document_settings_trml2pdf` and the migration notes when upgrading
 
 Translations
 ------------
 Migration Notes
 ---------------
 
+PDF generation
+++++++++++++++
+
+If you wish to maintain the ``trml2pdf`` PDF generation (recommended if you
+have customized templates) for invoices, packing slips and shipping labels,
+you must set the ``'DOCUMENT_CONVERTER'`` key
+within ``SATCHMO_SETTINGS`` to ``'shipping.views.TRMLDocument'``::
+
+    SATCHMO_SETTINGS = {
+        ...
+        'DOCUMENT_CONVERTER': 'shipping.views.TRMLDocument',
+        ...
+    }
+
+You should also move your templates, as the following template renames happened
+(here is indicated only the *template path*, from ``templates/`` onward):
+
+    * ``shop/pdf/invoice.rml`` → ``shop/docs/rml/invoice.rml``
+    * ``shop/pdf/packing-slip.rml`` → ``shop/docs/rml/packingslip.rml``
+    * ``shop/pdf/shipping-label.rml`` → ``shop/docs/rml/shippinglabel.rml``
+
+See :ref:`document_settings` for more details.
+
 Sorl Thumbnail
 ++++++++++++++
 In `rev 2449 <http://bitbucket.org/chris1610/satchmo/changeset/9fb522d26404>`_ Satchmo is updated to use the latest Sorl Thumbnail code.

File satchmo/apps/satchmo_store/shop/templates/shop/docs/html/billing_and_shipping.html

+{% load i18n %}
+<div id="billing" class="billing-and-shipping">
+  <h3>{% trans "Billed to" %}</h3>
+  {% if order.bill_addressee %}
+  <p>{{order.bill_addressee}}</p>
+  {% endif %}
+  {% if order.bill_street1 %}
+  <p>{{order.bill_street1}}</p>
+  {% endif %}
+  {% if order.bill_street1 %}
+  <p>{{order.bill_street2}}</p>
+  {% endif %}
+  <p>
+    {% if order.bill_city %}{{order.bill_city}}{% endif %}{% if order.bill_state or order.bill_postal_code %},{% endif %}
+    {% if order.bill_postal_code %}{{order.bill_postal_code}}{% endif %}
+    {% if order.bill_state %}{{order.bill_state}}{% endif %}
+  </p>
+  {% if order.bill_country %}
+  <p>
+    {{order.bill_country}}
+  </p>
+  {% endif %}
+  {% if order.contact.primary_phone.phone or order.contact.email %}
+  <dl>
+    {% if order.contact.primary_phone.phone %}
+    <dt>{% trans "Phone" %}:</dt>
+    <dd>{{order.contact.primary_phone.phone}}</dd>
+    {% endif %}
+    {% if order.contact.email %}
+    <dt>{% trans "Email" %}:</dt>
+    <dd>{{order.contact.email}}</dd>
+    {% endif %}
+  </dl>
+  {% endif %}
+</div>
+<div id="shipping" class="billing-and-shipping">
+  <h3>{% trans "Shipped to" %}</h3>
+  {% if order.ship_addressee %}
+  <p>{{order.ship_addressee}}</p>
+  {% endif %}
+  {% if order.ship_street1 %}
+  <p>{{order.ship_street1}}</p>
+  {% endif %}
+  {% if order.ship_street1 %}
+  <p>{{order.ship_street2}}</p>
+  {% endif %}
+  <p>
+    {% if order.ship_city %}{{order.ship_city}}{% endif %}{% if order.ship_state or order.ship_postal_code %},{% endif %}
+    {% if order.ship_postal_code %}{{order.ship_postal_code}}{% endif %}
+    {% if order.ship_state %}{{order.ship_state}}{% endif %}
+  </p>
+  {% if order.ship_country %}
+  <p>
+    {{order.ship_country}}
+  </p>
+  {% endif %}
+</div>
+

File satchmo/apps/satchmo_store/shop/templates/shop/docs/html/header.html

+{% load i18n %}
+<div id="header">
+  <div id="logo">
+    {% if iconURI %}
+    <img src="{{iconURI}}" />
+    {% endif %}
+  </div>
+  <div id="shop-info">
+    <h3>{{shopDetails.store_name}}</h3>
+    <div>
+      {% if shopDetails.street1 %}
+      <p>{{shopDetails.street1}}</p>
+      {% endif %}
+      {% if shopDetails.street1 %}
+      <p>{{shopDetails.street2}}</p>
+      {% endif %}
+      <p>
+        {% if shopDetails.city %}{{shopDetails.city}}{% endif %}{% if shopDetails.state or shopDetails.postal_code %},{% endif %}
+        {% if shopDetails.postal_code %}{{shopDetails.postal_code}}{% endif %}
+        {% if shopDetails.state %}{{shopDetails.state}}{% endif %}
+      </p>
+      {% if shopDetails.country %}
+      <p>
+        {{shopDetails.country.name}}
+      </p>
+      {% endif %}
+    </div>
+    {% if shopDetails.phone or shopDetails.store_email %}
+    <dl>
+      {% if shopDetails.phone %}
+      <dt>{% trans "Phone" %}:</dt>
+      <dd>{{shopDetails.phone}}</dd>
+      {% endif %}
+      {% if shopDetails.store_email %}
+      <dt>{% trans "Email" %}:</dt>
+      <dd>{{shopDetails.store_email}}</dd>
+      {% endif %}
+    </dl>
+    {% endif %}
+  </div>
+</div>

File satchmo/apps/satchmo_store/shop/templates/shop/docs/html/invoice.html

-<!DOCTYPE HTML PUBLIC "-//w3c//DTD HTML 4.0 Frameset//EN">
+<!DOCTYPE html>
 {% load i18n satchmo_currency %}
 <html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-    <style type="text/css">
-        p {margin:0px; font-size:12px;}
-        td {font-size:14px;}
-        p.conditions {font-size:13.0px; text-align:justify}
-        p.name {font-size:17.0px}
-        p.payment {font-size:19.0px}
-    </style>
-</head>
-<body>
-    <img src='{{ iconURI }}' width='80' height='72' />
-    <div id="tiny_data">
-        <table border='0' cellpadding='0' cellspacing='0'><tr><td width='396'></td><td style='color:(0,0,0);font-size:10px' width='0'></td><td width='113' align='right' style='color:(0,0,0);font-size:10px'>{{ order.id }}</td></tr></table><table border='0' cellpadding='0' cellspacing='0'><tr><td width='396'></td><td style='color:(0,0,0);font-size:10px' width='0'></td><td width='113' align='right' style='color:(0,0,0);font-size:10px'></td></tr></table><table border='0' cellpadding='0' cellspacing='0'><tr><td width='212'></td><td style='color:(0,0,0);font-size:14px' width='0'></td><td width='170'></td><td style='color:(0,0,0);font-size:14px' width='0'></td></tr></table><table border='0' cellpadding='0' cellspacing='0'><tr><td width='28'></td><td style='color:(0,0,0);font-size:12px' width='0'>{{shopDetails.street1}}</td></tr></table><table border='0' cellpadding='0' cellspacing='0'><tr><td width='28'></td><td style='color:(0,0,0);font-size:12px' width='0'>{{shopDetails.city}} {{shopDetails.state}}, {{shopDetails.postal_code}}</td></tr></table><table border='0' cellpadding='0' cellspacing='0'><tr><td width='28'></td><td style='color:(0,0,0);font-size:12px' width='0'>{{shopDetails.phone}}</td></tr></table><table border='0' cellpadding='0' cellspacing='0'><tr><td width='28'></td><td style='color:(0,0,0);font-size:12px' width='0'>{{shopDetails.store_email}}</td></tr></table><table border='0' cellpadding='0' cellspacing='0'><tr><td width='28'></td><td style='color:(0,0,0);font-size:12px' width='0'>{{shopDetails.store_email}}</td></tr></table><table border='0' width='509'><tr><td width='368'>&nbsp;</td><td><p style='name' class='name'>{{order.bill_addressee}}</p>
-    <p>{{order.bill_street1}}</p>
-    <p>{{order.bill_street2}}</p>
-    <p>{{order.bill_city}}, {{order.bill_state}}</p>
-    <p>{{order.bill_postal_code}}</p>
-    <br/><p>{% trans 'Phone' %}: {{order.contact.primary_phone.phone}}</p>
-    <p>{% trans 'Email' %}: {{order.contact.email}}</p>
+  <head>
+    <title>
+      {% blocktrans with order_id=order.id shop_name=shopDetails.store_name %}
+        {{shop_name}} ― Invoice for order #{{order_id}}
+      {% endblocktrans %}
+    </title>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+    <style type="text/css">/*<![CDATA[*/
+    {% include "shop/docs/html/styles.css" %}
+    /*]]>*/</style>
+  </head>
+  <body>
+    {% include "shop/docs/html/navbar.html" with document_name=_("Invoice") %}
+    <div id="wrapper">
+      {% include "shop/docs/html/header.html" %}
+      <h1>
+        {% blocktrans with order_id=order.id %}
+        Invoice for order #{{order_id}}
+        {% endblocktrans %}
+      </h1>
 
-    </td></tr></table><br/><br/><table border='0' cellpadding='0' cellspacing='0'><tr><td width='623' align='center' style='color:(0,0,0);font-size:16px'></td></tr></table><table border='0' width='566'><tr><td width='28'>&nbsp;</td><td><p style='name' class='name'>{{order.ship_addressee}}</p>
-    <p>{{order.ship_street1}}</p>
-    <p>{{order.ship_street2}}</p>
-    <p>{{order.ship_city}}, {{order.ship_state}}</p>
-    <p>{{order.ship_postal_code}}</p>
-    <br/></td></tr></table><br/><br/><br/><table colWidths='7cm, 3.0cm, 3.0cm, 3.0cm, 3.0cm' style='products'>
-    <tr>
-        <td>{% trans 'Description' %}</td>
-        <td>{% trans 'Quantity' %}</td>
-        <td>{% trans 'Unit Price' %}</td>
-	<td>{% trans 'Discount' %}</td>
-        <td>{% trans 'Total' %}</td>
-    </tr>
-    {% for item in order.orderitem_set.all %}
-    <tr>
-        <td><p>{{ item.product.name|fix_ampersands }}</p></td>
-        <p>{{ item.quantity }} </p>
-        <p>{{ item.unit_price|currency }}</p>
-	<p>{{ item.discount|currency }}</p>
-        <p>{{ item.sub_total|currency }} </p>
-    </tr>
-    {% endfor %}
-    <tr><p></p></tr>
-    <tr><p></p></tr>
-    <tr><p></p></tr>
-    <tr><p></p></tr>
-    <tr><p></p></tr>
-    <tr><td width='198.42519685'/><td width='False'/><td width='False'/><td width='False'/><td width='False'/></tr></table>
-    <table colWidths='7cm, 3.0cm, 3.0cm, 3.0cm, 3.0cm' style='products2'>
-    <tr>
-        <p></p><p></p><p></p>
-        <td>{% trans 'Subtotal' %}:</td><p>{{order.sub_total|currency}}</p>
-    </tr>
-    {% if order.discount %}
-    <tr>
-	<p></p><p></p><p></p>
-	<td>{% trans 'Discount' %}:</td><p>- {{order.item_discount|currency}}</p>
-    </tr>
-    {% endif %}
-    <tr>
-        <p></p><p></p>
-        <p></p><p>{{order.shipping_method}} - {{order.shipping_description}}</p><p>{{order.shipping_cost|currency}}</p>
-    </tr>
-    {% if order.shipping_discount %}
-    <tr>
-        <p></p><p></p><p></p>
-        <td>{% trans 'Shipping Discount' %}</td><p>- {{ order.shipping_discount|currency }}</p>
-    </tr>
-    {% endif %}
-    <tr>
-        <p></p><p></p><p></p>
-        <td>{% trans 'Tax' %}:</td><p>{{order.tax|currency}}</p>
-    </tr><tr>
-        <p></p><p></p><p></p>
-        <td>{% trans 'Total' %}:</td><p>{{order.total|currency}}</p>
-    </tr>
-    <tr>
-	<p></p><p></p><p></p>
-	<td>{% trans 'Payments Made' %}</td><p>- {{ order.balance_paid|currency }}</p>
-    </tr>
-    <tr>
-	<p></p><p></p><p></p>
-        <td>{% trans 'Balance Due' %}</td><p>{{ order.balance|currency }}</p>
-    </tr>
-    <tr><td width='198.42519685'/><td width='False'/><td width='False'/><td width='False'/><td width='False'/></tr></table>
-    <br/><br/><p style='payment' class='payment'>
-            {% with order.total|currency as order_total %}
-            {% blocktrans %}Payment total {{order_total}} due to:{% endblocktrans %}
-            {% endwith %}
+      {% include "shop/docs/html/billing_and_shipping.html" %}
+
+      <h2>{% trans "Order details" %}</h2>
+
+      <h3>{% trans "Products" %}</h3>
+      <table class="priced">
+        <thead>
+          <tr>
+            <th>{% trans "Description" %}</th>
+            <th>{% trans "Quantity" %}</th>
+            <th>{% trans "Unit price" %}</th>
+            <th>{% trans "Discount" %}</th>
+            <th>{% trans "Total" %}</th>
+          </tr>
+        </thead>
+        <tbody>
+          {% for item in order.orderitem_set.all %}
+          <tr>
+            <td>{{item.product.name|fix_ampersands}}</td>
+            <td>{{item.quantity}}</td>
+            <td>{{item.unit_price|currency}}</td>
+	        <td>{{item.discount|currency}}</td>
+            <td>{{item.sub_total|currency}} </td>
+          </tr>
+          {% empty %}
+          <tr>
+            <td colspan="5" class="alert">{% trans "No products!" %}</td>
+          </tr>
+          {% endfor %}
+          <tr class="price">
+            <td colspan="4">{% trans "Subtotal" %}</td>
+            <td>{{order.sub_total|currency}}</td>
+          </tr>
+          {% if order.discount %}
+          <tr class="price">
+	        <td colspan="4">{% trans "Discount" %}</td>
+            <td>- {{order.item_discount|currency}}</td>
+          </tr>
+          {% endif %}
+        </tbody>
+      </table>
+
+      <h3>{% trans "Shipping" %}</h3>
+      <table class="priced">
+        <tbody>
+          <tr class="price">
+	        <td colspan="4">
+              <h5>{{order.shipping_method}}</h5>
+              <p class="description">{{order.shipping_description}}</p>
+            </td>
+            <td>{{order.shipping_cost|currency}}</td>
+          </tr>
+          {% if order.shipping_discount %}
+          <tr class="price">
+            <td colspan="4">{% trans "Shipping Discount" %}</td>
+            <td>- {{ order.shipping_discount|currency }}</td>
+          </tr>
+          {% endif %}
+        </tbody>
+     </table>
+
+     <h3>{% trans "Totals" %}</h3>
+     <table class="priced">
+       <tbody>
+         <tr class="price">
+	       <td colspan="4">{% trans "Tax" %}</td>
+           <td>{{order.tax|currency}}</td>
+         </tr>
+         <tr class="price">
+	       <td colspan="4">{% trans "Total" %}</td>
+           <td>{{order.total|currency}}</td>
+         </tr>
+         <tr class="price">
+	       <td colspan="4">{% trans "Payments Made" %}</td>
+           <td>- {{order.balance_paid|currency}}</td>
+         </tr>
+         <tr class="price">
+	       <td colspan="4">{% trans "Balance Due" %}</td>
+           <td>{{order.balance|currency}}</td>
+         </tr>
+        </tbody>
+      </table>
+
+      <h2>{% trans "Payment information" %}</h2>
+      <div id="payment-info">
+        <p>
+          {% blocktrans with order_total=order.total|currency %}
+          Payment total of <span class="currency">{{order_total}}</span>
+          due to:
+          {% endblocktrans %}
         </p>
-        <br/><p style='payment' class='payment'>
-            {% trans 'Accounts Receivable' %}
-        </p><p style='payment' class='payment'>
-            {{shopDetails.street1}}
-        {% if shopDetails.street2 %}
-            </p><p style='payment' class='payment'>
-            {{shopDetails.street2}}
-        {% endif %}
-        </p><p style='payment' class='payment'>
-            {{shopDetails.city}} {{shopDetails.state}}, {{shopDetails.postal_code}}
-        </p>
-    <p style='payment' class='payment'>{% blocktrans with order.time_stamp|date:'F j, Y' as order_date %}{{ order_total }} was charged to your {{ credit_card_type }} card (x{{ credit_card_number }}) on {{ order_date }}.{% endblocktrans %}</p>
-        <p style='payment' class='payment'>{% blocktrans %}This invoice has been paid in full. Thank you for your business!{% endblocktrans %}</p>
-    
-</div>
+        <div class="shop-details">
+          {% if shopDetails.street1 %}
+          <p>{{shopDetails.street1}}</p>
+          {% endif %}
+          {% if shopDetails.street1 %}
+          <p>{{shopDetails.street2}}</p>
+          {% endif %}
+          <p>
+            {% if shopDetails.city %}{{shopDetails.city}}{% endif %}{% if shopDetails.state or shopDetails.postal_code %},{% endif %}
+            {% if shopDetails.postal_code %}{{shopDetails.postal_code}}{% endif %}
+            {% if shopDetails.state %}{{shopDetails.state}}{% endif %}
+          </p>
+          {% if shopDetails.country %}
+          <p>
+            {{shopDetails.country.name}}
+          </p>
+          {% endif %}
+        </div>
 
-</body>
+        {% blocktrans with order_date=order.time_stamp|date:"DATE_FORMAT" order_total=order.total|currency %}
+        <span class="currency">{{order_total}}</span> was charged to your
+        {{credit_card_type}} card (ending with
+        <code>{{credit_card_number}}</code>) on <em>{{order_date}}</em>.
+        {% endblocktrans %}
+      </div>
+      <p>
+        {% blocktrans %}
+        This invoice has been paid in full.
+        Thank you for your business!
+        {% endblocktrans %}
+      </p>
+    </div>
+  </body>
 </html>

File satchmo/apps/satchmo_store/shop/templates/shop/docs/html/navbar.html

+{% load i18n %}
+<div id="navigation-bar">
+  <h2>
+    {% blocktrans with order_id=order.id %}
+    Order #{{order_id}} - {{document_name}}
+    {% endblocktrans %}
+  </h2>
+  <ul>
+    <li>
+      <a href="javascript:window.print();"
+         title="{% trans "Print this page" %}">
+        {% trans "Print" %}
+      </a>
+    </li>
+    <li>
+      <a href="{% url admin:shop_order_changelist %}"
+         title="{% trans "Back to orders list"%}">
+        {% trans "Go back to the orders list" %}
+      </a>
+    </li>
+  </ul>
+</div>

File satchmo/apps/satchmo_store/shop/templates/shop/docs/html/packing-slip.html

-<!DOCTYPE HTML PUBLIC "-//w3c//DTD HTML 4.0 Frameset//EN">
-{% load i18n satchmo_currency %}
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-    <style type="text/css">
-        p {margin:0px; font-size:12px;}
-        td {font-size:14px;}
-        p.conditions {font-size:13.0px; text-align:justify}
-        p.name {font-size:17.0px}
-        p.payment {font-size:19.0px}
-    </style>
-</head>
-<body>
-<img src='{{ iconURI }}' width='80' height='72' />
-<div id="tiny_data">
-    <table border='0' cellpadding='0' cellspacing='0'>
-        <tr>
-            <td width='396'></td>
-            <td style='color:(0,0,0);font-size:10px' width='0'></td>
-            <td width='113' align='right' style='color:(0,0,0);font-size:10px'>{{ order.id }}</td>
-        </tr>
-    </table>
-    <table border='0' cellpadding='0' cellspacing='0'>
-        <tr>
-            <td width='396'></td>
-            <td style='color:(0,0,0);font-size:10px' width='0'></td>
-            <td width='113' align='right' style='color:(0,0,0);font-size:10px'></td>
-        </tr>
-    </table>
-    <table border='0' cellpadding='0' cellspacing='0'>
-        <tr>
-            <td width='212'></td>
-            <td style='color:(0,0,0);font-size:14px' width='0'></td>
-            <td width='170'></td>
-            <td style='color:(0,0,0);font-size:14px' width='0'></td>
-        </tr>
-    </table>
-    <table border='0' cellpadding='0' cellspacing='0'>
-        <tr>
-            <td width='28'></td>
-            <td style='color:(0,0,0);font-size:12px' width='0'>{{shopDetails.street1}}</td>
-        </tr>
-    </table>
-    <table border='0' cellpadding='0' cellspacing='0'>
-        <tr>
-            <td width='28'></td>
-            <td style='color:(0,0,0);font-size:12px' width='0'>{{shopDetails.city}}, {{shopDetails.state}} {{shopDetails.postal_code}}</td>
-        </tr>
-    </table>
-    <table border='0' cellpadding='0' cellspacing='0'>
-        <tr>
-            <td width='28'></td>
-            <td style='color:(0,0,0);font-size:12px' width='0'>{{shopDetails.phone}}</td>
-        </tr>
-    </table>
-    <table border='0' cellpadding='0' cellspacing='0'>
-        <tr>
-            <td width='28'></td>
-            <td style='color:(0,0,0);font-size:12px' width='0'>{{shopDetails.store_email}}</td>
-        </tr>
-    </table>
-    <table border='0' cellpadding='0' cellspacing='0'>
-        <tr>
-            <td width='28'></td>
-            <td style='color:(0,0,0);font-size:12px' width='0'>{{shopDetails.store_email}}</td>
-        </tr>
-    </table>
-    <table border='0' width='509'>
-        <tr>
-            <td width='368'>&nbsp;</td>
-            <td>
-                <p style='name' class='name'>{{order.bill_addressee}}</p>
-	            <p>{{order.bill_street1}}</p>
-	            <p>{{ order.bill_street2}}</p>
-                <p>{{order.bill_city}}, {{order.bill_state}}</p>
-	            <p>{{order.bill_postal_code}}</p>
-                <p>{{order.bill_country_name}}</p>
-                <br/>
-                <p>{% trans 'Phone' %}: {{order.contact.primary_phone.phone}}</p>
-	            <p>{% trans 'Email' %}: {{order.contact.email}}</p>
-	        </td>
-	    </tr>
-	</table>
-	<br/><br/>
-	<table border='0' cellpadding='0' cellspacing='0'>
-	    <tr>
-	        <td width='623' align='center' style='color:(0,0,0);font-size:16px'></td>
-	    </tr>
-	</table>
-	<table border='0' width='566'>
-	    <tr>
-	        <td width='28'>&nbsp;</td>
-	        <td>
-	            <p style='name' class='name'>{{order.ship_addressee}}</p>
-	            <p>{{order.ship_street1}}</p>
-                <p>{{ order.ship_street2 }}</p>
-                <p>{{order.ship_city}}, {{order.ship_state}}</p>
-	            <p>{{order.ship_postal_code}}</p>
-                <p>{{ order.ship_country_name }}</p>
-                <br/>
-            </td>
-        </tr>
-    </table>
-    <br/><br/><br/>
-    <table colWidths='14cm, 3.5cm' style='products'>
-	    <tr>
-		    <td>{% trans 'Description' %}</td>
-            <td>{% trans 'Quantity' %}</td>
-	    </tr>
-        {% for item in order.orderitem_set.all %}
-        <tr>
-            <td><p>{{ item.product.name|fix_ampersands }}</p></td>
-            <td><p>{{ item.quantity }} </p></td>
-        </tr>
-        {% endfor %}
-    	<tr><p></p></tr>
-        <tr><p></p></tr>
-    	<tr>
-    	    <td width='396.850393701'/>
-    	    <td width='False'/>
-    	</tr>
-    </table>
-	<br/><p style='payment' class='payment'>{% trans 'Thank you for your business!' %}</p>
-
-</div>
-</body>
-</html>

File satchmo/apps/satchmo_store/shop/templates/shop/docs/html/packingslip.html

+<!DOCTYPE html>
+{% load i18n satchmo_currency %}
+<html>
+  <head>
+    <title>
+      {% blocktrans with order_id=order.id shop_name=shopDetails.store_name %}
+        {{shop_name}} ― Packing slip for order #{{order_id}}
+      {% endblocktrans %}
+    </title>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+    <style type="text/css">/*<![CDATA[*/
+    {% include "shop/docs/html/styles.css" %}
+    /*]]>*/</style>
+  </head>
+  <body>
+    {% include "shop/docs/html/navbar.html" with document_name=_("Packing slip") %}
+    <div id="wrapper">
+      {% include "shop/docs/html/header.html" %}
+      <h1>
+        {% blocktrans with order_id=order.id %}
+        Order #{{order_id}}
+        {% endblocktrans %}
+      </h1>
+
+      {% include "shop/docs/html/billing_and_shipping.html" %}
+
+      <h2>{% trans "Ordered products" %}</h2>
+      <table>
+        <thead>
+          <tr>
+            <th>{% trans "Description" %}</th>
+            <th>{% trans "Quantity" %}</th>
+          </tr>
+        </thead>
+        <tbody>
+          {% for item in order.orderitem_set.all %}
+          <tr>
+            <td>{{item.product.name|fix_ampersands}}</td>
+            <td>{{item.quantity}}</td>
+          </tr>
+          {% empty %}
+          <tr>
+            <td colspan="2" class="alert">{% trans "No products!" %}</td>
+          </tr>
+          {% endfor %}
+        </tbody>
+      </table>
+
+      <p>
+        {% blocktrans %}
+        Thank you for your business!
+        {% endblocktrans %}
+      </p>
+    </div>
+  </body>
+</html>

File satchmo/apps/satchmo_store/shop/templates/shop/docs/html/shipping-label.html

-<!DOCTYPE HTML PUBLIC "-//w3c//DTD HTML 4.0 Frameset//EN">
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-    <style type="text/css">
-        p {margin:0px; font-size:12px;}
-        td {font-size:14px;}
-        p.returnto {font-size:14.0px}
-        p.sendto {font-size:17.0px}
-    </style>
-</head>
-<body>
-    <div id="tiny_data">
-        <table border='0' width='160'>
-            <tr>
-                <td width='19'>&nbsp;</td>
-                <td>
-                    <p style='returnto' class='returnto'>
-                        {{shopDetails.store_name}}
-                    </p>
-                    <p style='returnto' class='returnto'>
-                        {{shopDetails.street1}}
-                    </p>
-                    {% if shopDetails.street2 %}
-                    <p style='returnto' class='returnto'>
-                        {{shopDetails.street2}}
-                    </p>
-                    {% endif %}
-                    <p style='returnto' class='returnto'>
-                        {{shopDetails.city}}, {{shopDetails.state}} {{shopDetails.postal_code}}
-                    </p>
-                    {% ifnotequal shopDetails.country.iso2_code order.ship_country %}
-                    <p style='returnto' class='returnto'>
-                        {{ shopDetails.country.name }}
-                    </p>
-                    {% endifnotequal %}
-                </td>
-            </tr>
-        </table>
-        <br/><br/>
-        <table border='0' width='240'>
-            <tr>
-                <td width='99'>&nbsp;</td>
-                <td>
-                    <p style='sendto' class='sendto'><b>{{order.ship_addressee}}</b></p>
-                    <p style='sendto' class='sendto'>{{order.ship_street1}}</p>
-                    {% if order.ship_street2 %}<p style='sendto' class='sendto'>{{order.ship_street2}}</p>{% endif %}
-                    <p style='sendto' class='sendto'>{{order.ship_city}}, {{order.ship_state}} {{order.ship_postal_code}}</p>
-                    {% ifnotequal shopDetails.country.iso2_code order.ship_country %}<p style='sendto' class='sendto'>{{ order.ship_country_name }}</p>{% endifnotequal %}
-                </td>
-            </tr>
-        </table>
-        <br/><br/>
-    </div>
-</body>
-</html>

File satchmo/apps/satchmo_store/shop/templates/shop/docs/html/shippinglabel.html

+<!DOCTYPE html>
+{% load i18n satchmo_currency %}
+<html>
+  <head>
+    <title>
+      {% blocktrans with order_id=order.id shop_name=shopDetails.store_name %}
+        {{shop_name}} ― Shipping label for order #{{order_id}}
+      {% endblocktrans %}
+    </title>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+    <style type="text/css">/*<![CDATA[*/
+    {% include "shop/docs/html/styles.css" %}
+    /*]]>*/</style>
+  </head>
+  <body>
+    {% include "shop/docs/html/navbar.html" with document_name=_("Shipping label") %}
+    <div id="wrapper">
+
+      <div id="billing" class="billing-and-shipping">
+        <h3>{% trans "Return to" %}</h3>
+        <p>{{shopDetails.store_name}}</p>
+        {% if shopDetails.street1 %}
+        <p>{{shopDetails.street1}}</p>
+        {% endif %}
+        {% if shopDetails.street1 %}
+        <p>{{shopDetails.street2}}</p>
+        {% endif %}
+        <p>
+          {% if shopDetails.city %}{{shopDetails.city}}{% endif %}{% if shopDetails.state or shopDetails.postal_code %},{% endif %}
+          {% if shopDetails.postal_code %}{{shopDetails.postal_code}}{% endif %}
+          {% if shopDetails.state %}{{shopDetails.state}}{% endif %}
+        </p>
+        {% if shopDetails.country %}
+        <p>
+          {{shopDetails.country.name}}
+        </p>
+        {% endif %}
+        {% if shopDetails.phone or shopDetails.store_email %}
+        <dl>
+          {% if shopDetails.phone %}
+          <dt>{% trans "Phone" %}:</dt>
+          <dd>{{shopDetails.phone}}</dd>
+          {% endif %}
+          {% if shopDetails.store_email %}
+          <dt>{% trans "Email" %}:</dt>
+          <dd>{{shopDetails.store_email}}</dd>
+          {% endif %}
+        </dl>
+        {% endif %}
+      </div>
+      <div id="shipping" class="billing-and-shipping">
+        <h3>{% trans "Send to" %}</h3>
+        {% if order.ship_addressee %}
+        <p>{{order.ship_addressee}}</p>
+        {% endif %}
+        {% if order.ship_street1 %}
+        <p>{{order.ship_street1}}</p>
+        {% endif %}
+        {% if order.ship_street1 %}
+        <p>{{order.ship_street2}}</p>
+        {% endif %}
+        <p>
+          {% if order.ship_city %}{{order.ship_city}}{% endif %}{% if order.ship_state or order.ship_postal_code %},{% endif %}
+          {% if order.ship_postal_code %}{{order.ship_postal_code}}{% endif %}
+          {% if order.ship_state %}{{order.ship_state}}{% endif %}
+        </p>
+        {% if order.ship_country %}
+        <p>
+          {{order.ship_country}}
+        </p>
+        {% endif %}
+      </div>
+      <div class="clear"><!-- clear floats --></div>
+    </div>
+  </body>
+</html>

File satchmo/apps/satchmo_store/shop/templates/shop/docs/html/styles.css

+@media all {
+    body {
+        font-family: sans-serif;
+        font-size: 9pt;
+    }
+
+    p {
+        margin-top: 0.7em;
+        margin-bottom: 0.7em;
+    }
+
+    .clear {
+        clear: both;
+    }
+
+    #header {
+        border-bottom: 1pt solid #ccc;
+        padding: 1em;
+        height: 12em;
+    }
+
+    #logo,
+    #shop-info {
+        height: 100%;
+        float: left;
+    }
+
+    #logo {
+        margin-right: 3em;
+        width: 20%;
+    }
+
+    #logo img {
+        width: 100%;
+        margin-top: 1.5em;
+    }
+
+    #shop-info div,
+    #shop-info dl {
+        float: left;
+    }
+
+    #shop-info dl {
+        margin-top: 0.7em;
+        margin-bottom: 0.7em;
+        margin-left: 2em;
+    }
+
+    #shop-info dl dt {
+        font-weight: bold;
+        color: #777;
+    }
+
+    h1, h2 {
+        clear: both;
+        margin-top: 0.7em;
+    }
+
+    .billing-and-shipping {
+        padding: 1em 2em 1em 2em;
+        float: left;
+        border: 1pt solid #ccc;
+        height: 18em;
+        width: 43%;
+        margin-bottom: 2em;
+    }
+
+    .billing-and-shipping dt,
+    .billing-and-shipping dd {
+        display: block;
+        float: left;
+        margin-top: 0.8em;
+    }
+
+    .billing-and-shipping dt {
+        clear: left;
+    }
+
+    .billing-and-shipping dd {
+        margin-left: 1.5em;
+    }
+
+    #shipping {
+        border-left: none;
+    }
+
+    table {
+        width: 100%;
+        border: 1pt solid #ccc;
+        border-collapse: collapse;
+        margin-bottom: 2em;
+    }
+
+    table td,
+    table th {
+        padding: 0.5em;
+        border: 1pt solid #ccc;
+    }
+
+    table td h5 {
+        margin: 0.4em 0em 0.4em 0em;
+    }
+
+    table td p {
+        margin: 0.2em 0em 0.2em 0em;
+    }
+
+    table.priced td:last-child {
+        width: 9em;
+        text-align: right;
+    }
+
+    table thead tr {
+        font-weight: bold;
+        background-color: #ccc;
+    }
+
+    table tr.price {
+        background-color: #eee;
+    }
+
+    table tr.price td:last-child {
+        font-weight: bold;
+    }
+
+    #payment-info {
+        margin-bottom: 1.5em;
+    }
+
+    #payment-info .shop-details {
+        margin: 1em 0em 1em 3em;
+        padding: 1em;
+        background-color: #eee;
+    }
+
+    .currency {
+        font-weight: bold;
+    }
+
+    div.clear {
+        clear: both;
+    }
+}
+
+@media screen {
+    #wrapper {
+        max-width: 80em;
+        margin: 3em auto;
+        padding: 5em 10em 10em 10em;
+        box-shadow: 0em 0em 2em 0em #999;
+    }
+
+    #navigation-bar {
+        position: fixed;
+        top: 0;
+        left: 0;
+        right: 0;
+        background-color: #555;
+        display: table-cell;
+        vertical-align: middle;
+    }
+
+    #navigation-bar ul {
+        display: block;
+        float: right;
+        margin-right: 4em;
+    }
+
+    #navigation-bar ul li {
+        float: left;
+        display: block;
+    }
+
+    #navigation-bar ul li a {
+        display: block;
+        font-weight: bold;
+        text-decoration: none;
+        color: #fff;
+        margin: 0em 1em 0em 1em;
+        padding: 0.5em;
+        border: 1pt solid #ccc;
+    }
+
+    #navigation-bar ul li a:hover {
+        background-color: #777;
+    }
+
+    #navigation-bar h2 {
+        display: block;
+        color: #fff;
+        margin-left: 2em;
+        float: left;
+    }
+}
+
+@media print {
+    #navigation-bar {
+        display: none;
+    }
+
+    .billing-and-shipping {
+        width: 40%;
+    }
+
+    table {
+        page-break-inside: avoid;
+    }
+}

File satchmo/apps/satchmo_store/shop/templates/shop/docs/rml/packing-slip.rml

-<?xml version="1.0" encoding="utf-8" standalone="no" ?>
-<!DOCTYPE document SYSTEM "rml_1_0.dtd">
-{% load i18n satchmo_currency %}
-<document filename="{{ filename }}">
-<template pageSize="(21.5cm, 28cm)" leftMargin="1.0cm" rightMargin="1.0cm" topMargin="1.0cm" bottomMargin="1.0cm" title="Store Packing Slip" author="{{ shopDetails.store_name }}" allowSplitting="20">
-	<pageTemplate id="first">
-		<pageGraphics>
-
-			<image x="5mm" y="240mm" width="65mm" height="30mm" file="{{iconURI}}"/>
-
-            <setFont name="Helvetica" size="10"/>
-			<fill color="(0,0,0)"/>
-
-			<drawString x="14cm" y="270mm">{% trans "Invoice #" %}</drawString>
-			<drawString x="14cm" y="266mm">{% trans "Date" %}: </drawString>
-
-			<drawRightString x="18cm" y="270mm">{{ order.id }}</drawRightString>
-			<drawRightString x="18cm" y="266mm">{% now "N j, Y" %}</drawRightString>
-
-			<setFont name="Helvetica" size="16"/>
-			<drawCentredString x="11cm" y="182mm">{% trans "PACKING SLIP" %}</drawCentredString>
-            
-            <setFont name="Helvetica" size="14"/>
-			<drawString x="7.5cm" y="24cm">{% trans "Billing Address" %}</drawString>
-            <drawString x="13.5cm" y="24cm">{% trans "Shipping Address" %}</drawString>
-            
-            <setFont name="Helvetica" size="12"/>
-            <drawString x="1cm" y="235mm">{{shopDetails.street1}}</drawString>
-            {% if shopDetails.street2 %}
-            <drawString x="1cm" y="230mm">{{shopDetails.street2}}</drawString>
-            <drawString x="1cm" y="225mm">{{shopDetails.city}}, {{shopDetails.state}} {{shopDetails.postal_code}}</drawString>
-            <drawString x="1cm" y="220mm">{{shopDetails.phone}}</drawString>
-            <drawString x="1cm" y="215mm">{{shopDetails.store_email}}</drawString>
-            {% else %}
-            <drawString x="1cm" y="230mm">{{shopDetails.city}}, {{shopDetails.state}} {{shopDetails.postal_code}}</drawString>
-            <drawString x="1cm" y="225mm">{{shopDetails.phone}}</drawString>
-            <drawString x="1cm" y="220mm">{{shopDetails.store_email}}</drawString>
-            {% endif %}
-            <rect x="13.5cm" y="26.2cm" width="5cm" height="1.3cm" fill="no" stroke="yes" round="5mm" />
-            
-            <rect x="7.1cm" y="19.8cm" width="5cm" height="4cm" fill="no" stroke="yes" round="5mm" />
-            <rect x="13.1cm" y="19.8cm" width="5cm" height="4cm" fill="no" stroke="yes" round="5mm" />
-            
-		</pageGraphics>
-        <frame id="billaddress" x1="7cm" y1="18.9cm" width="5cm" height="5cm" />
-		<frame id="shipaddress" x1="13cm" y1="18.9cm" width="5cm" height="5cm"/>
-		<frame id="column" x1="1.0cm" y1="2cm" width="19cm" height="16.5cm"/>
-	</pageTemplate>
-	<pageTemplate id="others">
-		<pageGraphics>
-			<image x="5mm" y="240mm" width="65mm" height="30mm" file="{{iconURI}}"/>
-
-			<setFont name="Helvetica" size="8"/>
-			<fill color="(0,0,0)"/>
-
-			<drawString x="15cm" y="270mm">{% trans "Invoice #" %}</drawString>
-			<drawString x="15cm" y="266mm">{% trans "Date" %}: </drawString>
-
-			<drawRightString x="20cm" y="270mm">{{ order.id }}</drawRightString>
-			<drawRightString x="20cm" y="266mm">{% now "N j, Y" %}</drawRightString>
-
-			<setFont name="Helvetica" size="18"/>
-			<drawString x="13cm" y="230mm">{% trans "PACKING SLIP" %}, {% trans "Page" %} <pageNumber/></drawString>
-            <rect x="14.5cm" y="26cm" width="6.5cm" height="1.5cm" fill="no" stroke="yes" round="5mm" />
-		</pageGraphics>
-		<frame id="column" x1="2.0cm" y1="1.5cm" width="18cm" height="17cm"/>
-	</pageTemplate>
-</template>
-<stylesheet>
-	<blockTableStyle id="accounts">
-		<blockAlignment value="RIGHT" start="-1,0" stop="-1,-1"/>
-		<lineStyle kind="LINEABOVE" start="-1,-2" stop="-1,-2"/>
-	</blockTableStyle>
-
-	<paraStyle name="conditions" fontName="Helvetica" fontSize="8" alignment="justify"/>
-	<paraStyle name="name" fontName="Helvetica-Bold" fontSize="12"/>
-	<paraStyle name="payment" fontName="Helvetica" fontSize="14"/>
-	<blockTableStyle id="products">
-		 <blockFont name="Helvetica-BoldOblique" size="12" start="0,0" stop="-1,0"/>
-		 <blockBackground colorName="grey" start="0,0" stop="-1,0"/>
-		 <blockTextColor colorName="white" start="0,0" stop="-1,0"/>
-		 <blockValign value="TOP"/>
-		 <blockAlignment value="RIGHT" start="1,0" stop="-1,-1"/>
-		 <lineStyle kind="LINEBELOW" colorName="black" start="0,0" stop="-1,0"/>
-	</blockTableStyle>
-</stylesheet>
-<story>
-
-    <para style="name">{{order.bill_addressee}}</para>
-	<para>{{order.bill_street1}}</para>
-	{% if order.bill_street2 %}
-          <para>{{ order.bill_street2}}</para>
-        {% endif %}
-	<para>{{order.bill_city}}, {{order.bill_state}}</para>
-	<para>{{order.bill_postal_code}}</para>
-        {% ifnotequal order.bill_country shopDetails.country.iso2_code %}
-        <para>{{order.bill_country_name}}</para>
-        {% else %}
-	<spacer length="0.8cm" width="1mm"/>
-	{% endifnotequal %}
-	<para>{% trans "Phone" %}: {{order.contact.primary_phone.phone}}</para>
-	<para>{% trans "Email" %}: {{order.contact.email}}</para>
-
-	<nextFrame/>
-    
-    <para style="name">{{order.ship_addressee}}</para>
-	<para>{{order.ship_street1}}</para>
-        {% if order.ship_street2 %}
-          <para>{{ order.ship_street2 }}</para>
-        {% endif %}
-	<para>{{order.ship_city}}, {{order.ship_state}}</para>
-	<para>{{order.ship_postal_code}}</para>
-        {% ifnotequal order.ship_country shopDetails.country.iso2_code %}
-        <para>{{ order.ship_country_name }}</para>
-        {% else %}
-	<spacer length="0.8cm" width="1mm"/>
-        {% endifnotequal %}
-    <nextFrame/>
-    
-	<setNextTemplate name="others"/>
-	<spacer length="0.5cm" width="1mm"/>
-	<blockTable colWidths="14cm, 3.5cm" style="products">
-	<tr>
-		<td>{% trans "Description" %}</td>
-        <td>{% trans "Quantity" %}</td>
-	</tr>
-    {% for item in order.orderitem_set.all %}
-    <tr>
-        <td><para>{{ item.product.name|fix_ampersands }}</para></td>
-        <td>{{ item.quantity }} </td>
-    </tr>
-    {% endfor %}
-	<tr><td></td></tr>
-    <tr><td></td></tr>
-	</blockTable>
-	<spacer length="0.5cm" width="1mm"/>
-	<para style="payment">
-		{% trans "Thank you for your business!" %}
-	</para>
-</story>
-</document>

File satchmo/apps/satchmo_store/shop/templates/shop/docs/rml/packingslip.rml

+<?xml version="1.0" encoding="utf-8" standalone="no" ?>
+<!DOCTYPE document SYSTEM "rml_1_0.dtd">
+{% load i18n satchmo_currency %}
+<document filename="{{ filename }}">
+<template pageSize="(21.5cm, 28cm)" leftMargin="1.0cm" rightMargin="1.0cm" topMargin="1.0cm" bottomMargin="1.0cm" title="Store Packing Slip" author="{{ shopDetails.store_name }}" allowSplitting="20">
+	<pageTemplate id="first">
+		<pageGraphics>
+
+			<image x="5mm" y="240mm" width="65mm" height="30mm" file="{{iconURI}}"/>
+
+            <setFont name="Helvetica" size="10"/>
+			<fill color="(0,0,0)"/>
+
+			<drawString x="14cm" y="270mm">{% trans "Invoice #" %}</drawString>
+			<drawString x="14cm" y="266mm">{% trans "Date" %}: </drawString>
+
+			<drawRightString x="18cm" y="270mm">{{ order.id }}</drawRightString>
+			<drawRightString x="18cm" y="266mm">{% now "N j, Y" %}</drawRightString>
+
+			<setFont name="Helvetica" size="16"/>
+			<drawCentredString x="11cm" y="182mm">{% trans "PACKING SLIP" %}</drawCentredString>
+            
+            <setFont name="Helvetica" size="14"/>
+			<drawString x="7.5cm" y="24cm">{% trans "Billing Address" %}</drawString>
+            <drawString x="13.5cm" y="24cm">{% trans "Shipping Address" %}</drawString>
+            
+            <setFont name="Helvetica" size="12"/>
+            <drawString x="1cm" y="235mm">{{shopDetails.street1}}</drawString>
+            {% if shopDetails.street2 %}
+            <drawString x="1cm" y="230mm">{{shopDetails.street2}}</drawString>
+            <drawString x="1cm" y="225mm">{{shopDetails.city}}, {{shopDetails.state}} {{shopDetails.postal_code}}</drawString>
+            <drawString x="1cm" y="220mm">{{shopDetails.phone}}</drawString>
+            <drawString x="1cm" y="215mm">{{shopDetails.store_email}}</drawString>
+            {% else %}
+            <drawString x="1cm" y="230mm">{{shopDetails.city}}, {{shopDetails.state}} {{shopDetails.postal_code}}</drawString>
+            <drawString x="1cm" y="225mm">{{shopDetails.phone}}</drawString>
+            <drawString x="1cm" y="220mm">{{shopDetails.store_email}}</drawString>
+            {% endif %}
+            <rect x="13.5cm" y="26.2cm" width="5cm" height="1.3cm" fill="no" stroke="yes" round="5mm" />
+            
+            <rect x="7.1cm" y="19.8cm" width="5cm" height="4cm" fill="no" stroke="yes" round="5mm" />
+            <rect x="13.1cm" y="19.8cm" width="5cm" height="4cm" fill="no" stroke="yes" round="5mm" />
+            
+		</pageGraphics>
+        <frame id="billaddress" x1="7cm" y1="18.9cm" width="5cm" height="5cm" />
+		<frame id="shipaddress" x1="13cm" y1="18.9cm" width="5cm" height="5cm"/>
+		<frame id="column" x1="1.0cm" y1="2cm" width="19cm" height="16.5cm"/>
+	</pageTemplate>
+	<pageTemplate id="others">
+		<pageGraphics>
+			<image x="5mm" y="240mm" width="65mm" height="30mm" file="{{iconURI}}"/>
+
+			<setFont name="Helvetica" size="8"/>
+			<fill color="(0,0,0)"/>
+
+			<drawString x="15cm" y="270mm">{% trans "Invoice #" %}</drawString>
+			<drawString x="15cm" y="266mm">{% trans "Date" %}: </drawString>
+
+			<drawRightString x="20cm" y="270mm">{{ order.id }}</drawRightString>
+			<drawRightString x="20cm" y="266mm">{% now "N j, Y" %}</drawRightString>
+
+			<setFont name="Helvetica" size="18"/>
+			<drawString x="13cm" y="230mm">{% trans "PACKING SLIP" %}, {% trans "Page" %} <pageNumber/></drawString>
+            <rect x="14.5cm" y="26cm" width="6.5cm" height="1.5cm" fill="no" stroke="yes" round="5mm" />
+		</pageGraphics>
+		<frame id="column" x1="2.0cm" y1="1.5cm" width="18cm" height="17cm"/>
+	</pageTemplate>
+</template>
+<stylesheet>
+	<blockTableStyle id="accounts">
+		<blockAlignment value="RIGHT" start="-1,0" stop="-1,-1"/>
+		<lineStyle kind="LINEABOVE" start="-1,-2" stop="-1,-2"/>
+	</blockTableStyle>
+
+	<paraStyle name="conditions" fontName="Helvetica" fontSize="8" alignment="justify"/>
+	<paraStyle name="name" fontName="Helvetica-Bold" fontSize="12"/>
+	<paraStyle name="payment" fontName="Helvetica" fontSize="14"/>
+	<blockTableStyle id="products">
+		 <blockFont name="Helvetica-BoldOblique" size="12" start="0,0" stop="-1,0"/>
+		 <blockBackground colorName="grey" start="0,0" stop="-1,0"/>
+		 <blockTextColor colorName="white" start="0,0" stop="-1,0"/>
+		 <blockValign value="TOP"/>
+		 <blockAlignment value="RIGHT" start="1,0" stop="-1,-1"/>
+		 <lineStyle kind="LINEBELOW" colorName="black" start="0,0" stop="-1,0"/>
+	</blockTableStyle>
+</stylesheet>
+<story>
+
+    <para style="name">{{order.bill_addressee}}</para>
+	<para>{{order.bill_street1}}</para>
+	{% if order.bill_street2 %}
+          <para>{{ order.bill_street2}}</para>
+        {% endif %}
+	<para>{{order.bill_city}}, {{order.bill_state}}</para>
+	<para>{{order.bill_postal_code}}</para>
+        {% ifnotequal order.bill_country shopDetails.country.iso2_code %}
+        <para>{{order.bill_country_name}}</para>
+        {% else %}
+	<spacer length="0.8cm" width="1mm"/>
+	{% endifnotequal %}
+	<para>{% trans "Phone" %}: {{order.contact.primary_phone.phone}}</para>
+	<para>{% trans "Email" %}: {{order.contact.email}}</para>
+
+	<nextFrame/>
+    
+    <para style="name">{{order.ship_addressee}}</para>
+	<para>{{order.ship_street1}}</para>
+        {% if order.ship_street2 %}
+          <para>{{ order.ship_street2 }}</para>
+        {% endif %}
+	<para>{{order.ship_city}}, {{order.ship_state}}</para>
+	<para>{{order.ship_postal_code}}</para>
+        {% ifnotequal order.ship_country shopDetails.country.iso2_code %}
+        <para>{{ order.ship_country_name }}</para>
+        {% else %}
+	<spacer length="0.8cm" width="1mm"/>
+        {% endifnotequal %}
+    <nextFrame/>
+    
+	<setNextTemplate name="others"/>
+	<spacer length="0.5cm" width="1mm"/>
+	<blockTable colWidths="14cm, 3.5cm" style="products">
+	<tr>
+		<td>{% trans "Description" %}</td>
+        <td>{% trans "Quantity" %}</td>
+	</tr>
+    {% for item in order.orderitem_set.all %}
+    <tr>
+        <td><para>{{ item.product.name|fix_ampersands }}</para></td>
+        <td>{{ item.quantity }} </td>
+    </tr>
+    {% endfor %}
+	<tr><td></td></tr>
+    <tr><td></td></tr>
+	</blockTable>
+	<spacer length="0.5cm" width="1mm"/>
+	<para style="payment">
+		{% trans "Thank you for your business!" %}
+	</para>
+</story>
+</document>

File satchmo/apps/satchmo_store/shop/templates/shop/docs/rml/shipping-label.rml

-<?xml version="1.0" encoding="utf-8" standalone="no" ?>
-<!DOCTYPE document SYSTEM "rml_1_0.dtd">
-<document filename="{{ filename }}">
-<template pageSize="(10.2cm, 15.4cm)"
-          leftMargin="1cm"
-          rightMargin="1cm"
-          topMargin="2.5cm"
-          bottomMargin="2.5cm"
-          allowSplitting="20"
-          >
-          <!-- Avery multi-use label Item#5444                              -->
-          <!-- showBoundary means that we will be able to see the            -->
-          <!-- limits of frames                                              -->
-    <pageTemplate>
-          <pageGraphics>
-          </pageGraphics>
-          <frame id="returnto" x1=".7cm" y1="10.5cm" width="5cm"
-              height="3cm"/>
-          <frame id="sendto" x1="3.5cm" y1="6cm" width="5cm"
-              height="5cm"/>
-    </pageTemplate>
-</template>
-<stylesheet>
-    <paraStyle name="returnto"
-    fontName="Helvetica"
-    fontSize="9"
-    spaceBefore="0.1 cm"
-     />
-     <paraStyle name="sendto"
-     fontName="Helvetica"
-     fontSize="12"
-     spaceBefore="0.1 cm"
-     />
-     <blockTableStyle id="temp001">
-       <blockAlignment value="left"/>
-       <blockFont name="Helvetica-Oblique"/>
-       <lineStyle kind="GRID" colorName="black"/>
-       <lineStyle kind="OUTLINE" colorName="black" thickness="2"/>
-     </blockTableStyle>
-</stylesheet>
-<story>
-     <para style="returnto">
-        {{shopDetails.store_name}}
-     </para>
-     <para style="returnto">
-        {{shopDetails.street1}}
-     </para>
-     {% if shopDetails.street2 %}
-     <para style="returnto">
-        {{shopDetails.street2}}
-     </para>
-     {% endif %}
-     <para style="returnto">
-        {{shopDetails.city}}, {{shopDetails.state}} {{shopDetails.postal_code}}
-     </para>
-     {% ifnotequal shopDetails.country.iso2_code order.ship_country %}
-     <para style="returnto">
-       {{ shopDetails.country.name }}
-     </para>
-     {% endifnotequal %}
-     <nextFrame/>
-
-    <para style="sendto"><b>{{order.ship_addressee}}</b></para>
-    <para style="sendto">{{order.ship_street1}}</para>
-    {% if order.ship_street2 %}
-    <para style="sendto">{{order.ship_street2}}</para>
-    {% endif %}
-    <para style="sendto">{{order.ship_city}}, {{order.ship_state}} {{order.ship_postal_code}}</para>
-    {% ifnotequal shopDetails.country.iso2_code order.ship_country %}
-    <para style="sendto">{{ order.ship_country_name }}</para>
-    {% endifnotequal %}
-
-</story>
-</document>

File satchmo/apps/satchmo_store/shop/templates/shop/docs/rml/shippinglabel.rml

+<?xml version="1.0" encoding="utf-8" standalone="no" ?>
+<!DOCTYPE document SYSTEM "rml_1_0.dtd">
+<document filename="{{ filename }}">
+<template pageSize="(10.2cm, 15.4cm)"
+          leftMargin="1cm"
+          rightMargin="1cm"
+          topMargin="2.5cm"
+          bottomMargin="2.5cm"
+          allowSplitting="20"
+          >
+          <!-- Avery multi-use label Item#5444                              -->
+          <!-- showBoundary means that we will be able to see the            -->
+          <!-- limits of frames                                              -->
+    <pageTemplate>
+          <pageGraphics>
+          </pageGraphics>
+          <frame id="returnto" x1=".7cm" y1="10.5cm" width="5cm"
+              height="3cm"/>
+          <frame id="sendto" x1="3.5cm" y1="6cm" width="5cm"
+              height="5cm"/>
+    </pageTemplate>
+</template>
+<stylesheet>
+    <paraStyle name="returnto"
+    fontName="Helvetica"
+    fontSize="9"
+    spaceBefore="0.1 cm"
+     />
+     <paraStyle name="sendto"
+     fontName="Helvetica"
+     fontSize="12"
+     spaceBefore="0.1 cm"
+     />
+     <blockTableStyle id="temp001">
+       <blockAlignment value="left"/>
+       <blockFont name="Helvetica-Oblique"/>
+       <lineStyle kind="GRID" colorName="black"/>
+       <lineStyle kind="OUTLINE" colorName="black" thickness="2"/>
+     </blockTableStyle>
+</stylesheet>
+<story>
+     <para style="returnto">
+        {{shopDetails.store_name}}
+     </para>
+     <para style="returnto">
+        {{shopDetails.street1}}
+     </para>
+     {% if shopDetails.street2 %}
+     <para style="returnto">
+        {{shopDetails.street2}}
+     </para>
+     {% endif %}
+     <para style="returnto">
+        {{shopDetails.city}}, {{shopDetails.state}} {{shopDetails.postal_code}}
+     </para>
+     {% ifnotequal shopDetails.country.iso2_code order.ship_country %}
+     <para style="returnto">
+       {{ shopDetails.country.name }}
+     </para>
+     {% endifnotequal %}
+     <nextFrame/>
+
+    <para style="sendto"><b>{{order.ship_addressee}}</b></para>
+    <para style="sendto">{{order.ship_street1}}</para>
+    {% if order.ship_street2 %}
+    <para style="sendto">{{order.ship_street2}}</para>
+    {% endif %}
+    <para style="sendto">{{order.ship_city}}, {{order.ship_state}} {{order.ship_postal_code}}</para>
+    {% ifnotequal shopDetails.country.iso2_code order.ship_country %}
+    <para style="sendto">{{ order.ship_country_name }}</para>
+    {% endifnotequal %}
+
+</story>
+</document>

File satchmo/apps/shipping/tests.py

 from decimal import Decimal
+from django.conf import settings
 from django.contrib.sites.models import Site
 from django.test import TestCase
 from product.models import Product
         self.assert_(self.cart1.is_shippable)
         self.assertEqual(flat(self.cart1, None).cost(), Decimal("4.00"))
         self.assertEqual(per(self.cart1, None).cost(), Decimal("12.00"))
+
+
+class ConverterFactoryTest(TestCase):
+
+    def setUp(self):
+        pass
+
+    def tearDown(self):
+        pass