[POS-commit] r7438 - in stoq/trunk: data/glade stoq/gui/payable stoq/gui/receivable

george at async.com.br george at async.com.br
Tue Feb 19 12:36:54 BRT 2008


Author: george
Date: Tue Feb 19 12:36:53 2008
New Revision: 7438

Log:
#3091: Implementar wizard para cadastro de contas a receber. (stoq)
r=jdahlin


Modified:
   stoq/trunk/data/glade/receivable.glade
   stoq/trunk/stoq/gui/payable/payable.py
   stoq/trunk/stoq/gui/receivable/receivable.py

Modified: stoq/trunk/data/glade/receivable.glade
==============================================================================
--- stoq/trunk/data/glade/receivable.glade	(original)
+++ stoq/trunk/data/glade/receivable.glade	Tue Feb 19 12:36:53 2008
@@ -5,6 +5,14 @@
         <child>
             <widget class="GtkActionGroup" id="DefaultActions">
                 <child>
+                    <widget class="GtkAction" id="AddReceiving">
+                        <property name="name">AddReceiving</property>
+                        <property name="label" translatable="yes">Add receiving...</property>
+                        <property name="stock_id">gtk-add</property>
+                       <property name="accelerator">&lt;Control&gt;r</property>
+                    </widget>
+                </child>
+                <child>
                     <widget class="GtkAction" id="Bill">
                         <property name="name">Bill</property>
                         <property name="label" translatable="yes">Bills</property>
@@ -163,6 +171,7 @@
         <ui id="initial-state"><![CDATA[<ui>
 	<menubar action="menubar">
 	  <menu action="TillMenu">
+	    <menuitem action="AddReceiving"/>
 	    <menuitem action="Receipt"/>
 	    <menuitem action="quit_action"/>
 	  </menu>

Modified: stoq/trunk/stoq/gui/payable/payable.py
==============================================================================
--- stoq/trunk/stoq/gui/payable/payable.py	(original)
+++ stoq/trunk/stoq/gui/payable/payable.py	Tue Feb 19 12:36:53 2008
@@ -42,7 +42,7 @@
 from stoqlib.domain.payment.payment import Payment
 from stoqlib.domain.payment.views import OutPaymentView
 from stoqlib.gui.base.dialogs import run_dialog
-from stoqlib.gui.dialogs.paymentadditiondialog import PaymentAdditionDialog
+from stoqlib.gui.dialogs.paymentadditiondialog import OutPaymentAdditionDialog
 from stoqlib.gui.dialogs.purchasedetails import PurchaseDetailsDialog
 from stoqlib.gui.dialogs.saledetails import SaleDetailsDialog
 from stoqlib.gui.printing import print_report
@@ -253,6 +253,6 @@
 
     def on_AddPayment__activate(self, action):
         trans = new_transaction()
-        retval = self.run_dialog(PaymentAdditionDialog, trans)
+        retval = self.run_dialog(OutPaymentAdditionDialog, trans)
         if finish_transaction(trans, retval):
             self.results.refresh()

Modified: stoq/trunk/stoq/gui/receivable/receivable.py
==============================================================================
--- stoq/trunk/stoq/gui/receivable/receivable.py	(original)
+++ stoq/trunk/stoq/gui/receivable/receivable.py	Tue Feb 19 12:36:53 2008
@@ -43,13 +43,16 @@
 from stoqlib.domain.payment.payment import Payment
 from stoqlib.domain.payment.views import InPaymentView
 from stoqlib.domain.sale import SaleView
+from stoqlib.domain.till import Till
 from stoqlib.reporting.payment import ReceivablePaymentReport
 from stoqlib.reporting.receival_receipt import ReceivalReceipt
 from stoqlib.gui.printing import print_report
 from stoqlib.gui.base.dialogs import run_dialog
+from stoqlib.gui.dialogs.paymentadditiondialog import InPaymentAdditionDialog
 from stoqlib.gui.dialogs.paymentduedatedialog import PaymentDueDateChangeDialog
 from stoqlib.gui.dialogs.saledetails import SaleDetailsDialog
 from stoqlib.gui.slaves.installmentslave import SaleInstallmentConfirmationSlave
+from stoqlib.lib.message import info
 
 from stoq.gui.application import SearchableAppWindow
 
@@ -173,6 +176,18 @@
         trans.close()
         self._update_widgets()
 
+    def _add_receiving(self):
+        trans = new_transaction()
+        till = Till.get_current(trans)
+        if till is None:
+            trans.close()
+            info(_(u'This action requires an open till.'))
+            return
+
+        retval = self.run_dialog(InPaymentAdditionDialog, trans, till)
+        if finish_transaction(trans, retval):
+            self.results.refresh()
+
     def _change_due_date(self, receivable_view):
         """ Receives a receivable_view and change the payment due date
         related to the view.
@@ -219,6 +234,9 @@
         if not receivable_views:
             return False
 
+        if len(receivable_views) == 1:
+            return receivable_views[0].status == Payment.STATUS_PENDING
+
         sale = receivable_views[0].sale
         if sale is None:
             return False
@@ -249,6 +267,8 @@
             return False
 
         sale = receivable_views[0].sale
+        if sale is None:
+            return False
         return all(view.sale == sale for view in receivable_views[1:])
 
     #
@@ -280,3 +300,6 @@
         payments = [v.payment for v in receivable_views]
         print_report(ReceivalReceipt, payments=payments,
                      sale=receivable_views[0].sale)
+
+    def on_AddReceiving__activate(self, action):
+        self._add_receiving()


More information about the POS-commit mailing list