Updating account charts with trytond-console

Any hints as to how one can script the update of his account charts with trytond-console?
Not sure how to even get a handle to the wizard (‘account.update_chart’)…

You should have a look a the tests of the account module. The chart is setup by proteus there.

The update of the chart should be quite similar.

Thanks! test_account.py gave me the astuce (namely, type=‘wizard’)

I am using the following code:

def updateChart():
    with transaction.set_user(1):
        Account = pool.get('account.account')
        root, = Account.search([('parent', '=', None)])
        UpdateChart = pool.get('account.update_chart', type='wizard')
        session_id, _, _ = UpdateChart.create()
        update_chart = UpdateChart(session_id)
        update_chart.start.account = root
        return update_chart.transition_update()

print('Updating Chart of Accounts...')
updateChart()
transaction.commit()

It mostly comes from tests.

Yeah, that’s pretty much what I came up with, adding account_code_digits support as well.
cheers

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.