ffl_core.api.crm¶
Source: apps/ffl_core/ffl_core/api/crm.py · 31 endpoint(s)
Generated by
make api-docs— do not edit by hand.
add_want¶
POST /api/method/ffl_core.api.crm.add_want
Auth (derived from code): Roles: Sales User / Sales Manager / System Manager
Add a want to a deal's primary contact: when stock that fits arrives, you get a task.
| arg | type | required | default | description |
|---|---|---|---|---|
deal |
string | yes | — | The CRM Deal's name. |
keywords |
string | null | no | None |
What they are after, for example "P228" or "Mosin 91/30". Every word must appear in the arriving gun's name, brand, model, caliber or description. |
item |
string | null | no | None |
An Item to alert on, instead of or as well as keywords. |
budget |
number | null | no | None |
What they want to spend. Shown on the task; arrivals are not filtered by price. |
notes |
string | null | no | None |
Anything else worth knowing. |
Returns: str: The CRM Want's name. The owner is the caller. Refused for a deal with no contact, and when neither keywords nor an item is given.
apps/ffl_core/ffl_core/api/crm.py:235
check_sale¶
POST /api/method/ffl_core.api.crm.check_sale
Auth (derived from code): Roles: Sales User / Sales Manager / Stock Manager / System Manager / Accounts User / Accounts Manager
Before a POS / Sales Invoice is saved: the guns on it held for a deal whose customer is not this
sale's.
| arg | type | required | default | description |
|---|---|---|---|---|
doc |
— | yes | — | The form's document (POS Invoice or Sales Invoice) as JSON. |
Returns: dict: {"blocked": [{"serial", "hold", "deal", "customer", "customer_name", "expires_at", "expires_label", "held_by", "held_by_name", "message"}], "self_approves": the caller is a manager, "approvers": [{"user", "full_name", "has_pin", "pin_off"}] when something is blocked}.
apps/ffl_core/ffl_core/api/crm.py:523
connect_my_mailbox¶
POST /api/method/ffl_core.api.crm.connect_my_mailbox
Auth (derived from code): Roles: Sales User / Sales Manager / System Manager
Start connecting your own mailbox to the POS: the address of the provider's sign-in page.
For a staff member whose mailbox an administrator set up as an OAuth Email Account with them as its connected user; they sign in to their own mail account, not the administrator. Frappe's own Authorize button needs read access to the Connected App, which staff do not have.
| arg | type | required | default | description |
|---|---|---|---|---|
email_account |
string | null | no | None |
The Email Account to connect. Optional when you have only one. |
success_uri |
string | null | no | None |
Where to land after signing in (a path on this site). Default: CRM. |
Returns: str: The sign-in address to open. Refused for an Email Account whose connected user is someone else, or that does not sign in with OAuth.
apps/ffl_core/ffl_core/api/crm.py:47
crm_list_data¶
POST /api/method/ffl_core.api.crm.crm_list_data
Auth (derived from code): Any authenticated user — no explicit role gate at function entry (deliberate open reads document this in Permissions).
CRM's list data for its Leads and Deals pages (hooks.py overrides crm.api.doc.get_data), with
three changes: a Leads list leaves out other mail unless it filters on the status or category,
@me inside a filter's list of values is the caller (CRM's page replaces only a plain @me, and
My follow-ups asks for "mine or nobody's"), and a Deals list on CRM's own columns shows the
person's name first.
| arg | type | required | default | description |
|---|---|---|---|---|
**kwargs |
— | no | — | CRM's own arguments, unchanged, chiefly doctype and filters. |
Returns: dict: CRM's answer: the rows and columns of the list.
apps/ffl_core/ffl_core/api/crm.py:266
deal_customer_summary¶
POST /api/method/ffl_core.api.crm.deal_customer_summary
Auth (derived from code): Roles: Sales User / Sales Manager / System Manager
What the Deal page's customer card shows. Never carries an ID number, date of birth, 4473 or
NICS.
| arg | type | required | default | description |
|---|---|---|---|---|
deal |
string | yes | — | The CRM Deal's name. |
Returns: dict: {"customer": None, "matches": [...], "html"} before the deal has a customer, else {"customer", "customer_name", "flags": {"status", "status_reason", "banned", "override_until", "alerts", "tags"}, "ffl": {"is_dealer", "on_file", "expiry_date", "expired"}, "orders": last orders, "open_orders": orders on Pending Order, "lifetime_spend": Net Sales as the Sales Report reads it, "holds": guns held for the deal [{"serial", "expires_label"}], "marketing": {"status", "tags"} of the customer's marketing contact or None, "html"}. Refused while the switch is off.
apps/ffl_core/ffl_core/api/crm.py:114
deal_holds¶
POST /api/method/ffl_core.api.crm.deal_holds
Auth (derived from code): Roles: Sales User / Sales Manager / System Manager
The Deal page's Hold guns dialog: each gun on the deal's lines, its hold and what can be done.
Answers while Hold guns for deals is off too, so holds still running stay in view.
| arg | type | required | default | description |
|---|---|---|---|---|
deal |
string | yes | — | The CRM Deal's name. |
Returns: dict: {"guns": [{"serial", "item_code", "item_name", "hold": None or {"name", "expires_at", "expires_label", "held_by", "held_by_name", "extensions", "extend_needs_manager", "release_needs_manager"}, "blocked": why it cannot be held or None, "needs_manager": holding it takes a manager}], "enabled": whether new holds are on, "self_approves": the caller is a manager, "approvers": [{"user", "full_name", "has_pin", "pin_off"}] otherwise}.
apps/ffl_core/ffl_core/api/crm.py:407
deals_use_no_quotes¶
POST /api/method/ffl_core.api.crm.deals_use_no_quotes
Auth (derived from code): Any authenticated user — no explicit role gate at function entry (deliberate open reads document this in Permissions).
Stands in for CRM's quotation gates (hooks.py): the Deal page shows no Quotations tab and no
Create Quotation button, since a deal closes through Open order.
Returns: bool: Always False.
apps/ffl_core/ffl_core/api/crm.py:310
draft_reply¶
POST /api/method/ffl_core.api.crm.draft_reply
Auth (derived from code): Roles: Sales User / Sales Manager / System Manager
A draft reply to the customer's message, written by an extension, or the one it wrote when the mail
arrived while that still holds. Nothing is sent or saved.
| arg | type | required | default | description |
|---|---|---|---|---|
doctype |
string | yes | — | "CRM Lead" or "CRM Deal". |
name |
string | yes | — | The record's name. |
quote_text |
string | no | '' |
The text of the quote in CRM's open composer (the mail Reply was clicked on), if any. |
composer |
integer | no | 0 |
1 when CRM's composer is open. |
Returns: dict: {"native_ok": 1 when the draft goes into that composer, "to", "subject", "sender", "in_reply_to": the Communication answered, "channel": "email" or "gunbroker", "content_html", "signature_html", "handoff": what needs a person, or None}. The envelope fields are for the page's own dialog when the composer is not used. Refused when the record has nothing from the customer to answer, or with the extension's own reason.
apps/ffl_core/ffl_core/api/crm.py:593
ensure_deal_customer¶
POST /api/method/ffl_core.api.crm.ensure_deal_customer
Auth (derived from code): Roles: Sales User / Sales Manager / System Manager
The deal's POS customer: its link, the matches to confirm, or a new customer on confirm.
| arg | type | required | default | description |
|---|---|---|---|---|
deal |
string | yes | — | The CRM Deal's name. |
customer |
string | null | no | None |
The Customer the employee confirmed: it goes on the deal and on its contact. |
create |
integer | no | 0 |
1 to make a new Customer from the deal's contact. |
Returns: dict: {"customer": name} once there is one; else {"customer": None, "matches": [{"name", "customer_name", "customer_status", "matched", "banned", "status_reason", "alerts"}], "new": the values a new customer would take, "html": the dialog's text}.
apps/ffl_core/ffl_core/api/crm.py:135
extend_hold¶
POST /api/method/ffl_core.api.crm.extend_hold
Auth (derived from code): Roles: Sales User / Sales Manager / System Manager
Another 48 hours on a hold. The person who placed it extends it once; after that, or for anyone
else, a manager does (signed in, or picked with their PIN).
| arg | type | required | default | description |
|---|---|---|---|---|
hold |
string | yes | — | The CRM Deal Hold's name. |
approver |
string | null | no | None |
The manager approving. |
pin |
string | null | no | None |
The approver's counter PIN. |
password |
string | null | no | None |
Or their password. |
Returns: dict: The hold: {"name", "serial", "deal", "status", "expires_at", "expires_label", "held_by", "extensions", "end_reason"}.
apps/ffl_core/ffl_core/api/crm.py:458
hold_guns¶
POST /api/method/ffl_core.api.crm.hold_guns
Auth (derived from code): Roles: Sales User / Sales Manager / System Manager
Hold guns on a deal (for 48 hours unless told otherwise): only the deal's customer can buy them meanwhile, at the
counter and on the website. Each gun is judged on its own.
| arg | type | required | default | description |
|---|---|---|---|---|
deal |
string | yes | — | The CRM Deal's name. It needs its POS customer. |
serials |
— | yes | — | The guns' serial numbers (a list, or JSON). One that is not on the deal's lines yet and is in stock goes on first: on the line of its item that names no gun, else on a line of its own. |
approver |
string | null | no | None |
The manager approving, when a gun needs one (held for this deal before). |
pin |
string | null | no | None |
The approver's counter PIN. |
password |
string | null | no | None |
Or their password. |
hours |
integer | null | no | None |
How long: 24, 48, 72 or 168. 48 when not given. |
Returns: dict: {"held": [{"name", "serial", "deal", "status", "expires_at", "expires_label", "held_by", "extensions", "end_reason"}], "refused": [{"serial", "reason", "needs_manager"?}]}. Refused while Hold guns for deals is off.
apps/ffl_core/ffl_core/api/crm.py:426
make_lead_from_mail¶
POST /api/method/ffl_core.api.crm.make_lead_from_mail
Auth (derived from code): Roles: Sales User / Sales Manager / System Manager
Make the lead for a mail the AI screening judged not to be from a customer.
The mail goes by the normal mail rules with the screening skipped: a new lead shared with the team, or the sender's deal if they have become a customer.
| arg | type | required | default | description |
|---|---|---|---|---|
communication |
string | yes | — | The Communication's name. |
Returns: dict: {"doctype": "CRM Lead" or "CRM Deal", "name": its name} (open it at /crm/leads/
apps/ffl_core/ffl_core/api/crm.py:82
make_sell_offer¶
POST /api/method/ffl_core.api.crm.make_sell_offer
Auth (derived from code): Roles: Sales User / Sales Manager / System Manager
Store what the store offers for a gun someone sells it. No email is sent, and the amount never
counts as a sale (the deal's value).
| arg | type | required | default | description |
|---|---|---|---|---|
deal |
string | yes | — | The CRM Deal's name, an open sell request whose gun is not received yet. |
amount |
number | yes | — | The offer, more than 0. |
Returns: dict: The Gun offered card, as sell_request_card.
apps/ffl_core/ffl_core/api/crm.py:187
matches_card¶
POST /api/method/ffl_core.api.crm.matches_card
Auth (derived from code): Roles: Sales User / Sales Manager / System Manager
The Matches card of a Lead or Deal page: what the store has for this customer, priced as the
register prices it now.
| arg | type | required | default | description |
|---|---|---|---|---|
doctype |
string | yes | — | "CRM Lead" or "CRM Deal". |
name |
string | yes | — | The record's name. |
Returns: dict: {"shown": there is something to show, "html", "guns": on a deal, the matched guns not on it yet that can be held now ([{"serial", "label"}])}.
apps/ffl_core/ffl_core/api/crm.py:679
memory_card¶
POST /api/method/ffl_core.api.crm.memory_card
Auth (derived from code): Roles: Sales User / Sales Manager / System Manager
The Memory card of a Lead or Deal page: what the customer told the store, and the record's summary.
| arg | type | required | default | description |
|---|---|---|---|---|
doctype |
string | yes | — | "CRM Lead" or "CRM Deal". |
name |
string | yes | — | The record's name. |
Returns: dict: {"html", "shown": the page shows the card (memory is on, or something is kept), "ready": an extension updates memory (Update memory shows), "can_edit": you may change this record, "has_content", "values": {"want", "trade_in", "preference", "question" (one row a line), "budget", "state", "auto_update"} for Edit memory}.
apps/ffl_core/ffl_core/api/crm.py:659
memory_clear¶
POST /api/method/ffl_core.api.crm.memory_clear
Auth (derived from code): Roles: Sales User / Sales Manager / System Manager
Clear memory: every row of the customer's memory you can see goes, and the summary of each of their
leads and deals you may change. On a lead that became a deal, the deal's rights apply.
| arg | type | required | default | description |
|---|---|---|---|---|
doctype |
string | yes | — | "CRM Lead" or "CRM Deal". |
name |
string | yes | — | The record's name. |
Returns: dict: The new card, as memory_card returns it, with "summaries_cleared" and "summaries_kept" (the person's other leads and deals you may not change keep theirs).
apps/ffl_core/ffl_core/api/crm.py:738
memory_save¶
POST /api/method/ffl_core.api.crm.memory_save
Auth (derived from code): Roles: Sales User / Sales Manager / System Manager
Edit memory: save what the customer's memory says. A new or changed row is yours and the AI leaves
it alone.
| arg | type | required | default | description |
|---|---|---|---|---|
doctype |
string | yes | — | "CRM Lead" or "CRM Deal". |
name |
string | yes | — | The record's name. |
values |
— | yes | — | {"want", "trade_in", "preference", "question" (one row a line), "budget", "state", "auto_update"}, as a dict or JSON. |
Returns: dict: The new card, as memory_card returns it. Refused with ID numbers, eligibility details, prices or stock in a row, a state that is not a US state, or more lines than a kind keeps.
apps/ffl_core/ffl_core/api/crm.py:717
memory_source¶
POST /api/method/ffl_core.api.crm.memory_source
Auth (derived from code): Roles: Sales User / Sales Manager / System Manager
The customer message a row of the Memory card came from (its "said" link).
| arg | type | required | default | description |
|---|---|---|---|---|
doctype |
string | yes | — | "CRM Lead" or "CRM Deal". |
name |
string | yes | — | The record's name. |
row |
string | yes | — | The memory row's name, from the card. |
Returns: dict: {"subject", "at", "text": plain text, 2000 characters at most}. Refused for a row that is not this customer's, or a message on a record you may not read.
apps/ffl_core/ffl_core/api/crm.py:698
memory_update_now¶
POST /api/method/ffl_core.api.crm.memory_update_now
Auth (derived from code): Roles: Sales User / Sales Manager / System Manager
Update memory: have the extension read the record's latest customer messages now.
| arg | type | required | default | description |
|---|---|---|---|---|
doctype |
string | yes | — | "CRM Lead" or "CRM Deal". |
name |
string | yes | — | The record's name. |
Returns: dict: The new card, as memory_card returns it. Refused while memory is off, with the extension's own reason (for example a spending limit), or when nothing could be updated.
apps/ffl_core/ffl_core/api/crm.py:757
open_deal¶
POST /api/method/ffl_core.api.crm.open_deal
Auth (derived from code): Roles: Sales User / Sales Manager / System Manager
The contact's open deal, made when they have none, to write to them from CRM.
| arg | type | required | default | description |
|---|---|---|---|---|
contact |
string | yes | — | The Contact's name. |
Returns: str: The CRM Deal's name (open it at /crm/deals/
apps/ffl_core/ffl_core/api/crm.py:25
open_deal_order¶
POST /api/method/ffl_core.api.crm.open_deal_order
Auth (derived from code): Roles: Sales User / Sales Manager / System Manager
Save a deal with a customer as a Create Order draft, to finish the sale on that page.
| arg | type | required | default | description |
|---|---|---|---|---|
deal |
string | yes | — | The CRM Deal's name. |
Returns: dict: {"draft": the draft's name, "route": the page to open, "skipped": deal lines that are not POS items}. The page sets the prices, as for a line picked there.
apps/ffl_core/ffl_core/api/crm.py:154
override_hold¶
POST /api/method/ffl_core.api.crm.override_hold
Auth (derived from code): Roles: Sales User / Sales Manager / Stock Manager / System Manager
A manager ends a deal's hold at the counter so the gun can be sold to someone else; the deal's
owner gets a task. A manager signed in approves their own; anyone else names one, who types their counter PIN (or password).
| arg | type | required | default | description |
|---|---|---|---|---|
serial |
string | yes | — | The held gun's Serial No. |
reason |
string | yes | — | Why (required). |
approver |
string | null | no | None |
The manager approving. |
pin |
string | null | no | None |
The approver's counter PIN. |
password |
string | null | no | None |
Or their password. |
Returns: dict: {"released": the hold, now Released, or None when nothing held the gun, "task": the CRM Task given to the deal owner, or None}.
apps/ffl_core/ffl_core/api/crm.py:549
price_options¶
POST /api/method/ffl_core.api.crm.price_options
Auth (derived from code): Roles: Sales User / Sales Manager / System Manager
The products Insert price offers on a Lead or Deal, most relevant first, at the register's price.
| arg | type | required | default | description |
|---|---|---|---|---|
doctype |
string | yes | — | "CRM Lead" or "CRM Deal". |
name |
string | yes | — | The record's name. |
Returns: dict: {"options": [{"item_code", "serial_no", "label"}] (15 at most), "default": 0}.
apps/ffl_core/ffl_core/api/crm.py:617
price_text¶
POST /api/method/ffl_core.api.crm.price_text
Auth (derived from code): Roles: Sales User / Sales Manager / System Manager
The line Insert price puts in the reply, priced now.
| arg | type | required | default | description |
|---|---|---|---|---|
doctype |
string | yes | — | "CRM Lead" or "CRM Deal". |
name |
string | yes | — | The record's name. |
item_code |
string | yes | — | The Item. |
serial_no |
string | null | no | None |
The gun, for a model priced gun by gun; it must be one of the Item's in stock. |
Returns: dict: {"text": "{product} — ${price}"}. Refused when the Item has no price.
apps/ffl_core/ffl_core/api/crm.py:634
release_hold¶
POST /api/method/ffl_core.api.crm.release_hold
Auth (derived from code): Roles: Sales User / Sales Manager / System Manager
End a hold: the gun is for sale to anyone again. Whoever placed it, the deal owner or a manager;
anyone else with a manager's PIN.
| arg | type | required | default | description |
|---|---|---|---|---|
hold |
string | yes | — | The CRM Deal Hold's name. |
reason |
string | null | no | None |
Why (optional). |
approver |
string | null | no | None |
The manager approving. |
pin |
string | null | no | None |
The approver's counter PIN. |
password |
string | null | no | None |
Or their password. |
Returns: dict: The hold, now Released: {"name", "serial", "deal", "status", "expires_at", "expires_label", "held_by", "extensions", "end_reason"}.
apps/ffl_core/ffl_core/api/crm.py:479
reply_draft_ready¶
POST /api/method/ffl_core.api.crm.reply_draft_ready
Auth (derived from code): Roles: Sales User / Sales Manager / System Manager
Which of a Lead or Deal page's Draft reply and Insert price buttons show. No network call.
| arg | type | required | default | description |
|---|---|---|---|---|
doctype |
string | yes | — | "CRM Lead" or "CRM Deal". |
name |
string | yes | — | The record's name. |
Returns: dict: {"ready": an extension drafts replies, "insert_price": linking deals to POS orders is on, "draft_ready": a reply drafted when the mail arrived is waiting for the caller}. All false on a sell request.
apps/ffl_core/ffl_core/api/crm.py:574
reply_queue¶
POST /api/method/ffl_core.api.crm.reply_queue
Auth (derived from code): Roles: Sales User / Sales Manager / System Manager
Your own reply queue: the customers on your CRM leads and deals who wait for an answer, longest first.
The same rows as the daily reply list, for the records you own.
Returns: list: One dict per record: "doctype", "name", "link" (the CRM page's path), "customer", "owner", "subject" and "received" of the waiting message, "days" waiting, "messages" from the customer since the store's last mail, "tasks" (open task titles) and "summary". A record kept in the list only by an open task has no "subject", "received" or "days".
apps/ffl_core/ffl_core/api/crm.py:775
sell_gun_intake¶
POST /api/method/ffl_core.api.crm.sell_gun_intake
Auth (derived from code): Roles: Sales User / Sales Manager / System Manager
What the register's Trade-in dialog is filled with to receive a sell request's gun. Writes
nothing: staff check the gun and submit the dialog, and that books it.
| arg | type | required | default | description |
|---|---|---|---|---|
deal |
string | yes | — | The CRM Deal's name, an open sell request with a customer and no gun received yet. |
Returns: dict: {"deal", "source_name": the seller (the deal's customer), "manufacturer", "model_name", "caliber", "firearm_type", "serial_no", "acquisition_cost": the offer or None}. No condition: staff grade the gun after inspecting it.
apps/ffl_core/ffl_core/api/crm.py:218
sell_offer_accepted¶
POST /api/method/ffl_core.api.crm.sell_offer_accepted
Auth (derived from code): Roles: Sales User / Sales Manager / System Manager
The seller accepted the offer: the deal waits for the gun from today. A second call keeps the
first day.
| arg | type | required | default | description |
|---|---|---|---|---|
deal |
string | yes | — | The CRM Deal's name, an open sell request with an offer. |
Returns: dict: The Gun offered card, as sell_request_card.
apps/ffl_core/ffl_core/api/crm.py:203
sell_request_card¶
POST /api/method/ffl_core.api.crm.sell_request_card
Auth (derived from code): Roles: Sales User / Sales Manager / System Manager
What a sell request's Gun offered card shows: the gun, its photos and where the buy stands.
| arg | type | required | default | description |
|---|---|---|---|---|
deal |
string | yes | — | The CRM Deal's name, a sell request. |
Returns: dict: {"html", "offer": the store's offer or 0, "accepted_on": the day the seller accepted or None, "received": the gun is received}. Refused while the switch is off.
apps/ffl_core/ffl_core/api/crm.py:169
serial_hold¶
POST /api/method/ffl_core.api.crm.serial_hold
Auth (derived from code): Roles: Sales User / Sales Manager / Stock Manager / System Manager
The live deal hold on one gun, for the counter. Carries no ID, 4473 or NICS data.
| arg | type | required | default | description |
|---|---|---|---|---|
serial |
string | yes | — | The Serial No. |
Returns: dict: {"hold": None or {"serial", "hold", "deal", "customer", "customer_name", "expires_at", "expires_label", "held_by", "held_by_name", "message"}, "self_approves": the caller is a manager, "approvers": [{"user", "full_name", "has_pin", "pin_off"}] otherwise}.
apps/ffl_core/ffl_core/api/crm.py:502