File size: 15,450 Bytes
1ad1eea 81a8217 1ad1eea 81a8217 1ad1eea 81a8217 1ad1eea 81a8217 1ad1eea 81a8217 1ad1eea 81a8217 1ad1eea 043da5c 1ad1eea 81a8217 1ad1eea 81a8217 1ad1eea 81a8217 1ad1eea 043da5c 1ad1eea | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 | # 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."
|