1. Rafał Kos
  2. pytis

Commits

Rafał Kos  committed ee5b702

added possibility to change currency date in invoice

  • Participants
  • Parent commits 09d92c0
  • Branches default

Comments (0)

Files changed (4)

File pytis/controllers/invoices.py

View file
         
         if request.method == 'POST' and c.form.validate():            
             c.form.populate_obj(c.invoice, exclude=['company', 'number', 'payment_date'])
+            c.invoice.currencyDate = request.params.get('currencyDate')
             c.invoice.save()
             
             if not c.invoice.is_exported:

File pytis/lib/printer.py

View file
                 if order.transport_order:
                     ws.write(i + 1, 0, invoice.number, style1)
                     ws.write(i + 1, 1, order.company.name, style1)
-                    ws.write(i + 1, 2, order.freight, style1)
+                    ws.write(i + 1, 2, order.real_value, style1)
                     ws.write(i + 1, 4, order.transport_order.company.name, style1)
-                    ws.write(i + 1, 5, order.transport_order.freight, style1)
+                    ws.write(i + 1, 5, order.transport_order.real_value, style1)
                 else:
                     ws.write(i + 1, 6, invoice.number, style1)
                     ws.write(i + 1, 7, order.company.name, style1)
-                    ws.write(i + 1, 8, order.freight, style1)
+                    ws.write(i + 1, 8, order.real_value, style1)
                     ws.write(i + 1, 9, order.delegation.driver.full_name, style1)
                 i = i + 1
 

File pytis/model/invoice.py

View file
             date = date - datetime.timedelta(days = 1)
             date = date.strftime('%Y-%m-%d')
             currencySymbol = self.elements[0].order.currency.value
-            currencyDate = str(date)
+            currencyDate = self.currencyDate or str(date)
 
             currency = Currency.get(currencySymbol, currencyDate)
             if currency is not None:

File pytis/templates/invoices/edit.xhtml

View file
 </div>
 
 <div id="content-main">
+    {{ h.form(url(controller='invoices', action='edit', id=request.urlvars['id']), method="post") }}
     <div id="tabs">
         <ul>
             <li><a href="#tabs-1">Faktura</a></li>
 		</ul>
 
         <div id="tabs-1">
-            {{ h.form(url(controller='invoices', action='edit', id=request.urlvars['id']), method="post") }}
             <fieldset class="module aligned">
                 <div class="form-row">
                 	{{ c.form.id() }}
 				{% endif %}						 
 			</div>
 
-            {{ h.end_form() }}
-
             <fieldset class="module aligned">
                 <h2>Pozycje faktury</h2>
 				<div class="bottom">
             </fieldset>
         </div>
     </div>
+    {{ h.end_form() }}
 </div>
 {% endblock %}
 
 	  $(document).ready(function(){
 	    $('#issueDate').datepicker({
 	        dateFormat: 'yy-mm-dd'
-	    });    
+	    });
+
+        $('#currencydate').datepicker({
+            dateFormat: 'yy-mm-dd'
+        });
 		
 	    $('#sellDate').datepicker({
 	        dateFormat: 'yy-mm-dd'