sugarai-erp-connector-prophet21 1.70.dev1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. sugarai_erp_connector_prophet21-1.70.dev1/PKG-INFO +6 -0
  2. sugarai_erp_connector_prophet21-1.70.dev1/README.md +174 -0
  3. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/__init__.py +1 -0
  4. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/extractors.py +505 -0
  5. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/models/__init__.py +0 -0
  6. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/models/crm/__init__.py +0 -0
  7. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/models/crm/contact.py +27 -0
  8. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/models/crm/invoice.py +25 -0
  9. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/models/crm/master_data.py +99 -0
  10. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/models/erp/__init__.py +0 -0
  11. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/models/erp/contact.py +27 -0
  12. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/models/erp/invoice.py +28 -0
  13. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/models/erp/master_data.py +52 -0
  14. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/models/erp/order.py +40 -0
  15. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/models/erp/part.py +16 -0
  16. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/normalize.py +658 -0
  17. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/pipeline.py +133 -0
  18. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/py.typed +0 -0
  19. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/register.py +134 -0
  20. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/resources.py +233 -0
  21. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/settings.py +99 -0
  22. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/transformers.py +381 -0
  23. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/writeback/__init__.py +30 -0
  24. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/writeback/accounts.py +391 -0
  25. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/writeback/common.py +186 -0
  26. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/writeback/contacts.py +220 -0
  27. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/writeback/definitions.json +443 -0
  28. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/writeback/identity.py +138 -0
  29. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/writeback/orders.py +545 -0
  30. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/writeback/quotes.py +273 -0
  31. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/writeback/ship_tos.py +301 -0
  32. sugarai_erp_connector_prophet21-1.70.dev1/connector_prophet21/writeback/wire.py +120 -0
  33. sugarai_erp_connector_prophet21-1.70.dev1/pyproject.toml +70 -0
  34. sugarai_erp_connector_prophet21-1.70.dev1/setup.cfg +4 -0
  35. sugarai_erp_connector_prophet21-1.70.dev1/sugarai_erp_connector_prophet21.egg-info/PKG-INFO +6 -0
  36. sugarai_erp_connector_prophet21-1.70.dev1/sugarai_erp_connector_prophet21.egg-info/SOURCES.txt +37 -0
  37. sugarai_erp_connector_prophet21-1.70.dev1/sugarai_erp_connector_prophet21.egg-info/dependency_links.txt +1 -0
  38. sugarai_erp_connector_prophet21-1.70.dev1/sugarai_erp_connector_prophet21.egg-info/requires.txt +1 -0
  39. sugarai_erp_connector_prophet21-1.70.dev1/sugarai_erp_connector_prophet21.egg-info/top_level.txt +1 -0
@@ -0,0 +1,6 @@
1
+ Metadata-Version: 2.4
2
+ Name: sugarai-erp-connector-prophet21
3
+ Version: 1.70.dev1
4
+ Summary: Epicor Prophet 21 mapping layer for the SugarAI ERP connector: view resources, normalization and the Account, ship-to and Contact forward mappings. Not agnostic core.
5
+ Requires-Python: >=3.12
6
+ Requires-Dist: sugarai-erp-connector-base>=1.42
@@ -0,0 +1,174 @@
1
+ # connector-prophet21 — Epicor Prophet 21 mapping layer
2
+
3
+ Maps Epicor Prophet 21 (P21) OData view rows to the canonical models in
4
+ `connector-base`, for forward sync (P21 to Sugar) of Accounts, ship-tos,
5
+ Contacts, billing terms, sales reps, the product catalog, orders, order lines,
6
+ invoices and invoice lines. P21 is a different product from Epicor Kinetic:
7
+ nothing here is shared with `connector-epicor`.
8
+
9
+ This package never imports the host engine. The host calls
10
+ `register(registrar)` (`connector_prophet21.register`) for `erp_kind` `prophet21`
11
+ and owns the transport (token, OData reads).
12
+
13
+ ## Company model
14
+
15
+ One connection per P21 company. Keys are company-scoped (`<company>__<id>`)
16
+ because `customer_id` repeats across companies.
17
+
18
+ | Entity | Sync key |
19
+ |---|---|
20
+ | accounts | `<co>__<customer>` |
21
+ | shipping_addresses | `<co>__<customer>_<ship_to_id>` |
22
+ | contacts | `<co>__<customer>_<contact_id>` (one Sugar Contact per customer-contact link) |
23
+
24
+ ## Views and deltas
25
+
26
+ | Entity | Primary view | Companion folded in | Delta |
27
+ |---|---|---|---|
28
+ | accounts | `p21_view_customer` | `p21_view_address` (`id` = customer id) | `date_last_modified` |
29
+ | shipping_addresses | `p21_view_ship_to` | `p21_view_address` (`id` = ship-to id) | `date_last_modified` |
30
+ | contacts | `p21_view_oe_contacts_customer` | `p21_view_contacts` (`id` = contact id) | `date_last_modified` |
31
+
32
+ An address or contact has its own `date_last_modified`; a primary-only delta
33
+ misses an edit made only to it. Each extractor therefore also reads the
34
+ companion for the delta window and returns the primary rows it belongs to. The
35
+ `ice_*` address views have no date column and are not read.
36
+
37
+ ## Mapping
38
+
39
+ | P21 column | Canonical field |
40
+ |---|---|
41
+ | customer: `company_id` | `AccountERP.company` |
42
+ | customer: `customer_id_string` (else `customer_id`) | `id` (scoped), `account_code`, `account_num` |
43
+ | customer: `customer_name` (else address `name`) | `name` |
44
+ | customer: `credit_limit` | `credit_limit` |
45
+ | customer: `terms_id` | `terms_code` |
46
+ | customer: `salesrep_id` | `sales_rep_code` |
47
+ | customer: `delete_flag` (`Y`) | `inactive` |
48
+ | customer / address: `date_last_modified` | `change_date` (the later of the two) |
49
+ | address: `mail_address1..3`, `mail_city`, `mail_state`, `mail_postal_code`, `mail_country` | account billing `address`, `city`, `state`, `zip`, `country` |
50
+ | address: `central_phone_number`, `central_fax_number`, `email_address`, `url` | `phone`, `phone_fax`, `email`, `website` |
51
+ | ship-to: `company_id`, `customer_id`, `ship_to_id` | `ShipToAddressERP.company`, `account_code`, `ship_to_num` (key scoped) |
52
+ | ship-to: `delete_flag` | `inactive` |
53
+ | address (same id): `name`, `phys_address1..3`, `phys_city`, `phys_state`, `phys_postal_code`, `phys_country` | ship-to `name`, `address`, `city`, `state`, `zip`, `country` |
54
+ | contact link: `company_id`, `customer_id`, `contact_id`, `delete_flag` | `P21ContactERP.company`, `account_code`, `contact_id`, `inactive` |
55
+ | contact: `first_name`, `last_name` (else `contact_name`), `title`, `email_address`, `direct_phone`, `cellular`, `delete_flag` | `first_name`, `last_name`, `title`, `email`, `phone`, `mobile`, `inactive` |
56
+
57
+ The mailing address is the account's billing address, and the physical address is
58
+ a ship-to's delivery address.
59
+
60
+ ## Deliberately unmapped
61
+
62
+ No stated meaning, or no canonical home, so left out rather than defaulted.
63
+ The account transformer also withholds the shared mapping's concrete
64
+ `False`/`0` for them (a fabricated zero is indistinguishable from a real one).
65
+
66
+ - `AccountERP`: `customer_type` (`customer_type_cd` is an unexplained code),
67
+ `credit_hold` and `credit_hold_reason_code` (`credit_status` and
68
+ `place_orders_on_hold` are not reliably set), `currency_code`
69
+ (`currency_id` is an integer foreign key, needs the currency lookup),
70
+ `billing_frequency`, `fob_code`, `territory_code`, `ship_via_code`,
71
+ `discount_percent` (three candidate columns, no stated meaning),
72
+ `open_invoices`, `open_orders`, `credit_available`, revenue and payment fields.
73
+ - `ShipToAddressERP`: `primary_ship_to`.
74
+ - Contacts: a contact has no canonical inactive state, so a deleted link maps to
75
+ nothing and cannot retire a Sugar Contact an earlier run created. The phone
76
+ extension, home address and fax are not mapped.
77
+ - Currency lookups: the code is mapped; the lookup itself is a later phase, so
78
+ the relate resolves only if Sugar already holds it.
79
+ - `LookupValueERP_Terms`: none. `SalesRepERP`: `email` and `title` (the view
80
+ states a name and nothing else).
81
+ - `PartERP` (`p21_view_inv_mast`): `unit_price` (`price1` is one of ten price
82
+ columns and is often 0, so its meaning is unstated), `tax_category`,
83
+ `class_id` and `prod_code` (no view for the ProductTypes and
84
+ ProductCategories rows they would relate to), `unit_cost`, and every stock
85
+ field (`on_hand_qty`, `available_qty`): availability is a real-time read.
86
+
87
+ ## Lookups, sales reps and the catalog
88
+
89
+ | Entity | View | Sync key | Read |
90
+ |---|---|---|---|
91
+ | lookup_values (billing terms only) | `p21_view_terms` (no company column) | `<co>__BillingTerms_<terms_id>` | full every run |
92
+ | sales_reps | `p21_view_jm_salesrep` (no date) | `<co>__<id>` | full every run, no delta signal |
93
+ | product_templates | `p21_view_inv_mast` (no company column) | `<co>__<item_id>`, verbatim | delta on `date_last_modified` |
94
+
95
+ A lookup with no delta signal is read in full every run, exactly as Epicor reads
96
+ its sales reps and territories. The three views have no company column, so every
97
+ connection reads the same rows and writes them under its own company's key.
98
+ `item_id` is not stripped: an id may start with a space, and stripping would
99
+ merge distinct items. A row whose `item_id` is blank is refused by name. Sales
100
+ reps map to `ERP_SalesReps` only; the default Users fan-out would mint a Sugar
101
+ user for every rep.
102
+
103
+ ## Orders, order lines, invoices and invoice lines
104
+
105
+ Four forward entities, each its own delta read on its own `date_last_modified`
106
+ (a header never moves when a line does, and the reverse).
107
+
108
+ | Entity | View (company column) | Sync key | Folded in |
109
+ |---|---|---|---|
110
+ | orders | `p21_view_oe_hdr` (`company_id`) | `<co>__<order_no>` | the order's lines, for the total, status and watermark |
111
+ | order_lines | `p21_view_oe_line` (`company_no`) | `<co>__<order_no>_<line_no>` | item description (`p21_view_inv_mast`), header customer |
112
+ | invoices | `p21_view_invoice_hdr` (`company_no`) | `<co>__<invoice_no>` | nothing |
113
+ | invoice_items | `p21_view_invoice_line` (`company_id`) | `<co>__<invoice_no>_<line_no>` | the invoice header (customer, date, status, rep) |
114
+
115
+ Numbers stay text (`JEM53`, `05111001`); `item_id` is the product key verbatim.
116
+
117
+ **Order total.** P21 states none, so it is the sum of `extended_price + sales_tax`
118
+ over the order's live lines, in decimal; `None` (omitted, never 0) for an order with
119
+ no live line or a live line with a null `extended_price`. A line moves neither its
120
+ header's date nor the header's watermark, so a delta window also reads the lines
121
+ changed in it and re-reads their headers. The header's staged watermark is the later
122
+ of its own date and its lines'. An invoice that closes moves no line, so a delta
123
+ window also re-reads the lines of the headers changed in it.
124
+
125
+ **Status.** Order: `removed_in_erp` (`delete_flag` Y), `Void` (`cancel_flag` Y),
126
+ `Closed` (`completed` Y), `Held` (`validation_status` `Hold`), `ReadyToFulfill`
127
+ (a live line is on a pick ticket), else `Open`; `completed` values `T`, `B`, `X`,
128
+ null state nothing and read as open. Line: `removed_in_erp`, `Void`, `Closed`
129
+ (`complete` Y), `Open`. Invoice: `OPEN`/`CLOSED`, any other word refused.
130
+
131
+ **Soft deletes.** The views return deleted orders and lines. Nothing in a read can tell a deleted order Sugar already
132
+ holds from one it never saw, so every read takes live rows only
133
+ (`delete_flag = 'N'`) and a deleted document is never delivered. A deleted LINE
134
+ still re-reads its order, so the total stops counting it. The cost: an order or line
135
+ deleted AFTER it was delivered stays as it was in Sugar; retiring it is the host's
136
+ identity reconcile job, which has no Prophet 21 key shape yet. The
137
+ `removed_in_erp` status mapping stays in the normalizers for that day.
138
+
139
+ **Invoice balance.** 0 for a CLOSED invoice; otherwise
140
+ `total - amount_paid - terms_taken - allowed`, `None` when any is null.
141
+
142
+ **Links.** An invoice's order link is optional (`P21SellInvoiceCRM`): the order may
143
+ be outside the window or absent from the view. A line's product link is optional.
144
+ Account links are required.
145
+
146
+ **Not stated by P21, so not sent:** currency and rate (`currency_id` is blank, so a
147
+ foreign-currency document reads as the base currency), order tax and discount, invoice sub-total, discount and type, FOB,
148
+ ship via, shipped quantity beyond `qty_invoiced`, and an order line's quote origin.
149
+
150
+ **Volume.** There is no history window in code. A delta read starts from the
151
+ entity's stored watermark, so seeding `date_last_modified` floors for the four
152
+ entities bounds the first read; with none, the first read is every row of the
153
+ company (288k orders).
154
+
155
+ ## Pipelines
156
+
157
+ Three, named apart from every other ERP's (the host keys a pipeline by name):
158
+
159
+ | Pipeline | Steps (in `depends_on` order) | Cron |
160
+ |---|---|---|
161
+ | `p21_core` | `companies` (manual), `accounts`, `shipping_addresses`, `contacts` | `0 */6 * * *` |
162
+ | `p21_batch` | `companies` (manual), `lookup_values`, `sales_reps`, `product_templates` | `0 */4 * * *` |
163
+ | `p21_transactions` (after `p21_core`) | `companies` (manual), `orders`, `order_lines`, `invoices`, `invoice_items` | `30 */6 * * *` |
164
+
165
+ A cron fires only on a tenant whose scheduler switch is on (off for a new tenant),
166
+ and a first read with no watermark reads a whole view, so seed floors first (see
167
+ Volume). `companies` is the one manual step: the Sugar `ERP_Companies` are entered
168
+ by ops, never read from P21. There is no currency, exchange-rate, quote,
169
+ account-totals or Sugar Predict step: P21 states none of them.
170
+
171
+ ## Not in this package
172
+
173
+ Write-back, pricing and availability, per-location stock, locations (there is no
174
+ canonical location model), and comment Notes for documents.
@@ -0,0 +1 @@
1
+ """Epicor Prophet 21 mapping layer (forward sync: Accounts, ship-tos, Contacts)."""