Skip to content

Marketplace Settings Documentation

Overview

The Marketplace Settings model (marketplace.settings) configures how marketplace integrations (like Shopee) synchronize data with the accounting system. It controls which mapping mode is active: channel-based, product-based, or account-based mapping.


Model Information

Model Name: marketplace.settings Display Name: Marketplace Settings Key Fields: None (singleton pattern)

Features

  • ❌ Audit logging enabled (_audit_log)
  • ❌ Multi-company support (company_id)
  • ❌ Full-text content search (_content_search)
  • ✅ Mutually exclusive options (only one active at a time)
  • ✅ At least one option required

Key Fields Reference

All Fields

Field Type Required Description
channel_mapping Boolean Enable channel-based mapping
product_mapping Boolean Enable product-based mapping
account_mapping Boolean Enable account-based mapping (default)

Default Values

_defaults = {
    "channel_mapping": False,
    "product_mapping": False,
    "account_mapping": True,
}

Mapping Modes

Mode Description
Channel Mapping Maps sales by marketplace channel
Product Mapping Maps sales by product to specific accounts
Account Mapping Maps all sales to configured accounts

API Methods

1. Write Override

Method: write(ids, vals, context={}, **kw)

Validates that only one option is selected.

Validation: - Only one mapping option can be true - At least one option must be selected

Raises: - Exception("Only one option can be selected at a time.") - Exception("At least one option must be selected.")


Common Use Cases

Use Case 1: Enable Channel Mapping

# Get settings record
settings = get_model("marketplace.settings").browse([1])[0]

# Switch to channel mapping
get_model("marketplace.settings").write([1], {
    "channel_mapping": True,
    "product_mapping": False,
    "account_mapping": False,
})

Use Case 2: Check Active Mode

settings = get_model("marketplace.settings").browse([1])[0]

if settings.channel_mapping:
    print("Using channel-based mapping")
elif settings.product_mapping:
    print("Using product-based mapping")
else:
    print("Using account-based mapping")

Version History

Last Updated: December 2024 Model Version: marketplace_settings.py Framework: Netforce


This documentation is generated for developer onboarding and reference purposes.