Merge pull request #5043 from neilLasrado/warehouse
Validate purchase item only if material request type is purchase
diff --git a/erpnext/accounts/report/balance_sheet/balance_sheet.py b/erpnext/accounts/report/balance_sheet/balance_sheet.py
index 7e05b95..52a358b 100644
--- a/erpnext/accounts/report/balance_sheet/balance_sheet.py
+++ b/erpnext/accounts/report/balance_sheet/balance_sheet.py
@@ -16,6 +16,8 @@
provisional_profit_loss = get_provisional_profit_loss(asset, liability, equity,
period_list, filters.company)
+
+ message = check_opening_balance(asset, liability, equity)
data = []
data.extend(asset or [])
@@ -26,7 +28,7 @@
columns = get_columns(filters.periodicity, period_list, company=filters.company)
- return columns, data
+ return columns, data, message
def get_provisional_profit_loss(asset, liability, equity, period_list, company):
if asset and (liability or equity):
@@ -57,3 +59,14 @@
if has_value:
return provisional_profit_loss
+
+def check_opening_balance(asset, liability, equity):
+ # Check if previous year balance sheet closed
+ opening_balance = flt(asset[0].get("opening_balance", 0))
+ if liability:
+ opening_balance -= flt(liability[0].get("opening_balance", 0))
+ if equity:
+ opening_balance -= flt(asset[0].get("opening_balance", 0))
+
+ if opening_balance:
+ return _("Previous Financial Year is not closed")
\ No newline at end of file
diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py
index 3e70a0e..1a59a9d 100644
--- a/erpnext/accounts/report/financial_statements.py
+++ b/erpnext/accounts/report/financial_statements.py
@@ -125,14 +125,20 @@
if entry.posting_date <= period.to_date:
if accumulated_values or entry.posting_date >= period.from_date:
d[period.key] = d.get(period.key, 0.0) + flt(entry.debit) - flt(entry.credit)
+
+ if entry.posting_date < period_list[0].year_start_date:
+ d["opening_balance"] = d.get("opening_balance", 0.0) + flt(entry.debit) - flt(entry.credit)
def accumulate_values_into_parents(accounts, accounts_by_name, period_list, accumulated_values):
"""accumulate children's values in parent accounts"""
for d in reversed(accounts):
if d.parent_account:
for period in period_list:
- accounts_by_name[d.parent_account][period.key] = accounts_by_name[d.parent_account].get(period.key, 0.0) + \
- d.get(period.key, 0.0)
+ accounts_by_name[d.parent_account][period.key] = \
+ accounts_by_name[d.parent_account].get(period.key, 0.0) + d.get(period.key, 0.0)
+
+ accounts_by_name[d.parent_account]["opening_balance"] = \
+ accounts_by_name[d.parent_account].get("opening_balance", 0.0) + d.get("opening_balance", 0.0)
def prepare_data(accounts, balance_must_be, period_list, company_currency):
data = []
@@ -150,13 +156,14 @@
"indent": flt(d.indent),
"year_start_date": year_start_date,
"year_end_date": year_end_date,
- "currency": company_currency
+ "currency": company_currency,
+ "opening_balance": d.get("opening_balance", 0.0) * (1 if balance_must_be=="Debit" else -1)
})
for period in period_list:
- if d.get(period.key):
+ if d.get(period.key) and balance_must_be=="Credit":
# change sign based on Debit or Credit, since calculation is done using (debit - credit)
- d[period.key] *= (1 if balance_must_be=="Debit" else -1)
-
+ d[period.key] *= -1
+
row[period.key] = flt(d.get(period.key, 0.0), 3)
if abs(row[period.key]) >= 0.005:
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.js b/erpnext/manufacturing/doctype/production_order/production_order.js
index d2e95fa..404ae38 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.js
+++ b/erpnext/manufacturing/doctype/production_order/production_order.js
@@ -6,6 +6,7 @@
frm.doc.status = 'Draft';
frm.add_fetch("sales_order", "delivery_date", "expected_delivery_date");
+ frm.add_fetch("sales_order", "project", "project");
if(frm.doc.__islocal) {
frm.set_value({
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py
index 5614f37..04022c5 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/production_order.py
@@ -51,12 +51,14 @@
def validate_sales_order(self):
if self.sales_order:
- so = frappe.db.sql("""select name, delivery_date from `tabSales Order`
+ so = frappe.db.sql("""select name, delivery_date, project from `tabSales Order`
where name=%s and docstatus = 1""", self.sales_order, as_dict=1)
if len(so):
if not self.expected_delivery_date:
self.expected_delivery_date = so[0].delivery_date
+
+ self.project = so[0].project
self.validate_production_order_against_so()
else:
diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.json b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.json
index 9ccd55e..8817f65 100644
--- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.json
+++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.json
@@ -12,11 +12,12 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
- "default": "Sales Order",
+ "default": "",
"fieldname": "get_items_from",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Get Items From",
@@ -44,6 +45,7 @@
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Filters",
@@ -67,6 +69,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Item",
@@ -92,6 +95,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Customer",
@@ -117,6 +121,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Warehouse",
@@ -143,6 +148,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Company",
@@ -167,6 +173,7 @@
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
@@ -190,6 +197,7 @@
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "From Date",
@@ -213,6 +221,7 @@
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "To Date",
@@ -233,10 +242,38 @@
"bold": 0,
"collapsible": 0,
"depends_on": "eval: doc.get_items_from == \"Sales Order\"",
+ "fieldname": "project",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Project",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Project",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "depends_on": "eval: doc.get_items_from == \"Sales Order\"",
"fieldname": "section_break1",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
@@ -261,6 +298,7 @@
"fieldtype": "Button",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Get Sales Orders",
@@ -285,6 +323,7 @@
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Sales Orders",
@@ -310,6 +349,7 @@
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
@@ -334,6 +374,7 @@
"fieldtype": "Button",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Get Material Request",
@@ -359,6 +400,7 @@
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Material Requests",
@@ -384,6 +426,7 @@
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Select Items",
@@ -408,6 +451,7 @@
"fieldtype": "Button",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Get Items",
@@ -435,6 +479,7 @@
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Use Multi-Level BOM",
@@ -458,6 +503,7 @@
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Items",
@@ -483,6 +529,7 @@
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Production Orders",
@@ -507,6 +554,7 @@
"fieldtype": "Button",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Create Production Orders",
@@ -532,6 +580,7 @@
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Material Requirement",
@@ -555,6 +604,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Material Request For Warehouse",
@@ -580,6 +630,7 @@
"fieldtype": "Button",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Create Material Requests",
@@ -605,6 +656,7 @@
"fieldtype": "Button",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Download Materials Required",
@@ -631,7 +683,7 @@
"issingle": 1,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-02-23 02:37:51.260645",
+ "modified": "2016-03-16 06:18:50.179089",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Production Planning Tool",
diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
index b79b136..57eca4b 100644
--- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
+++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
@@ -32,6 +32,8 @@
so_filter += " and so.transaction_date <= %(to_date)s"
if self.customer:
so_filter += " and so.customer = %(customer)s"
+ if self.project:
+ so_filter += " and so.project = %(project)s"
if self.fg_item:
item_filter += " and item.name = %(item)s"
@@ -53,6 +55,7 @@
"from_date": self.from_date,
"to_date": self.to_date,
"customer": self.customer,
+ "project": self.project,
"item": self.fg_item,
"company": self.company
}, as_dict=1)
diff --git a/erpnext/projects/doctype/project/project.json b/erpnext/projects/doctype/project/project.json
index 1f1943c..02a3fd0 100644
--- a/erpnext/projects/doctype/project/project.json
+++ b/erpnext/projects/doctype/project/project.json
@@ -921,7 +921,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 4,
- "modified": "2016-03-10 05:10:21.779365",
+ "modified": "2016-03-15 05:10:21.779365",
"modified_by": "Administrator",
"module": "Projects",
"name": "Project",
diff --git a/erpnext/projects/doctype/project/project.py b/erpnext/projects/doctype/project/project.py
index ec4f523..c2b8fb1 100644
--- a/erpnext/projects/doctype/project/project.py
+++ b/erpnext/projects/doctype/project/project.py
@@ -123,7 +123,19 @@
from `tabPurchase Invoice Item` where project = %s and docstatus=1""", self.name)
self.total_purchase_cost = total_purchase_cost and total_purchase_cost[0][0] or 0
+
+
+def get_project_list(doctype, txt, filters, limit_start, limit_page_length=20):
+ from frappe.templates.pages.list import get_list
+ return get_list(doctype, txt, filters, limit_start, limit_page_length, ignore_permissions=True)
+
+def get_list_context(context=None):
+ return {
+ "title": _("My Projects"),
+ "get_list": get_project_list,
+ "row_template": "templates/includes/project_row.html"
+ }
@frappe.whitelist()
def get_cost_center_name(project):
return frappe.db.get_value("Project", project, "cost_center")
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index 529c17c..4111eb4 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -336,6 +336,10 @@
def make_material_request(source_name, target_doc=None):
def postprocess(source, doc):
doc.material_request_type = "Purchase"
+
+ def update_item(source, target, source_parent):
+ target.project = source_parent.project
+
so = frappe.get_doc("Sales Order", source_name)
@@ -353,7 +357,8 @@
"field_map": {
"parent": "sales_order",
"stock_uom": "uom"
- }
+ },
+ "postprocess": update_item
}
}, target_doc, postprocess)
diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py
index 27271af..7d5e250 100644
--- a/erpnext/shopping_cart/cart.py
+++ b/erpnext/shopping_cart/cart.py
@@ -437,3 +437,6 @@
break
return territory
+
+def show_terms(doc):
+ return doc.tc_name
diff --git a/erpnext/shopping_cart/utils.py b/erpnext/shopping_cart/utils.py
index b8d5054..3e1afe2 100644
--- a/erpnext/shopping_cart/utils.py
+++ b/erpnext/shopping_cart/utils.py
@@ -30,9 +30,10 @@
def update_my_account_context(context):
context["my_account_list"].extend([
+ {"label": _("Projects"), "url": "project"},
{"label": _("Orders"), "url": "orders"},
{"label": _("Invoices"), "url": "invoices"},
{"label": _("Shipments"), "url": "shipments"},
{"label": _("Issues"), "url": "issues"},
- {"label": _("Addresses"), "url": "addresses"},
+ {"label": _("Addresses"), "url": "addresses"}
])
diff --git a/erpnext/stock/doctype/material_request_item/material_request_item.json b/erpnext/stock/doctype/material_request_item/material_request_item.json
index eecb42a..f6c0ac2 100644
--- a/erpnext/stock/doctype/material_request_item/material_request_item.json
+++ b/erpnext/stock/doctype/material_request_item/material_request_item.json
@@ -16,6 +16,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 1,
"label": "Item Code",
@@ -44,6 +45,7 @@
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
@@ -66,6 +68,7 @@
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Item Name",
@@ -93,6 +96,7 @@
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Description",
@@ -117,6 +121,7 @@
"fieldtype": "Text Editor",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Description",
@@ -144,6 +149,7 @@
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
@@ -167,6 +173,7 @@
"fieldtype": "Attach Image",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Image",
@@ -191,6 +198,7 @@
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Quantity and Warehouse",
@@ -214,6 +222,7 @@
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Quantity",
@@ -241,6 +250,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Stock UOM",
@@ -269,6 +279,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "For Warehouse",
@@ -297,6 +308,7 @@
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
@@ -319,6 +331,7 @@
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Required Date",
@@ -346,6 +359,7 @@
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "More Information",
@@ -370,6 +384,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Item Group",
@@ -396,6 +411,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Brand",
@@ -424,6 +440,7 @@
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Lead Time Date",
@@ -449,6 +466,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Sales Order",
@@ -469,10 +487,37 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "fieldname": "project",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Project",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Project",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
"fieldname": "col_break3",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
@@ -495,6 +540,7 @@
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Min Order Qty",
@@ -522,6 +568,7 @@
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Projected Qty",
@@ -549,6 +596,7 @@
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Completed Qty",
@@ -574,6 +622,7 @@
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Page Break",
@@ -601,7 +650,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2016-01-30 06:03:41.424851",
+ "modified": "2016-03-17 07:20:38.969978",
"modified_by": "Administrator",
"module": "Stock",
"name": "Material Request Item",
diff --git a/erpnext/stock/doctype/warehouse/warehouse.js b/erpnext/stock/doctype/warehouse/warehouse.js
index 22396b7..586d248 100644
--- a/erpnext/stock/doctype/warehouse/warehouse.js
+++ b/erpnext/stock/doctype/warehouse/warehouse.js
@@ -1,9 +1,25 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
-cur_frm.cscript.refresh = function(doc) {
- cur_frm.toggle_display('warehouse_name', doc.__islocal);
-}
+frappe.ui.form.on("Warehouse", {
+ refresh: function(frm) {
+ frm.toggle_display('warehouse_name', frm.doc.__islocal);
+
+ frm.add_custom_button(__("Stock Ledger"), function() {
+ frappe.set_route("query-report", "Stock Ledger", {"warehouse": frm.doc.name});
+ });
+ if(frm.doc.__onload && frm.doc.__onload.account) {
+ frm.add_custom_button(__("General Ledger"), function() {
+ frappe.route_options = {
+ "account": frm.doc.__onload.account,
+ "company": frm.doc.company
+ }
+ frappe.set_route("query-report", "General Ledger");
+ });
+ }
+ }
+});
+
cur_frm.set_query("create_account_under", function() {
return {
diff --git a/erpnext/stock/doctype/warehouse/warehouse.py b/erpnext/stock/doctype/warehouse/warehouse.py
index 610c7b8..901b229 100644
--- a/erpnext/stock/doctype/warehouse/warehouse.py
+++ b/erpnext/stock/doctype/warehouse/warehouse.py
@@ -14,6 +14,14 @@
if not self.warehouse_name.endswith(suffix):
self.name = self.warehouse_name + suffix
+ def onload(self):
+ '''load account name for General Ledger Report'''
+ account = frappe.db.get_value("Account", {
+ "account_type": "Warehouse", "company": self.company, "warehouse": self.name})
+
+ if account:
+ self.set_onload('account', account)
+
def validate(self):
if self.email_id:
validate_email_add(self.email_id, True)
diff --git a/erpnext/support/doctype/issue/issue.json b/erpnext/support/doctype/issue/issue.json
index 1f40a21..2a6f7a0 100644
--- a/erpnext/support/doctype/issue/issue.json
+++ b/erpnext/support/doctype/issue/issue.json
@@ -16,6 +16,7 @@
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Subject",
@@ -40,6 +41,7 @@
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Series",
@@ -64,6 +66,7 @@
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Subject",
@@ -87,6 +90,7 @@
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
@@ -110,6 +114,7 @@
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Status",
@@ -137,6 +142,7 @@
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 1,
"label": "Raised By (Email)",
@@ -163,6 +169,7 @@
"fieldtype": "Fold",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
@@ -185,6 +192,7 @@
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
@@ -209,6 +217,7 @@
"fieldtype": "Text",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Description",
@@ -234,6 +243,7 @@
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
@@ -258,6 +268,7 @@
"fieldtype": "Datetime",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Resolution Date",
@@ -283,6 +294,7 @@
"fieldtype": "Datetime",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "First Responded On",
@@ -306,6 +318,7 @@
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "",
@@ -330,6 +343,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Lead",
@@ -354,6 +368,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Contact",
@@ -378,6 +393,7 @@
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
@@ -401,6 +417,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Customer",
@@ -427,6 +444,7 @@
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Customer Name",
@@ -452,6 +470,7 @@
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
@@ -476,6 +495,7 @@
"fieldtype": "Small Text",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Resolution Details",
@@ -502,6 +522,7 @@
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
@@ -526,6 +547,7 @@
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Opening Date",
@@ -551,6 +573,7 @@
"fieldtype": "Time",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Opening Time",
@@ -576,6 +599,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Company",
@@ -600,6 +624,7 @@
"fieldtype": "Data",
"hidden": 1,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Content Type",
@@ -623,6 +648,7 @@
"fieldtype": "Attach",
"hidden": 1,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Attachment",
@@ -638,6 +664,32 @@
"search_index": 0,
"set_only_once": 0,
"unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "fieldname": "project",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Project",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Project",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
}
],
"hide_heading": 0,
@@ -650,7 +702,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-02-03 01:08:48.180242",
+ "modified": "2016-03-09 18:31:10.404549",
"modified_by": "Administrator",
"module": "Support",
"name": "Issue",
@@ -661,6 +713,26 @@
"apply_user_permissions": 1,
"cancel": 0,
"create": 1,
+ "delete": 1,
+ "email": 1,
+ "export": 1,
+ "if_owner": 0,
+ "import": 0,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "Projects User",
+ "set_user_permissions": 0,
+ "share": 1,
+ "submit": 0,
+ "write": 1
+ },
+ {
+ "amend": 0,
+ "apply_user_permissions": 0,
+ "cancel": 0,
+ "create": 1,
"delete": 0,
"email": 1,
"export": 0,
@@ -670,6 +742,8 @@
"print": 1,
"read": 1,
"report": 1,
+ "restrict": 0,
+ "restricted": 0,
"role": "Customer",
"set_user_permissions": 0,
"share": 1,
@@ -690,6 +764,8 @@
"print": 1,
"read": 1,
"report": 1,
+ "restrict": 0,
+ "restricted": 0,
"role": "Support Team",
"set_user_permissions": 0,
"share": 1,
diff --git a/erpnext/templates/includes/cart.css b/erpnext/templates/includes/cart.css
index 7a18530..07302db 100644
--- a/erpnext/templates/includes/cart.css
+++ b/erpnext/templates/includes/cart.css
@@ -23,3 +23,10 @@
margin-top: 80px;
margin-bottom: 60px;
}
+
+.cart-link {
+ margin-top: 40px;
+ text-align: right;
+
+
+}
\ No newline at end of file
diff --git a/erpnext/templates/includes/cart.js b/erpnext/templates/includes/cart.js
index 0c29569..9cb5e6e 100644
--- a/erpnext/templates/includes/cart.js
+++ b/erpnext/templates/includes/cart.js
@@ -147,3 +147,8 @@
$(".cart-icon").hide();
shopping_cart.bind_events();
});
+
+function show_terms() {
+ var html = $(".cart-terms").html();
+ frappe.msgprint(html);
+}
diff --git a/erpnext/templates/includes/project_row.html b/erpnext/templates/includes/project_row.html
new file mode 100644
index 0000000..3c7331b
--- /dev/null
+++ b/erpnext/templates/includes/project_row.html
@@ -0,0 +1,29 @@
+{% if doc.status=="Open" %}
+<div class="web-list-item">
+ <a class="no-decoration" href="/projects?project={{ doc.name }}">
+ <div class="row">
+ <div class="col-xs-4">
+
+ {{ doc.name }}
+ </div>
+ <div class="col-xs-4">
+ {% if doc.percent_complete %}
+ <div class="progress" style="margin-bottom: 0!important;">
+ <div class="progress-bar progress-bar-warning" role="progressbar"
+ aria-valuenow="{{ doc.percent_complete|round|int }}"
+ aria-valuemin="0" aria-valuemax="100" style="width:{{ doc.percent_complete|round|int }}%;">
+ {{ doc.percent_complete|round|int }}% Complete
+ </div>
+ </div>
+ {% else %}
+ <span class="indicator {{ "red" if doc.status=="Open" else "darkgrey" }}">
+ {{ doc.status }}</span>
+ {% endif %}
+ </div>
+ <div class="col-xs-4 text-right small text-muted">
+ {{ frappe.utils.pretty_date(doc.modified) }}
+ </div>
+ </div>
+ </a>
+</div>
+{% endif %}
diff --git a/erpnext/templates/includes/project_search_box.html b/erpnext/templates/includes/project_search_box.html
new file mode 100644
index 0000000..8788fcd
--- /dev/null
+++ b/erpnext/templates/includes/project_search_box.html
@@ -0,0 +1,20 @@
+<div class="project-search">
+ <input type="text" id="project-search"
+ placeholder="Search..."><span style="position:relative;
+ left:-19px;"> <a href="/projects?project={{doc.name}}" class="octicon octicon-x text-extra-muted" title="Clear" ></a> </span>
+</div>
+
+<script>
+frappe.ready(function() {
+ var thread = null;
+ function findResult(t) {
+ window.location.href="/projects?project={{doc.name}}&q=" + t;
+ }
+
+ $("#project-search").keyup(function() {
+ clearTimeout(thread);
+ var $this = $(this); thread = setTimeout(function(){findResult($this.val())}, 1000);
+ });
+ $(".form-search").on("submit", function() { return false; });
+});
+</script>
\ No newline at end of file
diff --git a/erpnext/templates/includes/projects.css b/erpnext/templates/includes/projects.css
new file mode 100644
index 0000000..d3f2e17
--- /dev/null
+++ b/erpnext/templates/includes/projects.css
@@ -0,0 +1,144 @@
+/* CSS used here will be applied after bootstrap.css */
+
+.underline {
+ text-decoration: underline;
+}
+
+.page-container .indicator {
+ font-weight: normal;
+}
+
+.page-container .project-item {
+ padding-top: 5px;
+ padding-bottom: 5px;
+}
+
+.row-header {
+ font-size: 14px;
+ font-weight: 500;
+ padding-bottom: 8px;
+ border-bottom: 2px solid #d1d8dd;
+ margin: 0!important;
+}
+
+.content_display{
+ padding: 5px;
+}
+
+.task-btn, .issue-btn, .timelog-btn{
+ padding: 8px;
+}
+
+.timeline-centered {
+ position: relative;
+ margin-bottom: 10px;
+}
+
+.timeline-centered:before {
+ content: '';
+ position: absolute;
+ display: block;
+ width: 3px;
+ background: #f5f5f6;
+ /*left: 50%;*/
+ top: 0px;
+ bottom: 0px;
+ margin-left: 10px;
+}
+
+.timeline-centered .timeline-entry {
+ position: relative;
+ /*width: 50%;
+float: right;*/
+ margin-top: 5px;
+ margin-left: 10px;
+ margin-bottom: 5px;
+ clear: both;
+}
+
+
+.timeline-centered .timeline-entry .timeline-entry-inner {
+ position: relative;
+ margin-left: -3px;
+}
+
+
+.timeline-centered .timeline-entry .timeline-entry-inner .timeline-icon {
+ margin-top:10px;
+ background: #fff;
+ color: #737881;
+ display: block;
+ width: 10px;
+ height: 10px;
+ -webkit-background-clip: padding-box;
+ -moz-background-clip: padding;
+ background-clip: padding-box;
+ -webkit-border-radius: 20px;
+ -moz-border-radius: 20px;
+ border-radius: 20px;
+ text-align: center;
+ -moz-box-shadow: 0 0 0 2px #f5f5f6;
+ -webkit-box-shadow: 0 0 0 2px #f5f5f6;
+ box-shadow: 0 0 0 2px #f5f5f6;
+ line-height: 30px;
+ float: left;
+}
+
+
+.timeline-centered .timeline-entry .timeline-entry-inner .timeline-icon.bg-primary {
+ background-color: #303641;
+ color: #fff;
+}
+
+.timeline-centered .timeline-entry .timeline-entry-inner .timeline-icon.bg-secondary {
+ background-color: #ee4749;
+ color: #fff;
+}
+
+.timeline-centered .timeline-entry .timeline-entry-inner .timeline-icon.bg-success {
+ background-color: #98d85b;
+ color: #fff;
+}
+
+.timeline-centered .timeline-entry .timeline-entry-inner .timeline-icon.bg-info {
+ background-color: #21a9e1;
+ color: #fff;
+}
+
+.timeline-centered .timeline-entry .timeline-entry-inner .timeline-icon.bg-warning {
+ background-color: #ffa00a;
+ color: #fff;
+}
+
+.timeline-centered .timeline-entry .timeline-entry-inner .timeline-icon.bg-danger {
+ background-color: #ff5858;
+ color: #fff;
+}
+
+
+.timeline-centered .timeline-entry .timeline-entry-inner .timeline-label {
+ position: relative;
+ background: #f5f5f6;
+ padding: 1em;
+ margin-left: 40px;
+ -webkit-background-clip: padding-box;
+ -moz-background-clip: padding;
+ background-clip: padding-box;
+ -webkit-border-radius: 3px;
+ -moz-border-radius: 3px;
+ border-radius: 3px;
+}
+
+.timeline-centered .timeline-entry .timeline-entry-inner .timeline-label:after {
+ content: '';
+ display: block;
+ position: absolute;
+ width: 0;
+ height: 0;
+ border-style: solid;
+ border-width: 9px 9px 9px 0;
+ border-color: transparent #f5f5f6 transparent transparent;
+ left: 0;
+ top: 10px;
+ margin-left: -9px;
+}
diff --git a/erpnext/templates/includes/projects/project_issues.html b/erpnext/templates/includes/projects/project_issues.html
new file mode 100644
index 0000000..34f6633
--- /dev/null
+++ b/erpnext/templates/includes/projects/project_issues.html
@@ -0,0 +1,31 @@
+{% for issue in doc.issues %}
+ <div class='issue'>
+ <div class='row project-item'>
+ <div class='col-xs-9'>
+ <a class="no-decoration" href="/issues-view?name={{ issue.name}}">
+ <span class="indicator {{ "red" if issue.status=="Open" else "green" }}">
+ {% if issue.status == "Closed" %}
+ {{ issue.subject }} resolved {{ frappe.utils.pretty_date(issue.resolution_date) }}
+ {% else %}
+ {{ issue.subject }} raised on {{ issue.opening_date }}
+ {% endif %}
+ </span>
+ </a>
+ </div>
+ <div class='col-xs-3'>
+ <div class='pull-right'>
+ {% if issue.todo %}
+ <span class="avatar avatar-small" title="{{ issue.todo.owner }}"> <img src="{{ issue.todo.user_image }}"></span>
+ {% else %}
+ <span class="avatar avatar-small avatar-empty"></span>
+ {% endif %}
+ </div>
+ <div class='pull-right' style='padding-right:10px;'>
+ {% if issue.status != "Closed" %}
+ <span class="text-extra-muted "> <i class="octicon octicon-x issue-x" title="Close" id = "{{issue.name}}"></i> </span>
+ {% endif %}
+ </div>
+ </div>
+ </div>
+ </div>
+{% endfor %}
diff --git a/erpnext/templates/includes/projects/project_tasks.html b/erpnext/templates/includes/projects/project_tasks.html
new file mode 100644
index 0000000..b2be27b
--- /dev/null
+++ b/erpnext/templates/includes/projects/project_tasks.html
@@ -0,0 +1,30 @@
+{% for task in doc.tasks %}
+ <div class='task'>
+ <div class='row project-item'>
+ <div class='col-xs-9'>
+ <a class="no-decoration" href="/tasks-view?name={{ task.name}}">
+ <span class="indicator {{ "orange" if task.status=="Open" else "green" }}">
+ {% if task.status == "Closed" %}
+ {{ task.subject }} completed on {{ task.closing_date }}
+ {% else %}
+ {{ task.subject }}
+ {% endif %}
+ </span>
+ </a>
+ </div>
+ <div class='col-xs-3'>
+ <div class='pull-right'>
+ {% if task.todo %} <span class="avatar avatar-small" title="{{ task.todo.owner }}"> <img src="{{ task.todo.user_image }}"></span>
+ {% else %}
+ <span class="avatar avatar-small avatar-empty"></span>
+ {% endif %}
+ </div>
+ <div class='pull-right' style='padding-right:10px;'>
+ {% if task.status != "Closed" %}
+ <span class="text-extra-muted "> <i class="octicon octicon-x task-x" title="Close" id = "{{task.name}}"></i> </span>
+ {% endif %}
+ </div>
+ </div>
+ </div>
+ </div>
+{% endfor %}
\ No newline at end of file
diff --git a/erpnext/templates/includes/projects/project_timelogs.html b/erpnext/templates/includes/projects/project_timelogs.html
new file mode 100644
index 0000000..4934032
--- /dev/null
+++ b/erpnext/templates/includes/projects/project_timelogs.html
@@ -0,0 +1,20 @@
+{% for timelog in doc.timelogs %}
+<div class='timelog'>
+ <div class='row project-item'>
+ <div class='col-xs-9'>
+ <a class="no-decoration" href="/timelog_info?timelog={{ timelog.name}}">
+ <span class="indicator {{ "green" if timelog.status=="Draft" else "blue" if timelog.status=="Submitted" else "darkgrey"}}">
+
+ {{ timelog.title }}: From {{ frappe.format_date(timelog.from_time) }} to {{ frappe.format_date(timelog.to_time) }}
+
+</span>
+ </a>
+ </div>
+ <div class='col-xs-3'>
+ <div class='pull-right'>
+ <span class="avatar avatar-small" title="{{ timelog.modified_by }}"> <img src="{{ timelog.user_image }}"></span>
+ </div>
+ </div>
+ </div>
+</div>
+{% endfor %}
\ No newline at end of file
diff --git a/erpnext/templates/includes/projects/timeline.html b/erpnext/templates/includes/projects/timeline.html
new file mode 100644
index 0000000..605404b
--- /dev/null
+++ b/erpnext/templates/includes/projects/timeline.html
@@ -0,0 +1,17 @@
+{% for timeline in doc.timelines %}
+ <article class="timeline-entry">
+ <div class="timeline-entry-inner">
+ <div class="timeline-icon {{ "bg-danger" if ((timeline.reference_name).startswith('ISS') and (timeline.subject).startswith('Open')) else "bg-warning" if ((timeline.reference_name).startswith('TASK') and (timeline.subject).startswith('Open')) else "bg-success" if (timeline.subject).startswith('Closed') else "bg-info"}}">
+ </div>
+ <div class="timeline-label">
+ <span class="avatar avatar-small" title="{{ timeline.modified_by }}"> <img src="{{ timeline.user_image }}"></span>
+ <span class='indicator'>
+ {{timeline.reference_name}} {{timeline.subject }}
+ </span>
+ <span class='indicator pull-right'>
+ {{ frappe.utils.pretty_date(timeline.creation) }}
+ </span>
+ </div>
+ </div>
+ </article>
+{% endfor %}
\ No newline at end of file
diff --git a/erpnext/templates/pages/cart.html b/erpnext/templates/pages/cart.html
index 6891bce..f2104f9 100644
--- a/erpnext/templates/pages/cart.html
+++ b/erpnext/templates/pages/cart.html
@@ -61,6 +61,15 @@
</div>
<div id="cart-totals">
</div>
+ {% if doc.tc_name %}
+ <div class="cart-terms" style="display: none;" title={{doc.tc_name}}>
+ {{doc.tc_name}}
+ {{doc.terms}}
+ </div>
+ <div class="cart-link">
+ <a href="#" onclick="show_terms();return false;">*Terms and Conditions</a>
+ </div>
+ {% endif %}
<div class="cart-addresses">
{% include "templates/includes/cart/cart_address.html" %}
</div>
diff --git a/erpnext/templates/pages/cart_terms.html b/erpnext/templates/pages/cart_terms.html
new file mode 100644
index 0000000..521c583
--- /dev/null
+++ b/erpnext/templates/pages/cart_terms.html
@@ -0,0 +1,2 @@
+
+<div>{{doc.terms}}</div>
\ No newline at end of file
diff --git a/erpnext/templates/pages/order.html b/erpnext/templates/pages/order.html
index 03e625d..3252eb9 100644
--- a/erpnext/templates/pages/order.html
+++ b/erpnext/templates/pages/order.html
@@ -1,4 +1,4 @@
-t{% extends "templates/web.html" %}
+{% extends "templates/web.html" %}
{% block header %}
<h1>{{ doc.name }}</h1>
diff --git a/erpnext/templates/pages/projects.html b/erpnext/templates/pages/projects.html
new file mode 100644
index 0000000..c71cf2e
--- /dev/null
+++ b/erpnext/templates/pages/projects.html
@@ -0,0 +1,109 @@
+{% extends "templates/web.html" %}
+
+{% block title %}{{ doc.project_name }}{% endblock %}
+
+{% block breadcrumbs %}
+ <div class="page-breadcrumbs" data-html-block="breadcrumbs">
+ <ul class="breadcrumb">
+ <li>
+ <span class="icon icon-angle-left"></span>
+ <a href="/project">Projects</a>
+ </li>
+ </ul>
+ </div>
+{% endblock %}
+
+{% block header %}
+<h1 class= "title">
+{{ doc.project_name }}
+</h1>
+{% endblock %}
+
+{% block style %}
+<style>
+{% include "templates/includes/projects.css" %}
+</style>
+{% endblock %}
+
+
+{% block page_content %}
+
+{% include 'templates/includes/project_search_box.html' %}
+
+{% if frappe.form_dict.q %}
+ <p class="text-muted"> <a href="/projects?project={{doc.name}}" class="text-muted">
+ Filtered by "{{ frappe.form_dict.q }}" Clear</a></p>
+{% else %}
+ <h3>{{ _("Activity Feed") }}</h3>
+ <div class='project-timelines timeline-centered'>
+ {% include "erpnext/templates/includes/projects/timeline.html" %}
+ </div>
+ {% if doc.timelines|length > 9 %}
+ <p><a class='more-timelines small underline'>{{ _("More") }}</a><p>
+ {% endif %}
+{% endif %}
+
+{% if doc.tasks %}
+ <div class='project-tasks-section'>
+ <div>
+ <a class="btn btn-xs btn-primary pull-right"
+ href='/tasks?new=1&project={{ doc.project_name }}'>New</a>
+ <h3>{{ _("Tasks") }}</h3>
+ </div>
+ <div class="btn-group btn-toggle">
+ <button class="btn btn-xs btn-open-tasks" style="float:left;">Open</button>
+ <button class="btn btn-xs btn-closed-tasks">Close</button>
+ </div>
+ <div class='project-tasks'>
+ {% include "erpnext/templates/includes/projects/project_tasks.html" %}
+ </div>
+
+ {% if doc.tasks|length > 4 %}
+ <p><a id= 'more-tasks' class='more-tasks small underline'>{{ _("More") }}</a><p>
+ {% endif %}
+ </div>
+{% else %}
+ <p class="text-muted">No tasks</p>
+{% endif %}
+
+{% if doc.issues %}
+ <div class='project-issues-section'>
+ <div>
+ <a class="btn btn-xs btn-primary pull-right"
+ href='/issues?new=1&project={{ doc.project_name }}'>New</a>
+ <h3>{{ _("Issues") }}</h3>
+ </div>
+ <div class="btn-group btn-toggle">
+ <button class="btn btn-xs btn-open-issues" style="float:left;">Open</button>
+ <button class="btn btn-xs btn-closed-issues">Close</button>
+ </div>
+ <div class='project-issues'>
+ {% include "erpnext/templates/includes/projects/project_issues.html" %}
+ </div>
+
+ {% if doc.issues|length > 4 %}
+ <p><a id='more-issues' class='more-issues small underline'>{{ _("More") }}</a><p>
+ {% endif %}
+ </div>
+{% else %}
+ <p class="text-muted">No Issues</p>
+{% endif %}
+
+{% if doc.timelogs %}
+ <h3>{{ _("Time Logs") }}</h3>
+ <div class='project-timelogs'>
+ {% include "erpnext/templates/includes/projects/project_timelogs.html" %}
+ </div>
+ {% if doc.timelogs|length > 1 %}
+ <p><a class='more-timelogs small underline'>{{ _("More") }}</a><p>
+ {% endif %}
+{% else %}
+ <p class="text-muted">No time logs</p>
+{% endif %}
+</div>
+
+<script>
+ {% include "erpnext/templates/pages/projects.js" %}
+</script>
+
+{% endblock %}
\ No newline at end of file
diff --git a/erpnext/templates/pages/projects.js b/erpnext/templates/pages/projects.js
new file mode 100644
index 0000000..b1468eb
--- /dev/null
+++ b/erpnext/templates/pages/projects.js
@@ -0,0 +1,120 @@
+frappe.ready(function() {
+ $( window ).load(function() {
+ $(".btn-open-tasks").click();
+ $(".btn-open-issues").click();
+ });
+
+ $('.btn-closed-tasks').click(function() {
+ reload_items('closed','tasks');
+ });
+
+ $('.btn-open-tasks').click(function() {
+ reload_items('open','tasks');
+ });
+
+ $('.btn-closed-issues').click(function() {
+ reload_items('closed','issues');
+ });
+
+ $('.btn-open-issues').click(function() {
+ reload_items('open','issues');
+ });
+
+ var start = 10;
+ $(".more-tasks").click(function() {
+ more_items('tasks', true);
+ });
+
+ $(".more-issues").click(function() {
+ more_items('issues', true);
+ });
+
+ $(".more-timelogs").click(function() {
+ more_items('timelogs', false);
+ });
+
+ $(".more-timelines").click(function() {
+ more_items('timelines', false);
+ });
+
+ $( ".project-tasks" ).on('click', '.task-x', function() {
+ var item_name = $(this).attr('id');
+ close_item('task', item_name);
+ });
+
+ $( ".project-issues" ).on('click', '.issue-x', function() {
+ var item_name = $(this).attr('id');
+ close_item('issue', item_name);
+ });
+
+ var reload_items = function(item_status, item) {
+ $.ajax({
+ method: "GET",
+ url: "/",
+ dataType: "json",
+ data: {
+ cmd: "erpnext.templates.pages.projects.get_"+ item +"_html",
+ project: '{{ doc.name }}',
+ item_status: item_status,
+ },
+ dataType: "json",
+ success: function(data) {
+ $('.project-'+ item).html(data.message);
+
+ $('.project-'+ item +'-section .btn-group .btn-primary').removeClass('btn-primary');
+ $('.btn-'+ item_status +'-'+ item).addClass( "btn-primary" );
+ $(".more-"+ item).toggle(true);
+ }
+ });
+
+ }
+
+ var more_items = function(item, item_status){
+ if(item_status)
+ {
+ var item_status = $('.project-'+ item +'-section .btn-group .btn-primary').hasClass('btn-closed-'+ item)
+ ? 'closed' : 'open';
+ }
+ $.ajax({
+ method: "GET",
+ url: "/",
+ dataType: "json",
+ data: {
+ cmd: "erpnext.templates.pages.projects.get_"+ item +"_html",
+ project: '{{ doc.name }}',
+ start: start,
+ item_status: item_status,
+ },
+ dataType: "json",
+ success: function(data) {
+ $(data.message).appendTo('.project-'+ item);
+ if(typeof data.message == 'undefined') {
+ $(".more-"+ item).toggle(false);
+ }
+ start = start+10;
+ }
+ });
+ }
+
+ var close_item = function(item, item_name){
+ var args = {
+ project: '{{ doc.name }}',
+ item_name: item_name,
+ }
+ frappe.call({
+ btn: this,
+ type: "POST",
+ method: "erpnext.templates.pages.projects.set_"+ item +"_status",
+ args: args,
+ callback: function(r) {
+ if(r.exc) {
+ if(r._server_messages)
+ frappe.msgprint(r._server_messages);
+ } else {
+ $(this).remove();
+ }
+ }
+ })
+ return false;
+ }
+});
diff --git a/erpnext/templates/pages/projects.py b/erpnext/templates/pages/projects.py
new file mode 100644
index 0000000..758113f
--- /dev/null
+++ b/erpnext/templates/pages/projects.py
@@ -0,0 +1,142 @@
+# 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 frappe import _
+
+def get_context(context):
+ context.no_cache = 1
+
+ project = frappe.get_doc('Project', frappe.form_dict.project)
+
+ project.has_permission('read')
+
+ context.issues = frappe.get_all('Issue', filters={'project': project.project_name},
+ fields=['subject', 'opening_date', 'resolution_date', 'status', 'name', 'resolution_details','modified','modified_by'])
+
+ project.tasks = get_tasks(project.name, start=0, search=frappe.form_dict.get("q"))
+
+ project.timelogs = get_timelogs(project.name, start=0, search=frappe.form_dict.get("q"))
+
+ project.issues = get_issues(project.name, start=0, search=frappe.form_dict.get("q"))
+
+ project.timelines = get_timeline(project.project_name, start=0)
+
+
+
+ context.doc = project
+
+
+def get_timeline(project, start=10):
+ issue_names = '({0})'.format(", ".join(["'{0}'".format(i.name) for i in get_issues(project)]))
+
+
+ timelines = frappe.db.sql("""
+ select
+ sender_full_name,
+ subject, communication_date, comment_type, name, creation, modified_by, reference_doctype, reference_name,
+ _liked_by, comment_type, _comments
+ from
+ tabCommunication
+ where
+ (reference_doctype='Project' and reference_name=%s)
+ or (timeline_doctype='Project' and timeline_name=%s)
+ or (reference_doctype='Issue' and reference_name IN {issue_names})
+ order by
+ modified DESC limit {start}, {limit}""".format(
+ issue_names=issue_names, start=start, limit=10),
+ (project, project), as_dict=True);
+ for timeline in timelines:
+ timeline.user_image = frappe.db.get_value('User', timeline.modified_by, 'user_image')
+ return timelines
+
+@frappe.whitelist()
+def get_timelines_html(project, start=0):
+ return frappe.render_template("erpnext/templates/includes/projects/timeline.html",
+ {"doc": {"timelines": get_timeline(project, start)}}, is_path=True)
+
+def get_issue_list(project):
+ return [issue.name for issue in get_issues(project)]
+
+def get_tasks(project, start=0, search=None, item_status=None):
+ filters = {"project": project}
+ if search:
+ filters["subject"] = ("like", "%{0}%".format(search))
+ if item_status:
+ filters = {"status": item_status}
+ tasks = frappe.get_all("Task", filters=filters,
+ fields=["name", "subject", "status", "exp_start_date", "exp_end_date", "priority"],
+ limit_start=start, limit_page_length=10)
+
+ for task in tasks:
+ task.todo = frappe.get_all('ToDo',filters={'reference_name':task.name, 'reference_type':'Task'},
+ fields=["assigned_by", "owner", "modified", "modified_by"])
+ if task.todo:
+ task.todo=task.todo[0]
+ task.todo.user_image = frappe.db.get_value('User', task.todo.owner, 'user_image')
+
+ return tasks
+
+@frappe.whitelist()
+def get_tasks_html(project, start=0, item_status=None):
+ return frappe.render_template("erpnext/templates/includes/projects/project_tasks.html",
+ {"doc": {"tasks": get_tasks(project, start, item_status=item_status)}}, is_path=True)
+
+
+def get_issues(project, start=0, search=None, item_status=None):
+ filters = {"project": project}
+ if search:
+ filters["subject"] = ("like", "%{0}%".format(search))
+ if item_status:
+ filters = {"status": item_status}
+ issues = frappe.get_all("Issue", filters=filters,
+ fields=["name", "subject", "status", "opening_date", "resolution_date", "resolution_details"],
+ order_by='modified desc',
+ limit_start=start, limit_page_length=10)
+
+ for issue in issues:
+ issue.todo = frappe.get_all('ToDo',filters={'reference_name':issue.name, 'reference_type':'Issue'},
+ fields=["assigned_by", "owner", "modified", "modified_by"])
+ if issue.todo:
+ issue.todo=issue.todo[0]
+ issue.todo.user_image = frappe.db.get_value('User', issue.todo.owner, 'user_image')
+
+ return issues
+
+@frappe.whitelist()
+def get_issues_html(project, start=0, item_status=None):
+ return frappe.render_template("erpnext/templates/includes/projects/project_issues.html",
+ {"doc": {"issues": get_issues(project, start, item_status=item_status)}}, is_path=True)
+
+def get_timelogs(project, start=0, search=None):
+ filters = {"project": project}
+ if search:
+ filters["title"] = ("like", "%{0}%".format(search))
+
+ timelogs = frappe.get_all('Time Log', filters=filters,
+ fields=['name','title','task','activity_type','from_time','to_time','hours','status','modified','modified_by'],
+ limit_start=start, limit_page_length=10)
+ for timelog in timelogs:
+ timelog.user_image = frappe.db.get_value('User', timelog.modified_by, 'user_image')
+ return timelogs
+
+@frappe.whitelist()
+def get_timelogs_html(project, start=0):
+ return frappe.render_template("erpnext/templates/includes/projects/project_timelogs.html",
+ {"doc": {"timelogs": get_timelogs(project, start)}}, is_path=True)
+
+@frappe.whitelist()
+def set_task_status(project, item_name):
+ task = frappe.get_doc("Task", item_name)
+ task.status = 'Closed'
+ task.save(ignore_permissions=True)
+
+@frappe.whitelist()
+def set_issue_status(project, item_name):
+ issue = frappe.get_doc("Issue", item_name)
+ issue.status = 'Closed'
+ issue.save(ignore_permissions=True)
+
+
\ No newline at end of file
diff --git a/erpnext/templates/pages/task_info.html b/erpnext/templates/pages/task_info.html
new file mode 100644
index 0000000..c756cd5
--- /dev/null
+++ b/erpnext/templates/pages/task_info.html
@@ -0,0 +1,149 @@
+{% extends "templates/web.html" %}
+{% block title %} {{ doc.name }} {% endblock %}
+{% block breadcrumbs %}
+<div class="page-breadcrumbs" data-html-block="breadcrumbs">
+ <ul class="breadcrumb">
+ <li>
+ <span class="icon icon-angle-left"></span>
+ <a href="/projects?project={{ doc.project }}">{{ doc.project }}</a>
+ </li>
+ </ul>
+</div>
+{% endblock %}
+{% block page_content %}
+<div class="row">
+ <div class=" col-sm-8 ">
+ <h1> {{ doc.subject }} </h1>
+ </div>
+
+ <div class="col-sm-4">
+ <div class="page-header-actions-block" data-html-block="header-actions">
+ <button type="submit" class="btn btn-primary btn-sm btn-form-submit">
+ Update</button>
+ <a href="tasks" class="btn btn-default btn-sm">
+ Cancel</a>
+ </div>
+ </div>
+</div>
+
+<div class="page-content-block">
+ <form role="form" data-web-form="tasks">
+
+ <input type="hidden" name="web_form" value="tasks">
+ <input type="hidden" name="doctype" value="Task">
+ <input type="hidden" name="name" value="TASK00056">
+
+ <div class="row">
+ <div class="col-sm-12" style="max-width: 500px;">
+ <div class="form-group">
+ <label for="project" class="control-label text-muted small">Project</label>
+ <input type="text" class="form-control" name="project" readonly value= "{{ doc.project }}">
+ </div>
+
+ <div class="form-group">
+ <label for="subject" class="control-label text-muted small">Subject</label>
+ <input type="text" class="form-control" name="subject" readonly value="{{ doc.subject }}">
+ </div>
+
+ <div class="form-group">
+ <label for="description" class="control-label text-muted small">Details</label>
+ <textarea class="form-control" style="height: 200px;" name="description">{{ doc.description }}</textarea>
+ </div>
+
+ <div class="form-group">
+ <label for="priority" class="control-label text-muted small">Priority</label>
+ <input type="text" class="form-control" name="priority" readonly value="{{ doc.priority }}">
+ </div>
+
+ <div class="form-group">
+ <label for="exp_start_date" class="control-label text-muted small">Expected Start Date</label>
+ <input type="text" class="form-control hasDatepicker" name="exp_start_date" readonly value="{{ doc.exp_start_date }}">
+ </div>
+
+ <div class="form-group">
+ <label for="exp_end_date" class="control-label text-muted small">Expected End Date</label>
+ <input type="text" class="form-control hasDatepicker" name="exp_end_date" readonly value="{{ doc.exp_end_date }}">
+ </div>
+
+ <div class="form-group">
+ <label for="status" class="control-label text-muted small">Status</label>
+ <select class="form-control" name="status" id="status" data-label="Status" data-fieldtype="Select">
+ <option value="Open" selected="selected">
+ Open</option><option value="Working">
+ Working</option><option value="Pending Review">
+ Pending Review</option><option value="Overdue">
+ Overdue</option><option value="Closed">
+ Closed</option><option value="Cancelled">
+ Cancelled</option>
+ </select>
+ </div>
+ </div>
+ </div>
+ </form>
+</div>
+
+<div class="comments">
+ <h3>Comments</h3>
+ <div class="no-comment">
+ {% for comment in comments %}
+ <p class="text-muted">{{comment.sender_full_name}} : {{comment.subject}} on {{comment.communication_date.strftime('%Y-%m-%d')}}</p>
+ {% endfor %}
+ </div>
+ <div class="comment-form-wrapper">
+ <a class="add-comment btn btn-default btn-sm">Add Comment</a>
+ <div style="display: none;" id="comment-form">
+ <p>Add Comment</p>
+ <form>
+ <fieldset>
+ <textarea class="form-control" name="comment" rows="5" placeholder="Comment"></textarea>
+ <p>
+ <button class="btn btn-primary btn-sm" id="submit-comment">Submit</button>
+ </p>
+ </fieldset>
+ </form>
+ </div>
+ </div>
+</div>
+ <script>
+ frappe.ready(function() {
+ var n_comments = $(".comment-row").length;
+ $(".add-comment").click(function() {
+ $(this).toggle(false);
+ $("#comment-form").toggle();
+ $("#comment-form textarea").val("");
+ })
+ $("#submit-comment").click(function() {
+ var args = {
+ comment_by_fullname: "test",
+ comment_by: "admin@localhost.com",
+ comment: $("[name='comment']").val(),
+ reference_doctype: "Task",
+ reference_name: "TASK00069",
+ comment_type: "Comment",
+ page_name: "tasks",
+ }
+
+ frappe.call({
+ btn: this,
+ type: "POST",
+ method: "frappe.templates.includes.comments.comments.add_comment",
+ args: args,
+ callback: function(r) {
+ if(r.exc) {
+ if(r._server_messages)
+ frappe.msgprint(r._server_messages);
+ } else {
+ $(r.message).appendTo("#comment-list");
+ $(".no-comment, .add-comment").toggle(false);
+ $("#comment-form")
+ .replaceWith('<div class="text-muted">Thank you for your comment!</div>')
+ }
+ }
+ })
+
+ return false;
+ })
+ });
+ </script>
+
+{% endblock %}
\ No newline at end of file
diff --git a/erpnext/templates/pages/task_info.py b/erpnext/templates/pages/task_info.py
new file mode 100644
index 0000000..b832b88
--- /dev/null
+++ b/erpnext/templates/pages/task_info.py
@@ -0,0 +1,14 @@
+from __future__ import unicode_literals
+import frappe
+
+from frappe import _
+
+def get_context(context):
+ context.no_cache = 1
+
+ task = frappe.get_doc('Task', frappe.form_dict.task)
+
+ context.comments = frappe.get_all('Communication', filters={'reference_name': task.name, 'comment_type': 'comment'},
+ fields=['subject', 'sender_full_name', 'communication_date'])
+
+ context.doc = task
\ No newline at end of file
diff --git a/erpnext/templates/pages/timelog_info.html b/erpnext/templates/pages/timelog_info.html
new file mode 100644
index 0000000..76dbc32
--- /dev/null
+++ b/erpnext/templates/pages/timelog_info.html
@@ -0,0 +1,48 @@
+{% extends "templates/web.html" %}
+{% block title %} {{ doc.name }} {% endblock %}
+{% block breadcrumbs %}
+<div class="page-breadcrumbs" data-html-block="breadcrumbs">
+ <ul class="breadcrumb">
+ <li>
+ <span class="icon icon-angle-left"></span>
+ <a href="/projects?project={{ doc.project }}">{{ doc.project }}</a>
+ </li>
+</ul>
+</div>
+{% endblock %}
+
+{% block page_content %}
+ <div class=" col-sm-8 ">
+ <h1> {{ doc.name }} </h1>
+ </div>
+
+ <div class="page-content-block">
+ <div class="row">
+ <div class="col-sm-12" style="max-width: 500px;">
+ <label for="project" class="control-label text-muted small">Project</label>
+ <input type="text" class="form-control" name="project" readonly value= "{{ doc.project }}">
+
+ <label for="activity_type" class="control-label text-muted small">Activity Type</label>
+ <input type="text" class="form-control" name="activity_type" readonly value= "{{ doc.activity_type }}">
+
+ <label for="task" class="control-label text-muted small">Task</label>
+ <input type="text" class="form-control" name="task" readonly value= "{{ doc.task }}">
+
+ <label for="from_time" class="control-label text-muted small">From Time</label>
+ <input type="text" class="form-control" name="from_time" readonly value= "{{ doc.from_time }}">
+
+ <label for="to_time" class="control-label text-muted small">To Time</label>
+ <input type="text" class="form-control" name="to_time" readonly value= "{{ doc.to_time }}">
+
+ <label for="to_time" class="control-label text-muted small">Hours</label>
+ <input type="text" class="form-control" name="Hours" readonly value= "{{ doc.hours }}">
+
+ <label for="status" class="control-label text-muted small">Status</label>
+ <input type="text" class="form-control" name="status" readonly value= "{{ doc.status }}">
+
+ <label for="Note" class="control-label text-muted small">Note</label>
+ <textarea class="form-control" name="Hours" readonly> {{ doc.note }} </textarea>
+ </div>
+ </div>
+ </div>
+{% endblock %}
\ No newline at end of file
diff --git a/erpnext/templates/pages/timelog_info.py b/erpnext/templates/pages/timelog_info.py
new file mode 100644
index 0000000..7a3361c
--- /dev/null
+++ b/erpnext/templates/pages/timelog_info.py
@@ -0,0 +1,11 @@
+from __future__ import unicode_literals
+import frappe
+
+from frappe import _
+
+def get_context(context):
+ context.no_cache = 1
+
+ timelog = frappe.get_doc('Time Log', frappe.form_dict.timelog)
+
+ context.doc = timelog
\ No newline at end of file