brotherton-erpnext/erpnext/shopping_cart/product_info.py

69 lines
2.4 KiB
Python
Raw Normal View History

Hub (#10934) * [WIP]Hub * [listing] Show items, users and item_groups * Show filters * [start] cart, api for rfq and opp * rfq working * [wip] keys * wip quotes * [hub] register/unregister * [hub] rename password to access_token, remove passed company field * [hub] publishing cases, api call wrapper * [hub] add and remove fields working * [hub] fix flags, update on client save working * [hub] new hub page, client item CUD at hub working * listing, standard rate, local site hack * item listing, item page, search, back to home * [hub] implement hub company * [hub] company filter * [hub] basic rfq-ing, item page cleanup * categories wip * [hub] use get_doc_before_save() * [hub] send opportunity message to hub, api to make locally * [hub] enqueueing in hub api request wrapper * cleanup * [hub] refactor shopping cart's product.py to reuse * sync dynamic item fields daily * Scheduler heartbeat check * [wip] hub categories * [hub] wip enqueued callbacks * [hub] outgoing messages, fixing callback loop * [hub] bug: callback save after primary save * [hub] pricing, stock, currency * [hub] replace send_hub_request with make_and_enqueue * add hub.less, refactor code * Remove template html files, add styling for hub item cards * fix paging * add breadcrumb * Add sidebar * [hub] add company page, change country * [hub] order_by filters * [hub] make hub category a tree * [hub] enqueue batched item enqueueing * [hub] requested products page * [minor] * update hub url * [fix] url * [fix] more reform * fix recursion * [hub] data migration plans as jsons * Hub register, create data connector, sync with run * [add] user registration by session user * Removed hub_message * Remove sync code from hub_settings * Remove hub methods from item.py * Update Hub Sync plan * Hub unregister * Update Hub connector on reregister * Dont delete Hub Connector on unregister * Enable hub on success response * Add new hub whitelisted methods * [hub] list working * Hub register from hub page * [hub] Add hub logo in desk icon, link to page * [hub] hide page head on empty state * [hub] make rfq * [hub] push opportunity doc, poll for opportunity docs * add fields to item mapping * update hub mappings * Make RFQ * [hub] item, home routing * Make rfq and send opportunity refactor * [hub][fix] remote lead data * images passed as base64 * set default company on register * Revert "images passed as base64" This reverts commit 0b033a5fb7072b2d39a1b87a47dc41e7af707bb4. * Add sync to hub page * Prompt for publish items to hub * add post process to hub document to lead * Rename Hub document to Hub message, create opportunity in post process
2017-10-05 05:47:30 +00:00
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from erpnext.shopping_cart.cart import _get_cart_quotation, _set_price_list
Hub (#10934) * [WIP]Hub * [listing] Show items, users and item_groups * Show filters * [start] cart, api for rfq and opp * rfq working * [wip] keys * wip quotes * [hub] register/unregister * [hub] rename password to access_token, remove passed company field * [hub] publishing cases, api call wrapper * [hub] add and remove fields working * [hub] fix flags, update on client save working * [hub] new hub page, client item CUD at hub working * listing, standard rate, local site hack * item listing, item page, search, back to home * [hub] implement hub company * [hub] company filter * [hub] basic rfq-ing, item page cleanup * categories wip * [hub] use get_doc_before_save() * [hub] send opportunity message to hub, api to make locally * [hub] enqueueing in hub api request wrapper * cleanup * [hub] refactor shopping cart's product.py to reuse * sync dynamic item fields daily * Scheduler heartbeat check * [wip] hub categories * [hub] wip enqueued callbacks * [hub] outgoing messages, fixing callback loop * [hub] bug: callback save after primary save * [hub] pricing, stock, currency * [hub] replace send_hub_request with make_and_enqueue * add hub.less, refactor code * Remove template html files, add styling for hub item cards * fix paging * add breadcrumb * Add sidebar * [hub] add company page, change country * [hub] order_by filters * [hub] make hub category a tree * [hub] enqueue batched item enqueueing * [hub] requested products page * [minor] * update hub url * [fix] url * [fix] more reform * fix recursion * [hub] data migration plans as jsons * Hub register, create data connector, sync with run * [add] user registration by session user * Removed hub_message * Remove sync code from hub_settings * Remove hub methods from item.py * Update Hub Sync plan * Hub unregister * Update Hub connector on reregister * Dont delete Hub Connector on unregister * Enable hub on success response * Add new hub whitelisted methods * [hub] list working * Hub register from hub page * [hub] Add hub logo in desk icon, link to page * [hub] hide page head on empty state * [hub] make rfq * [hub] push opportunity doc, poll for opportunity docs * add fields to item mapping * update hub mappings * Make RFQ * [hub] item, home routing * Make rfq and send opportunity refactor * [hub][fix] remote lead data * images passed as base64 * set default company on register * Revert "images passed as base64" This reverts commit 0b033a5fb7072b2d39a1b87a47dc41e7af707bb4. * Add sync to hub page * Prompt for publish items to hub * add post process to hub document to lead * Rename Hub document to Hub message, create opportunity in post process
2017-10-05 05:47:30 +00:00
from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings \
2019-01-22 18:58:37 +00:00
import get_shopping_cart_settings, show_quantity_in_website
from erpnext.utilities.product import get_price, get_qty_in_stock, get_non_stock_item_status
Hub (#10934) * [WIP]Hub * [listing] Show items, users and item_groups * Show filters * [start] cart, api for rfq and opp * rfq working * [wip] keys * wip quotes * [hub] register/unregister * [hub] rename password to access_token, remove passed company field * [hub] publishing cases, api call wrapper * [hub] add and remove fields working * [hub] fix flags, update on client save working * [hub] new hub page, client item CUD at hub working * listing, standard rate, local site hack * item listing, item page, search, back to home * [hub] implement hub company * [hub] company filter * [hub] basic rfq-ing, item page cleanup * categories wip * [hub] use get_doc_before_save() * [hub] send opportunity message to hub, api to make locally * [hub] enqueueing in hub api request wrapper * cleanup * [hub] refactor shopping cart's product.py to reuse * sync dynamic item fields daily * Scheduler heartbeat check * [wip] hub categories * [hub] wip enqueued callbacks * [hub] outgoing messages, fixing callback loop * [hub] bug: callback save after primary save * [hub] pricing, stock, currency * [hub] replace send_hub_request with make_and_enqueue * add hub.less, refactor code * Remove template html files, add styling for hub item cards * fix paging * add breadcrumb * Add sidebar * [hub] add company page, change country * [hub] order_by filters * [hub] make hub category a tree * [hub] enqueue batched item enqueueing * [hub] requested products page * [minor] * update hub url * [fix] url * [fix] more reform * fix recursion * [hub] data migration plans as jsons * Hub register, create data connector, sync with run * [add] user registration by session user * Removed hub_message * Remove sync code from hub_settings * Remove hub methods from item.py * Update Hub Sync plan * Hub unregister * Update Hub connector on reregister * Dont delete Hub Connector on unregister * Enable hub on success response * Add new hub whitelisted methods * [hub] list working * Hub register from hub page * [hub] Add hub logo in desk icon, link to page * [hub] hide page head on empty state * [hub] make rfq * [hub] push opportunity doc, poll for opportunity docs * add fields to item mapping * update hub mappings * Make RFQ * [hub] item, home routing * Make rfq and send opportunity refactor * [hub][fix] remote lead data * images passed as base64 * set default company on register * Revert "images passed as base64" This reverts commit 0b033a5fb7072b2d39a1b87a47dc41e7af707bb4. * Add sync to hub page * Prompt for publish items to hub * add post process to hub document to lead * Rename Hub document to Hub message, create opportunity in post process
2017-10-05 05:47:30 +00:00
@frappe.whitelist(allow_guest=True)
def get_product_info_for_website(item_code, skip_quotation_creation=False):
Hub (#10934) * [WIP]Hub * [listing] Show items, users and item_groups * Show filters * [start] cart, api for rfq and opp * rfq working * [wip] keys * wip quotes * [hub] register/unregister * [hub] rename password to access_token, remove passed company field * [hub] publishing cases, api call wrapper * [hub] add and remove fields working * [hub] fix flags, update on client save working * [hub] new hub page, client item CUD at hub working * listing, standard rate, local site hack * item listing, item page, search, back to home * [hub] implement hub company * [hub] company filter * [hub] basic rfq-ing, item page cleanup * categories wip * [hub] use get_doc_before_save() * [hub] send opportunity message to hub, api to make locally * [hub] enqueueing in hub api request wrapper * cleanup * [hub] refactor shopping cart's product.py to reuse * sync dynamic item fields daily * Scheduler heartbeat check * [wip] hub categories * [hub] wip enqueued callbacks * [hub] outgoing messages, fixing callback loop * [hub] bug: callback save after primary save * [hub] pricing, stock, currency * [hub] replace send_hub_request with make_and_enqueue * add hub.less, refactor code * Remove template html files, add styling for hub item cards * fix paging * add breadcrumb * Add sidebar * [hub] add company page, change country * [hub] order_by filters * [hub] make hub category a tree * [hub] enqueue batched item enqueueing * [hub] requested products page * [minor] * update hub url * [fix] url * [fix] more reform * fix recursion * [hub] data migration plans as jsons * Hub register, create data connector, sync with run * [add] user registration by session user * Removed hub_message * Remove sync code from hub_settings * Remove hub methods from item.py * Update Hub Sync plan * Hub unregister * Update Hub connector on reregister * Dont delete Hub Connector on unregister * Enable hub on success response * Add new hub whitelisted methods * [hub] list working * Hub register from hub page * [hub] Add hub logo in desk icon, link to page * [hub] hide page head on empty state * [hub] make rfq * [hub] push opportunity doc, poll for opportunity docs * add fields to item mapping * update hub mappings * Make RFQ * [hub] item, home routing * Make rfq and send opportunity refactor * [hub][fix] remote lead data * images passed as base64 * set default company on register * Revert "images passed as base64" This reverts commit 0b033a5fb7072b2d39a1b87a47dc41e7af707bb4. * Add sync to hub page * Prompt for publish items to hub * add post process to hub document to lead * Rename Hub document to Hub message, create opportunity in post process
2017-10-05 05:47:30 +00:00
"""get product price / stock info for website"""
cart_settings = get_shopping_cart_settings()
if not cart_settings.enabled:
return frappe._dict()
cart_quotation = frappe._dict()
if not skip_quotation_creation:
cart_quotation = _get_cart_quotation()
Hub (#10934) * [WIP]Hub * [listing] Show items, users and item_groups * Show filters * [start] cart, api for rfq and opp * rfq working * [wip] keys * wip quotes * [hub] register/unregister * [hub] rename password to access_token, remove passed company field * [hub] publishing cases, api call wrapper * [hub] add and remove fields working * [hub] fix flags, update on client save working * [hub] new hub page, client item CUD at hub working * listing, standard rate, local site hack * item listing, item page, search, back to home * [hub] implement hub company * [hub] company filter * [hub] basic rfq-ing, item page cleanup * categories wip * [hub] use get_doc_before_save() * [hub] send opportunity message to hub, api to make locally * [hub] enqueueing in hub api request wrapper * cleanup * [hub] refactor shopping cart's product.py to reuse * sync dynamic item fields daily * Scheduler heartbeat check * [wip] hub categories * [hub] wip enqueued callbacks * [hub] outgoing messages, fixing callback loop * [hub] bug: callback save after primary save * [hub] pricing, stock, currency * [hub] replace send_hub_request with make_and_enqueue * add hub.less, refactor code * Remove template html files, add styling for hub item cards * fix paging * add breadcrumb * Add sidebar * [hub] add company page, change country * [hub] order_by filters * [hub] make hub category a tree * [hub] enqueue batched item enqueueing * [hub] requested products page * [minor] * update hub url * [fix] url * [fix] more reform * fix recursion * [hub] data migration plans as jsons * Hub register, create data connector, sync with run * [add] user registration by session user * Removed hub_message * Remove sync code from hub_settings * Remove hub methods from item.py * Update Hub Sync plan * Hub unregister * Update Hub connector on reregister * Dont delete Hub Connector on unregister * Enable hub on success response * Add new hub whitelisted methods * [hub] list working * Hub register from hub page * [hub] Add hub logo in desk icon, link to page * [hub] hide page head on empty state * [hub] make rfq * [hub] push opportunity doc, poll for opportunity docs * add fields to item mapping * update hub mappings * Make RFQ * [hub] item, home routing * Make rfq and send opportunity refactor * [hub][fix] remote lead data * images passed as base64 * set default company on register * Revert "images passed as base64" This reverts commit 0b033a5fb7072b2d39a1b87a47dc41e7af707bb4. * Add sync to hub page * Prompt for publish items to hub * add post process to hub document to lead * Rename Hub document to Hub message, create opportunity in post process
2017-10-05 05:47:30 +00:00
selling_price_list = cart_quotation.get("selling_price_list") if cart_quotation else _set_price_list(cart_settings, None)
Hub (#10934) * [WIP]Hub * [listing] Show items, users and item_groups * Show filters * [start] cart, api for rfq and opp * rfq working * [wip] keys * wip quotes * [hub] register/unregister * [hub] rename password to access_token, remove passed company field * [hub] publishing cases, api call wrapper * [hub] add and remove fields working * [hub] fix flags, update on client save working * [hub] new hub page, client item CUD at hub working * listing, standard rate, local site hack * item listing, item page, search, back to home * [hub] implement hub company * [hub] company filter * [hub] basic rfq-ing, item page cleanup * categories wip * [hub] use get_doc_before_save() * [hub] send opportunity message to hub, api to make locally * [hub] enqueueing in hub api request wrapper * cleanup * [hub] refactor shopping cart's product.py to reuse * sync dynamic item fields daily * Scheduler heartbeat check * [wip] hub categories * [hub] wip enqueued callbacks * [hub] outgoing messages, fixing callback loop * [hub] bug: callback save after primary save * [hub] pricing, stock, currency * [hub] replace send_hub_request with make_and_enqueue * add hub.less, refactor code * Remove template html files, add styling for hub item cards * fix paging * add breadcrumb * Add sidebar * [hub] add company page, change country * [hub] order_by filters * [hub] make hub category a tree * [hub] enqueue batched item enqueueing * [hub] requested products page * [minor] * update hub url * [fix] url * [fix] more reform * fix recursion * [hub] data migration plans as jsons * Hub register, create data connector, sync with run * [add] user registration by session user * Removed hub_message * Remove sync code from hub_settings * Remove hub methods from item.py * Update Hub Sync plan * Hub unregister * Update Hub connector on reregister * Dont delete Hub Connector on unregister * Enable hub on success response * Add new hub whitelisted methods * [hub] list working * Hub register from hub page * [hub] Add hub logo in desk icon, link to page * [hub] hide page head on empty state * [hub] make rfq * [hub] push opportunity doc, poll for opportunity docs * add fields to item mapping * update hub mappings * Make RFQ * [hub] item, home routing * Make rfq and send opportunity refactor * [hub][fix] remote lead data * images passed as base64 * set default company on register * Revert "images passed as base64" This reverts commit 0b033a5fb7072b2d39a1b87a47dc41e7af707bb4. * Add sync to hub page * Prompt for publish items to hub * add post process to hub document to lead * Rename Hub document to Hub message, create opportunity in post process
2017-10-05 05:47:30 +00:00
price = get_price(
item_code,
selling_price_list,
Hub (#10934) * [WIP]Hub * [listing] Show items, users and item_groups * Show filters * [start] cart, api for rfq and opp * rfq working * [wip] keys * wip quotes * [hub] register/unregister * [hub] rename password to access_token, remove passed company field * [hub] publishing cases, api call wrapper * [hub] add and remove fields working * [hub] fix flags, update on client save working * [hub] new hub page, client item CUD at hub working * listing, standard rate, local site hack * item listing, item page, search, back to home * [hub] implement hub company * [hub] company filter * [hub] basic rfq-ing, item page cleanup * categories wip * [hub] use get_doc_before_save() * [hub] send opportunity message to hub, api to make locally * [hub] enqueueing in hub api request wrapper * cleanup * [hub] refactor shopping cart's product.py to reuse * sync dynamic item fields daily * Scheduler heartbeat check * [wip] hub categories * [hub] wip enqueued callbacks * [hub] outgoing messages, fixing callback loop * [hub] bug: callback save after primary save * [hub] pricing, stock, currency * [hub] replace send_hub_request with make_and_enqueue * add hub.less, refactor code * Remove template html files, add styling for hub item cards * fix paging * add breadcrumb * Add sidebar * [hub] add company page, change country * [hub] order_by filters * [hub] make hub category a tree * [hub] enqueue batched item enqueueing * [hub] requested products page * [minor] * update hub url * [fix] url * [fix] more reform * fix recursion * [hub] data migration plans as jsons * Hub register, create data connector, sync with run * [add] user registration by session user * Removed hub_message * Remove sync code from hub_settings * Remove hub methods from item.py * Update Hub Sync plan * Hub unregister * Update Hub connector on reregister * Dont delete Hub Connector on unregister * Enable hub on success response * Add new hub whitelisted methods * [hub] list working * Hub register from hub page * [hub] Add hub logo in desk icon, link to page * [hub] hide page head on empty state * [hub] make rfq * [hub] push opportunity doc, poll for opportunity docs * add fields to item mapping * update hub mappings * Make RFQ * [hub] item, home routing * Make rfq and send opportunity refactor * [hub][fix] remote lead data * images passed as base64 * set default company on register * Revert "images passed as base64" This reverts commit 0b033a5fb7072b2d39a1b87a47dc41e7af707bb4. * Add sync to hub page * Prompt for publish items to hub * add post process to hub document to lead * Rename Hub document to Hub message, create opportunity in post process
2017-10-05 05:47:30 +00:00
cart_settings.default_customer_group,
cart_settings.company
)
stock_status = get_qty_in_stock(item_code, "website_warehouse")
product_info = {
"price": price,
"stock_qty": stock_status.stock_qty,
"in_stock": stock_status.in_stock if stock_status.is_stock_item else get_non_stock_item_status(item_code, "website_warehouse"),
Hub (#10934) * [WIP]Hub * [listing] Show items, users and item_groups * Show filters * [start] cart, api for rfq and opp * rfq working * [wip] keys * wip quotes * [hub] register/unregister * [hub] rename password to access_token, remove passed company field * [hub] publishing cases, api call wrapper * [hub] add and remove fields working * [hub] fix flags, update on client save working * [hub] new hub page, client item CUD at hub working * listing, standard rate, local site hack * item listing, item page, search, back to home * [hub] implement hub company * [hub] company filter * [hub] basic rfq-ing, item page cleanup * categories wip * [hub] use get_doc_before_save() * [hub] send opportunity message to hub, api to make locally * [hub] enqueueing in hub api request wrapper * cleanup * [hub] refactor shopping cart's product.py to reuse * sync dynamic item fields daily * Scheduler heartbeat check * [wip] hub categories * [hub] wip enqueued callbacks * [hub] outgoing messages, fixing callback loop * [hub] bug: callback save after primary save * [hub] pricing, stock, currency * [hub] replace send_hub_request with make_and_enqueue * add hub.less, refactor code * Remove template html files, add styling for hub item cards * fix paging * add breadcrumb * Add sidebar * [hub] add company page, change country * [hub] order_by filters * [hub] make hub category a tree * [hub] enqueue batched item enqueueing * [hub] requested products page * [minor] * update hub url * [fix] url * [fix] more reform * fix recursion * [hub] data migration plans as jsons * Hub register, create data connector, sync with run * [add] user registration by session user * Removed hub_message * Remove sync code from hub_settings * Remove hub methods from item.py * Update Hub Sync plan * Hub unregister * Update Hub connector on reregister * Dont delete Hub Connector on unregister * Enable hub on success response * Add new hub whitelisted methods * [hub] list working * Hub register from hub page * [hub] Add hub logo in desk icon, link to page * [hub] hide page head on empty state * [hub] make rfq * [hub] push opportunity doc, poll for opportunity docs * add fields to item mapping * update hub mappings * Make RFQ * [hub] item, home routing * Make rfq and send opportunity refactor * [hub][fix] remote lead data * images passed as base64 * set default company on register * Revert "images passed as base64" This reverts commit 0b033a5fb7072b2d39a1b87a47dc41e7af707bb4. * Add sync to hub page * Prompt for publish items to hub * add post process to hub document to lead * Rename Hub document to Hub message, create opportunity in post process
2017-10-05 05:47:30 +00:00
"qty": 0,
"uom": frappe.db.get_value("Item", item_code, "stock_uom"),
"show_stock_qty": show_quantity_in_website(),
"sales_uom": frappe.db.get_value("Item", item_code, "sales_uom")
Hub (#10934) * [WIP]Hub * [listing] Show items, users and item_groups * Show filters * [start] cart, api for rfq and opp * rfq working * [wip] keys * wip quotes * [hub] register/unregister * [hub] rename password to access_token, remove passed company field * [hub] publishing cases, api call wrapper * [hub] add and remove fields working * [hub] fix flags, update on client save working * [hub] new hub page, client item CUD at hub working * listing, standard rate, local site hack * item listing, item page, search, back to home * [hub] implement hub company * [hub] company filter * [hub] basic rfq-ing, item page cleanup * categories wip * [hub] use get_doc_before_save() * [hub] send opportunity message to hub, api to make locally * [hub] enqueueing in hub api request wrapper * cleanup * [hub] refactor shopping cart's product.py to reuse * sync dynamic item fields daily * Scheduler heartbeat check * [wip] hub categories * [hub] wip enqueued callbacks * [hub] outgoing messages, fixing callback loop * [hub] bug: callback save after primary save * [hub] pricing, stock, currency * [hub] replace send_hub_request with make_and_enqueue * add hub.less, refactor code * Remove template html files, add styling for hub item cards * fix paging * add breadcrumb * Add sidebar * [hub] add company page, change country * [hub] order_by filters * [hub] make hub category a tree * [hub] enqueue batched item enqueueing * [hub] requested products page * [minor] * update hub url * [fix] url * [fix] more reform * fix recursion * [hub] data migration plans as jsons * Hub register, create data connector, sync with run * [add] user registration by session user * Removed hub_message * Remove sync code from hub_settings * Remove hub methods from item.py * Update Hub Sync plan * Hub unregister * Update Hub connector on reregister * Dont delete Hub Connector on unregister * Enable hub on success response * Add new hub whitelisted methods * [hub] list working * Hub register from hub page * [hub] Add hub logo in desk icon, link to page * [hub] hide page head on empty state * [hub] make rfq * [hub] push opportunity doc, poll for opportunity docs * add fields to item mapping * update hub mappings * Make RFQ * [hub] item, home routing * Make rfq and send opportunity refactor * [hub][fix] remote lead data * images passed as base64 * set default company on register * Revert "images passed as base64" This reverts commit 0b033a5fb7072b2d39a1b87a47dc41e7af707bb4. * Add sync to hub page * Prompt for publish items to hub * add post process to hub document to lead * Rename Hub document to Hub message, create opportunity in post process
2017-10-05 05:47:30 +00:00
}
if product_info["price"]:
if frappe.session.user != "Guest":
item = cart_quotation.get({"item_code": item_code}) if cart_quotation else None
Hub (#10934) * [WIP]Hub * [listing] Show items, users and item_groups * Show filters * [start] cart, api for rfq and opp * rfq working * [wip] keys * wip quotes * [hub] register/unregister * [hub] rename password to access_token, remove passed company field * [hub] publishing cases, api call wrapper * [hub] add and remove fields working * [hub] fix flags, update on client save working * [hub] new hub page, client item CUD at hub working * listing, standard rate, local site hack * item listing, item page, search, back to home * [hub] implement hub company * [hub] company filter * [hub] basic rfq-ing, item page cleanup * categories wip * [hub] use get_doc_before_save() * [hub] send opportunity message to hub, api to make locally * [hub] enqueueing in hub api request wrapper * cleanup * [hub] refactor shopping cart's product.py to reuse * sync dynamic item fields daily * Scheduler heartbeat check * [wip] hub categories * [hub] wip enqueued callbacks * [hub] outgoing messages, fixing callback loop * [hub] bug: callback save after primary save * [hub] pricing, stock, currency * [hub] replace send_hub_request with make_and_enqueue * add hub.less, refactor code * Remove template html files, add styling for hub item cards * fix paging * add breadcrumb * Add sidebar * [hub] add company page, change country * [hub] order_by filters * [hub] make hub category a tree * [hub] enqueue batched item enqueueing * [hub] requested products page * [minor] * update hub url * [fix] url * [fix] more reform * fix recursion * [hub] data migration plans as jsons * Hub register, create data connector, sync with run * [add] user registration by session user * Removed hub_message * Remove sync code from hub_settings * Remove hub methods from item.py * Update Hub Sync plan * Hub unregister * Update Hub connector on reregister * Dont delete Hub Connector on unregister * Enable hub on success response * Add new hub whitelisted methods * [hub] list working * Hub register from hub page * [hub] Add hub logo in desk icon, link to page * [hub] hide page head on empty state * [hub] make rfq * [hub] push opportunity doc, poll for opportunity docs * add fields to item mapping * update hub mappings * Make RFQ * [hub] item, home routing * Make rfq and send opportunity refactor * [hub][fix] remote lead data * images passed as base64 * set default company on register * Revert "images passed as base64" This reverts commit 0b033a5fb7072b2d39a1b87a47dc41e7af707bb4. * Add sync to hub page * Prompt for publish items to hub * add post process to hub document to lead * Rename Hub document to Hub message, create opportunity in post process
2017-10-05 05:47:30 +00:00
if item:
product_info["qty"] = item[0].qty
return frappe._dict({
"product_info": product_info,
"cart_settings": cart_settings
})
def set_product_info_for_website(item):
"""set product price uom for website"""
2020-06-09 20:50:49 +00:00
product_info = get_product_info_for_website(item.item_code, skip_quotation_creation=True).get("product_info")
if product_info:
item.update(product_info)
item["stock_uom"] = product_info.get("uom")
item["sales_uom"] = product_info.get("sales_uom")
if product_info.get("price"):
item["price_stock_uom"] = product_info.get("price").get("formatted_price")
item["price_sales_uom"] = product_info.get("price").get("formatted_price_sales_uom")
else:
item["price_stock_uom"] = ""
item["price_sales_uom"] = ""