File size: 2,961 Bytes
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
# Amazon's order-head mirror and its independent Sales summary share the tenant-bound file.
# Runtime reads require an explicit runtime, unrestricted caller and matching summary interval.
# Field keys are snake_case Amazon report headers (amazon_store._snake), the same keys the grid shows.
key: amazon_orders
semantic:
  approved: [amazon_order_id, purchase_date, last_updated_date, order_status, sku, asin, quantity, item_price, currency]
  date_field: purchase_date
  scope: "Distinct Amazon order ids in this tenant seller's connected marketplace and complete UTC purchase-date window. Exclude order_status Cancelled and Canceled. Both dates must match the completed Amazon Sales summary interval. This is not the Odoo wholesale or GIFTWARE scope."
  measure:
    key: amazon_order_count
    source: amazon_orders
    validate: amazon_sales_order_count
  purposes:
    amazon_order_id: "The Amazon order number. One row per order, so count rows for an order count."
    purchase_date: "When the buyer placed the order, ISO 8601 text in UTC. Use it for orders by day, week or month."
    order_status: "Pending, Unshipped, Shipped or Cancelled. Exclude both Cancelled and Canceled from order counts and sales."
    item_price: "The first line's price for its quantity. Use Amazon order items for whole order sales."
  synonyms:
    amazon_order_id: [order number, order id, Amazon order]
    purchase_date: [order date, purchase date, ordered on]
    order_status: [status]
  choices:
    order_status: [Pending, Unshipped, Shipped, Cancelled]
label: "Amazon orders"
entity: amazon.order
grid: ut_amzn_orders
subject: "amazon:order"
grain: "one row per Amazon order (document grain)"
store:
  source: amazon_sp
  table: amzn_orders
  alias: o
  date_col: o.purchase_date
  scope_sql: "lower(COALESCE(o.order_status, '')) NOT IN ('cancelled', 'canceled')"
  dims:
    purchase_date: {col: "CAST(CAST(o.purchase_date AS TIMESTAMPTZ) AT TIME ZONE 'UTC' AS DATE)", type: date}
fields:
  - key: amazon_order_id
    label: "Amazon order id"
    type: text
    kind: data
  - key: purchase_date
    label: "Purchase date"
    type: date
    kind: data
  - key: last_updated_date
    label: "Last updated date"
    type: date
    kind: data
  - key: order_status
    label: "Order status"
    type: text
    kind: data
  - key: sku
    label: "Sku"
    type: text
    kind: data
  - key: asin
    label: "Asin"
    type: text
    kind: data
  - key: quantity
    label: "Quantity"
    type: int
    kind: data
  - key: item_price
    label: "Item price"
    type: currency
    kind: data
  - key: currency
    label: "Currency"
    type: text
    kind: data
ai_context: >
  Amazon orders at document grain. For how many orders arrived per day, count rows grouped by the
  UTC day of purchase_date and exclude order_status Cancelled and Canceled. The order count must
  reconcile to Amazon Sales for the same full interval. For units or sales use Amazon order items.