def on_credit__toggled(self, widget): if self.credit.get_active(): msg = ( _("The client will receive %s in credit for future purchases") % format_price(self.returned_total.read())) self.message.set_text(msg) self.wizard.credit = True
def _update_difference_label(self): difference = self.get_total_difference() if not difference: label_name = _('Difference') elif difference > 0: label_name = _('Overpaid:') elif difference < 0: label_name = _('Outstanding:') difference *= -1 difference = format_price(difference, True, DECIMAL_PRECISION) self.difference_label.set_text(difference) self.difference_status_label.set_text(label_name)
def _update_next_step(self, method): received_value = self.cash_change_slave.received_value if method and method.method_name == u'money': self.wizard.enable_finish() if self.wizard.need_create_payment(): self.cash_change_slave.enable_cash_change() else: # In this case, the user has already paid more than the total # sale amount. self.cash_change_slave.disable_cash_change() elif method and method.method_name == u'credit': self.wizard.enable_finish() if self.wizard.need_create_payment(): received_value.set_text(format_price(self.get_remaining_value())) self.cash_change_slave.disable_cash_change() else: self.wizard.disable_finish() if self.wizard.need_create_payment(): received_value.set_text(format_price(self.get_remaining_value())) else: self.wizard.enable_finish() self.cash_change_slave.disable_cash_change()
def get_formatted_price(float_value, symbol=True, precision=DECIMAL_PRECISION): return format_price(float_value, symbol=symbol, precision=precision)
def _setup_widgets(self): self.payment_list.set_columns(self._get_columns()) self.total_label.set_text(format_price(self.total_value, True, DECIMAL_PRECISION))