Ejemplo n.º 1
0
    def forwards(self, orm):
        # Quotation
        for quotation in Quotation.objects():
            quotation._changed_fields = [
                'tenant', 'issuer', 'organization', 'contact', 'attachments',
                'related_invoice', 'down_payments', 'subscribers'
            ]
            set_embedded_changed_fields(quotation)
            quotation.save()

        # Invoice
        for invoice in Invoice.objects():
            invoice._changed_fields = [
                'tenant', 'issuer', 'organization', 'contact', 'attachments',
                'related_quotation', 'payments', 'subscribers'
            ]
            set_embedded_changed_fields(invoice)
            invoice.save()

        # DownPaymentInvoice
        for down_payment_invoice in DownPaymentInvoice.objects():
            down_payment_invoice._changed_fields = [
                'tenant', 'issuer', 'organization', 'contact', 'attachments',
                'related_quotation', 'payments', 'tax_applied', 'subscribers'
            ]
            set_embedded_changed_fields(down_payment_invoice)
            down_payment_invoice.save()

        # CreditNote
        for credit_note in CreditNote.objects():
            credit_note._changed_fields = [
                'tenant', 'issuer', 'organization', 'contact', 'attachments',
                'related_invoice', 'subscribers'
            ]
            set_embedded_changed_fields(credit_note)
            credit_note.save()

        # Item
        for item in Item.objects():
            item._changed_fields = ['tenant', 'currency', 'tax']
            item.save()

        # Payment
        for payment in Payment.objects():
            payment._changed_fields = ['tenant', 'issuer', 'currency']
            payment.save()

        # Tax
        for tax in Tax.objects():
            tax._changed_fields = ['tenant']
            tax.save()
    def forwards(self, orm):
        # Quotation
        for quotation in Quotation.objects():
            quotation._changed_fields = ['tenant', 'issuer', 'organization', 'contact', 'attachments', 'related_invoice', 'down_payments', 'subscribers']
            set_embedded_changed_fields(quotation)
            quotation.save()

        # Invoice
        for invoice in Invoice.objects():
            invoice._changed_fields = ['tenant', 'issuer', 'organization', 'contact', 'attachments', 'related_quotation', 'payments', 'subscribers']
            set_embedded_changed_fields(invoice)
            invoice.save()

        # DownPaymentInvoice
        for down_payment_invoice in DownPaymentInvoice.objects():
            down_payment_invoice._changed_fields = ['tenant', 'issuer', 'organization', 'contact', 'attachments', 'related_quotation', 'payments', 'tax_applied', 'subscribers']
            set_embedded_changed_fields(down_payment_invoice)
            down_payment_invoice.save()

        # CreditNote
        for credit_note in CreditNote.objects():
            credit_note._changed_fields = ['tenant', 'issuer', 'organization', 'contact', 'attachments', 'related_invoice', 'subscribers']
            set_embedded_changed_fields(credit_note)
            credit_note.save()

        # Item
        for item in Item.objects():
            item._changed_fields = ['tenant', 'currency', 'tax']
            item.save()

        # Payment
        for payment in Payment.objects():
            payment._changed_fields = ['tenant', 'issuer', 'currency']
            payment.save()

        # Tax
        for tax in Tax.objects():
            tax._changed_fields = ['tenant']
            tax.save()