OCA / account-financial-tools

Odoo Accountant Financial Tools and Utils
GNU Affero General Public License v3.0
300 stars 741 forks source link

account_chart_update: mass update on several companies #1818

Open fgi-osw opened 5 months ago

fgi-osw commented 5 months ago

The wizard "only" allows to edit in one company at a time. Well, it remains a great tool, but in case of minor changes, in case of dozens of companies, it's quicker to use an import file.

Is there a way to update at once in several companies using the same chart template?

Do you see an issue in doing so?

Thank you!

pedrobaeza commented 5 months ago

Hi, Frédéric! I'm afraid the tool is not thought for that mass-update.

It's easy to pipe through a shell script for doing in mass though, but not having decision power between them:

for company in env["res.company"].search([]):
    print(f"Company {company.name} ({company.id})")
    wizard = env["wizard.update.charts.accounts"].with_company(company).create({"company_id": company.id, "chart_template_id": company.chart_template_id.id, "continue_on_errors": True, "recreate_xml_ids": True})
    wizard.action_find_records()
    wizard.action_update_records()
    env.cr.commit()
fgi-osw commented 5 months ago

Thank you @pedrobaeza !

btw any recommendation on how to set it up? Is it not safer to configure custom charts (with new accounts, taxes) rather than editing existing ones? In order to keep a fully standard setup in the system, in case. @

pedrobaeza commented 5 months ago

There's not too much problem in creating new accounts, but new taxes should be more controlled, specially in Spain, as the localization modules don't use taxes grids (it's a conscious decision by several reasons (you can see them here - in Spanish -: https://youtu.be/bmXozh08xbM?t=740)