sr_general_sales — Programmer's Notes¶
Module version: 17.0.6.0.0 Last updated: 2026-03-31 Primary owner: Dan Dependencies: base, web, product, sale, stock, account
What This Module Does¶
General merchandise sales for Scott Recycling. Handles anything that isn't a computer/phone/tablet (those go through sr_inventory_processing). Items include vehicles, furniture, office supplies, clothing, equipment, electronics, raw materials.
Multi-channel listing: eBay (live), WooCommerce (live), Amazon (stub), Walmart (stub).
Downstream Dependents — DON'T BREAK THESE¶
| Module | What it uses |
|---|---|
| sr_inventory_processing | marketplace.api.connector for posting processed items |
| sr_multichannel_ecommerce | general.sale.item fields, general.sale.listing.history, marketplace.listing.template.mixin, security groups |
| sr_operations_kpi | Transitive via above two |
| sr_shipping | Transitive via sr_inventory_processing |
If you change fields on general.sale.item or methods on marketplace.api.connector, check these modules.
Architecture¶
models/
general_sale_item.py ← Core item model (35+ fields)
general_sale_item_photo.py ← Photo attachments
general_sale_item_specific.py ← eBay name/value pairs
api_settings.py ← UI for API credentials + OAuth
ai_service.py ← OpenAI integration (descriptions, price research)
template_service.py ← Free template system (no API needed)
listing_template.py ← Reusable listing templates + history
listing_template_mixin.py ← Abstract base for templates
price_research_service.py ← eBay Browse API price research
operations_log.py ← Audit trail for bulk ops
marketplace_connector.py ← EMPTY SHIM (legacy, don't use)
marketplace/
base_connector.py ← marketplace.api.connector (base class)
ebay_connector.py ← Trading API (XML): post, end, photos, order import
ebay_rest_client.py ← REST API (OAuth): inventory, offers, policies
woocommerce_connector.py ← WooCommerce REST API
amazon_connector.py ← STUB (raises UserError)
walmart_connector.py ← STUB (raises UserError)
general_sale_item_actions.py ← Button actions on general.sale.item
wizard/
listing_wizard.py ← Detailed eBay listing form
bulk_price_wizard.py ← Bulk price/state/end/post wizards
mark_sold_wizard.py ← Mark sold + bulk mark sold
How eBay Posting Works¶
Two paths, automatic fallback:
action_post_to_ebay()
├─ Has OAuth refresh token? → REST API (Sell Inventory API)
│ 1. PUT /sell/inventory/v1/inventory_item/{sku}
│ 2. POST /sell/inventory/v1/offer
│ 3. POST /sell/inventory/v1/offer/{id}/publish
│
└─ Has Trading API auth token? → Trading API (XML)
1. Upload photos to eBay Picture Services
2. Build XML with SellerProfiles (business policies)
3. AddFixedPriceItem API call
Currently the Trading API path is active (auth token valid until Aug 2027). REST API is ready but needs an OAuth user token.
Key Gotchas¶
Business Policies¶
The eBay account (internationalrecyclers) has business policies enabled. You CANNOT use inline shipping/return/payment XML — must use SellerProfiles with ProfileIDs. The module auto-fetches and caches these on first post.
Cached in system parameters:
- ebay_payment_profile_id → 222006128012
- ebay_return_profile_id → 237205033012
- ebay_shipping_profile_id → 252626638012
If policies change on eBay, delete these params and the module will re-fetch.
Photo Requirements¶
- Minimum 500px on longest side (eBay rejects smaller)
- Module doesn't resize — photos need to be taken at proper resolution
- Up to 12 photos per listing
- Uploaded to eBay Picture Services (EPS) before listing creation
Category IDs Must Be Leaf Categories¶
eBay rejects parent categories. Current mapping:
| Item Category | eBay Category ID | eBay Name |
|---|---|---|
| vehicle | 6001 | Cars & Trucks |
| furniture | 11832 | Desks & Tables |
| office_supply | 159710 | Other Office Supplies |
| clothing | 260034 | Mixed Lots |
| equipment | 11765 | Business & Industrial |
| electronics_other | 179 | PC Desktops |
| materials | 41964 | Multi-Purpose Crafts |
| other | 88433 | Everything Else |
Condition IDs Are Category-Specific¶
Not all categories support 4000/5000/6000. Safe mapping:
| Our Condition | eBay ID | eBay Name |
|---|---|---|
| new | 1000 | New |
| like_new | 1500 | Open box |
| good | 3000 | Used |
| fair | 3000 | Used |
| parts | 7000 | For parts or not working |
Item Specifics Auto-Generation¶
eBay requires certain item specifics per category (e.g., "Brand", "Type" for electronics). The module auto-adds: - Brand and Model from item fields - Category-specific defaults (Type, Processor, Memory Size, etc.) - Custom specifics from item_specific_ids
marketplace_connector.py Is Dead Code¶
All logic is in models/marketplace/. The top-level marketplace_connector.py is an empty shim kept to avoid import errors. Don't add code there.
eBay API Credentials¶
Credentials are stored in two places:
- Odoo system parameters (Settings > Technical > System Parameters) — search for ebay_
- Dev machine file: ~/Desktop/ebay/ebay_credentials.txt — has both sandbox and production keys
The auth token is linked to the internationalrecyclers eBay account and expires August 2027.
Do NOT commit credentials to git. Reference the system parameters or the credentials file.
Cron Jobs¶
| Job | Interval | Default | Purpose |
|---|---|---|---|
| Auto Price Research | 3 hours | ON | Research prices for pending/ready items |
| Auto-Post eBay | Daily | OFF | Auto-post ready items to eBay |
| Auto-Post Store | Daily | OFF | Auto-post to WooCommerce |
| Stale Listings | Weekly | ON | Log items listed 60+ days |
| eBay Order Import | Daily | OFF | Import orders, auto-match items |
| Cleanup History | Monthly | ON | Remove old listing history |
Enable the OFF ones only after manual posting is validated in production.