Script: Invoice to post / cancel

This script sets an invoice to posted or cancelled again, without carrying over data to the accounting system.

Product line

Standard

|

Expert

Operating mode

CLOUD ABO

|

ON-PREMISES

Modules

Services & CRM

Budget & Phases

Purchases

Resource Planning

Business Intelligence

Created: 25.05.2012
Updated: 10.10.2024 | Replaced script: When posting, the posting number is set to “0”.

Content

This script sets an invoice to posted or cancelled again, without carrying over data to the accounting system. This can be useful, for example, if an invoice should appear as posted in Vertec afterwards, but the accounting period has already been completed.

During the posting process, certain values are fixed in the Vertec. This script simulates this process. If the invoice has already been posted, it is cancelled, otherwise it is posted.

Version

All Vertec versions.

Execute

On the invoice or a list of invoices you want to set to posted/cancelled.

Scripting

InvoiceUpBookedCancelledSet.py

Script text

# coding: windows-1252
#
#---Description: Set post to post (without accounting)
# Class: Invoice
#   ObjectScript: Y
#   ContainerScript: Y
#   EventType: None
#   EventClass:
#   EventMembers:
#   ExtendedRights: N
#---If the member posted on the invoice is changed, instead of the default function post,
# Post some information is missing on the transactions (account, pknr). With this script the information
# Store saved and reinstated after switching.
#---29.10.2010, IB: created.
#---05.10.2012 RS: extended script allowing canceling and posting with a script.
#---19.06.2015 BR: extended: Execute on lists and individual items. Updatedatabase added.
#---05.11.2019 STH: When posting, set the document number to “0”.

from vtcapp import getpropertyvalue


def main():
    # Load selection objects
    if argobject.eval('oclistypeof( invoice)'):
        invoices = argobject.eval('self->asset’)
    else:
        invoices = argobject.eval('eintraege.list.oclastype( invoice)')

    # Adjust post/cancel.
    for invoice in invoices:
        if billed:
            if invoice.booked:
        # Change invoice posted so that all information is in it.
                invoice.booked = False
            else:
                rechnung.bhEKontoServices = invoice.
                invoice.bhEkountExpenses = invoice.IncomeAccountExpenses
                rechnung.bhEKountExpenses = invoice
                rechnung.bhPersonal account = invoice.Personalaccnum
                invoice.bhAdvanceAccount = invoice.project.advanceAccount
                invoice.bhDebiAccount = invoice.posting document.collective account
                invoice.bhDiscountAccount = getpropertyvalue(“DiscountAccount”)
                invoice.document number = “0”
                invoice.booked = True
      
    # Save
    vtcapp.updatedatabase()

main()



Bitte wählen Sie Ihren Standort