from configuration.models import (PaymentType, InvoiceStatus, InvoiceTerm, Template, Config, Image, ProductOrServiceTag, CustomerTag) from mercury.admin import MercuryAdmin, site class ConfigAdmin(MercuryAdmin): search_fields = ["name"] # All models must have MercuryAdmin (or subclasses) ModelAdmins # so that global list_per_page and other functionality works. site.register(PaymentType, MercuryAdmin) site.register(InvoiceStatus, MercuryAdmin) site.register(InvoiceTerm, MercuryAdmin) site.register(ProductOrServiceTag, MercuryAdmin) site.register(CustomerTag, MercuryAdmin) site.register(Template, MercuryAdmin) site.register(Config, ConfigAdmin) site.register(Image, MercuryAdmin)
new_deposit.made_by = request.user # save() to create the deposit, otherwise it can't have # payments assigned to it. new_deposit.save() rows_updated = queryset.update(deposit=new_deposit) if rows_updated == 1: message = "1 payment was" else: message = "%s payments were" % rows_updated message += " deposited successfully" # update the deposit total field new_deposit.update_total() new_deposit.save() self.message_user(request, message) else: messages.warning(request, "No deposit was created as none of the " "selected payments were depositable") deposit.short_description = "Deposit selected payments" # Registration site.register(Customer, CustomerAdmin) site.register(ProductOrService, ProductOrServiceAdmin) site.register(Invoice, InvoiceAdmin) site.register(Quote, QuoteAdmin) site.register(Payment, PaymentAdmin) site.register(Deposit, DepositAdmin) site.register(InvoiceEntry, SalesReportAdmin)