Пример #1
0
    def _setup_widgets(self):
        self.ordered_items.set_columns(self._get_ordered_columns())
        self.received_items.set_columns(self._get_received_columns())
        self.payments_info_list.set_columns(self._get_payments_info_columns())

        purchase_items = PurchaseItemView.find_by_purchase(self.store, self.model)

        self.ordered_items.add_list(purchase_items)
        self.received_items.add_list(purchase_items)

        self.payments_list.set_columns(self._get_payments_columns())
        self.payments_list.add_list(self.model.group.payments)

        changes = PaymentChangeHistoryView.find_by_group(self.store,
                                                         self.model.group)
        self.payments_info_list.add_list(changes)

        if not self._receiving_orders:
            for widget in (self.received_freight_type_label,
                           self.received_freight_type,
                           self.received_freight_label,
                           self.received_freight):
                widget.hide()

        self.export_csv.set_visible(
            self.model.status == PurchaseOrder.ORDER_QUOTING)

        self._setup_summary_labels()

        label = self.print_labels.get_children()[0]
        label = label.get_children()[0].get_children()[1]
        label.set_label(_(u'Print labels'))
Пример #2
0
    def _setup_widgets(self):
        self.ordered_items.set_columns(self._get_ordered_columns())
        self.received_items.set_columns(self._get_received_columns())
        self.payments_info_list.set_columns(self._get_payments_info_columns())

        purchase_items = PurchaseItemView.find_by_purchase(
            self.store, self.model)

        self.ordered_items.add_list(purchase_items)
        self.received_items.add_list(purchase_items)

        self.payments_list.set_columns(self._get_payments_columns())
        self.payments_list.add_list(self.model.group.payments)

        changes = PaymentChangeHistoryView.find_by_group(
            self.store, self.model.group)
        self.payments_info_list.add_list(changes)

        if not self._receiving_orders:
            for widget in (self.received_freight_type_label,
                           self.received_freight_type,
                           self.received_freight_label, self.received_freight):
                widget.hide()

        self.export_csv.set_visible(
            self.model.status == PurchaseOrder.ORDER_QUOTING)

        self._setup_summary_labels()

        label = self.print_labels.get_children()[0]
        label = label.get_children()[0].get_children()[1]
        label.set_label(_(u'Print labels'))
Пример #3
0
    def _setup_widgets(self):
        self.payment_info_list.set_columns(self._get_columns())
        changes = PaymentChangeHistoryView.find_by_group(self.store, self.model.group)
        self.payment_info_list.add_list(changes)

        # workaround to improve the dialog looking
        if self.model.paid_value:
            penalty = self._get_penalty()
            self.penalty.update(penalty)
            self.interest.update(self.model.interest)
        else:
            self.paid_value.update(currency(0))
Пример #4
0
    def _setup_widgets(self):
        self.payment_info_list.set_columns(self._get_columns())
        changes = PaymentChangeHistoryView.find_by_group(self.store, self.model.group)
        self.payment_info_list.add_list(changes)

        # workaround to improve the dialog looking
        if self.model.paid_value:
            penalty = self._get_penalty()
            self.penalty.update(penalty)
            self.interest.update(self.model.interest)
        else:
            self.paid_value.update(currency(0))
Пример #5
0
    def _setup_widgets(self):
        if not self.model.client:
            self.details_button.set_sensitive(False)
        self._setup_columns()

        if self.model.status == PaymentRenegotiation.STATUS_RENEGOTIATED:
            self.status_details_button.show()
        else:
            self.status_details_button.hide()

        self.items_list.add_list(self._get_renegotiation_items())
        self.payments_list.add_list(self.model.payments)
        changes = PaymentChangeHistoryView.find_by_group(self.store, self.model.group)
        self.payments_info_list.add_list(changes)

        self._setup_summary_labels()
Пример #6
0
    def _setup_widgets(self):
        if not self.model.client:
            self.details_button.set_sensitive(False)
        self._setup_columns()

        if self.model.status == PaymentRenegotiation.STATUS_RENEGOTIATED:
            self.status_details_button.show()
        else:
            self.status_details_button.hide()

        self.items_list.add_list(self._get_renegotiation_items())
        self.payments_list.add_list(self.model.payments)
        changes = PaymentChangeHistoryView.find_by_group(
            self.store, self.model.group)
        self.payments_info_list.add_list(changes)

        self._setup_summary_labels()
Пример #7
0
    def _setup_widgets(self):
        if not self.model.client_id:
            self.details_button.set_sensitive(False)
        self._setup_columns()

        self.sale_order = self.model.sale
        if self.sale_order.status == Sale.STATUS_RENEGOTIATED:
            self.status_details_button.show()
        else:
            self.status_details_button.hide()

        parent_items = SaleItemsView.find_parent_items(self.store, self.sale_order)
        for parent_item in parent_items:
            self.items_list.append(None, parent_item)
            if parent_item.product and not parent_item.product.is_package:
                # Prevent Production components to be shown
                continue
            for children in parent_item.get_children():
                self.items_list.append(parent_item, children)

        notes = []
        details = self.sale_order.get_details_str()
        if details:
            notes.append(details)

        # Information about the original sale (in this case, this sale was
        # created as a trade for some items)
        returned_sale = self.store.find(ReturnedSale, new_sale=self.model.id).one()
        if returned_sale:
            if returned_sale.sale:
                traded_sale = returned_sale.sale.identifier
            else:
                traded_sale = _("Unknown")
            trade_notes = [
                "* %s" % _("Items traded for this sale"),
                _("Date: %s") % get_full_date(returned_sale.return_date),
                _("Traded sale: %s") % traded_sale,
                _("Invoice number: %s") % returned_sale.invoice.invoice_number,
                _("Reason: %s") % returned_sale.reason,
            ]
            notes.append("\n".join(trade_notes))

        returned_items = ReturnedSaleItemsView.find_parent_items(self.store, self.sale_order)
        seen_set = set()
        for item in returned_items:
            self.returned_items_list.append(None, item)
            if not item.is_package():
                continue
            for child in item.get_children():
                self.returned_items_list.append(item, child)
            if item.invoice_number in seen_set:
                continue

            fmt = _("Itens returned on %s")
            return_notes = ["* %s" % (fmt % (get_full_date(item.return_date)))]
            if item.new_sale:
                fmt = _("Traded for sale: %s")
                return_notes.append(fmt % (item.new_sale.identifier))

            return_notes.extend([_("Invoice number: %s") % item.invoice_number, _("Reason: %s") % item.reason])

            notes.append("\n".join(return_notes))
            seen_set.add(item.invoice_number)
        if len(list(self.returned_items_list)) == 0:
            page_no = self.details_notebook.page_num(self.returned_items_vbox)
            self.details_notebook.remove_page(page_no)

        buffer = gtk.TextBuffer()
        buffer.set_text("\n\n".join(notes))
        self.notes.set_buffer(buffer)

        self.payments_list.add_list(self._get_payments(self.sale_order))
        changes = PaymentChangeHistoryView.find_by_group(self.store, self.sale_order.group)
        self.payments_info_list.add_list(changes)

        for widget, method_name in [(self.print_bills, u"bill"), (self.print_booklets, u"store_credit")]:
            widget.set_visible(
                any([p.method.method_name == method_name and not p.is_cancelled() for p in self.payments_list])
            )

        self._refresh_comments()
        self.comment_info.set_sensitive(False)
Пример #8
0
    def _setup_widgets(self):
        if not self.model.client_id:
            self.details_button.set_sensitive(False)
        self._setup_columns()

        self.sale_order = self.store.get(Sale, self.model.id)

        if self.sale_order.status == Sale.STATUS_RENEGOTIATED:
            self.status_details_button.show()
        else:
            self.status_details_button.hide()

        sale_items = self.sale_order.get_items()
        self.items_list.add_list(sale_items)

        notes = []
        details = self.sale_order.get_details_str()
        if details:
            notes.append(details)

        returned_sale = self.store.find(ReturnedSale,
                                        new_sale=self.model.id).one()
        if returned_sale:
            if returned_sale.sale:
                traded_sale = returned_sale.sale.identifier
            else:
                traded_sale = _("Unknown")
            trade_notes = [
                '====== %s ======' % _("Items traded for this sale"),
                _("Date: %s") % returned_sale.return_date.strftime('%x'),
                _("Traded sale: %s") % traded_sale,
                _("Invoice number: %s") % returned_sale.invoice_number,
                _("Reason: %s") % returned_sale.reason,
            ]
            notes.append('\n'.join(trade_notes))

        returned_items = list(
            ReturnedSaleItemsView.find_by_sale(self.store, self.sale_order))
        if returned_items:
            self.returned_items_list.add_list(returned_items)
            seen_set = set()
            for item in returned_items:
                if item.invoice_number in seen_set:
                    continue

                fmt = _("Itens returned on %s")
                return_notes = [
                    '====== %s ======' % (fmt %
                                          (item.return_date.strftime('%x')))
                ]
                if item.new_sale:
                    fmt = _("Traded for sale: %s")
                    return_notes.append(fmt % (item.new_sale.identifier))

                return_notes.extend([
                    _("Invoice number: %s") % item.invoice_number,
                    _("Reason: %s") % item.reason,
                ])

                notes.append('\n'.join(return_notes))
                seen_set.add(item.invoice_number)
        else:
            page_no = self.details_notebook.page_num(self.returned_items_vbox)
            self.details_notebook.remove_page(page_no)

        buffer = gtk.TextBuffer()
        buffer.set_text('\n\n'.join(notes))
        self.notes.set_buffer(buffer)

        self.payments_list.add_list(self._get_payments(self.sale_order))
        changes = PaymentChangeHistoryView.find_by_group(
            self.store, self.sale_order.group)
        self.payments_info_list.add_list(changes)

        for widget, method_name in [(self.print_bills, u'bill'),
                                    (self.print_booklets, u'store_credit')]:
            widget.set_visible(
                any([
                    p.method.method_name == method_name
                    for p in self.payments_list
                ]))
Пример #9
0
    def _setup_widgets(self):
        if not self.model.client_id:
            self.details_button.set_sensitive(False)
        self._setup_columns()

        self.sale_order = self.model.sale
        if self.sale_order.status == Sale.STATUS_RENEGOTIATED:
            self.status_details_button.show()
        else:
            self.status_details_button.hide()

        parent_items = SaleItemsView.find_parent_items(self.store, self.sale_order)
        for parent_item in parent_items:
            self.items_list.append(None, parent_item)
            if parent_item.product and not parent_item.product.is_package:
                # Prevent Production components to be shown
                continue
            for children in parent_item.get_children():
                self.items_list.append(parent_item, children)

        notes = []
        details = self.sale_order.get_details_str()
        if details:
            notes.append(details)

        # Information about the original sale (in this case, this sale was
        # created as a trade for some items)
        returned_sale = self.store.find(ReturnedSale,
                                        new_sale=self.model.id).one()
        if returned_sale:
            if returned_sale.sale:
                traded_sale = returned_sale.sale.identifier
            else:
                traded_sale = _("Unknown")
            trade_notes = [
                '* %s' % _("Items traded for this sale"),
                _("Date: %s") % get_full_date(returned_sale.return_date),
                _("Traded sale: %s") % traded_sale,
                _("Invoice number: %s") % returned_sale.invoice_number,
                _("Reason: %s") % returned_sale.reason,
            ]
            notes.append('\n'.join(trade_notes))

        returned_items = ReturnedSaleItemsView.find_parent_items(self.store,
                                                                 self.sale_order)
        seen_set = set()
        for item in returned_items:
            self.returned_items_list.append(None, item)
            if not item.is_package():
                continue
            for child in item.get_children():
                self.returned_items_list.append(item, child)
            if item.invoice_number in seen_set:
                continue

            fmt = _("Itens returned on %s")
            return_notes = ['* %s' % (
                fmt % (get_full_date(item.return_date)))]
            if item.new_sale:
                fmt = _("Traded for sale: %s")
                return_notes.append(fmt % (item.new_sale.identifier))

            return_notes.extend([
                _("Invoice number: %s") % item.invoice_number,
                _("Reason: %s") % item.reason,
            ])

            notes.append('\n'.join(return_notes))
            seen_set.add(item.invoice_number)
        if len(list(self.returned_items_list)) == 0:
            page_no = self.details_notebook.page_num(self.returned_items_vbox)
            self.details_notebook.remove_page(page_no)

        buffer = gtk.TextBuffer()
        buffer.set_text('\n\n'.join(notes))
        self.notes.set_buffer(buffer)

        self.payments_list.add_list(self._get_payments(self.sale_order))
        changes = PaymentChangeHistoryView.find_by_group(self.store,
                                                         self.sale_order.group)
        self.payments_info_list.add_list(changes)

        for widget, method_name in [(self.print_bills, u'bill'),
                                    (self.print_booklets, u'store_credit')]:
            widget.set_visible(any(
                [p.method.method_name == method_name and not p.is_cancelled()
                 for p in self.payments_list]))

        self._refresh_comments()
        self.comment_info.set_sensitive(False)
Пример #10
0
    def _setup_widgets(self):
        if not self.model.client_id:
            self.details_button.set_sensitive(False)
        self._setup_columns()

        self.sale_order = self.store.get(Sale, self.model.id)

        if self.sale_order.status == Sale.STATUS_RENEGOTIATED:
            self.status_details_button.show()
        else:
            self.status_details_button.hide()

        sale_items = self.sale_order.get_items()
        self.items_list.add_list(sale_items)

        notes = []
        details = self.sale_order.get_details_str()
        if details:
            notes.append(details)

        returned_sale = self.store.find(ReturnedSale,
                                        new_sale=self.model.id).one()
        if returned_sale:
            if returned_sale.sale:
                traded_sale = returned_sale.sale.identifier
            else:
                traded_sale = _("Unknown")
            trade_notes = [
                '====== %s ======' % _("Items traded for this sale"),
                _("Date: %s") % returned_sale.return_date.strftime('%x'),
                _("Traded sale: %s") % traded_sale,
                _("Invoice number: %s") % returned_sale.invoice_number,
                _("Reason: %s") % returned_sale.reason,
            ]
            notes.append('\n'.join(trade_notes))

        returned_items = list(ReturnedSaleItemsView.find_by_sale(self.store,
                                                                 self.sale_order))
        if returned_items:
            self.returned_items_list.add_list(returned_items)
            seen_set = set()
            for item in returned_items:
                if item.invoice_number in seen_set:
                    continue

                return_notes = ['====== %s ======' % (
                                _("Itens returned on %s") % (
                                item.return_date.strftime('%x')))]
                if item.new_sale:
                    return_notes.append(_("Traded for sale: %s") % (
                                        item.new_sale.identifier))
                return_notes.extend([
                    _("Invoice number: %s") % item.invoice_number,
                    _("Reason: %s") % item.reason,
                ])

                notes.append('\n'.join(return_notes))
                seen_set.add(item.invoice_number)
        else:
            page_no = self.details_notebook.page_num(self.returned_items_vbox)
            self.details_notebook.remove_page(page_no)

        buffer = gtk.TextBuffer()
        buffer.set_text('\n\n'.join(notes))
        self.notes.set_buffer(buffer)

        self.payments_list.add_list(self._get_payments(self.sale_order))
        changes = PaymentChangeHistoryView.find_by_group(self.store,
                                                         self.sale_order.group)
        self.payments_info_list.add_list(changes)

        for widget, method_name in [(self.print_bills, u'bill'),
                                    (self.print_booklets, u'store_credit')]:
            widget.set_visible(any([p.method.method_name == method_name
                                    for p in self.payments_list]))