[POS-commit] r6319 - in stoqlib/trunk: data/glade stoqlib/gui/dialogs stoqlib/gui/slaves

fabio morbec fabio at async.com.br
Wed Apr 4 17:39:16 BRT 2007


Author: fabio
Date: Wed Apr  4 17:39:16 2007
New Revision: 6319

Modified:
   stoqlib/trunk/data/glade/PurchaseDetailsDialog.glade
   stoqlib/trunk/stoqlib/gui/dialogs/purchasedetails.py
   stoqlib/trunk/stoqlib/gui/slaves/installmentslave.py

Log:
#3271: Nos detalhes de pagamentos é necessário que seja exibido as condições do mesmo. r=jdahlin

Modified: stoqlib/trunk/data/glade/PurchaseDetailsDialog.glade
==============================================================================
--- stoqlib/trunk/data/glade/PurchaseDetailsDialog.glade	(original)
+++ stoqlib/trunk/data/glade/PurchaseDetailsDialog.glade	Wed Apr  4 17:39:16 2007
@@ -45,8 +45,8 @@
                             <packing>
                                 <property name="top_attach">2</property>
                                 <property name="bottom_attach">3</property>
-                                <property name="x_options">&lt;flags 0 of type GtkAttachOptions&gt;</property>
-                                <property name="y_options">&lt;flags 0 of type GtkAttachOptions&gt;</property>
+                                <property name="x_options"></property>
+                                <property name="y_options"></property>
                             </packing>
                         </child>
                         <child>
@@ -181,6 +181,31 @@
                         <property name="is_focus">True</property>
                         <property name="visible">True</property>
                         <child>
+                            <widget class="GtkVBox" id="payments_vbox">
+                                <property name="border_width">6</property>
+                                <property name="spacing">6</property>
+                                <property name="visible">True</property>
+                                <child>
+                                    <widget class="ObjectList" id="payments_list">
+                                        <property name="is_focus">True</property>
+                                        <property name="shadow_type">in</property>
+                                        <property name="visible">True</property>
+                                        <property name="vscrollbar_policy">automatic</property>
+                                    </widget>
+                                </child>
+                                <child>
+                                    <placeholder/>
+                                    <packing>
+                                        <property name="expand">False</property>
+                                        <property name="position">1</property>
+                                    </packing>
+                                </child>
+                            </widget>
+                            <packing>
+                                <property name="tab_label" context="yes" translatable="yes">Payments</property>
+                            </packing>
+                        </child>
+                        <child>
                             <widget class="GtkVBox" id="vbox">
                                 <property name="border_width">6</property>
                                 <property name="spacing">18</property>
@@ -215,13 +240,14 @@
                                         <child>
                                             <placeholder/>
                                             <packing>
-                                                <property name="x_options">&lt;flags 0 of type GtkAttachOptions&gt;</property>
-                                                <property name="y_options">&lt;flags 0 of type GtkAttachOptions&gt;</property>
+                                                <property name="x_options"></property>
+                                                <property name="y_options"></property>
                                             </packing>
                                         </child>
                                         <child>
                                             <widget class="ProxyLabel" id="discount">
                                                 <property name="label" context="yes" translatable="yes">Discount:</property>
+                                                <property name="model_attribute"></property>
                                                 <property name="visible">True</property>
                                                 <property name="xalign">0.0</property>
                                             </widget>
@@ -237,7 +263,7 @@
                                             <packing>
                                                 <property name="left_attach">1</property>
                                                 <property name="right_attach">2</property>
-                                                <property name="y_options">&lt;flags 0 of type GtkAttachOptions&gt;</property>
+                                                <property name="y_options"></property>
                                             </packing>
                                         </child>
                                         <child>
@@ -261,13 +287,14 @@
                                             <packing>
                                                 <property name="left_attach">2</property>
                                                 <property name="right_attach">3</property>
-                                                <property name="x_options">&lt;flags 0 of type GtkAttachOptions&gt;</property>
-                                                <property name="y_options">&lt;flags 0 of type GtkAttachOptions&gt;</property>
+                                                <property name="x_options"></property>
+                                                <property name="y_options"></property>
                                             </packing>
                                         </child>
                                         <child>
                                             <widget class="ProxyLabel" id="surcharge">
                                                 <property name="label" context="yes" translatable="yes">Surcharge:</property>
+                                                <property name="model_attribute"></property>
                                                 <property name="visible">True</property>
                                                 <property name="xalign">1.0</property>
                                             </widget>
@@ -284,7 +311,7 @@
                                             <packing>
                                                 <property name="left_attach">3</property>
                                                 <property name="right_attach">4</property>
-                                                <property name="y_options">&lt;flags 0 of type GtkAttachOptions&gt;</property>
+                                                <property name="y_options"></property>
                                             </packing>
                                         </child>
                                         <child>
@@ -306,6 +333,7 @@
                                             <widget class="ProxyLabel" id="subtotal">
                                                 <property name="data_type">bool</property>
                                                 <property name="label" context="yes" translatable="yes">Subtotal:</property>
+                                                <property name="model_attribute"></property>
                                                 <property name="visible">True</property>
                                                 <property name="xalign">0.0</property>
                                             </widget>
@@ -320,6 +348,7 @@
                                             <widget class="ProxyLabel" id="total">
                                                 <property name="data_type">bool</property>
                                                 <property name="label" context="yes" translatable="yes">Total:</property>
+                                                <property name="model_attribute"></property>
                                                 <property name="visible">True</property>
                                                 <property name="xalign">0.0</property>
                                             </widget>
@@ -369,6 +398,7 @@
                                 </child>
                             </widget>
                             <packing>
+                                <property name="position">1</property>
                                 <property name="tab_label" context="yes" translatable="yes">Ordered</property>
                             </packing>
                         </child>
@@ -393,7 +423,7 @@
                                 </child>
                             </widget>
                             <packing>
-                                <property name="position">1</property>
+                                <property name="position">2</property>
                                 <property name="tab_label" context="yes" translatable="yes">Received</property>
                             </packing>
                         </child>
@@ -411,6 +441,7 @@
                                         <child>
                                             <widget class="ProxyLabel" id="kiwilabel1">
                                                 <property name="label" context="yes" translatable="yes">Payment Method:</property>
+                                                <property name="model_attribute"></property>
                                                 <property name="visible">True</property>
                                                 <property name="xalign">1.0</property>
                                             </widget>
@@ -418,6 +449,7 @@
                                         <child>
                                             <widget class="ProxyLabel" id="kiwilabel10">
                                                 <property name="label" context="yes" translatable="yes">Salesperson:</property>
+                                                <property name="model_attribute"></property>
                                                 <property name="visible">True</property>
                                                 <property name="xalign">1.0</property>
                                             </widget>
@@ -439,6 +471,7 @@
                                         <child>
                                             <widget class="ProxyLabel" id="kiwilabel5">
                                                 <property name="label" context="yes" translatable="yes">Transporter:</property>
+                                                <property name="model_attribute"></property>
                                                 <property name="visible">True</property>
                                                 <property name="xalign">1.0</property>
                                             </widget>
@@ -450,6 +483,7 @@
                                         <child>
                                             <widget class="ProxyLabel" id="kiwilabel9">
                                                 <property name="label" context="yes" translatable="yes">Freight Type:</property>
+                                                <property name="model_attribute"></property>
                                                 <property name="visible">True</property>
                                                 <property name="xalign">1.0</property>
                                             </widget>
@@ -471,6 +505,7 @@
                                         <child>
                                             <widget class="ProxyLabel" id="kiwilabel14">
                                                 <property name="label" context="yes" translatable="yes">Notes:</property>
+                                                <property name="model_attribute"></property>
                                                 <property name="visible">True</property>
                                                 <property name="xalign">1.0</property>
                                             </widget>
@@ -504,6 +539,7 @@
                                         <child>
                                             <widget class="ProxyLabel" id="payment_method">
                                                 <property name="data_type">unicode</property>
+                                                <property name="justify">right</property>
                                                 <property name="model_attribute">default_payment_method_name</property>
                                                 <property name="visible">True</property>
                                                 <property name="xalign">0.0</property>
@@ -567,6 +603,7 @@
                                         <child>
                                             <widget class="ProxyLabel" id="kiwilabel3">
                                                 <property name="label" context="yes" translatable="yes">Number of Installments:</property>
+                                                <property name="model_attribute"></property>
                                                 <property name="visible">True</property>
                                                 <property name="xalign">1.0</property>
                                             </widget>
@@ -587,6 +624,7 @@
                                         <child>
                                             <widget class="ProxyLabel" id="kiwilabel7">
                                                 <property name="label" context="yes" translatable="yes">Expected Receival Date:</property>
+                                                <property name="model_attribute"></property>
                                                 <property name="visible">True</property>
                                                 <property name="xalign">1.0</property>
                                             </widget>
@@ -600,6 +638,7 @@
                                         <child>
                                             <widget class="ProxyLabel" id="kiwilabel11">
                                                 <property name="label" context="yes" translatable="yes">Freight:</property>
+                                                <property name="model_attribute"></property>
                                                 <property name="visible">True</property>
                                             </widget>
                                             <packing>
@@ -667,6 +706,7 @@
                                                 <child>
                                                     <widget class="ProxyLabel" id="kiwilabel13">
                                                         <property name="label" context="yes" translatable="yes">%</property>
+                                                        <property name="model_attribute"></property>
                                                         <property name="visible">True</property>
                                                         <property name="xalign">0.0</property>
                                                     </widget>
@@ -711,7 +751,7 @@
                                 </child>
                             </widget>
                             <packing>
-                                <property name="position">2</property>
+                                <property name="position">3</property>
                                 <property name="tab_label" context="yes" translatable="yes">Additional Info</property>
                             </packing>
                         </child>

Modified: stoqlib/trunk/stoqlib/gui/dialogs/purchasedetails.py
==============================================================================
--- stoqlib/trunk/stoqlib/gui/dialogs/purchasedetails.py	(original)
+++ stoqlib/trunk/stoqlib/gui/dialogs/purchasedetails.py	Wed Apr  4 17:39:16 2007
@@ -24,10 +24,13 @@
 ##
 """ Purchase details dialogs """
 
+import datetime
+
 import gtk
 from kiwi.datatypes import currency
-from kiwi.ui.widgets.list import Column, SummaryLabel
+from kiwi.ui.widgets.list import Column, SummaryLabel, ColoredColumn
 
+from stoqlib.lib.defaults import payment_value_colorize
 from stoqlib.lib.translation import stoqlib_gettext
 from stoqlib.gui.editors.baseeditor import BaseEditor
 from stoqlib.gui.base.dialogs import print_report
@@ -41,7 +44,7 @@
     gladefile = "PurchaseDetailsDialog"
     model_type = PurchaseOrder
     title = _("Purchase Details")
-    size = (650, 460)
+    size = (750, 460)
     hide_footer = True
     proxy_widgets = ('branch',
                      'order_number',
@@ -61,14 +64,16 @@
     payment_proxy = ('payment_method',
                      'installments_number')
 
-    def _setup_widgets(self):
-        self.ordered_items.set_columns(self._get_ordered_columns())
-        self.received_items.set_columns(self._get_received_columns())
+    def _setup_summary_labels(self):
+        value_format = '<b>%s</b>'
 
-        self.ordered_items.add_list(self.model.get_items())
-        self.received_items.add_list(self.model.get_partially_received_items())
+        payment_summary_label = SummaryLabel(klist=self.payments_list,
+                                             column='base_value',
+                                             label='<b>%s</b>' % _(u"Total:"),
+                                             value_format=value_format)
+        payment_summary_label.show()
+        self.payments_vbox.pack_start(payment_summary_label, False)
 
-        value_format = '<b>%s</b>'
         received_label = '<b>%s</b>' % _('Total Received:')
         received_summary_label = SummaryLabel(klist=self.received_items,
                                               column='received_total',
@@ -77,6 +82,19 @@
         received_summary_label.show()
         self.received_vbox.pack_start(received_summary_label, False)
 
+    def _setup_widgets(self):
+        self.ordered_items.set_columns(self._get_ordered_columns())
+        self.received_items.set_columns(self._get_received_columns())
+
+        self.ordered_items.add_list(self.model.get_items())
+        self.received_items.add_list(self.model.get_partially_received_items())
+
+        self.payments_list.set_columns(self._get_payments_columns())
+        group = IPaymentGroup(self.model)
+        self.payments_list.add_list(group.get_items())
+
+        self._setup_summary_labels()
+
     def _get_ordered_columns(self):
         return [Column('sellable.base_sellable_info.description',
                        title=_('Description'),
@@ -102,6 +120,26 @@
                 Column('received_total', title=_('Total'),
                        data_type=currency, width=100)]
 
+    def _get_payments_columns(self):
+        return [Column('id', "#", data_type=int, width=50,
+                       format='%04d', justify=gtk.JUSTIFY_RIGHT),
+                Column('method.description', _("Type"),
+                       data_type=str, width=90),
+                Column('description', _("Description"), data_type=str,
+                       width=190, expand=True),
+                Column('due_date', _("Due Date"), sorted=True,
+                       data_type=datetime.date, width=110,
+                       justify=gtk.JUSTIFY_RIGHT),
+                Column('status_str', _("Status"), data_type=str, width=80),
+                ColoredColumn('paid_value', _("Paid Value"), data_type=currency,
+                              width=90, color='red',
+                              justify=gtk.JUSTIFY_RIGHT,
+                              data_func=payment_value_colorize),
+                ColoredColumn('base_value', _("Value"), data_type=currency,
+                              width=90, color='red',
+                              justify=gtk.JUSTIFY_RIGHT,
+                              data_func=payment_value_colorize)]
+
     #
     # BaseEditor hooks
     #

Modified: stoqlib/trunk/stoqlib/gui/slaves/installmentslave.py
==============================================================================
--- stoqlib/trunk/stoqlib/gui/slaves/installmentslave.py	(original)
+++ stoqlib/trunk/stoqlib/gui/slaves/installmentslave.py	Wed Apr  4 17:39:16 2007
@@ -133,8 +133,8 @@
                 Column('description', _("Description"), data_type=str),
                 Column('due_date', _("Due"), data_type=datetime.date),
                 Column('paid_date', _("Paid date"), data_type=datetime.date),
-                Column('value', _("Value"), data_type=currency),
-                Column('paid_value', _("Paid value"), data_type=currency)]
+                Column('base_value', _("Value"), data_type=currency),
+                Column('value', _("Paid value"), data_type=currency)]
 
     def _setup_widgets(self):
         self.installments.set_columns(self._get_columns())


More information about the POS-commit mailing list