skilld-labs / go-odoo

Golang wrapper for Odoo API
Apache License 2.0
86 stars 62 forks source link

Fixes for Odoo 17 compatibility and functionality enhancements #52

Closed Stolexiy closed 6 months ago

Stolexiy commented 6 months ago

This pull request addresses several issues encountered while using the go-odoo module with Odoo 17:

  1. Error handling for all models generation: Ensures that the generator gracefully handles errors that may occur when attempting to generate code for all available models, preventing unexpected crashes.
  2. Compatibility with models lacking ID property: Addresses an issue where models in Odoo 17 that lack an ID property (e.g., mixins) caused broken file generation due to the reliance on the ID for various methods.
  3. Correct variable naming for MailActivityPlan model: Fixes an issue where the generator incorrectly created a variable named map for the MailActivityPlan model, which caused errors.
  4. Context options for the Create() method: Introduces optional context parameters for the Create() method, allowing for more flexibility when creating model instances. This addition addresses specific use cases, such as setting the install_mode=true context for the res.user model to create an archived user or without sending emails.

Note: Adding context options to Create() introduces a backward compatibility issue. Therefore, it is only implemented for the Create() method, and the template needs to be updated to incorporate this functionality into higher-level methods if needed.

ahuret commented 6 months ago

LGTM, thanks a lot :fire: Merging