Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][MIG] procurement_mto_analytic: Migration to 17.0 #735

Open
wants to merge 24 commits into
base: 17.0
Choose a base branch
from

Conversation

alan196
Copy link
Contributor

@alan196 alan196 commented Jan 18, 2025

Migration of procurement_mto_analytic Module to 17.0

This Pull Request migrates the procurement_mto_analytic module from version 15.0 to 17.0 and updates its functionality to align with the new analytic distribution feature introduced in Odoo.

Key Changes

  1. Analytic Account to Analytic Distribution

    • The module now uses analytic distributions instead of the analytic account.
    • This allows distributing amounts across multiple analytic accounts in a single record.
  2. Search Method Enhancement

    • Updated the search method to support searching by analytic distribution.
    • The analytic distribution is serialized to JSON when defining the domain and deserialized back into a dictionary for processing. This resolves issues related to the dictionary domain key causing errors, such as the one in purchase_stock.models.stock_rule.
  3. Procurement Flow Adjustments

    • Analytic distribution values from sale orders are carried forward to the corresponding purchase order lines. Purchase orders are no longer grouped if their analytic distributions differ.
  4. Code Simplifications

    • Removed unused models and redundant methods, such as those handling the deprecated account_analytic_id.
    • Consolidated logic into relevant models for clarity and maintainability.
  5. Tests Updated

    • Enhanced test cases to validate the behavior with analytic distributions. Tests now ensure that the analytic distribution is correctly transferred and validated in purchase orders.

Why This Change?

The migration ensures the module leverages Odoo's latest analytic distribution feature for more flexible and accurate cost tracking. It also addresses technical limitations in the previous implementation by utilizing JSON serialization to manage domains involving dictionary data.

Technical Details

  • In purchase_order.search, analytic distribution domains are transformed into JSON strings and back into dictionaries to prevent errors.
  • Adjusted _make_po_get_domain in stock_rule.py to handle analytic distribution using JSON serialization.

Additional Changes

  • Removed obsolete code and replaced account_analytic_id logic with the new analytic_distribution field.

Impact

This migration improves the module's compatibility with Odoo 17.0, provides more robust analytic tracking, and resolves domain definition errors related to analytic distribution handling.

Sergej Lozikov and others added 24 commits January 17, 2025 15:52
Currently translated at 100.0% (3 of 3 strings)

Translation: account-analytic-13.0/account-analytic-13.0-procurement_mto_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-13-0/account-analytic-13-0-procurement_mto_analytic/es/
Currently translated at 100.0% (3 of 3 strings)

Translation: account-analytic-13.0/account-analytic-13.0-procurement_mto_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-13-0/account-analytic-13-0-procurement_mto_analytic/ca/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: account-analytic-15.0/account-analytic-15.0-procurement_mto_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-15-0/account-analytic-15-0-procurement_mto_analytic/
Currently translated at 100.0% (4 of 4 strings)

Translation: account-analytic-15.0/account-analytic-15.0-procurement_mto_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-15-0/account-analytic-15-0-procurement_mto_analytic/es/
Currently translated at 100.0% (4 of 4 strings)

Translation: account-analytic-15.0/account-analytic-15.0-procurement_mto_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-15-0/account-analytic-15-0-procurement_mto_analytic/ca/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants