diff --git a/selections/api.py b/selections/api.py index 8493c2f..4df0ea0 100644 --- a/selections/api.py +++ b/selections/api.py @@ -11,7 +11,7 @@ from erpnext.stock.get_item_details import get_item_details @frappe.whitelist() -def get_items_for_selection(filters=None, start=0, page_length=50, custom_filters=None): +def get_items_for_selection(filters=None, start=0, page_length=50, custom_filters=None, skip_price=0): """ Получить список товаров с остатками и ценами для формы подбора @@ -33,6 +33,8 @@ def get_items_for_selection(filters=None, start=0, page_length=50, custom_filter if isinstance(custom_filters, str): custom_filters = frappe.parse_json(custom_filters) + skip_price = flt(skip_price) + if not filters: filters = {} @@ -166,7 +168,7 @@ def get_items_for_selection(filters=None, start=0, page_length=50, custom_filter }) # Цены - if price_list and company: + if not skip_price and price_list and company: price_data = get_price_data( item.item_code, warehouse=warehouse, @@ -180,7 +182,7 @@ def get_items_for_selection(filters=None, start=0, page_length=50, custom_filter item_dict.update({ 'price_list_rate': 0.0, 'rate': 0.0, - 'currency': frappe.defaults.get_global_default('currency') or 'USD' + 'currency': '' if skip_price else (frappe.defaults.get_global_default('currency') or 'USD') }) result_items.append(item_dict) diff --git a/selections/hooks.py b/selections/hooks.py index f16e1d4..60fbcd7 100644 --- a/selections/hooks.py +++ b/selections/hooks.py @@ -44,7 +44,18 @@ app_include_js = "/assets/selections/js/selection_dialog.js" # include js in doctype views doctype_js = { - "Sales Invoice": "public/js/sales_invoice.js" + "Sales Invoice": "public/js/sales_invoice.js", + "Sales Order": "public/js/sales_order.js", + "Quotation": "public/js/quotation.js", + "Purchase Order": "public/js/purchase_order.js", + "Purchase Invoice": "public/js/purchase_invoice.js", + "Supplier Quotation": "public/js/supplier_quotation.js", + "Request for Quotation": "public/js/request_for_quotation.js", + "Delivery Note": "public/js/delivery_note.js", + "Purchase Receipt": "public/js/purchase_receipt.js", + "Material Request": "public/js/material_request.js", + "Stock Entry": "public/js/stock_entry.js", + "Pick List": "public/js/pick_list.js", } # doctype_list_js = {"doctype" : "public/js/doctype_list.js"} # doctype_tree_js = {"doctype" : "public/js/doctype_tree.js"} diff --git a/selections/public/css/selection_dialog.css b/selections/public/css/selection_dialog.css index 7ebb45a..1783a51 100644 --- a/selections/public/css/selection_dialog.css +++ b/selections/public/css/selection_dialog.css @@ -853,3 +853,11 @@ body.selection-resizing * { .selection-filters::-webkit-scrollbar-thumb:hover { background: var(--text-color); } + +/* No-rate mode: hide price-related elements */ +.selection-no-rate #selection-pricelist-link, +.selection-no-rate label[for="selection-pricelist-link"], +.selection-no-rate .cart-item-discount, +.selection-no-rate .cart-total, +.selection-no-rate .cart-item-price, +.selection-no-rate .line-through { display: none !important; } diff --git a/selections/public/js/delivery_note.js b/selections/public/js/delivery_note.js new file mode 100644 index 0000000..d980794 --- /dev/null +++ b/selections/public/js/delivery_note.js @@ -0,0 +1,41 @@ +/** + * Интеграция формы подбора с Delivery Note + */ + +frappe.ui.form.on('Delivery Note', { + refresh: function(frm) { + if (frm.doc.docstatus === 0) { + setup_selection_button(frm); + } + } +}); + +function setup_selection_button(frm) { + const grid = frm.fields_dict.items.grid; + + grid.wrapper.find('.grid-add-multiple-rows').remove(); + + $('