Go to file
2026-05-25 08:42:22 +07:00
models first commit 2026-05-25 08:42:22 +07:00
__init__.py first commit 2026-05-25 08:42:22 +07:00
__manifest__.py first commit 2026-05-25 08:42:22 +07:00
.gitignore first commit 2026-05-25 08:42:22 +07:00
README.md first commit 2026-05-25 08:42:22 +07:00

Multi-Company Product & Category Settings Sync

This Odoo 19 module automatically shares and synchronizes company-dependent product and product category settings from a parent company to all active branch (descendant) companies recursively.

Overview

In Odoo, standard product templates (product.template) and product categories (product.category) are globally accessible if their company_id is set to False (empty). However, accounting, taxes, and routing settings remain company-dependent:

  1. Accounting Accounts: Stored as jsonb fields on the model in Odoo 19, mapping company IDs directly to account record IDs.
  2. Taxes & Routes: Many-to-many relationships where each company must map its own specific records.

This module automates the propagation of these settings down the company hierarchy, minimizing manual configuration errors across multiple branch companies.

Features

🏢 Recursive Multi-Company Synchronization

Propagates all settings down the active company's branch hierarchy recursively using Odoo's fast 'child_of' operator.

🧮 Product Category Sync (product.category)

Synchronizes the following fields from the parent category to branch categories:

  • Inventory Valuation: Periodic or Automated (property_valuation)
  • Costing Method: Standard, Average (AVCO), or FIFO (property_cost_method)
  • Income Account (property_account_income_categ_id)
  • Expense Account (property_account_expense_categ_id)
  • Price Difference Account (property_price_difference_account_id)
  • Stock Production Cost Account (property_stock_account_production_cost_id)
  • Stock Valuation Account (property_stock_valuation_account_id)
  • Note: account_stock_variation_id (Stock Variation Account) in Odoo 19 is a global field (company_dependent=False) and is shared automatically without additional sync code.
  • Valuation Journal Excluded: The Stock Journal (property_stock_journal) is completely excluded from the sync to remain branch-company specific.

📦 Product Template Sync (product.template)

Synchronizes the following fields from the parent product template to branch templates:

  • Income Account (property_account_income_id)
  • Expense Account (property_account_expense_id)
  • Price Difference Account (property_price_difference_account_id)
  • Stock Inventory Location (property_stock_inventory)
  • Stock Production Location (property_stock_production)
  • Customer Taxes (taxes_id) & Vendor Taxes (supplier_taxes_id)
  • Logistics Routes (route_ids)
  • Note: Many-to-Many taxes and routes updates are performed safely to prevent standard Odoo writes from clearing the mappings of other unrelated branch companies.
  • Cost Price Excluded: Cost price (standard_price) is excluded from synchronization to allow branch-specific costing.

🔄 Intelligent Branch Counterpart Matching

When mapping a parent company record to a child company:

  1. Accounts: Matches by account code. (Falls back to the parent record if no branch-specific account is found, as accounts in Odoo 19 can be shared across companies).
  2. Taxes: Matches by tax name, type_tax_use, amount, and amount_type.
  3. Routes: Matches by route name.
  4. Locations: Matches by complete_name first, then by name.
  5. Universal Fallback: If no specific branch-company counterpart exists, the sync falls back to preserving the parent record value for the branch (to support retail setups where branch companies share the parent company's chart of accounts and taxes).

Installation

  1. Copy the multicompany_product_sync folder to your custom addons directory.
  2. Restart your Odoo server.
  3. Activate the developer mode in Odoo.
  4. Go to Apps -> Update Apps List.
  5. Search for Multi-Company Product & Category Settings Sync and click Activate.

Technical Details

Infinite Loop Prevention

All synchronization logic utilizes context variables (e.g., skip_company_dependent_sync=True) when executing writes on branch companies, ensuring that child company updates do not trigger redundant and infinite synchronization loops.

Directory Structure

multicompany_product_sync/
├── __init__.py
├── __manifest__.py
├── README.md
├── .gitignore
└── models/
    ├── __init__.py
    ├── product_category.py
    └── product_template.py