Moved Sales BOM & Sales BOM Item to Selling module, completed 'Available Stock for packing Items' report
This commit is contained in:
parent
64c8e28423
commit
a19014a846
1
selling/locale/_messages_js.json
Normal file
1
selling/locale/_messages_js.json
Normal file
@ -0,0 +1 @@
|
||||
[]
|
7
selling/locale/_messages_py.json
Normal file
7
selling/locale/_messages_py.json
Normal file
@ -0,0 +1,7 @@
|
||||
[
|
||||
"is not a Stock Item",
|
||||
"Item",
|
||||
"Please check",
|
||||
"reached its end of life on",
|
||||
"is a cancelled Item"
|
||||
]
|
7
selling/locale/ar-py.json
Normal file
7
selling/locale/ar-py.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"Item": "\u0628\u0646\u062f",
|
||||
"Please check": "\u064a\u0631\u062c\u0649 \u0645\u0631\u0627\u062c\u0639\u0629",
|
||||
"is a cancelled Item": "\u0647\u0648 \u0628\u0646\u062f \u0625\u0644\u063a\u0627\u0621",
|
||||
"is not a Stock Item": "\u0644\u064a\u0633 \u0627\u0644\u0625\u063a\u0644\u0627\u0642 \u0644\u0644\u0633\u0647\u0645",
|
||||
"reached its end of life on": "\u0648\u0635\u0644 \u0625\u0644\u0649 \u0646\u0647\u0627\u064a\u062a\u0647 \u0645\u0646 \u0627\u0644\u062d\u064a\u0627\u0629 \u0639\u0644\u0649"
|
||||
}
|
7
selling/locale/de-py.json
Normal file
7
selling/locale/de-py.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"Item": "Artikel",
|
||||
"Please check": "Bitte \u00fcberpr\u00fcfen Sie",
|
||||
"is a cancelled Item": "ist ein gestempeltes",
|
||||
"is not a Stock Item": "ist kein Lagerartikel",
|
||||
"reached its end of life on": "erreichte Ende des Lebens auf"
|
||||
}
|
7
selling/locale/es-py.json
Normal file
7
selling/locale/es-py.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"Item": "Art\u00edculo",
|
||||
"Please check": "Por favor, compruebe",
|
||||
"is a cancelled Item": "Es un Tema cancelado",
|
||||
"is not a Stock Item": "no es un elemento de serie",
|
||||
"reached its end of life on": "llegado al final de su vida en la"
|
||||
}
|
7
selling/locale/fr-py.json
Normal file
7
selling/locale/fr-py.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"Item": "Article",
|
||||
"Please check": "S'il vous pla\u00eet v\u00e9rifier",
|
||||
"is a cancelled Item": "est un \u00e9l\u00e9ment annul\u00e9e",
|
||||
"is not a Stock Item": "n'est pas un \u00e9l\u00e9ment de Stock",
|
||||
"reached its end of life on": "atteint la fin de sa vie sur"
|
||||
}
|
7
selling/locale/hi-py.json
Normal file
7
selling/locale/hi-py.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"Item": "\u092e\u0926",
|
||||
"Please check": "\u0915\u0943\u092a\u092f\u093e \u091c\u093e\u0901\u091a \u0915\u0930\u0947\u0902",
|
||||
"is a cancelled Item": "\u0930\u0926\u094d\u0926 \u0906\u0907\u091f\u092e",
|
||||
"is not a Stock Item": "\u0938\u094d\u091f\u0949\u0915 \u0906\u0907\u091f\u092e \u0928\u0939\u0940\u0902 \u0939\u0948",
|
||||
"reached its end of life on": "\u092a\u0930 \u0905\u092a\u0928\u0947 \u091c\u0940\u0935\u0928 \u0915\u0947 \u0905\u0902\u0924 \u0924\u0915 \u092a\u0939\u0941\u0901\u091a"
|
||||
}
|
7
selling/locale/hr-py.json
Normal file
7
selling/locale/hr-py.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"Item": "Stavka",
|
||||
"Please check": "Molimo provjerite",
|
||||
"is a cancelled Item": "je otkazan artikla",
|
||||
"is not a Stock Item": "nije katalo\u0161ki artikla",
|
||||
"reached its end of life on": "dosegla svoj kraj \u017eivota na"
|
||||
}
|
7
selling/locale/nl-py.json
Normal file
7
selling/locale/nl-py.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"Item": "Item",
|
||||
"Please check": "Controleer",
|
||||
"is a cancelled Item": "is een geannuleerde artikel",
|
||||
"is not a Stock Item": "is niet een Stock Item",
|
||||
"reached its end of life on": "het einde van zijn leven op"
|
||||
}
|
7
selling/locale/pt-BR-py.json
Normal file
7
selling/locale/pt-BR-py.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"Item": "Item",
|
||||
"Please check": "Por favor, verifique",
|
||||
"is a cancelled Item": "\u00e9 um Item cancelado",
|
||||
"is not a Stock Item": "n\u00e3o \u00e9 um Item de Estoque",
|
||||
"reached its end of life on": "chegou ao fim de vida em"
|
||||
}
|
7
selling/locale/pt-py.json
Normal file
7
selling/locale/pt-py.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"Item": "Item",
|
||||
"Please check": "Por favor, verifique",
|
||||
"is a cancelled Item": "\u00e9 um item cancelado",
|
||||
"is not a Stock Item": "n\u00e3o \u00e9 um item de estoque",
|
||||
"reached its end of life on": "chegou ao fim da vida na"
|
||||
}
|
7
selling/locale/sr-py.json
Normal file
7
selling/locale/sr-py.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"Item": "\u0421\u0442\u0430\u0432\u043a\u0430",
|
||||
"Please check": "\u041c\u043e\u043b\u0438\u043c\u043e \u0432\u0430\u0441 \u0434\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u0435",
|
||||
"is a cancelled Item": "\u0458\u0435 \u043e\u0442\u043a\u0430\u0437\u0430\u043d\u0430 \u0448\u0438\u0444\u0440\u0430",
|
||||
"is not a Stock Item": "\u043d\u0438\u0458\u0435 \u0431\u0435\u0440\u0437\u0430 \u0448\u0438\u0444\u0440\u0430",
|
||||
"reached its end of life on": "\u0434\u043e\u0441\u0442\u0438\u0433\u0430\u043e \u0441\u0432\u043e\u0458 \u043a\u0440\u0430\u0458 \u0436\u0438\u0432\u043e\u0442\u0430 \u043d\u0430"
|
||||
}
|
7
selling/locale/ta-py.json
Normal file
7
selling/locale/ta-py.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"Item": "\u0b89\u0bb0\u0bc1\u0baa\u0bcd\u0baa\u0b9f\u0bbf",
|
||||
"Please check": "\u0b9a\u0bb0\u0bbf\u0baa\u0bbe\u0bb0\u0bcd\u0b95\u0bcd\u0b95\u0bb5\u0bc1\u0bae\u0bcd",
|
||||
"is a cancelled Item": "\u0b92\u0bb0\u0bc1 \u0bb0\u0ba4\u0bcd\u0ba4\u0bc1 \u0b89\u0bb0\u0bc1\u0baa\u0bcd\u0baa\u0b9f\u0bbf \u0b89\u0bb3\u0bcd\u0bb3\u0ba4\u0bc1",
|
||||
"is not a Stock Item": "\u0b92\u0bb0\u0bc1 \u0baa\u0b99\u0bcd\u0b95\u0bc1 \u0baa\u0bc6\u0bbe\u0bb0\u0bc1\u0bb3\u0bcd \u0b85\u0bb2\u0bcd\u0bb2",
|
||||
"reached its end of life on": "\u0bb5\u0bbe\u0bb4\u0bcd\u0b95\u0bcd\u0b95\u0bc8 \u0b85\u0ba4\u0ba9\u0bcd \u0b87\u0bb1\u0bc1\u0ba4\u0bbf\u0baf\u0bbf\u0bb2\u0bcd \u0b85\u0b9f\u0bc8\u0ba8\u0bcd\u0ba4\u0ba4\u0bc1"
|
||||
}
|
7
selling/locale/th-py.json
Normal file
7
selling/locale/th-py.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"Item": "\u0e0a\u0e34\u0e49\u0e19",
|
||||
"Please check": "\u0e01\u0e23\u0e38\u0e13\u0e32\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a",
|
||||
"is a cancelled Item": "\u0e23\u0e32\u0e22\u0e01\u0e32\u0e23\u0e22\u0e01\u0e40\u0e25\u0e34\u0e01\u0e40\u0e1b\u0e47\u0e19",
|
||||
"is not a Stock Item": "\u0e44\u0e21\u0e48\u0e44\u0e14\u0e49\u0e40\u0e1b\u0e47\u0e19\u0e23\u0e32\u0e22\u0e01\u0e32\u0e23\u0e2a\u0e15\u0e47\u0e2d\u0e01",
|
||||
"reached its end of life on": "\u0e16\u0e36\u0e07\u0e08\u0e38\u0e14\u0e2a\u0e34\u0e49\u0e19\u0e2a\u0e38\u0e14\u0e02\u0e2d\u0e07\u0e0a\u0e35\u0e27\u0e34\u0e15\u0e40\u0e21\u0e37\u0e48\u0e2d"
|
||||
}
|
@ -167,13 +167,11 @@ wn.module_page["Selling"] = [
|
||||
},
|
||||
{
|
||||
"label":wn._("Territory Target Variance (Item Group-Wise)"),
|
||||
route: "query-report/Territory Target Variance Item Group-Wise",
|
||||
doctype: "Sales Order"
|
||||
route: "query-report/Territory Target Variance Item Group-Wise"
|
||||
},
|
||||
{
|
||||
"label":wn._("Sales Person Target Variance (Item Group-Wise)"),
|
||||
route: "query-report/Sales Person Target Variance Item Group-Wise",
|
||||
doctype: "Sales Order"
|
||||
route: "query-report/Sales Person Target Variance Item Group-Wise"
|
||||
},
|
||||
{
|
||||
"label":wn._("Customers Not Buying Since Long Time"),
|
||||
@ -190,6 +188,11 @@ wn.module_page["Selling"] = [
|
||||
route: "query-report/Sales Order Trends",
|
||||
doctype: "Sales Order"
|
||||
},
|
||||
{
|
||||
"label":wn._("Available Stock for Packing Items"),
|
||||
route: "query-report/Available Stock for Packing Items",
|
||||
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
|
@ -0,0 +1,89 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.utils import cint
|
||||
|
||||
def execute(filters=None):
|
||||
if not filters: filters = {}
|
||||
|
||||
columns = get_columns()
|
||||
item_warehouse_quantity_map = get_item_warehouse_quantity_map()
|
||||
|
||||
data = []
|
||||
for item, warehouse in item_warehouse_quantity_map.items():
|
||||
item_details = get_item_details(item)[0]
|
||||
total = 0
|
||||
total_qty = 0
|
||||
for wh, item_qty in warehouse.items():
|
||||
total += 1
|
||||
row = [item, item_details.item_name, item_details.description, \
|
||||
item_details.stock_uom, wh]
|
||||
for quantity in item_qty.items():
|
||||
max_qty = []
|
||||
max_qty.append(quantity[1])
|
||||
max_qty = min(max_qty)
|
||||
total_qty += cint(max_qty.qty)
|
||||
row += [max_qty.qty]
|
||||
data.append(row)
|
||||
if (total == len(warehouse)):
|
||||
row = ["", "", "Total", "", "", total_qty]
|
||||
data.append(row)
|
||||
|
||||
return columns, data
|
||||
|
||||
def get_columns():
|
||||
columns = ["Item Code:Link/Item:100", "Item Name::100", "Description::120", \
|
||||
"UOM:Link/UOM:80", "Warehouse:Link/Warehouse:100", "Quantity::100"]
|
||||
|
||||
return columns
|
||||
|
||||
def get_sales_bom():
|
||||
return webnotes.conn.sql("""select name from `tabSales BOM`""", as_dict=1)
|
||||
|
||||
def get_sales_bom_items(item):
|
||||
return webnotes.conn.sql("""select parent, item_code, qty from `tabSales BOM Item`
|
||||
where parent=%s""", (item), as_dict=1)
|
||||
|
||||
def get_item_details(item):
|
||||
return webnotes.conn.sql("""select name, item_name, description, stock_uom
|
||||
from `tabItem` where name=%s""", (item), as_dict=1)
|
||||
|
||||
def get_item_warehouse_quantity(item):
|
||||
return webnotes.conn.sql("""select item_code, warehouse, actual_qty from `tabBin`
|
||||
where item_code=%s""", (item), as_dict=1)
|
||||
|
||||
def get_item_warehouse_quantity_map():
|
||||
iwq_map = {}
|
||||
|
||||
sales_bom = get_sales_bom()
|
||||
|
||||
for item in sales_bom:
|
||||
child_item = get_sales_bom_items(item.name)
|
||||
for child in child_item:
|
||||
item_warehouse_quantity = get_item_warehouse_quantity(child.item_code)
|
||||
for iwq in item_warehouse_quantity:
|
||||
iwq_map.setdefault(item.name, {}).setdefault(iwq.warehouse, {}).\
|
||||
setdefault(child.item_code, webnotes._dict({
|
||||
"qty" : 0
|
||||
}))
|
||||
|
||||
q_dict = iwq_map[item.name][iwq.warehouse][child.item_code]
|
||||
|
||||
q_dict.qty = cint(iwq.actual_qty / child.qty)
|
||||
|
||||
return iwq_map
|
@ -0,0 +1,21 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-06-21 13:40:05",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-06-21 15:06:40",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"is_standard": "Yes",
|
||||
"name": "__common__",
|
||||
"ref_doctype": "Sales BOM",
|
||||
"report_name": "Available Stock for Packing Items",
|
||||
"report_type": "Script Report"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"name": "Available Stock for Packing Items"
|
||||
}
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user