Skip to content

sr_general_sales v6.0.0 — 2026-03-31

Author: Dan Branch: jan Conflicts with staging-2: None (Nisarg has no changes to sr_general_sales)


What Changed

  1. eBay REST API — Full Sell Inventory API implementation (create inventory item, create offer, publish) using OAuth 2.0
  2. OAuth 2.0 consent flow — Generate authorization URL, exchange auth code for tokens, auto-refresh. New UI in API Settings.
  3. Business policies — Auto-detects seller's payment/return/shipping profile IDs from eBay account. Caches them.
  4. Trading API fixes — Uses SellerProfiles (business policies) instead of inline XML. Auto-includes Brand/Model/Type as item specifics. Condition IDs use safe universally-supported values.
  5. API Settings UI rebuilt — Connection test buttons, OAuth consent flow, credential auto-sync to system parameters.
  6. Code cleanup — Duplicate marketplace_connector.py consolidated into marketplace/ subdirectory. ebay_rest_client.py now properly imported.
  7. Smart fallback — Tries REST API first (if OAuth configured), falls back to Trading API automatically.

Deploy Commands

# 1. Pull the code
git cherry-pick <commit-hash>
# Or checkout the module directly:
git checkout ScottRecycling/jan -- sr_general_sales/

# 2. Upgrade the module
/opt/odoo17/odoo17-venv/bin/python3 /opt/odoo17/odoo17/odoo-bin \
  -c /etc/odoo17.conf -d <DATABASE> -u sr_general_sales --stop-after-init

# 3. Restart
sudo systemctl restart odoo17.service

# 4. Check logs
sudo journalctl -u odoo17.service --since "5 minutes ago" --no-pager | tail -50

Post-Deploy Configuration

Set these system parameters (Settings > Technical > System Parameters) if not already set:

Key Where to find the value Notes
ebay_app_id ~/Desktop/ebay/ebay_credentials.txt on dev machine Already set on dev
ebay_dev_id Same file Already set on dev
ebay_cert_id Same file Already set on dev
ebay_auth_token Same file (long v^1.1#... string) Already set on dev, expires Aug 2027
ebay_environment production
ebay_postal_code 37872 Shipping origin ZIP

These are auto-populated on first eBay posting — do NOT set manually: - ebay_payment_profile_id, ebay_return_profile_id, ebay_shipping_profile_id - ebay_location_key - ebay_oauth_access_token, ebay_app_access_token (cached tokens)

Test Checklist

Test 1 (exp)

  • Module upgrades without errors
  • General Sales menu loads
  • API Settings page loads, shows OAuth status
  • "Test App Token" button returns success
  • Create item with photo, post to eBay — listing appears on ebay.com
  • End eBay listing — listing removed
  • Bulk price wizard works
  • Mark sold wizard works

Test 2 (1820)

  • Module upgrades without errors
  • All above tests pass
  • No errors in downstream modules (sr_inventory_processing, sr_multichannel_ecommerce)

Staging (1717)

  • Module upgrades without errors
  • All above tests pass
  • Cron jobs load (check Scheduled Actions in Settings)
  • No regression in existing listed items

Programmer's Notes

  • Business policies are mandatory on the eBay account (internationalrecyclers). The module auto-fetches profile IDs on first posting and caches them. If eBay policies change, clear ebay_payment_profile_id, ebay_return_profile_id, ebay_shipping_profile_id from system parameters.
  • Photos must be 500px+ or eBay rejects them. The module doesn't resize — photos need to be taken correctly.
  • Category map uses leaf categories only — eBay rejects parent categories. If you add new item categories, look up the correct leaf category ID via eBay's taxonomy API.
  • Condition IDs are conservative — uses 1000 (New), 1500 (Open box), 3000 (Used), 7000 (For parts). Not all categories support the granular 4000/5000/6000 conditions.
  • Amazon and Walmart are still stubs — they raise clear UserError messages. No seller accounts configured for those.
  • REST API needs OAuth user token — currently using Trading API (auth token). To enable REST API: get an OAuth refresh token from developer.ebay.com and paste it in API Settings.
  • marketplace_connector.py is now an empty shim — all logic moved to models/marketplace/ subdirectory. Don't add code to marketplace_connector.py.

Rollback

If something breaks:

# Revert to previous version
git checkout ScottRecycling/staging-2 -- sr_general_sales/
# Re-upgrade
/opt/odoo17/odoo17-venv/bin/python3 /opt/odoo17/odoo17/odoo-bin \
  -c /etc/odoo17.conf -d <DATABASE> -u sr_general_sales --stop-after-init
sudo systemctl restart odoo17.service