class EditTransaction(LoginRequiredMixin, TransactionPermissionMixin, QueuePostsMixin, LockTransactionDuringEditMixin, EditCashBookTransaction): header = { "model": CashBookHeader, "form": CashBookHeaderForm, "prefix": "header", "initial": { "total": 0 }, } line = { "model": CashBookLine, "formset": enter_lines, "prefix": "line", } create_on_the_fly = { "nominal_form": NominalForm(action=reverse_lazy("nominals:nominal_create"), prefix="nominal"), "vat_form": VatForm(action=reverse_lazy("vat:vat_create"), prefix="vat"), } template_name = "cashbook/edit.html" success_url = reverse_lazy("cashbook:transaction_enquiry") nominal_model = Nominal nominal_transaction_model = NominalTransaction cash_book_transaction_model = CashBookTransaction vat_transaction_model = VatTransaction module = "CB"
class EditTransaction( LoginRequiredMixin, TransactionPermissionMixin, QueuePostsMixin, LockTransactionDuringEditMixin, SupplierMixin, EditPurchaseOrSalesTransaction): header = { "model": PurchaseHeader, "form": PurchaseHeaderForm, "prefix": "header", } line = { "model": PurchaseLine, "formset": enter_lines, "prefix": "line", } match = { "model": PurchaseMatching, "formset": match, "prefix": "match" } create_on_the_fly = { "contact_form": ModalContactForm(action=reverse_lazy("contacts:create"), prefix="contact"), "nominal_form": NominalForm(action=reverse_lazy("nominals:nominal_create"), prefix="nominal"), "vat_form": VatForm(action=reverse_lazy("vat:vat_create"), prefix="vat"), } template_name = "purchases/edit.html" success_url = reverse_lazy("purchases:transaction_enquiry") nominal_model = Nominal nominal_transaction_model = NominalTransaction module = "PL" control_nominal_name = "Purchase Ledger Control" cash_book_transaction_model = CashBookTransaction vat_transaction_model = VatTransaction
def load_page(self): context_data = super().load_page() context_data["cashbook_form"] = CashBookForm( action=reverse_lazy("cashbook:cashbook_create"), prefix="cashbook") context_data["nominal_form"] = NominalForm( action=reverse_lazy("nominals:nominal_create"), prefix="nominal") context_data["form"] = self.get_filter_form() return context_data
class CreateTransaction( LoginRequiredMixin, TransactionPermissionMixin, QueuePostsMixin, CustomerMixin, CreatePurchaseOrSalesTransaction): header = { "model": SaleHeader, "form": SaleHeaderForm, "prefix": "header", "initial": {"total": 0}, } line = { "model": SaleLine, "formset": enter_lines, "prefix": "line", } match = { "model": SaleMatching, "formset": match, "prefix": "match" } create_on_the_fly = { "contact_form": ModalContactForm(action=reverse_lazy("contacts:create"), prefix="contact", initial={"customer": True}), "nominal_form": NominalForm(action=reverse_lazy("nominals:nominal_create"), prefix="nominal"), "vat_form": VatForm(action=reverse_lazy("vat:vat_create"), prefix="vat") } template_name = "sales/create.html" success_url = reverse_lazy("sales:transaction_enquiry") nominal_model = Nominal nominal_transaction_model = NominalTransaction module = "SL" control_nominal_name = SALES_CONTROL_ACCOUNT cash_book_transaction_model = CashBookTransaction default_type = "si" vat_transaction_model = VatTransaction
def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context["nominal_form"] = NominalForm( action=reverse_lazy("nominals:nominal_create"), prefix="nominal") return context