Script: Set verr attributes on invoices before Vertec 6.5

Sets the verr attributes (verrLeistungenExt, verrSpesenExt, and verrAuslagenExt) on invoices charged before Vertec 6.5.

Product line

Standard

|

Expert

Operating mode

CLOUD ABO

|

ON-PREMISES

Modules

Services & CRM

Budget & Phases

Purchases

Resource Planning

Business Intelligence

Created: 17.08.2021
Machine translated
Updated: 25.03.2024 | Script adapted

With Vertec version 6.5, the attributes verrLeistungenExt, verrSpesenExt and verrAuslagenExt have been introduced on the invoice.

When charging the invoice, the corresponding values are written into these attributes and thus fixed.

The invoice totals as well as the calculated (derived) attributes leistungenExt, spesenExt and auslagenExt then derive their values for charged invoices from these verr attributes, without having to load any objects for the summation, which means a performance improvement.

This script is available in order to fill the corresponding verr attributes for invoices charged before the update to Vertec 6.5.

Execute

Vertec versions from 6.5 onwards. The script is run once in the Script Editor . Requires administrator privileges.

Script

set_attributes_to_accounts_invoices.py

Script text

#---Setzt die Attribute verrAuslagenExt, verrSpesenExt und verrLeistWertExt auf verrechneten Rechnungen, welche vor dem Update auf Vertec 6.5 verrechnet wurden. 
#   Nach dem Ausführen dieses Scripts muss die Vertec Session neu gestartet werden, da auf die 
#   verr-Attribute nicht subscribed wird.
#---05.01.2021, cmi: erstellt.
#---03.04.2024, sth: SystemContext() entfernt. Das Script muss im Script Editor von einem Administrator ausgeführt werden.

def main():

    optimizingInvoices = vtcapp.getwithsql("Rechnung", "(verrechnet=1) and (verrAuslagenExt is null) and (verrSpesenExt is null) and (verrLeistWertExt is null)", "")

    for invoice in optimizingInvoices:
        invoice.verrAuslagenExt = invoice.AuslagenExt
        invoice.verrSpesenExt = invoice.SpesenExt
        invoice.verrLeistWertExt = invoice.LeistWertExt

    vtcapp.updatedatabase()
        
    print "updated %d invoices" % len(optimizingInvoices)

main()