fsanyoto's picture
Deploy AIOS web (React glide grid + FastAPI slice)
81a8217 verified
Raw History Blame Contribute Delete
15.5 kB
# Odoo knowledge pack: what the assistant reads before it queries an Odoo database.
# loopy_skills.py serves it, filtered to the databases the caller can open.
# Field keys must exist in each database's contract (odoo_relational.TABLES field functions,
# aios_grid_fields.json for customer_data and product_data). verify_agent_knowledge.py gates this.
# Plain ASCII only. The assistant repeats this text to users.
source: odoo
connector: odoo
title: Odoo
scope:
confirmed_orders:
field: state
values: [sale, done]
rule: "A confirmed sale order has state sale or done. Count only those rows as orders or sales."
wholesale:
field: wholesale_scope
excluded_partner_parameter: excluded_partner_name_like
rule: "Wholesale scope follows the workspace's configured teams and partner exclusions. For a wholesale figure, keep only rows where wholesale_scope is ticked."
inventory:
rule: "Inventory, SKU and dead stock analysis uses all channels. Do not apply the wholesale filter to stock."
business_units:
names_parameter: team_names
rule: "Use the workspace's configured Business Unit names. A user scoped to one Business Unit sees only that unit. Never infer another unit's figures."
read_only:
rule: "Odoo is read only. Never create, change, post or send an Odoo record."
traps:
- id: field_list_first
text: "Read the database's field list before a query. A field missing from the list does not exist for this user."
- id: sku_key
text: "The product code is the code field on product_data and the sku field on every other Odoo database. Join on product_id, not on the code."
- id: validated_figures
text: "A figure from a raw row sum is not a validated metric. Use a validated metric when one answers the question."
generated_tables:
prefix: ut_odoo_model_
note: "A ut_odoo_model_ database mirrors one Odoo model a workspace added itself. Its field list is the only contract. One row is one record of that model. The scope rules above still apply when it carries state or wholesale_scope."
databases:
customer_data:
label: Customers
row: "One Odoo customer (res.partner) with its contact, AR and buying summary."
fields:
money: [ar_open, ar_overdue, ar_outstanding, ar_exposure, ar_aged_1_30, ar_aged_31_60, ar_aged_61_90, ar_aged_90_plus]
quantity: [sku_count]
date: [customer_since, last_order, created_on]
status: [odoo_status, archived]
joins:
- {database: ut_odoo_invoices, from: partner_id, to: partner_id}
- {database: ut_odoo_orders, from: partner_id, to: partner_id}
- {database: ut_odoo_order_lines, from: partner_id, to: partner_id}
- {database: ut_odoo_shipments, from: partner_id, to: partner_id}
- {database: ut_odoo_gl_lines, from: partner_id, to: partner_id}
traps:
- id: archived_customers
text: "Archived customers stay in this database. Filter archived when you count active customers."
product_data:
label: Products
row: "One Odoo product variant (product.product) with prices, stock and sales summary."
fields:
money: [first_cost, unit_cost, price_1, price_2, price_3, rev_ytd, rev_ly, inv_value, inventory_value_per_quantity]
quantity: [on_hand, fba, incoming, pre_book_qty, open_backlog_qty, qty_ytd, qty_ltm, orders_ytd, demand_fwd, cover_gap_units]
date: [created_on]
status: [stock_bucket, discontinued, needs_pricing, inventory_value_per_quantity_state]
joins:
- {database: ut_odoo_order_lines, from: product_id, to: product_id}
- {database: ut_odoo_stock_quant, from: product_id, to: product_id}
- {database: ut_odoo_stock_moves, from: product_id, to: product_id}
- {database: ut_odoo_stock_valuation, from: product_id, to: product_id}
- {database: ut_odoo_purchase_lines, from: product_id, to: product_id}
traps:
- id: fba_locations
text: "on_hand includes FBA stock, and fba holds that FBA part from the workspace's own location tree. Subtract fba from on_hand for stock you can ship from the warehouse."
- id: all_channels
text: "Stock and SKU figures here cover all channels. Do not apply the wholesale filter to them."
ut_odoo_invoices:
label: Odoo invoices
row: "One customer invoice or credit note (account.move)."
fields:
money: [amount_untaxed, residual]
quantity: []
date: [invoice_date, due_date, refreshed]
status: [payment_state, move_type, wholesale_scope]
joins:
- {database: customer_data, from: partner_id, to: partner_id}
- {database: ut_odoo_agents, from: agent_id, to: agent_id}
- {database: ut_odoo_orders, from: origin_order, to: order_no}
traps:
- id: credit_notes
text: "move_type out_refund rows are credit notes. Net them against invoices or exclude them on purpose, never by accident."
- id: signed_residual
text: "residual is signed and exactly 0 on a settled document, so an AR sum needs no payment filter."
- id: many_agents
text: "agent_id is blank when an invoice has more than one agent. The agent field lists every name."
ut_odoo_payments:
label: Odoo payments
row: "One payment (account.payment), keyed by its native payment id."
fields:
money: [amount_company_currency_signed]
quantity: []
date: [date]
status: [state, payment_type, partner_type, is_internal_transfer]
joins:
- {database: customer_data, from: partner_id, to: partner_id}
traps:
- id: customer_receipts
text: "For customer receipts, use posted inbound customer payments and exclude internal transfers. Read amount_company_currency_signed in company currency."
- id: payment_grain
text: "One payment may settle several invoices. Keep its native payment identity and do not multiply its amount by joining invoice rows."
ut_odoo_orders:
label: Odoo orders
row: "One sale order (sale.order)."
fields:
money: [amount_untaxed]
quantity: []
date: [order_date, commitment_date, refreshed]
status: [state, delivery_status, invoice_status, team, wholesale_scope]
joins:
- {database: customer_data, from: partner_id, to: partner_id}
- {database: ut_odoo_order_lines, from: odoo_id, to: order_id}
- {database: ut_odoo_invoices, from: order_no, to: origin_order}
- {database: ut_odoo_shipments, from: odoo_id, to: order_id}
traps:
- id: confirmed_state
text: "Count an order only when state is sale or done."
- id: wholesale_filter
text: "Keep wholesale_scope ticked for a wholesale figure. Unticked rows are outside the workspace's configured wholesale scope."
ut_odoo_agents:
label: Odoo agents
row: "One sales agent (res.partner) found by its agent flag or its commission lines."
fields:
money: []
quantity: []
date: [refreshed]
status: [flagged, commissioned]
joins:
- {database: ut_odoo_invoices, from: agent_id, to: agent_id}
traps:
- id: agent_union
text: "This database is the union of flagged agents and agents with commission lines. An unflagged agent is still real."
ut_odoo_accounts:
label: Odoo GL accounts
row: "One general ledger account (account.account)."
fields:
money: []
quantity: []
date: [refreshed]
status: [account_type, is_expense]
joins:
- {database: ut_odoo_gl_lines, from: account_code, to: account_code}
traps: []
ut_odoo_vendors:
label: Odoo vendors
row: "One vendor (res.partner) with contact details."
fields:
money: []
quantity: []
date: [refreshed]
status: []
joins:
- {database: ut_odoo_bills, from: vendor_id, to: vendor_id}
- {database: ut_odoo_purchase_orders, from: vendor_id, to: vendor_id}
- {database: ut_odoo_purchase_lines, from: vendor_id, to: vendor_id}
traps: []
ut_odoo_bills:
label: Odoo vendor bills
row: "One vendor bill or vendor refund (account.move)."
fields:
money: [amount_untaxed, residual]
quantity: []
date: [invoice_date, due_date, refreshed]
status: [payment_state, move_type]
joins:
- {database: ut_odoo_vendors, from: vendor_id, to: vendor_id}
- {database: ut_odoo_pickings, from: landed_pickings, to: odoo_id}
traps:
- id: vendor_refunds
text: "move_type in_refund rows are vendor refunds. Net them against bills or exclude them on purpose."
- id: bill_date
text: "The bill date is the invoice_date field."
ut_odoo_order_lines:
label: Odoo order lines
row: "One sale order line (sale.order.line)."
fields:
money: [price_subtotal, margin, purchase_price]
quantity: [qty]
date: [order_date]
status: [state, wholesale_scope]
joins:
- {database: ut_odoo_orders, from: order_id, to: odoo_id}
- {database: customer_data, from: partner_id, to: partner_id}
- {database: product_data, from: product_id, to: product_id}
traps:
- id: fractional_returns
text: "qty can be fractional and is negative on a return. Do not round it or drop negative lines."
- id: section_lines
text: "Section and note lines have no product. Exclude a blank product from SKU counts."
- id: unit_cost
text: "purchase_price is a cost per unit. Multiply by qty for a line cost."
- id: confirmed_state
text: "Count a line only when state is sale or done, and keep wholesale_scope ticked for a wholesale figure."
ut_odoo_gl_lines:
label: Odoo GL lines
row: "One journal item (account.move.line)."
fields:
money: [debit, credit, balance]
quantity: []
date: [date]
status: [parent_state, line_type, wholesale_scope]
joins:
- {database: ut_odoo_accounts, from: account_code, to: account_code}
- {database: customer_data, from: partner_id, to: partner_id}
traps:
- id: posted_only
text: "Keep parent_state posted for reported figures. Draft and cancelled entries are not in the books."
- id: balance_nets
text: "balance is debit minus credit and sums to zero over a whole entry. Sum it per account, never per entry."
- id: blank_account
text: "account_code is blank on some lines. A join to ut_odoo_accounts drops them."
ut_odoo_stock_moves:
label: Odoo stock moves
row: "One stock move (stock.move) of one product between two locations."
fields:
money: [standard_price]
quantity: [qty]
date: [date]
status: [state, source_location_fba, destination_location_fba]
joins:
- {database: product_data, from: product_id, to: product_id}
- {database: ut_odoo_stock_valuation, from: odoo_id, to: stock_move_id}
- {database: ut_odoo_shipments, from: picking_id, to: odoo_id}
traps:
- id: fba_locations
text: "Use source_location_fba and destination_location_fba, which find FBA in each workspace's own location tree. Location ids are workspace-specific."
- id: move_unit
text: "qty is in move_uom, which can differ from the product unit in uom."
ut_odoo_stock_valuation:
label: Odoo stock valuation
row: "One stock valuation layer (stock.valuation.layer) for one product."
fields:
money: [value, standard_price]
quantity: [qty]
date: [date]
status: [source_location_fba, destination_location_fba]
joins:
- {database: product_data, from: product_id, to: product_id}
- {database: ut_odoo_stock_moves, from: stock_move_id, to: odoo_id}
traps:
- id: fba_locations
text: "Use source_location_fba and destination_location_fba from the workspace's own location tree. Location ids are workspace-specific."
ut_odoo_stock_quant:
label: Odoo stock on hand
row: "One quantity of one product at one location (stock.quant)."
fields:
money: [standard_price]
quantity: [qty, reserved_qty]
date: []
status: [location_usage, location_fba]
joins:
- {database: product_data, from: product_id, to: product_id}
traps:
- id: fba_locations
text: "Use location_fba to split FBA stock from warehouse stock in the workspace's own location tree. Location ids are workspace-specific."
- id: location_usage
text: "Filter location_usage before you sum on-hand stock. Not every location holds sellable stock."
- id: reserved
text: "reserved_qty is part of qty. Available stock is qty minus reserved_qty."
ut_odoo_purchase_orders:
label: Odoo purchase orders
row: "One purchase order (purchase.order)."
fields:
money: [amount_untaxed, amount_total]
quantity: []
date: [order_date, confirmation_date]
status: [state]
joins:
- {database: ut_odoo_vendors, from: vendor_id, to: vendor_id}
- {database: ut_odoo_purchase_lines, from: odoo_id, to: order_id}
traps:
- id: confirmed_purchase
text: "A confirmed purchase order has state purchase or done. Draft and sent rows are requests for quotation."
- id: order_currency
text: "Amounts are in the order's own currency field. Do not add amounts across currencies."
ut_odoo_purchase_lines:
label: Odoo purchase order lines
row: "One purchase order line (purchase.order.line)."
fields:
money: [price_unit, price_subtotal, standard_price]
quantity: [qty, purchase_qty, received_qty]
date: [confirmation_date, planned_date]
status: [state]
joins:
- {database: ut_odoo_purchase_orders, from: order_id, to: odoo_id}
- {database: ut_odoo_vendors, from: vendor_id, to: vendor_id}
- {database: product_data, from: product_id, to: product_id}
traps:
- id: purchase_units
text: "A purchase order quantity is in purchase units (packs), not product units. purchase_qty and received_qty count purchase_uom units. qty is the same quantity in product units."
- id: order_currency
text: "Amounts are in the order's own currency field. Do not add amounts across currencies."
ut_odoo_pickings:
label: Odoo pickings
row: "One receipt or delivery (stock.picking) that a landed cost ties to a vendor bill."
fields:
money: []
quantity: []
date: [scheduled_date, done_date]
status: [state, direction]
joins:
- {database: ut_odoo_bills, from: odoo_id, to: landed_pickings}
traps:
- id: landed_cost_links_only
text: "A picking reaches a bill only through a landed cost. A bill with no landed cost has an empty link because Odoo holds none."
- id: picking_direction
text: "direction is incoming for receipts and outgoing for deliveries. Filter it before counting either."
ut_odoo_shipments:
label: Odoo shipments
row: "One delivery (stock.picking) for a sale order."
fields:
money: []
quantity: []
date: [scheduled_date, date_done, order_date, refreshed]
status: [state]
joins:
- {database: ut_odoo_orders, from: order_id, to: odoo_id}
- {database: customer_data, from: partner_id, to: partner_id}
- {database: ut_odoo_stock_moves, from: odoo_id, to: picking_id}
traps:
- id: done_only
text: "Only state done shipments have a ship date. delivery_days is blank when either date is missing."