İçereği Atla
Menü
Bu soru işaretlendi

Hello Odoo Community,


I'm currently working with the Odoo 17 Community API using XML-RPC and have encountered an issue while attempting to set the default fiscal position. Below is a snippet of my code for configuring Romanian localization:



private async configureRomanianLocalization(uid: number, companyId: number): Promise<void> {

  try {

    // Step 1: Check and install Romanian localization module

    const moduleInfo = await this.executeKw(uid, "ir.module.module", "search_read", [[["name", "=", "l10n_ro"]], ["state"]]);


    if (!moduleInfo.length) {

      throw new Error("Romanian localization module (l10n_ro) not found");

    }


    if (moduleInfo[0].state !== "installed") {

      // Install the module

      await this.executeKw(uid, "ir.module.module", "button_immediate_install", [[moduleInfo[0].id]]);

      console.log("Romanian localization module installed successfully");

    }


    // ... [additional steps omitted for brevity]


    // Step 6: Set accounting settings

    await this.executeKw(uid, "res.config.settings", "create", [

      {

        company_id: companyId,

        chart_template_id: "l10n_ro.ro_chart_template",

        module_account_accountant: true,

        module_l10n_ro_accounting: true,

        group_analytic_accounting: true,

        fiscalyear_last_day: 31,

        fiscalyear_last_month: 12,

        tax_calculation_rounding_method: "round_globally",

      },

    ]);


    console.log("Romanian localization configured successfully for company:", companyId);

  } catch (error: any) {

    console.error("Error configuring Romanian localization:", error);

    throw new Error(`Failed to configure Romanian fiscal settings: ${error.message}`);

  }

}


I am particularly having trouble with setting the default fiscal position. If anyone has experience with this or can provide guidance on how to properly configure fiscal positions in Odoo, I would greatly appreciate your help.


Thank you in advance for your assistance!

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
0
Oca 25
855
2
Eyl 24
1218
3
Tem 25
2928
3
Tem 25
2016
1
Haz 25
2358