Merge branch 'v5.0' of https://github.com/frappe/erpnext into foreign_currency_calc

This commit is contained in:
Nabin Hait 2015-02-11 12:55:10 +05:30
commit 7945712171
257 changed files with 9926 additions and 5998 deletions

View File

@ -28,4 +28,4 @@ before_script:
- mysql -e 'create database test_frappe' - mysql -e 'create database test_frappe'
- echo "USE mysql;\nCREATE USER 'test_frappe'@'localhost' IDENTIFIED BY 'test_frappe';\nFLUSH PRIVILEGES;\n" | mysql -u root -ptravis - echo "USE mysql;\nCREATE USER 'test_frappe'@'localhost' IDENTIFIED BY 'test_frappe';\nFLUSH PRIVILEGES;\n" | mysql -u root -ptravis
- echo "USE mysql;\nGRANT ALL PRIVILEGES ON \`test_frappe\`.* TO 'test_frappe'@'localhost';\n" | mysql -u root -ptravis - echo "USE mysql;\nGRANT ALL PRIVILEGES ON \`test_frappe\`.* TO 'test_frappe'@'localhost';\n" | mysql -u root -ptravis

View File

@ -1,5 +1,7 @@
# ERPNext - Open source ERP for small and medium-size business [![Build Status](https://travis-ci.org/frappe/erpnext.png)](https://travis-ci.org/frappe/erpnext) # ERPNext - Open source ERP for small and medium-size business [![Build Status](https://travis-ci.org/frappe/erpnext.png)](https://travis-ci.org/frappe/erpnext)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/frappe/erpnext?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[https://erpnext.com](https://erpnext.com) [https://erpnext.com](https://erpnext.com)
Includes: Accounting, Inventory, CRM, Sales, Purchase, Projects, HRMS. Requires MariaDB. Includes: Accounting, Inventory, CRM, Sales, Purchase, Projects, HRMS. Requires MariaDB.

View File

@ -177,7 +177,7 @@
"icon": "icon-money", "icon": "icon-money",
"idx": 1, "idx": 1,
"in_create": 0, "in_create": 0,
"modified": "2015-01-05 11:03:07.861934", "modified": "2015-02-05 05:11:34.054236",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Account", "name": "Account",
@ -196,6 +196,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Accounts User", "role": "Accounts User",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
}, },
@ -255,6 +256,7 @@
"report": 1, "report": 1,
"role": "Accounts Manager", "role": "Accounts Manager",
"set_user_permissions": 1, "set_user_permissions": 1,
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
} }

View File

@ -40,7 +40,7 @@ def create_charts(chart_name, company):
}) })
if root_account: if root_account:
account.ignore_mandatory = True account.flags.ignore_mandatory = True
account.insert() account.insert()

View File

@ -43,7 +43,7 @@
"icon": "icon-cog", "icon": "icon-cog",
"idx": 1, "idx": 1,
"issingle": 1, "issingle": 1,
"modified": "2014-09-29 15:42:18.976866", "modified": "2015-02-05 05:11:34.163902",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Accounts Settings", "name": "Accounts Settings",
@ -56,6 +56,7 @@
"print": 1, "print": 1,
"read": 1, "read": 1,
"role": "Accounts Manager", "role": "Accounts Manager",
"share": 1,
"write": 1 "write": 1
} }
] ]

View File

@ -85,7 +85,7 @@
"icon": "icon-check", "icon": "icon-check",
"idx": 1, "idx": 1,
"issingle": 1, "issingle": 1,
"modified": "2015-01-19 07:49:15.830001", "modified": "2015-02-05 05:11:34.776660",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Bank Reconciliation", "name": "Bank Reconciliation",
@ -100,6 +100,7 @@
"read": 1, "read": 1,
"report": 0, "report": 0,
"role": "Accounts User", "role": "Accounts User",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
} }

View File

@ -139,7 +139,7 @@
"idx": 1, "idx": 1,
"is_submittable": 1, "is_submittable": 1,
"max_attachments": 3, "max_attachments": 3,
"modified": "2014-12-24 15:20:08.627169", "modified": "2015-02-05 05:11:35.427357",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "C-Form", "name": "C-Form",
@ -154,6 +154,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Accounts User", "role": "Accounts User",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
}, },
@ -165,6 +166,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Accounts Manager", "role": "Accounts Manager",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
}, },

View File

@ -79,7 +79,7 @@
"permlevel": 0 "permlevel": 0
}, },
{ {
"description": "Select Budget Distribution, if you want to track based on seasonality.", "description": "Select Monthly Distribution, if you want to track based on seasonality.",
"fieldname": "distribution_id", "fieldname": "distribution_id",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Distribution Id", "label": "Distribution Id",
@ -145,7 +145,7 @@
"icon": "icon-money", "icon": "icon-money",
"idx": 1, "idx": 1,
"in_create": 0, "in_create": 0,
"modified": "2014-12-25 15:35:09.968578", "modified": "2015-02-05 05:11:36.155435",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Cost Center", "name": "Cost Center",
@ -161,6 +161,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Accounts Manager", "role": "Accounts Manager",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
}, },

View File

@ -49,7 +49,7 @@
], ],
"icon": "icon-calendar", "icon": "icon-calendar",
"idx": 1, "idx": 1,
"modified": "2014-12-24 14:50:49.742088", "modified": "2015-02-05 05:11:38.994147",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Fiscal Year", "name": "Fiscal Year",
@ -64,6 +64,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "System Manager", "role": "System Manager",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
}, },

View File

@ -457,7 +457,7 @@
"icon": "icon-file-text", "icon": "icon-file-text",
"idx": 1, "idx": 1,
"is_submittable": 1, "is_submittable": 1,
"modified": "2015-01-07 18:06:21.042991", "modified": "2015-02-05 05:11:40.139467",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Journal Entry", "name": "Journal Entry",
@ -475,6 +475,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Accounts User", "role": "Accounts User",
"share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
}, },
@ -489,6 +490,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Accounts Manager", "role": "Accounts Manager",
"share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
}, },

View File

@ -29,7 +29,7 @@
], ],
"icon": "icon-credit-card", "icon": "icon-credit-card",
"idx": 1, "idx": 1,
"modified": "2015-01-06 17:21:12.485997", "modified": "2015-02-05 05:11:41.346436",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Mode of Payment", "name": "Mode of Payment",
@ -43,6 +43,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Accounts Manager", "role": "Accounts Manager",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
}, },

View File

@ -1,12 +1,12 @@
{ {
"autoname": "field:distribution_id", "autoname": "field:distribution_id",
"creation": "2013-01-10 16:34:05", "creation": "2013-01-10 16:34:05",
"description": "**Budget Distribution** helps you distribute your budget across months if you have seasonality in your business.\n\nTo distribute a budget using this distribution, set this **Budget Distribution** in the **Cost Center**", "description": "**Monthly Distribution** helps you distribute your budget across months if you have seasonality in your business.\n\nTo distribute a budget using this distribution, set this **Monthly Distribution** in the **Cost Center**",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"fields": [ "fields": [
{ {
"description": "Name of the Budget Distribution", "description": "Name of the Monthly Distribution",
"fieldname": "distribution_id", "fieldname": "distribution_id",
"fieldtype": "Data", "fieldtype": "Data",
"in_list_view": 1, "in_list_view": 1,
@ -40,7 +40,7 @@
], ],
"icon": "icon-bar-chart", "icon": "icon-bar-chart",
"idx": 1, "idx": 1,
"modified": "2014-12-25 15:45:04.729489", "modified": "2015-02-05 05:11:41.429491",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Monthly Distribution", "name": "Monthly Distribution",
@ -58,6 +58,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Accounts Manager", "role": "Accounts Manager",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
}, },

View File

@ -1,8 +1,8 @@
[{ [{
"doctype": "Budget Distribution", "doctype": "Monthly Distribution",
"distribution_id": "_Test Distribution", "distribution_id": "_Test Distribution",
"fiscal_year": "_Test Fiscal Year 2013", "fiscal_year": "_Test Fiscal Year 2013",
"budget_distribution_details": [ "percentages": [
{ {
"month": "January", "month": "January",
"percentage_allocation": "8" "percentage_allocation": "8"

View File

@ -132,7 +132,7 @@
"hide_toolbar": 1, "hide_toolbar": 1,
"icon": "icon-resize-horizontal", "icon": "icon-resize-horizontal",
"issingle": 1, "issingle": 1,
"modified": "2014-12-24 14:49:48.714639", "modified": "2015-02-05 05:11:42.105088",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Payment Reconciliation", "name": "Payment Reconciliation",
@ -146,6 +146,7 @@
"permlevel": 0, "permlevel": 0,
"read": 1, "read": 1,
"role": "Accounts Manager", "role": "Accounts Manager",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
}, },
@ -156,6 +157,7 @@
"permlevel": 0, "permlevel": 0,
"read": 1, "read": 1,
"role": "Accounts User", "role": "Accounts User",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
} }

View File

@ -1,361 +1,363 @@
{ {
"allow_copy": 0, "allow_copy": 0,
"allow_import": 0, "allow_import": 0,
"allow_rename": 0, "allow_rename": 0,
"creation": "2014-07-23 15:12:27.746665", "creation": "2014-07-23 15:12:27.746665",
"custom": 0, "custom": 0,
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"document_type": "", "document_type": "",
"fields": [ "fields": [
{ {
"fieldname": "sec_break1", "fieldname": "sec_break1",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Party Details", "label": "Party Details",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "company", "fieldname": "company",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Company", "label": "Company",
"options": "Company", "options": "Company",
"permlevel": 0, "permlevel": 0,
"reqd": 1 "reqd": 1
}, },
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"default": "Customer", "default": "Customer",
"fieldname": "party_type", "fieldname": "party_type",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 1,
"label": "Party Type", "label": "Party Type",
"no_copy": 0, "no_copy": 0,
"options": "DocType", "options": "DocType",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 1, "reqd": 1,
"search_index": 0, "search_index": 0,
"set_only_once": 0 "set_only_once": 0
}, },
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"depends_on": "", "depends_on": "",
"fieldname": "party", "fieldname": "party",
"fieldtype": "Dynamic Link", "fieldtype": "Dynamic Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 1,
"label": "Party", "label": "Party",
"no_copy": 0, "no_copy": 0,
"options": "party_type", "options": "party_type",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 1, "reqd": 1,
"search_index": 0, "search_index": 0,
"set_only_once": 0 "set_only_once": 0
}, },
{ {
"fieldname": "party_account", "fieldname": "party_account",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"label": "Party Account", "label": "Party Account",
"no_copy": 1, "no_copy": 1,
"options": "Account", "options": "Account",
"permlevel": 0, "permlevel": 0,
"read_only": 0 "read_only": 0
}, },
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"fieldname": "received_or_paid", "fieldname": "received_or_paid",
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 1,
"label": "Received Or Paid", "label": "Received Or Paid",
"no_copy": 0, "no_copy": 0,
"options": "Received\nPaid", "options": "Received\nPaid",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 1, "reqd": 1,
"search_index": 0, "search_index": 0,
"set_only_once": 0 "set_only_once": 0
}, },
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"fieldname": "get_outstanding_vouchers", "fieldname": "get_outstanding_vouchers",
"fieldtype": "Button", "fieldtype": "Button",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Get Outstanding Vouchers", "label": "Get Outstanding Vouchers",
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
"set_only_once": 0 "set_only_once": 0
}, },
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"fieldname": "col_break1", "fieldname": "col_break1",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Column Break 1", "label": "Column Break 1",
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
"set_only_once": 0 "set_only_once": 0
}, },
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"fieldname": "payment_mode", "fieldname": "payment_mode",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Payment Mode", "label": "Payment Mode",
"no_copy": 0, "no_copy": 0,
"options": "Mode of Payment", "options": "Mode of Payment",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
"set_only_once": 0 "set_only_once": 0
}, },
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"fieldname": "payment_account", "fieldname": "payment_account",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Payment Account", "label": "Payment Account",
"no_copy": 0, "no_copy": 0,
"options": "Account", "options": "Account",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
"set_only_once": 0 "set_only_once": 0
}, },
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"fieldname": "reference_no", "fieldname": "reference_no",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Reference No", "label": "Reference No",
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
"set_only_once": 0 "set_only_once": 0
}, },
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"fieldname": "reference_date", "fieldname": "reference_date",
"fieldtype": "Date", "fieldtype": "Date",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Reference Date", "label": "Reference Date",
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
"set_only_once": 0 "set_only_once": 0
}, },
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"depends_on": "eval:(doc.company && doc.party_type && doc.received_or_paid && (doc.customer || doc.supplier))", "depends_on": "eval:(doc.company && doc.party_type && doc.received_or_paid && (doc.customer || doc.supplier))",
"fieldname": "sec_break3", "fieldname": "sec_break3",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Against Voucher", "label": "Against Voucher",
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
"set_only_once": 0 "set_only_once": 0
}, },
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"fieldname": "vouchers", "fieldname": "vouchers",
"fieldtype": "Table", "fieldtype": "Table",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Against Vouchers", "label": "Against Vouchers",
"no_copy": 0, "no_copy": 0,
"options": "Payment Tool Detail", "options": "Payment Tool Detail",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
"set_only_once": 0 "set_only_once": 0
}, },
{ {
"depends_on": "eval:(doc.company && doc.party_type && doc.received_or_paid && (doc.customer || doc.supplier))", "depends_on": "eval:(doc.company && doc.party_type && doc.received_or_paid && (doc.customer || doc.supplier))",
"fieldname": "section_break_19", "fieldname": "section_break_19",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"permlevel": 0, "permlevel": 0,
"precision": "" "precision": ""
}, },
{ {
"fieldname": "total_payment_amount", "fieldname": "total_payment_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Total Payment Amount", "label": "Total Payment Amount",
"permlevel": 0, "permlevel": 0,
"read_only": 1 "read_only": 1
}, },
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"fieldname": "make_journal_entry", "fieldname": "make_journal_entry",
"fieldtype": "Button", "fieldtype": "Button",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Make Journal Entry", "label": "Make Journal Entry",
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
"set_only_once": 0 "set_only_once": 0
}, },
{ {
"fieldname": "data_22", "fieldname": "data_22",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"permlevel": 0, "permlevel": 0,
"precision": "" "precision": ""
}, },
{ {
"depends_on": "eval:(doc.company && doc.party_type && doc.received_or_paid && (doc.customer || doc.supplier))", "depends_on": "eval:(doc.company && doc.party_type && doc.received_or_paid && (doc.customer || doc.supplier))",
"fieldname": "section_break_21", "fieldname": "section_break_21",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"permlevel": 0, "permlevel": 0,
"precision": "" "precision": ""
}, },
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"fieldname": "make_jv_help", "fieldname": "make_jv_help",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"read_only": 1, "read_only": 1,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
"set_only_once": 0 "set_only_once": 0
} }
], ],
"hide_heading": 0, "hide_heading": 0,
"hide_toolbar": 1, "hide_toolbar": 1,
"icon": "icon-magic", "icon": "icon-magic",
"in_create": 0, "in_create": 0,
"in_dialog": 0, "in_dialog": 0,
"is_submittable": 0, "is_submittable": 0,
"issingle": 1, "issingle": 1,
"istable": 0, "istable": 0,
"modified": "2014-12-26 16:28:30.612640", "modified": "2015-02-05 05:11:42.181439",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Payment Tool", "name": "Payment Tool",
"name_case": "", "name_case": "",
"owner": "Administrator", "owner": "Administrator",
"permissions": [ "permissions": [
{ {
"amend": 0, "amend": 0,
"apply_user_permissions": 0, "apply_user_permissions": 0,
"cancel": 0, "cancel": 0,
"create": 1, "create": 1,
"delete": 0, "delete": 0,
"email": 0, "email": 0,
"export": 0, "export": 0,
"import": 0, "import": 0,
"permlevel": 0, "permlevel": 0,
"print": 0, "print": 0,
"read": 1, "read": 1,
"report": 0, "report": 0,
"role": "Accounts Manager", "role": "Accounts Manager",
"set_user_permissions": 0, "set_user_permissions": 0,
"submit": 0, "share": 1,
"submit": 0,
"write": 1 "write": 1
}, },
{ {
"amend": 0, "amend": 0,
"apply_user_permissions": 0, "apply_user_permissions": 0,
"cancel": 0, "cancel": 0,
"create": 1, "create": 1,
"delete": 0, "delete": 0,
"email": 0, "email": 0,
"export": 0, "export": 0,
"import": 0, "import": 0,
"permlevel": 0, "permlevel": 0,
"print": 0, "print": 0,
"read": 1, "read": 1,
"report": 0, "report": 0,
"role": "Accounts User", "role": "Accounts User",
"set_user_permissions": 0, "set_user_permissions": 0,
"submit": 0, "share": 1,
"submit": 0,
"write": 1 "write": 1
} }
], ],
"read_only": 0, "read_only": 0,
"read_only_onload": 0, "read_only_onload": 0,
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC" "sort_order": "DESC"
} }

View File

@ -103,7 +103,7 @@
"icon": "icon-file-text", "icon": "icon-file-text",
"idx": 1, "idx": 1,
"is_submittable": 1, "is_submittable": 1,
"modified": "2015-01-05 11:27:11.937653", "modified": "2015-02-05 05:11:42.268561",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Period Closing Voucher", "name": "Period Closing Voucher",
@ -120,6 +120,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "System Manager", "role": "System Manager",
"share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
}, },
@ -134,6 +135,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Accounts Manager", "role": "Accounts Manager",
"share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
} }

View File

@ -226,7 +226,7 @@
], ],
"icon": "icon-cog", "icon": "icon-cog",
"idx": 1, "idx": 1,
"modified": "2015-01-15 15:27:41.530538", "modified": "2015-02-05 05:11:42.344180",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "POS Setting", "name": "POS Setting",
@ -241,6 +241,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Accounts Manager", "role": "Accounts Manager",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
}, },

View File

@ -244,7 +244,7 @@
"icon": "icon-gift", "icon": "icon-gift",
"idx": 1, "idx": 1,
"istable": 0, "istable": 0,
"modified": "2015-01-05 10:58:42.550092", "modified": "2015-02-05 05:11:42.530822",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Pricing Rule", "name": "Pricing Rule",
@ -259,6 +259,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Accounts Manager", "role": "Accounts Manager",
"share": 1,
"write": 1 "write": 1
}, },
{ {
@ -271,6 +272,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Sales Manager", "role": "Sales Manager",
"share": 1,
"write": 1 "write": 1
}, },
{ {
@ -280,6 +282,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Purchase Manager", "role": "Purchase Manager",
"share": 1,
"write": 1 "write": 1
}, },
{ {
@ -289,6 +292,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Website Manager", "role": "Website Manager",
"share": 1,
"write": 1 "write": 1
}, },
{ {
@ -300,6 +304,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "System Manager", "role": "System Manager",
"share": 1,
"write": 1 "write": 1
} }
], ],

View File

@ -880,7 +880,7 @@
"icon": "icon-file-text", "icon": "icon-file-text",
"idx": 1, "idx": 1,
"is_submittable": 1, "is_submittable": 1,
"modified": "2015-01-15 07:34:54.049667", "modified": "2015-02-05 05:11:43.312905",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Purchase Invoice", "name": "Purchase Invoice",
@ -898,6 +898,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Accounts User", "role": "Accounts User",
"share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
}, },
@ -942,6 +943,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Accounts Manager", "role": "Accounts Manager",
"share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
}, },

View File

@ -393,7 +393,7 @@ def get_expense_account(doctype, txt, searchfield, start, page_len, filters):
# Hence the first condition is an "OR" # Hence the first condition is an "OR"
return frappe.db.sql("""select tabAccount.name from `tabAccount` return frappe.db.sql("""select tabAccount.name from `tabAccount`
where (tabAccount.report_type = "Profit and Loss" where (tabAccount.report_type = "Profit and Loss"
or tabAccount.account_type = "Expense Account") or tabAccount.account_type in ("Expense Account", "Fixed Asset"))
and tabAccount.group_or_ledger="Ledger" and tabAccount.group_or_ledger="Ledger"
and tabAccount.docstatus!=2 and tabAccount.docstatus!=2
and tabAccount.company = '%(company)s' and tabAccount.company = '%(company)s'

View File

@ -6,5 +6,8 @@ import frappe
from frappe.model.document import Document from frappe.model.document import Document
from erpnext.controllers.print_settings import print_settings_for_item_table
class PurchaseInvoiceItem(Document): class PurchaseInvoiceItem(Document):
pass def __setup__(self):
print_settings_for_item_table(self)

View File

@ -71,7 +71,7 @@
], ],
"icon": "icon-money", "icon": "icon-money",
"idx": 1, "idx": 1,
"modified": "2015-01-05 11:12:27.944849", "modified": "2015-02-05 05:11:44.223684",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Purchase Taxes and Charges Master", "name": "Purchase Taxes and Charges Master",
@ -101,6 +101,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Purchase Master Manager", "role": "Purchase Master Manager",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
} }

View File

@ -1,10 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and Contributors
# See license.txt
import frappe
import unittest
test_records = frappe.get_test_records('Purchase Taxes and Charges Master')
class TestPurchaseTaxesandChargesMaster(unittest.TestCase):
pass

View File

@ -1,6 +0,0 @@
[
{
"doctype": "Purchase Taxes and Charges Master",
"name": "_Test Purchase Taxes and Charges Master 1"
}
]

View File

@ -1202,7 +1202,7 @@
"icon": "icon-file-text", "icon": "icon-file-text",
"idx": 1, "idx": 1,
"is_submittable": 1, "is_submittable": 1,
"modified": "2015-01-15 07:33:52.971354", "modified": "2015-02-05 05:11:45.330358",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Sales Invoice", "name": "Sales Invoice",
@ -1219,6 +1219,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Accounts Manager", "role": "Accounts Manager",
"share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
}, },
@ -1234,6 +1235,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Accounts User", "role": "Accounts User",
"share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
}, },

View File

@ -152,7 +152,7 @@ class SalesInvoice(SellingController):
if d.time_log_batch: if d.time_log_batch:
tlb = frappe.get_doc("Time Log Batch", d.time_log_batch) tlb = frappe.get_doc("Time Log Batch", d.time_log_batch)
tlb.sales_invoice = sales_invoice tlb.sales_invoice = sales_invoice
tlb.ignore_validate_update_after_submit = True tlb.flags.ignore_validate_update_after_submit = True
tlb.save() tlb.save()
def validate_time_logs_are_submitted(self): def validate_time_logs_are_submitted(self):

View File

@ -5,14 +5,13 @@
frappe.listview_settings['Sales Invoice'] = { frappe.listview_settings['Sales Invoice'] = {
add_fields: ["customer", "customer_name", "grand_total", "outstanding_amount", "due_date", "company", add_fields: ["customer", "customer_name", "grand_total", "outstanding_amount", "due_date", "company",
"currency"], "currency"],
filters: [["outstanding_amount", ">", "0"]],
get_indicator: function(doc) { get_indicator: function(doc) {
if(doc.outstanding_amount==0) { if(doc.outstanding_amount==0) {
return [__("Paid"), "green", "oustanding_amount,=,0"] return [__("Paid"), "green", "outstanding_amount,=,0"]
} else if (doc.outstanding_amount > 0 && doc.due_date > frappe.datetime.get_today()) { } else if (doc.outstanding_amount > 0 && doc.due_date > frappe.datetime.get_today()) {
return [__("Unpaid"), "orange", "oustanding_amount,>,0|due_date,>,Today"] return [__("Unpaid"), "orange", "outstanding_amount,>,0|due_date,>,Today"]
} else if (doc.outstanding_amount > 0 && doc.due_date <= frappe.datetime.get_today()) { } else if (doc.outstanding_amount > 0 && doc.due_date <= frappe.datetime.get_today()) {
return [__("Overdue"), "red", "oustanding_amount,>,0|due_date,<=,Today"] return [__("Overdue"), "red", "outstanding_amount,>,0|due_date,<=,Today"]
} }
}, },
right_column: "grand_total_export" right_column: "grand_total_export"

View File

@ -5,6 +5,8 @@ from __future__ import unicode_literals
import frappe import frappe
from frappe.model.document import Document from frappe.model.document import Document
from erpnext.controllers.print_settings import print_settings_for_item_table
class SalesInvoiceItem(Document): class SalesInvoiceItem(Document):
pass def __setup__(self):
print_settings_for_item_table(self)

View File

@ -80,7 +80,7 @@
], ],
"icon": "icon-money", "icon": "icon-money",
"idx": 1, "idx": 1,
"modified": "2015-01-05 11:12:09.596733", "modified": "2015-02-05 05:11:46.282418",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Sales Taxes and Charges Master", "name": "Sales Taxes and Charges Master",
@ -110,6 +110,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Accounts Manager", "role": "Accounts Manager",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
}, },
@ -123,6 +124,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Sales Master Manager", "role": "Sales Master Manager",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
} }

View File

@ -102,7 +102,7 @@
], ],
"icon": "icon-truck", "icon": "icon-truck",
"idx": 1, "idx": 1,
"modified": "2015-01-05 14:59:25.045126", "modified": "2015-02-05 05:11:46.634371",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Shipping Rule", "name": "Shipping Rule",
@ -137,6 +137,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Accounts Manager", "role": "Accounts Manager",
"share": 1,
"write": 1 "write": 1
}, },
{ {
@ -148,6 +149,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Sales Master Manager", "role": "Sales Master Manager",
"share": 1,
"write": 1 "write": 1
} }
] ]

View File

@ -81,7 +81,7 @@ def save_entries(gl_map, adv_adj, update_outstanding):
def make_entry(args, adv_adj, update_outstanding): def make_entry(args, adv_adj, update_outstanding):
args.update({"doctype": "GL Entry"}) args.update({"doctype": "GL Entry"})
gle = frappe.get_doc(args) gle = frappe.get_doc(args)
gle.ignore_permissions = 1 gle.flags.ignore_permissions = 1
gle.insert() gle.insert()
gle.run_method("on_update_with_args", adv_adj, update_outstanding) gle.run_method("on_update_with_args", adv_adj, update_outstanding)
gle.submit() gle.submit()

View File

@ -7,7 +7,7 @@
// edit node // edit node
// see ledger // see ledger
pscript['onload_Accounts Browser'] = function(wrapper){ frappe.pages["Accounts Browser"].on_page_load = function(wrapper){
frappe.ui.make_app_page({ frappe.ui.make_app_page({
parent: wrapper, parent: wrapper,
single_column: true single_column: true
@ -58,7 +58,6 @@ pscript['onload_Accounts Browser'] = function(wrapper){
var ctype = frappe.get_route()[1] || 'Account'; var ctype = frappe.get_route()[1] || 'Account';
erpnext.account_chart = new erpnext.AccountsChart(ctype, $(this).val(), erpnext.account_chart = new erpnext.AccountsChart(ctype, $(this).val(),
chart_area.get(0)); chart_area.get(0));
pscript.set_title(wrapper, ctype, $(this).val());
}) })
// load up companies // load up companies
@ -74,18 +73,13 @@ pscript['onload_Accounts Browser'] = function(wrapper){
}); });
} }
pscript.set_title = function(wrapper, ctype, val) { frappe.pages["Accounts Browser"].on_page_show = function(wrapper){
}
pscript['onshow_Accounts Browser'] = function(wrapper){
// set route // set route
var ctype = frappe.get_route()[1] || 'Account'; var ctype = frappe.get_route()[1] || 'Account';
if(erpnext.account_chart && erpnext.account_chart.ctype != ctype) { if(erpnext.account_chart && erpnext.account_chart.ctype != ctype) {
wrapper.$company_select.change(); wrapper.$company_select.change();
} }
pscript.set_title(wrapper, ctype);
} }
erpnext.AccountsChart = Class.extend({ erpnext.AccountsChart = Class.extend({
@ -260,7 +254,7 @@ erpnext.AccountsChart = Class.extend({
}); });
// show // show
d.onshow = function() { d.on_page_show = function() {
$(fd.group_or_ledger.input).change(); $(fd.group_or_ledger.input).change();
$(fd.account_type.input).change(); $(fd.account_type.input).change();
} }

View File

@ -3,7 +3,7 @@
frappe.require("assets/erpnext/js/account_tree_grid.js"); frappe.require("assets/erpnext/js/account_tree_grid.js");
frappe.pages['financial-analytics'].onload = function(wrapper) { frappe.pages['financial-analytics'].on_page_load = function(wrapper) {
frappe.ui.make_app_page({ frappe.ui.make_app_page({
parent: wrapper, parent: wrapper,
title: __('Financial Analytics'), title: __('Financial Analytics'),
@ -49,7 +49,7 @@ erpnext.FinancialAnalytics = erpnext.AccountTreeGrid.extend({
], ],
setup_columns: function() { setup_columns: function() {
var std_columns = [ var std_columns = [
{id: "check", name: __("Plot"), field: "check", width: 30, {id: "_check", name: __("Plot"), field: "_check", width: 30,
formatter: this.check_formatter}, formatter: this.check_formatter},
{id: "name", name: __("Account"), field: "name", width: 300, {id: "name", name: __("Account"), field: "name", width: 300,
formatter: this.tree_formatter}, formatter: this.tree_formatter},

View File

@ -1,4 +1,4 @@
frappe.pages['pos'].onload = function(wrapper) { frappe.pages['pos'].on_page_load = function(wrapper) {
var page = frappe.ui.make_app_page({ var page = frappe.ui.make_app_page({
parent: wrapper, parent: wrapper,
title: __('Start POS'), title: __('Start POS'),

View File

@ -5,7 +5,7 @@
"doctype": "Print Format", "doctype": "Print Format",
"html": "{%- from \"templates/print_formats/standard_macros.html\" import add_header -%}\n<div class=\"page-break\">\n {%- if not doc.get(\"print_heading\") and not doc.get(\"select_print_heading\") \n and doc.set(\"select_print_heading\", _(\"Payment Receipt Note\")) -%}{%- endif -%}\n {{ add_header(0, 1, doc, letter_head, no_letterhead) }}\n\n {%- for label, value in (\n (_(\"Received On\"), frappe.utils.formatdate(doc.voucher_date)),\n (_(\"Received From\"), doc.pay_to_recd_from),\n (_(\"Amount\"), \"<strong>\" + doc.get_formatted(\"total_amount\") + \"</strong><br>\" + (doc.total_amount_in_words or \"\") + \"<br>\"),\n (_(\"Remarks\"), doc.remark)\n ) -%}\n <div class=\"row\">\n <div class=\"col-xs-3\"><label class=\"text-right\">{{ label }}</label></div>\n <div class=\"col-xs-9\">{{ value }}</div>\n </div>\n\n {%- endfor -%}\n\n <hr>\n <br>\n <p class=\"strong\">\n {{ _(\"For\") }} {{ doc.company }},<br>\n <br>\n <br>\n <br>\n {{ _(\"Authorized Signatory\") }}\n </p>\n</div>\n\n", "html": "{%- from \"templates/print_formats/standard_macros.html\" import add_header -%}\n<div class=\"page-break\">\n {%- if not doc.get(\"print_heading\") and not doc.get(\"select_print_heading\") \n and doc.set(\"select_print_heading\", _(\"Payment Receipt Note\")) -%}{%- endif -%}\n {{ add_header(0, 1, doc, letter_head, no_letterhead) }}\n\n {%- for label, value in (\n (_(\"Received On\"), frappe.utils.formatdate(doc.voucher_date)),\n (_(\"Received From\"), doc.pay_to_recd_from),\n (_(\"Amount\"), \"<strong>\" + doc.get_formatted(\"total_amount\") + \"</strong><br>\" + (doc.total_amount_in_words or \"\") + \"<br>\"),\n (_(\"Remarks\"), doc.remark)\n ) -%}\n <div class=\"row\">\n <div class=\"col-xs-3\"><label class=\"text-right\">{{ label }}</label></div>\n <div class=\"col-xs-9\">{{ value }}</div>\n </div>\n\n {%- endfor -%}\n\n <hr>\n <br>\n <p class=\"strong\">\n {{ _(\"For\") }} {{ doc.company }},<br>\n <br>\n <br>\n <br>\n {{ _(\"Authorized Signatory\") }}\n </p>\n</div>\n\n",
"idx": 1, "idx": 1,
"modified": "2015-01-12 11:03:22.893209", "modified": "2015-01-16 11:03:22.893209",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Payment Receipt Voucher", "name": "Payment Receipt Voucher",

View File

@ -29,6 +29,7 @@ def execute(filters=None):
row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date, d.supplier, row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date, d.supplier,
d.supplier_name, d.credit_to, d.project_name, d.company, d.purchase_order, d.supplier_name, d.credit_to, d.project_name, d.company, d.purchase_order,
purchase_receipt, expense_account, d.qty, d.base_rate, d.base_amount] purchase_receipt, expense_account, d.qty, d.base_rate, d.base_amount]
for tax in tax_accounts: for tax in tax_accounts:
row.append(item_tax.get(d.parent, {}).get(d.item_code, {}).get(tax, 0)) row.append(item_tax.get(d.parent, {}).get(d.item_code, {}).get(tax, 0))
@ -67,8 +68,8 @@ def get_items(filters):
match_conditions = frappe.build_match_conditions("Purchase Invoice") match_conditions = frappe.build_match_conditions("Purchase Invoice")
return frappe.db.sql("""select pi_item.parent, pi.posting_date, pi.credit_to, pi.company, return frappe.db.sql("""select pi_item.parent, pi.posting_date, pi.credit_to, pi.company,
pi.supplier, pi.remarks, pi_item.item_code, pi_item.item_name, pi_item.item_group, pi.supplier, pi.remarks, pi.net_total, pi_item.item_code, pi_item.item_name, pi_item.item_group,
pi_item.project_name, pi_item.purchase_order, pi_item.purchase_receipt, pi_item.po_detail, pi_item.project_name, pi_item.purchase_order, pi_item.purchase_receipt, pi_item.po_detail
pi_item.expense_account, pi_item.qty, pi_item.base_rate, pi_item.base_amount, pi.supplier_name pi_item.expense_account, pi_item.qty, pi_item.base_rate, pi_item.base_amount, pi.supplier_name
from `tabPurchase Invoice` pi, `tabPurchase Invoice Item` pi_item from `tabPurchase Invoice` pi, `tabPurchase Invoice Item` pi_item
where pi.name = pi_item.parent and pi.docstatus = 1 %s %s where pi.name = pi_item.parent and pi.docstatus = 1 %s %s
@ -81,13 +82,16 @@ def get_tax_accounts(item_list, columns):
import json import json
item_tax = {} item_tax = {}
tax_accounts = [] tax_accounts = []
invoice_wise_items = {}
for d in item_list:
invoice_wise_items.setdefault(d.parent, []).append(d)
tax_details = frappe.db.sql("""select parent, account_head, item_wise_tax_detail tax_details = frappe.db.sql("""select parent, account_head, item_wise_tax_detail, charge_type, tax_amount
from `tabPurchase Taxes and Charges` where parenttype = 'Purchase Invoice' from `tabPurchase Taxes and Charges` where parenttype = 'Purchase Invoice'
and docstatus = 1 and ifnull(account_head, '') != '' and category in ('Total', 'Valuation and Total') and docstatus = 1 and ifnull(account_head, '') != '' and category in ('Total', 'Valuation and Total')
and parent in (%s)""" % ', '.join(['%s']*len(item_list)), tuple([item.parent for item in item_list])) and parent in (%s)""" % ', '.join(['%s']*len(invoice_wise_items)), tuple(invoice_wise_items.keys()))
for parent, account_head, item_wise_tax_detail in tax_details: for parent, account_head, item_wise_tax_detail, charge_type, tax_amount in tax_details:
if account_head not in tax_accounts: if account_head not in tax_accounts:
tax_accounts.append(account_head) tax_accounts.append(account_head)
@ -100,6 +104,10 @@ def get_tax_accounts(item_list, columns):
except ValueError: except ValueError:
continue continue
elif charge_type == "Actual" and tax_amount:
for d in invoice_wise_items.get(parent, []):
item_tax.setdefault(parent, {}).setdefault(d.item_code, {})[account_head] = \
(tax_amount * d.base_amount) / d.net_total
tax_accounts.sort() tax_accounts.sort()
columns += [account_head + ":Currency:80" for account_head in tax_accounts] columns += [account_head + ":Currency:80" for account_head in tax_accounts]

View File

@ -3,7 +3,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe import msgprint, _ from frappe import _
from frappe.utils import flt from frappe.utils import flt
def execute(filters=None): def execute(filters=None):
@ -67,7 +67,7 @@ def get_conditions(filters):
def get_items(filters): def get_items(filters):
conditions = get_conditions(filters) conditions = get_conditions(filters)
return frappe.db.sql("""select si_item.parent, si.posting_date, si.debit_to, si.project_name, return frappe.db.sql("""select si_item.parent, si.posting_date, si.debit_to, si.project_name,
si.customer, si.remarks, si.territory, si.company, si_item.item_code, si_item.item_name, si.customer, si.remarks, si.territory, si.company, si.net_total, si_item.item_code, si_item.item_name,
si_item.item_group, si_item.sales_order, si_item.delivery_note, si_item.income_account, si_item.item_group, si_item.sales_order, si_item.delivery_note, si_item.income_account,
si_item.qty, si_item.base_rate, si_item.base_amount, si.customer_name, si_item.qty, si_item.base_rate, si_item.base_amount, si.customer_name,
si.customer_group, si_item.so_detail si.customer_group, si_item.so_detail
@ -79,14 +79,17 @@ def get_tax_accounts(item_list, columns):
import json import json
item_tax = {} item_tax = {}
tax_accounts = [] tax_accounts = []
invoice_wise_items = {}
for d in item_list:
invoice_wise_items.setdefault(d.parent, []).append(d)
tax_details = frappe.db.sql("""select parent, account_head, item_wise_tax_detail tax_details = frappe.db.sql("""select parent, account_head, item_wise_tax_detail, charge_type, tax_amount
from `tabSales Taxes and Charges` where parenttype = 'Sales Invoice' from `tabSales Taxes and Charges` where parenttype = 'Sales Invoice'
and docstatus = 1 and ifnull(account_head, '') != '' and docstatus = 1 and ifnull(account_head, '') != ''
and parent in (%s)""" % ', '.join(['%s']*len(item_list)), and parent in (%s)""" % ', '.join(['%s']*len(invoice_wise_items)),
tuple([item.parent for item in item_list])) tuple(invoice_wise_items.keys()))
for parent, account_head, item_wise_tax_detail in tax_details: for parent, account_head, item_wise_tax_detail, charge_type, tax_amount in tax_details:
if account_head not in tax_accounts: if account_head not in tax_accounts:
tax_accounts.append(account_head) tax_accounts.append(account_head)
@ -98,6 +101,10 @@ def get_tax_accounts(item_list, columns):
flt(tax_amount[1]) if isinstance(tax_amount, list) else flt(tax_amount) flt(tax_amount[1]) if isinstance(tax_amount, list) else flt(tax_amount)
except ValueError: except ValueError:
continue continue
elif charge_type == "Actual" and tax_amount:
for d in invoice_wise_items.get(parent, []):
item_tax.setdefault(parent, {}).setdefault(d.item_code, {})[account_head] = \
flt((tax_amount * d.base_amount) / d.net_total)
tax_accounts.sort() tax_accounts.sort()
columns += [account_head + ":Currency:80" for account_head in tax_accounts] columns += [account_head + ":Currency:80" for account_head in tax_accounts]

View File

@ -209,7 +209,7 @@ def update_against_doc(d, jv_obj):
ch.docstatus = 1 ch.docstatus = 1
# will work as update after submit # will work as update after submit
jv_obj.ignore_validate_update_after_submit = True jv_obj.flags.ignore_validate_update_after_submit = True
jv_obj.save() jv_obj.save()
def remove_against_link_from_jv(ref_type, ref_no, against_field): def remove_against_link_from_jv(ref_type, ref_no, against_field):

View File

@ -1,75 +1,76 @@
{ {
"creation": "2013-06-25 11:04:03.000000", "creation": "2013-06-25 11:04:03",
"description": "Settings for Buying Module", "description": "Settings for Buying Module",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"document_type": "Other", "document_type": "Other",
"fields": [ "fields": [
{ {
"default": "Supplier Name", "default": "Supplier Name",
"fieldname": "supp_master_name", "fieldname": "supp_master_name",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Supplier Naming By", "label": "Supplier Naming By",
"options": "Supplier Name\nNaming Series", "options": "Supplier Name\nNaming Series",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "supplier_type", "fieldname": "supplier_type",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Default Supplier Type", "label": "Default Supplier Type",
"options": "Supplier Type", "options": "Supplier Type",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "buying_price_list", "fieldname": "buying_price_list",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Default Buying Price List", "label": "Default Buying Price List",
"options": "Price List", "options": "Price List",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "column_break_3", "fieldname": "column_break_3",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "maintain_same_rate", "fieldname": "maintain_same_rate",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Maintain same rate throughout purchase cycle", "label": "Maintain same rate throughout purchase cycle",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "po_required", "fieldname": "po_required",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Purchase Order Required", "label": "Purchase Order Required",
"options": "No\nYes", "options": "No\nYes",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "pr_required", "fieldname": "pr_required",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Purchase Receipt Required", "label": "Purchase Receipt Required",
"options": "No\nYes", "options": "No\nYes",
"permlevel": 0 "permlevel": 0
} }
], ],
"icon": "icon-cog", "icon": "icon-cog",
"idx": 1, "idx": 1,
"issingle": 1, "issingle": 1,
"modified": "2014-02-19 19:02:00.000000", "modified": "2015-02-05 05:11:35.373253",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Buying Settings", "name": "Buying Settings",
"owner": "Administrator", "owner": "Administrator",
"permissions": [ "permissions": [
{ {
"create": 1, "create": 1,
"email": 1, "email": 1,
"permlevel": 0, "permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
"role": "System Manager", "role": "System Manager",
"share": 1,
"write": 1 "write": 1
} }
] ]
} }

View File

@ -186,26 +186,17 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
calculate_totals: function() { calculate_totals: function() {
var tax_count = this.frm.doc["taxes"] ? this.frm.doc["taxes"].length : 0; var tax_count = this.frm.doc["taxes"] ? this.frm.doc["taxes"].length : 0;
this.frm.doc.grand_total = flt(tax_count ? this.frm.doc.grand_total = flt(tax_count ? this.frm.doc["taxes"][tax_count - 1].total : this.frm.doc.net_total);
this.frm.doc["taxes"][tax_count - 1].total : this.frm.doc.net_total);
this.frm.doc.grand_total_import = flt(tax_count ?
flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate) : this.frm.doc.net_total_import);
this.frm.doc.total_tax = flt(this.frm.doc.grand_total - this.frm.doc.net_total, this.frm.doc.total_tax = flt(this.frm.doc.grand_total - this.frm.doc.net_total, precision("total_tax"));
precision("total_tax"));
this.frm.doc.grand_total = flt(this.frm.doc.grand_total, precision("grand_total")); this.frm.doc.grand_total = flt(this.frm.doc.grand_total, precision("grand_total"));
this.frm.doc.grand_total_import = flt(this.frm.doc.grand_total_import, precision("grand_total_import"));
// rounded totals // rounded totals
if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total", this.frm.doc.name)) { if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total", this.frm.doc.name)) {
this.frm.doc.rounded_total = Math.round(this.frm.doc.grand_total); this.frm.doc.rounded_total = Math.round(this.frm.doc.grand_total);
} }
if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total_import", this.frm.doc.name)) {
this.frm.doc.rounded_total_import = Math.round(this.frm.doc.grand_total_import);
}
// other charges added/deducted // other charges added/deducted
this.frm.doc.other_charges_added = 0.0 this.frm.doc.other_charges_added = 0.0
this.frm.doc.other_charges_deducted = 0.0 this.frm.doc.other_charges_deducted = 0.0
@ -223,6 +214,16 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
frappe.model.round_floats_in(this.frm.doc, frappe.model.round_floats_in(this.frm.doc,
["other_charges_added", "other_charges_deducted"]); ["other_charges_added", "other_charges_deducted"]);
} }
this.frm.doc.grand_total_import = flt((this.frm.doc.other_charges_added || this.frm.doc.other_charges_deducted) ?
flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate) : this.frm.doc.net_total_import);
this.frm.doc.grand_total_import = flt(this.frm.doc.grand_total_import, precision("grand_total_import"));
if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total_import", this.frm.doc.name)) {
this.frm.doc.rounded_total_import = Math.round(this.frm.doc.grand_total_import);
}
this.frm.doc.other_charges_added_import = flt(this.frm.doc.other_charges_added / this.frm.doc.other_charges_added_import = flt(this.frm.doc.other_charges_added /
this.frm.doc.conversion_rate, precision("other_charges_added_import")); this.frm.doc.conversion_rate, precision("other_charges_added_import"));
this.frm.doc.other_charges_deducted_import = flt(this.frm.doc.other_charges_deducted / this.frm.doc.other_charges_deducted_import = flt(this.frm.doc.other_charges_deducted /

View File

@ -117,7 +117,7 @@
"report_hide": 0 "report_hide": 0
}, },
{ {
"description": "Select the relevant company name if you have multiple companies", "description": "",
"fieldname": "company", "fieldname": "company",
"fieldtype": "Link", "fieldtype": "Link",
"in_filter": 1, "in_filter": 1,
@ -775,7 +775,7 @@
"icon": "icon-file-text", "icon": "icon-file-text",
"idx": 1, "idx": 1,
"is_submittable": 1, "is_submittable": 1,
"modified": "2015-01-15 07:34:27.901777", "modified": "2015-02-05 05:11:43.673323",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Purchase Order", "name": "Purchase Order",
@ -807,6 +807,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Purchase Manager", "role": "Purchase Manager",
"share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
}, },
@ -822,6 +823,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Purchase User", "role": "Purchase User",
"share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
}, },

View File

@ -6,5 +6,8 @@ import frappe
from frappe.model.document import Document from frappe.model.document import Document
from erpnext.controllers.print_settings import print_settings_for_item_table
class PurchaseOrderItem(Document): class PurchaseOrderItem(Document):
pass def __setup__(self):
print_settings_for_item_table(self)

View File

@ -207,7 +207,7 @@
"icon": "icon-search", "icon": "icon-search",
"idx": 1, "idx": 1,
"is_submittable": 1, "is_submittable": 1,
"modified": "2014-12-24 16:37:43.755107", "modified": "2015-02-05 05:11:44.292242",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Quality Inspection", "name": "Quality Inspection",
@ -224,6 +224,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Quality Manager", "role": "Quality Manager",
"share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
} }

View File

@ -1,244 +1,245 @@
{ {
"allow_import": 1, "allow_import": 1,
"allow_rename": 1, "allow_rename": 1,
"autoname": "naming_series:", "autoname": "naming_series:",
"creation": "2013-01-10 16:34:11", "creation": "2013-01-10 16:34:11",
"description": "Supplier of Goods or Services.", "description": "Supplier of Goods or Services.",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"document_type": "Master", "document_type": "Master",
"fields": [ "fields": [
{ {
"fieldname": "basic_info", "fieldname": "basic_info",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Basic Info", "label": "Basic Info",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"options": "icon-user", "options": "icon-user",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "naming_series", "fieldname": "naming_series",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Series", "label": "Series",
"no_copy": 1, "no_copy": 1,
"oldfieldname": "naming_series", "oldfieldname": "naming_series",
"oldfieldtype": "Select", "oldfieldtype": "Select",
"options": "SUPP-", "options": "SUPP-",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "supplier_name", "fieldname": "supplier_name",
"fieldtype": "Data", "fieldtype": "Data",
"in_list_view": 0, "in_list_view": 0,
"label": "Supplier Name", "label": "Supplier Name",
"no_copy": 1, "no_copy": 1,
"oldfieldname": "supplier_name", "oldfieldname": "supplier_name",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"permlevel": 0, "permlevel": 0,
"reqd": 1 "reqd": 1
}, },
{ {
"fieldname": "column_break0", "fieldname": "column_break0",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"permlevel": 0, "permlevel": 0,
"width": "50%" "width": "50%"
}, },
{ {
"fieldname": "supplier_type", "fieldname": "supplier_type",
"fieldtype": "Link", "fieldtype": "Link",
"in_list_view": 1, "in_list_view": 1,
"label": "Supplier Type", "label": "Supplier Type",
"oldfieldname": "supplier_type", "oldfieldname": "supplier_type",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "Supplier Type", "options": "Supplier Type",
"permlevel": 0, "permlevel": 0,
"reqd": 1 "reqd": 1
}, },
{ {
"depends_on": "eval:!doc.__islocal", "depends_on": "eval:!doc.__islocal",
"fieldname": "address_contacts", "fieldname": "address_contacts",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Address & Contacts", "label": "Address & Contacts",
"oldfieldtype": "Column Break", "oldfieldtype": "Column Break",
"options": "icon-map-marker", "options": "icon-map-marker",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "address_html", "fieldname": "address_html",
"fieldtype": "HTML", "fieldtype": "HTML",
"label": "Address HTML", "label": "Address HTML",
"permlevel": 0, "permlevel": 0,
"read_only": 1 "read_only": 1
}, },
{ {
"fieldname": "column_break1", "fieldname": "column_break1",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"permlevel": 0, "permlevel": 0,
"width": "50%" "width": "50%"
}, },
{ {
"fieldname": "contact_html", "fieldname": "contact_html",
"fieldtype": "HTML", "fieldtype": "HTML",
"label": "Contact HTML", "label": "Contact HTML",
"permlevel": 0, "permlevel": 0,
"read_only": 1 "read_only": 1
}, },
{ {
"fieldname": "default_payable_accounts", "fieldname": "default_payable_accounts",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Default Payable Accounts", "label": "Default Payable Accounts",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "accounts", "fieldname": "accounts",
"fieldtype": "Table", "fieldtype": "Table",
"label": "Accounts", "label": "Accounts",
"options": "Party Account", "options": "Party Account",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "more_info", "fieldname": "more_info",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "More Info", "label": "More Info",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"options": "icon-file-text", "options": "icon-file-text",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "default_currency", "fieldname": "default_currency",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1, "ignore_user_permissions": 1,
"label": "Default Currency", "label": "Default Currency",
"no_copy": 1, "no_copy": 1,
"options": "Currency", "options": "Currency",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "default_price_list", "fieldname": "default_price_list",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1, "ignore_user_permissions": 1,
"label": "Price List", "label": "Price List",
"options": "Price List", "options": "Price List",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "default_taxes_and_charges", "fieldname": "default_taxes_and_charges",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1, "ignore_user_permissions": 1,
"label": "Taxes and Charges", "label": "Taxes and Charges",
"options": "Purchase Taxes and Charges Master", "options": "Purchase Taxes and Charges Master",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "credit_days", "fieldname": "credit_days",
"fieldtype": "Int", "fieldtype": "Int",
"label": "Credit Days", "label": "Credit Days",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "column_break2", "fieldname": "column_break2",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"permlevel": 0, "permlevel": 0,
"width": "50%" "width": "50%"
}, },
{ {
"fieldname": "website", "fieldname": "website",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Website", "label": "Website",
"oldfieldname": "website", "oldfieldname": "website",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"permlevel": 0 "permlevel": 0
}, },
{ {
"description": "Statutory info and other general information about your Supplier", "description": "Statutory info and other general information about your Supplier",
"fieldname": "supplier_details", "fieldname": "supplier_details",
"fieldtype": "Text", "fieldtype": "Text",
"label": "Supplier Details", "label": "Supplier Details",
"oldfieldname": "supplier_details", "oldfieldname": "supplier_details",
"oldfieldtype": "Code", "oldfieldtype": "Code",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "communications", "fieldname": "communications",
"fieldtype": "Table", "fieldtype": "Table",
"hidden": 1, "hidden": 1,
"label": "Communications", "label": "Communications",
"options": "Communication", "options": "Communication",
"permlevel": 0, "permlevel": 0,
"print_hide": 1 "print_hide": 1
} }
], ],
"icon": "icon-user", "icon": "icon-user",
"idx": 1, "idx": 1,
"modified": "2015-01-06 17:32:39.936580", "modified": "2015-02-05 05:11:47.468728",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Supplier", "name": "Supplier",
"owner": "Administrator", "owner": "Administrator",
"permissions": [ "permissions": [
{ {
"email": 1, "email": 1,
"permlevel": 0, "permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Purchase User" "role": "Purchase User"
}, },
{ {
"amend": 0, "amend": 0,
"create": 0, "create": 0,
"delete": 0, "delete": 0,
"email": 1, "email": 1,
"permlevel": 0, "permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Purchase Manager", "role": "Purchase Manager",
"submit": 0, "submit": 0,
"write": 0 "write": 0
}, },
{ {
"amend": 0, "amend": 0,
"create": 1, "create": 1,
"delete": 1, "delete": 1,
"email": 1, "email": 1,
"permlevel": 0, "permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Purchase Master Manager", "role": "Purchase Master Manager",
"submit": 0, "share": 1,
"submit": 0,
"write": 1 "write": 1
}, },
{ {
"apply_user_permissions": 1, "apply_user_permissions": 1,
"permlevel": 0, "permlevel": 0,
"read": 1, "read": 1,
"role": "Material User" "role": "Material User"
}, },
{ {
"email": 1, "email": 1,
"permlevel": 0, "permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Material Manager" "role": "Material Manager"
}, },
{ {
"apply_user_permissions": 1, "apply_user_permissions": 1,
"permlevel": 0, "permlevel": 0,
"read": 1, "read": 1,
"role": "Accounts User" "role": "Accounts User"
}, },
{ {
"email": 1, "email": 1,
"permlevel": 0, "permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Accounts Manager" "role": "Accounts Manager"
} }
], ],
"search_fields": "supplier_name,supplier_type", "search_fields": "supplier_name, supplier_type",
"title_field": "supplier_name" "title_field": "supplier_name"
} }

View File

@ -117,7 +117,7 @@
"report_hide": 0 "report_hide": 0
}, },
{ {
"description": "Select the relevant company name if you have multiple companies", "description": "",
"fieldname": "company", "fieldname": "company",
"fieldtype": "Link", "fieldtype": "Link",
"in_filter": 1, "in_filter": 1,
@ -575,7 +575,7 @@
"icon": "icon-shopping-cart", "icon": "icon-shopping-cart",
"idx": 1, "idx": 1,
"is_submittable": 1, "is_submittable": 1,
"modified": "2015-01-15 07:34:12.734538", "modified": "2015-02-05 05:11:47.602292",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Supplier Quotation", "name": "Supplier Quotation",
@ -592,6 +592,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Manufacturing Manager", "role": "Manufacturing Manager",
"share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
}, },
@ -606,6 +607,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Purchase Manager", "role": "Purchase Manager",
"share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
}, },
@ -621,6 +623,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Purchase User", "role": "Purchase User",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
}, },

View File

@ -6,5 +6,8 @@ import frappe
from frappe.model.document import Document from frappe.model.document import Document
from erpnext.controllers.print_settings import print_settings_for_item_table
class SupplierQuotationItem(Document): class SupplierQuotationItem(Document):
pass def __setup__(self):
print_settings_for_item_table(self)

View File

@ -1,7 +1,7 @@
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt // License: GNU General Public License v3. See license.txt
frappe.pages['purchase-analytics'].onload = function(wrapper) { frappe.pages['purchase-analytics'].on_page_load = function(wrapper) {
frappe.ui.make_app_page({ frappe.ui.make_app_page({
parent: wrapper, parent: wrapper,
title: __('Purchase Analytics'), title: __('Purchase Analytics'),
@ -74,7 +74,7 @@ erpnext.PurchaseAnalytics = frappe.views.TreeGridReport.extend({
this.tree_grid = this.tree_grids[this.tree_type]; this.tree_grid = this.tree_grids[this.tree_type];
var std_columns = [ var std_columns = [
{id: "check", name: __("Plot"), field: "check", width: 30, {id: "_check", name: __("Plot"), field: "_check", width: 30,
formatter: this.check_formatter}, formatter: this.check_formatter},
{id: "name", name: this.tree_grid.label, field: "name", width: 300, {id: "name", name: this.tree_grid.label, field: "name", width: 300,
formatter: this.tree_formatter}, formatter: this.tree_formatter},

View File

@ -64,7 +64,7 @@
"read_only": 1 "read_only": 1
} }
], ],
"modified": "2014-05-27 03:49:14.598212", "modified": "2015-02-05 05:11:42.046004",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Contacts", "module": "Contacts",
"name": "Party Type", "name": "Party Type",
@ -76,6 +76,7 @@
"permlevel": 0, "permlevel": 0,
"read": 1, "read": 1,
"role": "Sales User", "role": "Sales User",
"share": 1,
"write": 1 "write": 1
}, },
{ {
@ -84,6 +85,7 @@
"permlevel": 0, "permlevel": 0,
"read": 1, "read": 1,
"role": "Purchase User", "role": "Purchase User",
"share": 1,
"write": 1 "write": 1
} }
] ]

View File

@ -15,9 +15,8 @@ from erpnext.controllers.stock_controller import StockController
class BuyingController(StockController): class BuyingController(StockController):
def __setup__(self): def __setup__(self):
if hasattr(self, "items"): if hasattr(self, "items"):
self.table_print_templates = { self.print_templates = {
"items": "templates/print_formats/includes/item_grid.html", "taxes": "templates/print_formats/includes/taxes.html"
"taxes": "templates/print_formats/includes/taxes.html",
} }
def get_feed(self): def get_feed(self):
@ -95,8 +94,7 @@ class BuyingController(StockController):
item.rate = flt(item.price_list_rate * (1.0 - (item.discount_percentage / 100.0)), item.rate = flt(item.price_list_rate * (1.0 - (item.discount_percentage / 100.0)),
self.precision("rate", item)) self.precision("rate", item))
item.amount = flt(item.rate * item.qty, item.amount = flt(item.rate * item.qty, self.precision("amount", item))
self.precision("amount", item))
item.item_tax_amount = 0.0; item.item_tax_amount = 0.0;
self._set_in_company_currency(item, "amount", "base_amount") self._set_in_company_currency(item, "amount", "base_amount")
@ -115,20 +113,14 @@ class BuyingController(StockController):
def calculate_totals(self): def calculate_totals(self):
self.grand_total = flt(self.get("taxes")[-1].total if self.get("taxes") else self.net_total) self.grand_total = flt(self.get("taxes")[-1].total if self.get("taxes") else self.net_total)
self.grand_total_import = flt(self.grand_total / self.conversion_rate) \
if self.get("taxes") else self.net_total_import
self.total_tax = flt(self.grand_total - self.net_total, self.precision("total_tax")) self.total_tax = flt(self.grand_total - self.net_total, self.precision("total_tax"))
self.grand_total = flt(self.grand_total, self.precision("grand_total")) self.grand_total = flt(self.grand_total, self.precision("grand_total"))
self.grand_total_import = flt(self.grand_total_import, self.precision("grand_total_import"))
if self.meta.get_field("rounded_total"): if self.meta.get_field("rounded_total"):
self.rounded_total = rounded(self.grand_total) self.rounded_total = rounded(self.grand_total)
if self.meta.get_field("rounded_total_import"):
self.rounded_total_import = rounded(self.grand_total_import)
if self.meta.get_field("other_charges_added"): if self.meta.get_field("other_charges_added"):
self.other_charges_added = flt(sum([flt(d.tax_amount) for d in self.get("taxes") self.other_charges_added = flt(sum([flt(d.tax_amount) for d in self.get("taxes")
if d.add_deduct_tax=="Add" and d.category in ["Valuation and Total", "Total"]]), if d.add_deduct_tax=="Add" and d.category in ["Valuation and Total", "Total"]]),
@ -139,6 +131,14 @@ class BuyingController(StockController):
if d.add_deduct_tax=="Deduct" and d.category in ["Valuation and Total", "Total"]]), if d.add_deduct_tax=="Deduct" and d.category in ["Valuation and Total", "Total"]]),
self.precision("other_charges_deducted")) self.precision("other_charges_deducted"))
self.grand_total_import = flt(self.grand_total / self.conversion_rate) \
if (self.other_charges_added or self.other_charges_deducted) else self.net_total_import
self.grand_total_import = flt(self.grand_total_import, self.precision("grand_total_import"))
if self.meta.get_field("rounded_total_import"):
self.rounded_total_import = rounded(self.grand_total_import)
if self.meta.get_field("other_charges_added_import"): if self.meta.get_field("other_charges_added_import"):
self.other_charges_added_import = flt(self.other_charges_added / self.other_charges_added_import = flt(self.other_charges_added /
self.conversion_rate, self.precision("other_charges_added_import")) self.conversion_rate, self.precision("other_charges_added_import"))

View File

@ -0,0 +1,9 @@
# Copyright (c) 2015, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
def print_settings_for_item_table(doc):
doc.print_templates = {
"description": "templates/print_formats/includes/item_table_description.html",
"qty": "templates/print_formats/includes/item_table_qty.html"
}
doc.hide_in_print_layout = ["item_code", "item_name", "image", "uom", "stock_uom"]

View File

@ -13,9 +13,8 @@ from erpnext.controllers.stock_controller import StockController
class SellingController(StockController): class SellingController(StockController):
def __setup__(self): def __setup__(self):
if hasattr(self, "items"): if hasattr(self, "items"):
self.table_print_templates = { self.print_templates = {
"items": "templates/print_formats/includes/item_grid.html", "taxes": "templates/print_formats/includes/taxes.html"
"taxes": "templates/print_formats/includes/taxes.html",
} }
def get_feed(self): def get_feed(self):
@ -49,8 +48,7 @@ class SellingController(StockController):
def set_missing_lead_customer_details(self): def set_missing_lead_customer_details(self):
if getattr(self, "customer", None): if getattr(self, "customer", None):
from erpnext.accounts.party import _get_party_details from erpnext.accounts.party import _get_party_details
party_details = _get_party_details(self.customer, party_details = _get_party_details(self.customer, ignore_permissions=self.flags.ignore_permissions)
ignore_permissions=getattr(self, "ignore_permissions", None))
if not self.meta.get_field("sales_team"): if not self.meta.get_field("sales_team"):
party_details.pop("sales_team") party_details.pop("sales_team")
@ -217,10 +215,11 @@ class SellingController(StockController):
def calculate_totals(self): def calculate_totals(self):
self.grand_total = flt(self.get("taxes")[-1].total if self.get("taxes") else self.net_total) self.grand_total = flt(self.get("taxes")[-1].total if self.get("taxes") else self.net_total)
self.grand_total_export = flt(self.grand_total / self.conversion_rate)
self.other_charges_total = flt(self.grand_total - self.net_total, self.precision("other_charges_total")) self.other_charges_total = flt(self.grand_total - self.net_total, self.precision("other_charges_total"))
self.grand_total_export = flt(self.grand_total / self.conversion_rate) \
if (self.other_charges_total or self.discount_amount) else self.net_total_export
self.other_charges_total_export = flt(self.grand_total_export - self.net_total_export + self.other_charges_total_export = flt(self.grand_total_export - self.net_total_export +
flt(self.discount_amount), self.precision("other_charges_total_export")) flt(self.discount_amount), self.precision("other_charges_total_export"))

View File

@ -17,6 +17,7 @@ status_map = {
["Submitted", "eval:self.docstatus==1"], ["Submitted", "eval:self.docstatus==1"],
["Lost", "eval:self.status=='Lost'"], ["Lost", "eval:self.status=='Lost'"],
["Quotation", "has_quotation"], ["Quotation", "has_quotation"],
["Converted", "has_ordered_quotation"],
["Cancelled", "eval:self.docstatus==2"], ["Cancelled", "eval:self.docstatus==2"],
], ],
"Quotation": [ "Quotation": [

View File

@ -197,9 +197,9 @@ class StockController(AccountsController):
sl_dict.update(args) sl_dict.update(args)
return sl_dict return sl_dict
def make_sl_entries(self, sl_entries, is_amended=None): def make_sl_entries(self, sl_entries, is_amended=None, allow_negative_stock=False):
from erpnext.stock.stock_ledger import make_sl_entries from erpnext.stock.stock_ledger import make_sl_entries
make_sl_entries(sl_entries, is_amended) make_sl_entries(sl_entries, is_amended, allow_negative_stock)
def make_gl_entries_on_cancel(self): def make_gl_entries_on_cancel(self):
if frappe.db.sql("""select name from `tabGL Entry` where voucher_type=%s if frappe.db.sql("""select name from `tabGL Entry` where voucher_type=%s

View File

@ -55,7 +55,8 @@ scheduler_events = {
"erpnext.stock.reorder_item.reorder_item", "erpnext.stock.reorder_item.reorder_item",
"erpnext.setup.doctype.email_digest.email_digest.send", "erpnext.setup.doctype.email_digest.email_digest.send",
"erpnext.support.doctype.issue.issue.auto_close_tickets", "erpnext.support.doctype.issue.issue.auto_close_tickets",
"erpnext.accounts.doctype.fiscal_year.fiscal_year.auto_create_fiscal_year" "erpnext.accounts.doctype.fiscal_year.fiscal_year.auto_create_fiscal_year",
"erpnext.hr.doctype.employee.employee.send_birthday_reminders"
], ],
"daily_long": [ "daily_long": [
"erpnext.setup.doctype.backup_manager.backup_manager.take_backups_daily" "erpnext.setup.doctype.backup_manager.backup_manager.take_backups_daily"

View File

@ -197,7 +197,7 @@
"icon": "icon-thumbs-up", "icon": "icon-thumbs-up",
"idx": 1, "idx": 1,
"is_submittable": 1, "is_submittable": 1,
"modified": "2015-01-07 14:51:15.943276", "modified": "2015-02-05 05:11:34.405796",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Appraisal", "name": "Appraisal",
@ -214,6 +214,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Employee", "role": "Employee",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
}, },
@ -228,6 +229,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "System Manager", "role": "System Manager",
"share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
}, },
@ -243,6 +245,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "HR User", "role": "HR User",
"share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
} }

View File

@ -47,7 +47,7 @@
], ],
"icon": "icon-file-text", "icon": "icon-file-text",
"idx": 1, "idx": 1,
"modified": "2015-01-15 15:26:55.553233", "modified": "2015-02-05 05:11:34.496238",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Appraisal Template", "name": "Appraisal Template",
@ -62,6 +62,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "HR User", "role": "HR User",
"share": 1,
"write": 1 "write": 1
} }
] ]

View File

@ -130,7 +130,7 @@
"icon": "icon-ok", "icon": "icon-ok",
"idx": 1, "idx": 1,
"is_submittable": 1, "is_submittable": 1,
"modified": "2015-01-07 14:45:03.326807", "modified": "2015-02-05 05:11:34.545262",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Attendance", "name": "Attendance",
@ -146,6 +146,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "System Manager", "role": "System Manager",
"share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
}, },
@ -160,6 +161,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "HR User", "role": "HR User",
"share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
}, },
@ -173,6 +175,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "HR Manager", "role": "HR Manager",
"share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
} }

View File

@ -20,7 +20,7 @@
], ],
"icon": "icon-code-fork", "icon": "icon-code-fork",
"idx": 1, "idx": 1,
"modified": "2014-05-27 03:49:08.179137", "modified": "2015-02-05 05:11:35.266252",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Branch", "name": "Branch",
@ -36,6 +36,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "HR User", "role": "HR User",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
}, },
@ -48,6 +49,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "HR Manager", "role": "HR Manager",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
} }

View File

@ -30,7 +30,7 @@
], ],
"icon": "icon-flag", "icon": "icon-flag",
"idx": 1, "idx": 1,
"modified": "2014-05-27 03:49:09.624972", "modified": "2015-02-05 05:11:37.070363",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Deduction Type", "name": "Deduction Type",
@ -46,6 +46,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "HR User", "role": "HR User",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
} }

View File

@ -29,7 +29,7 @@
], ],
"icon": "icon-sitemap", "icon": "icon-sitemap",
"idx": 1, "idx": 1,
"modified": "2014-05-27 03:49:10.061057", "modified": "2015-02-05 05:11:37.460611",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Department", "name": "Department",
@ -45,6 +45,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "HR User", "role": "HR User",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
} }

View File

@ -20,7 +20,7 @@
], ],
"icon": "icon-bookmark", "icon": "icon-bookmark",
"idx": 1, "idx": 1,
"modified": "2014-05-27 03:49:10.099099", "modified": "2015-02-05 05:11:37.500898",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Designation", "name": "Designation",
@ -36,6 +36,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "HR User", "role": "HR User",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
} }

View File

@ -31,7 +31,7 @@
], ],
"icon": "icon-flag", "icon": "icon-flag",
"idx": 1, "idx": 1,
"modified": "2014-07-31 07:25:26.606030", "modified": "2015-02-05 05:11:37.761378",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Earning Type", "name": "Earning Type",
@ -47,6 +47,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "HR User", "role": "HR User",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
} }

View File

@ -674,7 +674,7 @@
], ],
"icon": "icon-user", "icon": "icon-user",
"idx": 1, "idx": 1,
"modified": "2015-01-07 14:37:39.988374", "modified": "2015-02-05 05:11:38.234802",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Employee", "name": "Employee",
@ -705,6 +705,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "HR User", "role": "HR User",
"share": 1,
"submit": 0, "submit": 0,
"user_permission_doctypes": "[\"Branch\",\"Company\",\"Department\",\"Designation\"]", "user_permission_doctypes": "[\"Branch\",\"Company\",\"Department\",\"Designation\"]",
"write": 1 "write": 1
@ -720,6 +721,7 @@
"report": 1, "report": 1,
"role": "HR Manager", "role": "HR Manager",
"set_user_permissions": 1, "set_user_permissions": 1,
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
} }

View File

@ -51,8 +51,6 @@ class Employee(Document):
self.update_user() self.update_user()
self.update_user_permissions() self.update_user_permissions()
self.update_dob_event()
def update_user_permissions(self): def update_user_permissions(self):
frappe.permissions.add_user_permission("Employee", self.name, self.user_id) frappe.permissions.add_user_permission("Employee", self.name, self.user_id)
frappe.permissions.set_user_permission_if_allowed("Company", self.company, self.user_id) frappe.permissions.set_user_permission_if_allowed("Company", self.company, self.user_id)
@ -60,7 +58,7 @@ class Employee(Document):
def update_user(self): def update_user(self):
# add employee role if missing # add employee role if missing
user = frappe.get_doc("User", self.user_id) user = frappe.get_doc("User", self.user_id)
user.ignore_permissions = True user.flags.ignore_permissions = True
if "Employee" not in user.get("user_roles"): if "Employee" not in user.get("user_roles"):
user.add_roles("Employee") user.add_roles("Employee")
@ -136,8 +134,6 @@ class Employee(Document):
throw(_("User {0} is already assigned to Employee {1}").format(self.user_id, employee[0])) throw(_("User {0} is already assigned to Employee {1}").format(self.user_id, employee[0]))
def validate_employee_leave_approver(self): def validate_employee_leave_approver(self):
from erpnext.hr.doctype.leave_application.leave_application import InvalidLeaveApproverError
for l in self.get("leave_approvers")[:]: for l in self.get("leave_approvers")[:]:
if "Leave Approver" not in frappe.get_roles(l.leave_approver): if "Leave Approver" not in frappe.get_roles(l.leave_approver):
self.get("leave_approvers").remove(l) self.get("leave_approvers").remove(l)
@ -147,39 +143,6 @@ class Employee(Document):
if self.reports_to == self.name: if self.reports_to == self.name:
throw(_("Employee cannot report to himself.")) throw(_("Employee cannot report to himself."))
def update_dob_event(self):
if self.status == "Active" and self.date_of_birth \
and not cint(frappe.db.get_value("HR Settings", None, "stop_birthday_reminders")):
birthday_event = frappe.db.sql("""select name from `tabEvent` where repeat_on='Every Year'
and ref_type='Employee' and ref_name=%s""", self.name)
starts_on = self.date_of_birth + " 00:00:00"
ends_on = self.date_of_birth + " 00:15:00"
if birthday_event:
event = frappe.get_doc("Event", birthday_event[0][0])
event.starts_on = starts_on
event.ends_on = ends_on
event.save()
else:
frappe.get_doc({
"doctype": "Event",
"subject": _("Birthday") + ": " + self.employee_name,
"description": _("Happy Birthday!") + " " + self.employee_name,
"starts_on": starts_on,
"ends_on": ends_on,
"event_type": "Public",
"all_day": 1,
"send_reminder": 1,
"repeat_this_event": 1,
"repeat_on": "Every Year",
"ref_type": "Employee",
"ref_name": self.name
}).insert()
else:
frappe.db.sql("""delete from `tabEvent` where repeat_on='Every Year' and
ref_type='Employee' and ref_name=%s""", self.name)
def on_trash(self): def on_trash(self):
delete_events(self.doctype, self.name) delete_events(self.doctype, self.name)
@ -217,3 +180,31 @@ def update_user_permissions(doc, method):
if "Employee" in [d.role for d in doc.get("user_roles")]: if "Employee" in [d.role for d in doc.get("user_roles")]:
employee = frappe.get_doc("Employee", {"user_id": doc.name}) employee = frappe.get_doc("Employee", {"user_id": doc.name})
employee.update_user_permissions() employee.update_user_permissions()
def send_birthday_reminders():
"""Send Employee birthday reminders if no 'Stop Birthday Reminders' is not set."""
if int(frappe.db.get_single_value("HR Settings", "stop_birthday_reminders") or 0):
return
from frappe.utils.user import get_enabled_system_users
users = None
birthdays = get_employees_who_are_born_today()
if birthdays:
if not users:
users = [u.email_id or u.name for u in get_enabled_system_users()]
for e in birthdays:
frappe.sendmail(recipients=filter(lambda u: u not in (e.company_email, e.personal_email), users),
subject=_("Birthday Reminder for {0}").format(e.employee_name),
message=_("""Today is {0}'s birthday!""").format(e.employee_name),
reply_to=e.company_email or e.personal_email,
bulk=True)
def get_employees_who_are_born_today():
"""Get Employee properties whose birthday is today."""
return frappe.db.sql("""select name, personal_email, company_email, employee_name
from tabEmployee where day(date_of_birth) = day(curdate())
and month(date_of_birth) = month(curdate())
and status = 'Active'""", as_dict=True)

View File

@ -3,4 +3,31 @@
import frappe import frappe
test_records = frappe.get_test_records('Employee') import unittest
import frappe.utils
test_records = frappe.get_test_records('Employee')
class TestEmployee(unittest.TestCase):
def test_birthday_reminders(self):
employee = frappe.get_doc("Employee", frappe.db.sql_list("select name from tabEmployee limit 1")[0])
employee.date_of_birth = "1990" + frappe.utils.nowdate()[4:]
employee.company_email = "test@example.com"
employee.save()
from erpnext.hr.doctype.employee.employee import get_employees_who_are_born_today, send_birthday_reminders
self.assertTrue(employee.name in [e.name for e in get_employees_who_are_born_today()])
frappe.db.sql("delete from `tabBulk Email`")
hr_settings = frappe.get_doc("HR Settings", "HR Settings")
hr_settings.stop_birthday_reminders = 0
hr_settings.save()
send_birthday_reminders()
bulk_mails = frappe.db.sql("""select * from `tabBulk Email`""", as_dict=True)
self.assertTrue("Subject: Birthday Reminder for {0}".format(employee.employee_name) \
in bulk_mails[0].message)

View File

@ -20,7 +20,7 @@
], ],
"icon": "icon-flag", "icon": "icon-flag",
"idx": 1, "idx": 1,
"modified": "2015-01-15 15:24:46.680451", "modified": "2015-02-05 05:11:38.516592",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Employment Type", "name": "Employment Type",
@ -36,6 +36,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "HR User", "role": "HR User",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
}, },
@ -48,6 +49,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "HR Manager", "role": "HR Manager",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
} }

View File

@ -202,7 +202,7 @@
"icon": "icon-money", "icon": "icon-money",
"idx": 1, "idx": 1,
"is_submittable": 1, "is_submittable": 1,
"modified": "2015-01-07 11:31:12.783147", "modified": "2015-02-05 05:11:38.702422",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Expense Claim", "name": "Expense Claim",
@ -218,6 +218,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Employee", "role": "Employee",
"share": 1,
"write": 1 "write": 1
}, },
{ {
@ -235,6 +236,7 @@
"report": 1, "report": 1,
"role": "HR Manager", "role": "HR Manager",
"set_user_permissions": 0, "set_user_permissions": 0,
"share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
}, },
@ -250,6 +252,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Expense Approver", "role": "Expense Approver",
"share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
}, },
@ -265,6 +268,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "HR User", "role": "HR User",
"share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
} }

View File

@ -1,7 +1,7 @@
{ {
"allow_import": 1, "allow_import": 1,
"autoname": "field:expense_type", "autoname": "field:expense_type",
"creation": "2012-03-27 14:35:55.000000", "creation": "2012-03-27 14:35:55",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"document_type": "Master", "document_type": "Master",
@ -29,7 +29,7 @@
], ],
"icon": "icon-flag", "icon": "icon-flag",
"idx": 1, "idx": 1,
"modified": "2013-12-20 19:24:07.000000", "modified": "2015-02-05 05:11:38.794964",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Expense Claim Type", "name": "Expense Claim Type",
@ -43,6 +43,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "HR Manager", "role": "HR Manager",
"share": 1,
"write": 1 "write": 1
} }
] ]

View File

@ -74,7 +74,7 @@
], ],
"icon": "icon-calendar", "icon": "icon-calendar",
"idx": 1, "idx": 1,
"modified": "2015-01-15 15:26:20.031592", "modified": "2015-02-05 05:11:39.099428",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Holiday List", "name": "Holiday List",
@ -90,6 +90,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "HR Manager", "role": "HR Manager",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
} }

View File

@ -1,5 +1,5 @@
{ {
"creation": "2013-08-02 13:45:23.000000", "creation": "2013-08-02 13:45:23",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"document_type": "Other", "document_type": "Other",
@ -43,7 +43,7 @@
"icon": "icon-cog", "icon": "icon-cog",
"idx": 1, "idx": 1,
"issingle": 1, "issingle": 1,
"modified": "2014-02-19 17:40:18.000001", "modified": "2015-02-05 05:11:39.153447",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "HR Settings", "name": "HR Settings",
@ -56,6 +56,7 @@
"print": 1, "print": 1,
"read": 1, "read": 1,
"role": "System Manager", "role": "System Manager",
"share": 1,
"write": 1 "write": 1
} }
] ]

View File

@ -6,30 +6,10 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe.utils import cint
from frappe.model.document import Document from frappe.model.document import Document
class HRSettings(Document): class HRSettings(Document):
def validate(self): def validate(self):
self.update_birthday_reminders()
from erpnext.setup.doctype.naming_series.naming_series import set_by_naming_series from erpnext.setup.doctype.naming_series.naming_series import set_by_naming_series
set_by_naming_series("Employee", "employee_number", set_by_naming_series("Employee", "employee_number",
self.get("emp_created_by")=="Naming Series", hide_name_field=True) self.get("emp_created_by")=="Naming Series", hide_name_field=True)
def update_birthday_reminders(self):
original_stop_birthday_reminders = cint(frappe.db.get_value("HR Settings",
None, "stop_birthday_reminders"))
# reset birthday reminders
if cint(self.stop_birthday_reminders) != original_stop_birthday_reminders:
frappe.db.sql("""delete from `tabEvent` where repeat_on='Every Year' and ref_type='Employee'""")
if not self.stop_birthday_reminders:
for employee in frappe.db.sql_list("""select name from `tabEmployee` where status='Active' and
ifnull(date_of_birth, '')!=''"""):
frappe.get_doc("Employee", employee).update_dob_event()
frappe.msgprint(frappe._("Updated Birthday Reminders"))

View File

@ -65,7 +65,7 @@
], ],
"icon": "icon-user", "icon": "icon-user",
"idx": 1, "idx": 1,
"modified": "2015-01-07 14:52:03.446405", "modified": "2015-02-05 05:11:40.029237",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Job Applicant", "name": "Job Applicant",
@ -81,6 +81,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "HR User", "role": "HR User",
"share": 1,
"write": 1 "write": 1
} }
] ]

View File

@ -11,3 +11,7 @@ from frappe.utils import extract_email_id
class JobApplicant(Document): class JobApplicant(Document):
def validate(self): def validate(self):
self.set_status() self.set_status()
def set_sender(self, sender):
"""Will be called by **Communication** when a Job Application is created from an incoming email."""
self.email_id = sender

View File

@ -33,7 +33,7 @@
], ],
"icon": "icon-bookmark", "icon": "icon-bookmark",
"idx": 1, "idx": 1,
"modified": "2014-05-27 03:49:12.248194", "modified": "2015-02-05 05:11:40.083704",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Job Opening", "name": "Job Opening",
@ -49,6 +49,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "HR User", "role": "HR User",
"share": 1,
"write": 1 "write": 1
} }
] ]

View File

@ -137,7 +137,7 @@
"icon": "icon-ok", "icon": "icon-ok",
"idx": 1, "idx": 1,
"is_submittable": 1, "is_submittable": 1,
"modified": "2014-06-23 07:55:48.989894", "modified": "2015-02-05 05:11:40.529337",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Leave Allocation", "name": "Leave Allocation",
@ -155,6 +155,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "HR User", "role": "HR User",
"share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
}, },
@ -169,6 +170,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "HR Manager", "role": "HR Manager",
"share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
} }

View File

@ -192,7 +192,7 @@
"idx": 1, "idx": 1,
"is_submittable": 1, "is_submittable": 1,
"max_attachments": 3, "max_attachments": 3,
"modified": "2015-01-07 14:40:16.244403", "modified": "2015-02-05 05:11:40.611487",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Leave Application", "name": "Leave Application",
@ -208,6 +208,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Employee", "role": "Employee",
"share": 1,
"user_permission_doctypes": "[\"Company\",\"Employee\",\"Fiscal Year\",\"Leave Application\"]", "user_permission_doctypes": "[\"Company\",\"Employee\",\"Fiscal Year\",\"Leave Application\"]",
"write": 1 "write": 1
}, },
@ -225,6 +226,7 @@
"report": 1, "report": 1,
"role": "HR Manager", "role": "HR Manager",
"set_user_permissions": 1, "set_user_permissions": 1,
"share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
}, },
@ -252,6 +254,7 @@
"report": 1, "report": 1,
"role": "HR User", "role": "HR User",
"set_user_permissions": 1, "set_user_permissions": 1,
"share": 1,
"submit": 1, "submit": 1,
"user_permission_doctypes": "[\"Company\"]", "user_permission_doctypes": "[\"Company\"]",
"write": 1 "write": 1
@ -268,6 +271,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Leave Approver", "role": "Leave Approver",
"share": 1,
"submit": 1, "submit": 1,
"user_permission_doctypes": "[\"Company\",\"User\"]", "user_permission_doctypes": "[\"Company\",\"User\"]",
"write": 1 "write": 1

View File

@ -72,7 +72,7 @@
], ],
"icon": "icon-calendar", "icon": "icon-calendar",
"idx": 1, "idx": 1,
"modified": "2014-05-27 03:49:13.198735", "modified": "2015-02-05 05:11:40.729590",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Leave Block List", "name": "Leave Block List",
@ -86,6 +86,7 @@
"print": 1, "print": 1,
"read": 1, "read": 1,
"role": "HR User", "role": "HR User",
"share": 1,
"write": 1 "write": 1
} }
] ]

View File

@ -98,7 +98,7 @@
"icon": "icon-cog", "icon": "icon-cog",
"idx": 1, "idx": 1,
"issingle": 1, "issingle": 1,
"modified": "2014-05-09 02:16:44.996178", "modified": "2015-02-05 05:11:40.791976",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Leave Control Panel", "name": "Leave Control Panel",
@ -110,6 +110,7 @@
"read": 1, "read": 1,
"report": 0, "report": 0,
"role": "HR User", "role": "HR User",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
} }

View File

@ -63,7 +63,7 @@
], ],
"icon": "icon-flag", "icon": "icon-flag",
"idx": 1, "idx": 1,
"modified": "2015-01-15 12:37:30.557739", "modified": "2015-02-05 05:11:40.849495",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Leave Type", "name": "Leave Type",
@ -79,6 +79,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "HR User", "role": "HR User",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
}, },
@ -91,6 +92,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "HR Manager", "role": "HR Manager",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
}, },

View File

@ -2,9 +2,9 @@
// License: GNU General Public License v3. See license.txt // License: GNU General Public License v3. See license.txt
var display_activity_log = function(msg) { var display_activity_log = function(msg) {
if(!pscript.ss_html) if(!cur_frm.ss_html)
pscript.ss_html = $a(cur_frm.fields_dict['activity_log'].wrapper,'div'); cur_frm.ss_html = $a(cur_frm.fields_dict['activity_log'].wrapper,'div');
pscript.ss_html.innerHTML = cur_frm.ss_html.innerHTML =
'<div class="panel"><div class="panel-heading">'+__("Activity Log:")+'</div>'+msg+'</div>'; '<div class="panel"><div class="panel-heading">'+__("Activity Log:")+'</div>'+msg+'</div>';
} }

View File

@ -1,163 +1,164 @@
{ {
"allow_copy": 1, "allow_copy": 1,
"allow_email": 1, "allow_email": 1,
"allow_print": 1, "allow_print": 1,
"creation": "2012-03-27 14:35:59", "creation": "2012-03-27 14:35:59",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"document_type": "Other", "document_type": "Other",
"fields": [ "fields": [
{ {
"fieldname": "document_description", "fieldname": "document_description",
"fieldtype": "HTML", "fieldtype": "HTML",
"label": "Document Description", "label": "Document Description",
"options": "<div class=\"alert alert-info\">You can generate multiple salary slips based on the selected criteria, submit and mail those to the employee directly from here</div>", "options": "<div class=\"alert alert-info\">You can generate multiple salary slips based on the selected criteria, submit and mail those to the employee directly from here</div>",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "section_break0", "fieldname": "section_break0",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "column_break0", "fieldname": "column_break0",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"permlevel": 0, "permlevel": 0,
"width": "50%" "width": "50%"
}, },
{ {
"fieldname": "company", "fieldname": "company",
"fieldtype": "Link", "fieldtype": "Link",
"in_list_view": 1, "in_list_view": 1,
"label": "Company", "label": "Company",
"options": "Company", "options": "Company",
"permlevel": 0, "permlevel": 0,
"reqd": 1 "reqd": 1
}, },
{ {
"fieldname": "branch", "fieldname": "branch",
"fieldtype": "Link", "fieldtype": "Link",
"in_list_view": 1, "in_list_view": 1,
"label": "Branch", "label": "Branch",
"options": "Branch", "options": "Branch",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "department", "fieldname": "department",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Department", "label": "Department",
"options": "Department", "options": "Department",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "designation", "fieldname": "designation",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Designation", "label": "Designation",
"options": "Designation", "options": "Designation",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "column_break1", "fieldname": "column_break1",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"permlevel": 0, "permlevel": 0,
"width": "50%" "width": "50%"
}, },
{ {
"fieldname": "fiscal_year", "fieldname": "fiscal_year",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Fiscal Year", "label": "Fiscal Year",
"options": "Fiscal Year", "options": "Fiscal Year",
"permlevel": 0, "permlevel": 0,
"reqd": 1 "reqd": 1
}, },
{ {
"fieldname": "month", "fieldname": "month",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Month", "label": "Month",
"options": "\n01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12", "options": "\n01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12",
"permlevel": 0, "permlevel": 0,
"reqd": 1 "reqd": 1
}, },
{ {
"description": "Check if you want to send salary slip in mail to each employee while submitting salary slip", "description": "Check if you want to send salary slip in mail to each employee while submitting salary slip",
"fieldname": "send_email", "fieldname": "send_email",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Send Email", "label": "Send Email",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "section_break1", "fieldname": "section_break1",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "column_break2", "fieldname": "column_break2",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"permlevel": 0, "permlevel": 0,
"width": "50%" "width": "50%"
}, },
{ {
"description": "Creates salary slip for above mentioned criteria.", "description": "Creates salary slip for above mentioned criteria.",
"fieldname": "create_salary_slip", "fieldname": "create_salary_slip",
"fieldtype": "Button", "fieldtype": "Button",
"label": "Create Salary Slip", "label": "Create Salary Slip",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "column_break3", "fieldname": "column_break3",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"permlevel": 0, "permlevel": 0,
"width": "25%" "width": "25%"
}, },
{ {
"description": "Submit all salary slips for the above selected criteria", "description": "Submit all salary slips for the above selected criteria",
"fieldname": "submit_salary_slip", "fieldname": "submit_salary_slip",
"fieldtype": "Button", "fieldtype": "Button",
"label": "Submit Salary Slip", "label": "Submit Salary Slip",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "column_break4", "fieldname": "column_break4",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"permlevel": 0, "permlevel": 0,
"width": "25%" "width": "25%"
}, },
{ {
"description": "Create Bank Entry for the total salary paid for the above selected criteria", "description": "Create Bank Entry for the total salary paid for the above selected criteria",
"fieldname": "make_bank_entry", "fieldname": "make_bank_entry",
"fieldtype": "Button", "fieldtype": "Button",
"label": "Make Bank Entry", "label": "Make Bank Entry",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "section_break2", "fieldname": "section_break2",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "activity_log", "fieldname": "activity_log",
"fieldtype": "HTML", "fieldtype": "HTML",
"label": "Activity Log", "label": "Activity Log",
"permlevel": 0 "permlevel": 0
} }
], ],
"icon": "icon-cog", "icon": "icon-cog",
"idx": 1, "idx": 1,
"issingle": 1, "issingle": 1,
"modified": "2014-12-25 06:46:39.437061", "modified": "2015-02-05 05:11:44.876131",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Salary Manager", "name": "Salary Manager",
"owner": "Administrator", "owner": "Administrator",
"permissions": [ "permissions": [
{ {
"create": 1, "create": 1,
"permlevel": 0, "permlevel": 0,
"read": 1, "read": 1,
"role": "HR Manager", "role": "HR Manager",
"share": 1,
"write": 1 "write": 1
} }
], ],
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC" "sort_order": "DESC"
} }

View File

@ -337,7 +337,7 @@
"icon": "icon-file-text", "icon": "icon-file-text",
"idx": 1, "idx": 1,
"is_submittable": 1, "is_submittable": 1,
"modified": "2015-01-07 14:49:28.835615", "modified": "2015-02-05 05:11:44.967827",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Salary Slip", "name": "Salary Slip",
@ -354,6 +354,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "HR User", "role": "HR User",
"share": 1,
"submit": 1, "submit": 1,
"user_permission_doctypes": "[\"Branch\",\"Company\",\"Department\",\"Designation\",\"Fiscal Year\",\"Salary Slip\"]", "user_permission_doctypes": "[\"Branch\",\"Company\",\"Department\",\"Designation\",\"Fiscal Year\",\"Salary Slip\"]",
"write": 1 "write": 1
@ -369,6 +370,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "HR Manager", "role": "HR Manager",
"share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
}, },

View File

@ -45,7 +45,7 @@ class SalarySlip(TransactionBase):
def get_leave_details(self, lwp=None): def get_leave_details(self, lwp=None):
if not self.fiscal_year: if not self.fiscal_year:
self.fiscal_year = frappe.get_default("fiscal_year") self.fiscal_year = frappe.db.get_default("fiscal_year")
if not self.month: if not self.month:
self.month = "%02d" % getdate(nowdate()).month self.month = "%02d" % getdate(nowdate()).month

View File

@ -227,7 +227,7 @@
], ],
"icon": "icon-file-text", "icon": "icon-file-text",
"idx": 1, "idx": 1,
"modified": "2014-12-24 16:39:45.518474", "modified": "2015-02-05 05:11:45.120566",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Salary Structure", "name": "Salary Structure",
@ -243,6 +243,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "HR User", "role": "HR User",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
}, },
@ -255,6 +256,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "HR Manager", "role": "HR Manager",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
} }

View File

@ -1,5 +1,5 @@
{ {
"creation": "2013-01-25 11:34:53.000000", "creation": "2013-01-25 11:34:53",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"fields": [ "fields": [
@ -57,7 +57,7 @@
"idx": 1, "idx": 1,
"issingle": 1, "issingle": 1,
"max_attachments": 1, "max_attachments": 1,
"modified": "2013-12-20 19:21:54.000000", "modified": "2015-02-05 05:11:48.540845",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Upload Attendance", "name": "Upload Attendance",
@ -71,6 +71,7 @@
"read": 1, "read": 1,
"report": 0, "report": 0,
"role": "HR User", "role": "HR User",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
}, },
@ -82,6 +83,7 @@
"read": 1, "read": 1,
"report": 0, "report": 0,
"role": "HR Manager", "role": "HR Manager",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
} }

View File

@ -10,9 +10,6 @@ cur_frm.cscript.refresh = function(doc,dt,dn){
cur_frm.add_custom_button(__("Update Cost"), cur_frm.cscript.update_cost, cur_frm.add_custom_button(__("Update Cost"), cur_frm.cscript.update_cost,
"icon-money", "btn-default"); "icon-money", "btn-default");
} }
cur_frm.cscript.with_operations(doc);
erpnext.bom.set_operation(doc);
} }
cur_frm.cscript.update_cost = function() { cur_frm.cscript.update_cost = function() {
@ -25,29 +22,8 @@ cur_frm.cscript.update_cost = function() {
}) })
} }
cur_frm.cscript.with_operations = function(doc) {
cur_frm.fields_dict["items"].grid.set_column_disp("operation", doc.with_operations);
cur_frm.fields_dict["items"].grid.toggle_reqd("operation", doc.with_operations);
}
erpnext.bom.set_operation = function(doc) {
var op_table = doc["operations"] || [];
var operations = [];
for (var i=0, j=op_table.length; i<j; i++) {
operations[i] = (i+1);
}
frappe.meta.get_docfield("BOM Item", "operation", cur_frm.docname).options = operations.join("\n");
refresh_field("items");
}
cur_frm.cscript.operations_remove = function(){
erpnext.bom.set_operation(doc);
}
cur_frm.add_fetch("item", "description", "description"); cur_frm.add_fetch("item", "description", "description");
cur_frm.add_fetch("item", "item_name", "item_name");
cur_frm.add_fetch("item", "stock_uom", "uom"); cur_frm.add_fetch("item", "stock_uom", "uom");
@ -196,7 +172,6 @@ frappe.ui.form.on("BOM Operation", "operation", function(frm, cdt, cdn) {
callback: function (data) { callback: function (data) {
frappe.model.set_value(d.doctype, d.name, "opn_description", data.message.opn_description); frappe.model.set_value(d.doctype, d.name, "opn_description", data.message.opn_description);
frappe.model.set_value(d.doctype, d.name, "workstation", data.message.workstation); frappe.model.set_value(d.doctype, d.name, "workstation", data.message.workstation);
erpnext.bom.set_operation(frm.doc);
} }
}) })
}); });
@ -217,3 +192,13 @@ frappe.ui.form.on("BOM Operation", "workstation", function(frm, cdt, cdn) {
} }
}) })
}); });
frappe.ui.form.on("BOM Operation", "operations_remove", function(frm) {
erpnext.bom.calculate_op_cost(frm.doc);
erpnext.bom.calculate_total(frm.doc);
});
frappe.ui.form.on("BOM Item", "items_remove", function(frm) {
erpnext.bom.calculate_rm_cost(frm.doc);
erpnext.bom.calculate_total(frm.doc);
});

View File

@ -21,6 +21,33 @@
"reqd": 1, "reqd": 1,
"search_index": 1 "search_index": 1
}, },
{
"fieldname": "item_name",
"fieldtype": "Data",
"label": "Item Name",
"permlevel": 0,
"precision": ""
},
{
"fieldname": "rm_cost_as_per",
"fieldtype": "Select",
"label": "Rate Of Materials Based On",
"options": "Valuation Rate\nLast Purchase Rate\nPrice List",
"permlevel": 0
},
{
"depends_on": "eval:doc.rm_cost_as_per===\"Price List\"",
"fieldname": "buying_price_list",
"fieldtype": "Link",
"label": "Price List",
"options": "Price List",
"permlevel": 0
},
{
"fieldname": "cb0",
"fieldtype": "Column Break",
"permlevel": 0
},
{ {
"allow_on_submit": 1, "allow_on_submit": 1,
"default": "1", "default": "1",
@ -47,11 +74,6 @@
"oldfieldtype": "Check", "oldfieldtype": "Check",
"permlevel": 0 "permlevel": 0
}, },
{
"fieldname": "cb0",
"fieldtype": "Column Break",
"permlevel": 0
},
{ {
"description": "Manage cost of operations", "description": "Manage cost of operations",
"fieldname": "with_operations", "fieldname": "with_operations",
@ -59,21 +81,6 @@
"label": "With Operations", "label": "With Operations",
"permlevel": 0 "permlevel": 0
}, },
{
"fieldname": "rm_cost_as_per",
"fieldtype": "Select",
"label": "Rate Of Materials Based On",
"options": "Valuation Rate\nLast Purchase Rate\nPrice List",
"permlevel": 0
},
{
"depends_on": "eval:doc.rm_cost_as_per===\"Price List\"",
"fieldname": "buying_price_list",
"fieldtype": "Link",
"label": "Price List",
"options": "Price List",
"permlevel": 0
},
{ {
"depends_on": "with_operations", "depends_on": "with_operations",
"description": "Specify the operations, operating cost and give a unique Operation no to your operations.", "description": "Specify the operations, operating cost and give a unique Operation no to your operations.",
@ -245,7 +252,7 @@
"is_submittable": 1, "is_submittable": 1,
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"modified": "2015-01-07 11:11:07.047695", "modified": "2015-02-05 05:11:35.113320",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Manufacturing", "module": "Manufacturing",
"name": "BOM", "name": "BOM",
@ -261,6 +268,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Manufacturing Manager", "role": "Manufacturing Manager",
"share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
}, },
@ -275,6 +283,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Manufacturing User", "role": "Manufacturing User",
"share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
} }

View File

@ -27,11 +27,12 @@ class BOM(Document):
self.validate_main_item() self.validate_main_item()
from erpnext.utilities.transaction_base import validate_uom_is_integer from erpnext.utilities.transaction_base import validate_uom_is_integer
validate_uom_is_integer(self, "stock_uom", "qty") validate_uom_is_integer(self, "stock_uom", "qty", "BOM Item")
self.validate_materials() self.validate_materials()
self.set_bom_material_details() self.set_bom_material_details()
self.calculate_cost() self.calculate_cost()
self.validate_operations()
def on_update(self): def on_update(self):
self.check_recursion() self.check_recursion()
@ -53,7 +54,7 @@ class BOM(Document):
self.manage_default_bom() self.manage_default_bom()
def get_item_det(self, item_code): def get_item_det(self, item_code):
item = frappe.db.sql("""select name, is_asset_item, is_purchase_item, item = frappe.db.sql("""select name, item_name, is_asset_item, is_purchase_item,
docstatus, description, is_sub_contracted_item, stock_uom, default_bom, docstatus, description, is_sub_contracted_item, stock_uom, default_bom,
last_purchase_rate last_purchase_rate
from `tabItem` where name=%s""", item_code, as_dict = 1) from `tabItem` where name=%s""", item_code, as_dict = 1)
@ -69,7 +70,7 @@ class BOM(Document):
def set_bom_material_details(self): def set_bom_material_details(self):
for item in self.get("items"): for item in self.get("items"):
ret = self.get_bom_material_detail({"item_code": item.item_code, "bom_no": item.bom_no, ret = self.get_bom_material_detail({"item_code": item.item_code, "item_name": item.item_name, "bom_no": item.bom_no,
"qty": item.qty}) "qty": item.qty})
for r in ret: for r in ret:
@ -93,6 +94,7 @@ class BOM(Document):
rate = self.get_rm_rate(args) rate = self.get_rm_rate(args)
ret_item = { ret_item = {
'item_name' : item and args['item_name'] or '',
'description' : item and args['description'] or '', 'description' : item and args['description'] or '',
'stock_uom' : item and args['stock_uom'] or '', 'stock_uom' : item and args['stock_uom'] or '',
'bom_no' : args['bom_no'], 'bom_no' : args['bom_no'],
@ -129,7 +131,7 @@ class BOM(Document):
d.rate = rate d.rate = rate
if self.docstatus == 1: if self.docstatus == 1:
self.ignore_validate_update_after_submit = True self.flags.ignore_validate_update_after_submit = True
self.calculate_cost() self.calculate_cost()
self.save() self.save()
@ -184,8 +186,6 @@ class BOM(Document):
def clear_operations(self): def clear_operations(self):
if not self.with_operations: if not self.with_operations:
self.set('operations', []) self.set('operations', [])
for d in self.get("items"):
d.operation = None
def validate_main_item(self): def validate_main_item(self):
""" Validate main FG item""" """ Validate main FG item"""
@ -193,29 +193,25 @@ class BOM(Document):
if not item: if not item:
frappe.throw(_("Item {0} does not exist in the system or has expired").format(self.item)) frappe.throw(_("Item {0} does not exist in the system or has expired").format(self.item))
else: else:
ret = frappe.db.get_value("Item", self.item, ["description", "stock_uom"]) ret = frappe.db.get_value("Item", self.item, ["description", "stock_uom", "item_name"])
self.description = ret[0] self.description = ret[0]
self.uom = ret[1] self.uom = ret[1]
self.item_name= ret[2]
def validate_materials(self): def validate_materials(self):
""" Validate raw material entries """ """ Validate raw material entries """
if not self.get('items'):
frappe.throw(_("Raw Materials cannot be blank."))
check_list = [] check_list = []
for m in self.get('items'): for m in self.get('items'):
if m.bom_no: if m.bom_no:
validate_bom_no(m.item_code, m.bom_no) validate_bom_no(m.item_code, m.bom_no)
if flt(m.qty) <= 0: if flt(m.qty) <= 0:
frappe.throw(_("Quantity required for Item {0} in row {1}").format(m.item_code, m.idx)) frappe.throw(_("Quantity required for Item {0} in row {1}").format(m.item_code, m.idx))
check_list.append(cstr(m.item_code))
self.check_if_item_repeated(m.item_code, m.operation, check_list) unique_chk_list = set(check_list)
if len(unique_chk_list) != len(check_list):
frappe.throw(_("Same item has been entered multiple times."))
def check_if_item_repeated(self, item, op, check_list):
if [cstr(item), cstr(op)] in check_list:
frappe.throw(_("Item {0} has been entered multiple times against same operation").format(item))
else:
check_list.append([cstr(item), cstr(op)])
def check_recursion(self): def check_recursion(self):
""" Check whether recursion occurs in any bom""" """ Check whether recursion occurs in any bom"""
@ -303,6 +299,7 @@ class BOM(Document):
else: else:
self.add_to_cur_exploded_items(frappe._dict({ self.add_to_cur_exploded_items(frappe._dict({
'item_code' : d.item_code, 'item_code' : d.item_code,
'item_name' : d.item_name,
'description' : d.description, 'description' : d.description,
'stock_uom' : d.stock_uom, 'stock_uom' : d.stock_uom,
'qty' : flt(d.qty), 'qty' : flt(d.qty),
@ -318,7 +315,7 @@ class BOM(Document):
def get_child_exploded_items(self, bom_no, qty): def get_child_exploded_items(self, bom_no, qty):
""" Add all items from Flat BOM of child BOM""" """ Add all items from Flat BOM of child BOM"""
# Did not use qty_consumed_per_unit in the query, as it leads to rounding loss # Did not use qty_consumed_per_unit in the query, as it leads to rounding loss
child_fb_items = frappe.db.sql("""select bom_item.item_code, bom_item.description, child_fb_items = frappe.db.sql("""select bom_item.item_code, bom_item.item_name, bom_item.description,
bom_item.stock_uom, bom_item.qty, bom_item.rate, bom_item.stock_uom, bom_item.qty, bom_item.rate,
ifnull(bom_item.qty, 0 ) / ifnull(bom.quantity, 1) as qty_consumed_per_unit ifnull(bom_item.qty, 0 ) / ifnull(bom.quantity, 1) as qty_consumed_per_unit
from `tabBOM Explosion Item` bom_item, tabBOM bom from `tabBOM Explosion Item` bom_item, tabBOM bom
@ -327,6 +324,7 @@ class BOM(Document):
for d in child_fb_items: for d in child_fb_items:
self.add_to_cur_exploded_items(frappe._dict({ self.add_to_cur_exploded_items(frappe._dict({
'item_code' : d['item_code'], 'item_code' : d['item_code'],
'item_name' : d['item_name'],
'description' : d['description'], 'description' : d['description'],
'stock_uom' : d['stock_uom'], 'stock_uom' : d['stock_uom'],
'qty' : d['qty_consumed_per_unit']*qty, 'qty' : d['qty_consumed_per_unit']*qty,
@ -356,6 +354,10 @@ class BOM(Document):
if act_pbom and act_pbom[0][0]: if act_pbom and act_pbom[0][0]:
frappe.throw(_("Cannot deactivate or cancel BOM as it is linked with other BOMs")) frappe.throw(_("Cannot deactivate or cancel BOM as it is linked with other BOMs"))
def validate_operations(self):
if self.with_operations and not self.get('operations'):
frappe.throw(_("Operations cannot be left blank."))
def get_bom_items_as_dict(bom, qty=1, fetch_exploded=1): def get_bom_items_as_dict(bom, qty=1, fetch_exploded=1):
item_dict = {} item_dict = {}

View File

@ -67,7 +67,6 @@
], ],
"items": [ "items": [
{ {
"operation": 1,
"amount": 5000.0, "amount": 5000.0,
"doctype": "BOM Item", "doctype": "BOM Item",
"item_code": "_Test Item", "item_code": "_Test Item",
@ -77,7 +76,6 @@
"stock_uom": "_Test UOM" "stock_uom": "_Test UOM"
}, },
{ {
"operation": 1,
"amount": 2000.0, "amount": 2000.0,
"bom_no": "BOM/_Test Item Home Desktop Manufactured/001", "bom_no": "BOM/_Test Item Home Desktop Manufactured/001",
"doctype": "BOM Item", "doctype": "BOM Item",
@ -108,7 +106,6 @@
], ],
"items": [ "items": [
{ {
"operation": 1,
"amount": 5000.0, "amount": 5000.0,
"doctype": "BOM Item", "doctype": "BOM Item",
"item_code": "_Test Item", "item_code": "_Test Item",

View File

@ -16,6 +16,21 @@
"permlevel": 0, "permlevel": 0,
"read_only": 1 "read_only": 1
}, },
{
"fieldname": "item_name",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Item Name",
"permlevel": 0,
"precision": "",
"read_only": 1
},
{
"fieldname": "column_break_2",
"fieldtype": "Column Break",
"permlevel": 0,
"precision": ""
},
{ {
"fieldname": "description", "fieldname": "description",
"fieldtype": "Text", "fieldtype": "Text",
@ -28,6 +43,12 @@
"read_only": 1, "read_only": 1,
"width": "300px" "width": "300px"
}, },
{
"fieldname": "section_break_4",
"fieldtype": "Section Break",
"permlevel": 0,
"precision": ""
},
{ {
"fieldname": "qty", "fieldname": "qty",
"fieldtype": "Float", "fieldtype": "Float",
@ -50,16 +71,21 @@
"read_only": 1 "read_only": 1
}, },
{ {
"fieldname": "amount", "fieldname": "qty_consumed_per_unit",
"fieldtype": "Currency", "fieldtype": "Float",
"hidden": 0,
"in_list_view": 1, "in_list_view": 1,
"label": "Amount", "label": "Qty Consumed Per Unit",
"oldfieldname": "amount_as_per_sr", "no_copy": 0,
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0, "permlevel": 0,
"read_only": 1 "read_only": 1
}, },
{
"fieldname": "column_break_8",
"fieldtype": "Column Break",
"permlevel": 0,
"precision": ""
},
{ {
"fieldname": "stock_uom", "fieldname": "stock_uom",
"fieldtype": "Link", "fieldtype": "Link",
@ -72,19 +98,20 @@
"read_only": 1 "read_only": 1
}, },
{ {
"fieldname": "qty_consumed_per_unit", "fieldname": "amount",
"fieldtype": "Float", "fieldtype": "Currency",
"hidden": 0,
"in_list_view": 1, "in_list_view": 1,
"label": "Qty Consumed Per Unit", "label": "Amount",
"no_copy": 0, "oldfieldname": "amount_as_per_sr",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0, "permlevel": 0,
"read_only": 1 "read_only": 1
} }
], ],
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"modified": "2014-12-12 11:18:01.745641", "modified": "2015-01-20 13:28:52.258152",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Manufacturing", "module": "Manufacturing",
"name": "BOM Explosion Item", "name": "BOM Explosion Item",

View File

@ -1,147 +1,145 @@
{ {
"creation": "2013-02-22 01:27:49", "creation": "2013-02-22 01:27:49",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"fields": [ "fields": [
{ {
"fieldname": "operation", "fieldname": "item_code",
"fieldtype": "Select", "fieldtype": "Link",
"in_list_view": 1, "in_filter": 1,
"label": "Operation", "in_list_view": 1,
"oldfieldname": "operation_no", "label": "Item Code",
"oldfieldtype": "Data", "oldfieldname": "item_code",
"permlevel": 0, "oldfieldtype": "Link",
"reqd": 0 "options": "Item",
}, "permlevel": 0,
{ "reqd": 1,
"fieldname": "item_code",
"fieldtype": "Link",
"in_filter": 1,
"in_list_view": 1,
"label": "Item Code",
"oldfieldname": "item_code",
"oldfieldtype": "Link",
"options": "Item",
"permlevel": 0,
"reqd": 1,
"search_index": 1 "search_index": 1
}, },
{ {
"fieldname": "bom_no", "fieldname": "item_name",
"fieldtype": "Link", "fieldtype": "Data",
"in_filter": 1, "in_list_view": 1,
"in_list_view": 1, "label": "Item Name",
"label": "BOM No", "permlevel": 0,
"oldfieldname": "bom_no", "precision": ""
"oldfieldtype": "Link", },
"options": "BOM", {
"permlevel": 0, "fieldname": "bom_no",
"print_width": "150px", "fieldtype": "Link",
"reqd": 0, "in_filter": 1,
"search_index": 1, "in_list_view": 0,
"label": "BOM No",
"oldfieldname": "bom_no",
"oldfieldtype": "Link",
"options": "BOM",
"permlevel": 0,
"print_width": "150px",
"reqd": 0,
"search_index": 1,
"width": "150px" "width": "150px"
}, },
{ {
"fieldname": "col_break1", "fieldname": "col_break1",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "description", "fieldname": "description",
"fieldtype": "Text", "fieldtype": "Text",
"label": "Item Description", "label": "Item Description",
"oldfieldname": "description", "oldfieldname": "description",
"oldfieldtype": "Text", "oldfieldtype": "Text",
"permlevel": 0, "permlevel": 0,
"print_width": "250px", "print_width": "250px",
"reqd": 0, "reqd": 0,
"width": "250px" "width": "250px"
}, },
{ {
"fieldname": "quantity_and_rate", "fieldname": "quantity_and_rate",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Quantity and Rate", "label": "Quantity and Rate",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "qty", "fieldname": "qty",
"fieldtype": "Float", "fieldtype": "Float",
"in_list_view": 1, "in_list_view": 1,
"label": "Qty", "label": "Qty",
"oldfieldname": "qty", "oldfieldname": "qty",
"oldfieldtype": "Currency", "oldfieldtype": "Currency",
"permlevel": 0, "permlevel": 0,
"reqd": 1 "reqd": 1
}, },
{ {
"description": "See \"Rate Of Materials Based On\" in Costing Section", "description": "See \"Rate Of Materials Based On\" in Costing Section",
"fieldname": "rate", "fieldname": "rate",
"fieldtype": "Currency", "fieldtype": "Currency",
"in_list_view": 1, "in_list_view": 1,
"label": "Rate", "label": "Rate",
"options": "Company:company:default_currency", "options": "Company:company:default_currency",
"permlevel": 0, "permlevel": 0,
"reqd": 1 "reqd": 1
}, },
{ {
"fieldname": "col_break2", "fieldname": "col_break2",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "stock_uom", "fieldname": "stock_uom",
"fieldtype": "Link", "fieldtype": "Link",
"in_list_view": 0, "in_list_view": 0,
"label": "Stock UOM", "label": "Stock UOM",
"oldfieldname": "stock_uom", "oldfieldname": "stock_uom",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"options": "UOM", "options": "UOM",
"permlevel": 0, "permlevel": 0,
"read_only": 1, "read_only": 1,
"reqd": 1 "reqd": 1
}, },
{ {
"fieldname": "amount", "fieldname": "amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"in_list_view": 1, "in_list_view": 1,
"label": "Amount", "label": "Amount",
"oldfieldname": "amount_as_per_mar", "oldfieldname": "amount_as_per_mar",
"oldfieldtype": "Currency", "oldfieldtype": "Currency",
"options": "Company:company:default_currency", "options": "Company:company:default_currency",
"permlevel": 0, "permlevel": 0,
"print_width": "150px", "print_width": "150px",
"read_only": 1, "read_only": 1,
"width": "150px" "width": "150px"
}, },
{ {
"fieldname": "scrap", "fieldname": "scrap",
"fieldtype": "Float", "fieldtype": "Float",
"label": "Scrap %", "label": "Scrap %",
"oldfieldname": "scrap", "oldfieldname": "scrap",
"oldfieldtype": "Currency", "oldfieldtype": "Currency",
"permlevel": 0, "permlevel": 0,
"print_hide": 1 "print_hide": 1
}, },
{ {
"fieldname": "qty_consumed_per_unit", "fieldname": "qty_consumed_per_unit",
"fieldtype": "Float", "fieldtype": "Float",
"hidden": 1, "hidden": 1,
"label": "Qty Consumed Per Unit", "label": "Qty Consumed Per Unit",
"oldfieldname": "qty_consumed_per_unit", "oldfieldname": "qty_consumed_per_unit",
"oldfieldtype": "Float", "oldfieldtype": "Float",
"permlevel": 0, "permlevel": 0,
"print_hide": 1, "print_hide": 1,
"read_only": 1 "read_only": 1
} }
], ],
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"modified": "2014-12-12 11:15:43.798755", "modified": "2015-01-20 13:28:35.152945",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Manufacturing", "module": "Manufacturing",
"name": "BOM Item", "name": "BOM Item",
"owner": "Administrator", "owner": "Administrator",
"permissions": [], "permissions": [],
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC" "sort_order": "DESC"
} }

View File

@ -2,7 +2,7 @@
"allow_copy": 1, "allow_copy": 1,
"allow_email": 1, "allow_email": 1,
"allow_print": 1, "allow_print": 1,
"creation": "2012-12-06 12:10:10.000000", "creation": "2012-12-06 12:10:10",
"description": "Replace a particular BOM in all other BOMs where it is used. It will replace the old BOM link, update cost and regenerate \"BOM Explosion Item\" table as per new BOM", "description": "Replace a particular BOM in all other BOMs where it is used. It will replace the old BOM link, update cost and regenerate \"BOM Explosion Item\" table as per new BOM",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
@ -43,7 +43,7 @@
"idx": 1, "idx": 1,
"in_create": 1, "in_create": 1,
"issingle": 1, "issingle": 1,
"modified": "2013-07-05 14:27:52.000000", "modified": "2015-02-05 05:11:35.233845",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Manufacturing", "module": "Manufacturing",
"name": "BOM Replace Tool", "name": "BOM Replace Tool",
@ -55,6 +55,7 @@
"read": 1, "read": 1,
"report": 0, "report": 0,
"role": "Manufacturing Manager", "role": "Manufacturing Manager",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
} }

View File

@ -51,7 +51,7 @@
"is_submittable": 0, "is_submittable": 0,
"issingle": 1, "issingle": 1,
"istable": 0, "istable": 0,
"modified": "2014-12-22 12:43:15.261503", "modified": "2015-02-05 05:11:41.192126",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Manufacturing", "module": "Manufacturing",
"name": "Manufacturing Settings", "name": "Manufacturing Settings",
@ -73,6 +73,7 @@
"report": 0, "report": 0,
"role": "Manufacturing Manager", "role": "Manufacturing Manager",
"set_user_permissions": 0, "set_user_permissions": 0,
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
} }

View File

@ -65,7 +65,7 @@
"is_submittable": 0, "is_submittable": 0,
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"modified": "2014-12-18 16:21:59.462435", "modified": "2015-02-05 05:11:41.666429",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Manufacturing", "module": "Manufacturing",
"name": "Operation", "name": "Operation",
@ -87,6 +87,7 @@
"report": 0, "report": 0,
"role": "Manufacturing User", "role": "Manufacturing User",
"set_user_permissions": 0, "set_user_permissions": 0,
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
}, },
@ -99,6 +100,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Manufacturing Manager", "role": "Manufacturing Manager",
"share": 1,
"write": 1 "write": 1
} }
], ],

View File

@ -7,6 +7,13 @@ $.extend(cur_frm.cscript, {
cfn_set_fields(doc, dt, dn); cfn_set_fields(doc, dt, dn);
this.frm.add_fetch("sales_order", "delivery_date", "expected_delivery_date"); this.frm.add_fetch("sales_order", "delivery_date", "expected_delivery_date");
if(doc.__islocal) {
cur_frm.set_value({
"actual_start_date": "",
"actual_end_date": ""
});
}
}, },
before_submit: function() { before_submit: function() {
@ -60,10 +67,14 @@ $.extend(cur_frm.cscript, {
bom_no: function() { bom_no: function() {
return this.frm.call({ return this.frm.call({
doc: this.frm.doc, doc: this.frm.doc,
method: "set_production_order_operations", method: "set_production_order_operations"
callback: function(r) { });
if(!r.exc) refresh_field("operations"); },
}
planned_start_date: function() {
return this.frm.call({
doc: this.frm.doc,
method: "plan_operations"
}); });
}, },

View File

@ -351,7 +351,7 @@
"idx": 1, "idx": 1,
"in_create": 0, "in_create": 0,
"is_submittable": 1, "is_submittable": 1,
"modified": "2015-01-08 12:59:51.111895", "modified": "2015-02-05 05:11:42.851377",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Manufacturing", "module": "Manufacturing",
"name": "Production Order", "name": "Production Order",
@ -369,6 +369,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Manufacturing User", "role": "Manufacturing User",
"share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
}, },

View File

@ -175,16 +175,17 @@ class ProductionOrder(Document):
self.calculate_operating_cost() self.calculate_operating_cost()
def plan_operations(self): def plan_operations(self):
scheduled_datetime = self.planned_start_date if self.planned_start_date:
for d in self.get('operations'): scheduled_datetime = self.planned_start_date
while getdate(scheduled_datetime) in self.get_holidays(d.workstation): for d in self.get('operations'):
scheduled_datetime = get_datetime(scheduled_datetime) + relativedelta(days=1) while getdate(scheduled_datetime) in self.get_holidays(d.workstation):
scheduled_datetime = get_datetime(scheduled_datetime) + relativedelta(days=1)
d.planned_start_time = scheduled_datetime d.planned_start_time = scheduled_datetime
scheduled_datetime = get_datetime(scheduled_datetime) + relativedelta(minutes=d.time_in_mins) scheduled_datetime = get_datetime(scheduled_datetime) + relativedelta(minutes=d.time_in_mins)
d.planned_end_time = scheduled_datetime d.planned_end_time = scheduled_datetime
self.planned_end_date = scheduled_datetime self.planned_end_date = scheduled_datetime
def get_holidays(self, workstation): def get_holidays(self, workstation):
@ -208,7 +209,16 @@ class ProductionOrder(Document):
d.status = "Completed" d.status = "Completed"
else: else:
frappe.throw(_("Completed Qty can not be greater than 'Qty to Manufacture'")) frappe.throw(_("Completed Qty can not be greater than 'Qty to Manufacture'"))
def set_actual_dates(self):
if self.get("operations"):
actual_date = frappe.db.sql("""select min(actual_start_time) as start_date, max(actual_end_time) as end_date from `tabProduction Order Operation`
where parent = %s and docstatus=1""", self.name, as_dict=1)[0]
self.actual_start_date = actual_date.start_date
self.actual_end_date = actual_date.end_date
else:
self.actual_start_date = None
self.actual_end_date = None
@frappe.whitelist() @frappe.whitelist()
def get_item_details(item): def get_item_details(item):
@ -281,6 +291,7 @@ def make_time_log(name, operation, from_time, to_time, qty=None, project=None,
time_log.project = project time_log.project = project
time_log.operation= operation time_log.operation= operation
time_log.workstation= workstation time_log.workstation= workstation
time_log.activity_type= "Manufacturing"
time_log.completed_qty = flt(qty) time_log.completed_qty = flt(qty)
if from_time and to_time : if from_time and to_time :
time_log.calculate_total_hours() time_log.calculate_total_hours()
@ -288,7 +299,7 @@ def make_time_log(name, operation, from_time, to_time, qty=None, project=None,
@frappe.whitelist() @frappe.whitelist()
def auto_make_time_log(production_order_id): def auto_make_time_log(production_order_id):
if frappe.db.get_value("Time Log", filters={"production_order": production_order_id}): if frappe.db.get_value("Time Log", filters={"production_order": production_order_id, "docstatus":1}):
frappe.throw(_("Time logs already exists against this Production Order")) frappe.throw(_("Time logs already exists against this Production Order"))
time_logs = [] time_logs = []

View File

@ -1,180 +1,181 @@
{ {
"creation": "2013-01-21 12:03:47", "creation": "2013-01-21 12:03:47",
"default_print_format": "Standard", "default_print_format": "Standard",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"fields": [ "fields": [
{ {
"description": "Select Sales Orders from which you want to create Production Orders.", "description": "Select Sales Orders from which you want to create Production Orders.",
"fieldname": "select_sales_orders", "fieldname": "select_sales_orders",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Select Sales Orders", "label": "Select Sales Orders",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "column_break0", "fieldname": "column_break0",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"permlevel": 0, "permlevel": 0,
"width": "50%" "width": "50%"
}, },
{ {
"fieldname": "fg_item", "fieldname": "fg_item",
"fieldtype": "Link", "fieldtype": "Link",
"in_list_view": 1, "in_list_view": 1,
"label": "Filter based on item", "label": "Filter based on item",
"options": "Item", "options": "Item",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "customer", "fieldname": "customer",
"fieldtype": "Link", "fieldtype": "Link",
"in_list_view": 1, "in_list_view": 1,
"label": "Filter based on customer", "label": "Filter based on customer",
"options": "Customer", "options": "Customer",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "company", "fieldname": "company",
"fieldtype": "Link", "fieldtype": "Link",
"in_list_view": 1, "in_list_view": 1,
"label": "Company", "label": "Company",
"options": "Company", "options": "Company",
"permlevel": 0, "permlevel": 0,
"reqd": 1 "reqd": 1
}, },
{ {
"fieldname": "column_break1", "fieldname": "column_break1",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"permlevel": 0, "permlevel": 0,
"width": "50%" "width": "50%"
}, },
{ {
"fieldname": "from_date", "fieldname": "from_date",
"fieldtype": "Date", "fieldtype": "Date",
"label": "From Date", "label": "From Date",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "to_date", "fieldname": "to_date",
"fieldtype": "Date", "fieldtype": "Date",
"label": "To Date", "label": "To Date",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "section_break1", "fieldname": "section_break1",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"options": "Simple", "options": "Simple",
"permlevel": 0 "permlevel": 0
}, },
{ {
"description": "Pull sales orders (pending to deliver) based on the above criteria", "description": "Pull sales orders (pending to deliver) based on the above criteria",
"fieldname": "get_sales_orders", "fieldname": "get_sales_orders",
"fieldtype": "Button", "fieldtype": "Button",
"label": "Get Sales Orders", "label": "Get Sales Orders",
"options": "get_open_sales_orders", "options": "get_open_sales_orders",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "sales_orders", "fieldname": "sales_orders",
"fieldtype": "Table", "fieldtype": "Table",
"label": "Sales Orders", "label": "Sales Orders",
"options": "Production Plan Sales Order", "options": "Production Plan Sales Order",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "items_for_production", "fieldname": "items_for_production",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Select Items", "label": "Select Items",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "get_items_from_so", "fieldname": "get_items_from_so",
"fieldtype": "Button", "fieldtype": "Button",
"label": "Get Items From Sales Orders", "label": "Get Items From Sales Orders",
"options": "get_items_from_so", "options": "get_items_from_so",
"permlevel": 0 "permlevel": 0
}, },
{ {
"default": "1", "default": "1",
"description": "If checked, BOM for sub-assembly items will be considered for getting raw materials. Otherwise, all sub-assembly items will be treated as a raw material.", "description": "If checked, BOM for sub-assembly items will be considered for getting raw materials. Otherwise, all sub-assembly items will be treated as a raw material.",
"fieldname": "use_multi_level_bom", "fieldname": "use_multi_level_bom",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Use Multi-Level BOM", "label": "Use Multi-Level BOM",
"permlevel": 0, "permlevel": 0,
"reqd": 0 "reqd": 0
}, },
{ {
"fieldname": "items", "fieldname": "items",
"fieldtype": "Table", "fieldtype": "Table",
"label": "Items", "label": "Items",
"options": "Production Plan Item", "options": "Production Plan Item",
"permlevel": 0 "permlevel": 0
}, },
{ {
"description": "Enter items and planned qty for which you want to raise production orders or download raw materials for analysis.", "description": "Enter items and planned qty for which you want to raise production orders or download raw materials for analysis.",
"fieldname": "create_production_orders", "fieldname": "create_production_orders",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Production Orders", "label": "Production Orders",
"permlevel": 0 "permlevel": 0
}, },
{ {
"description": "Separate production order will be created for each finished good item.", "description": "Separate production order will be created for each finished good item.",
"fieldname": "raise_production_order", "fieldname": "raise_production_order",
"fieldtype": "Button", "fieldtype": "Button",
"label": "Create Production Orders", "label": "Create Production Orders",
"options": "raise_production_order", "options": "raise_production_order",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "sb5", "fieldname": "sb5",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Material Requirement", "label": "Material Requirement",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "purchase_request_for_warehouse", "fieldname": "purchase_request_for_warehouse",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Material Request For Warehouse", "label": "Material Request For Warehouse",
"options": "Warehouse", "options": "Warehouse",
"permlevel": 0 "permlevel": 0
}, },
{ {
"description": "Items to be requested which are \"Out of Stock\" considering all warehouses based on projected qty and minimum order qty", "description": "Items to be requested which are \"Out of Stock\" considering all warehouses based on projected qty and minimum order qty",
"fieldname": "raise_purchase_request", "fieldname": "raise_purchase_request",
"fieldtype": "Button", "fieldtype": "Button",
"label": "Create Material Requests", "label": "Create Material Requests",
"options": "", "options": "",
"permlevel": 0 "permlevel": 0
}, },
{ {
"description": "Download a report containing all raw materials with their latest inventory status", "description": "Download a report containing all raw materials with their latest inventory status",
"fieldname": "download_materials_required", "fieldname": "download_materials_required",
"fieldtype": "Button", "fieldtype": "Button",
"label": "Download Materials Required", "label": "Download Materials Required",
"permlevel": 0 "permlevel": 0
} }
], ],
"icon": "icon-calendar", "icon": "icon-calendar",
"idx": 1, "idx": 1,
"in_create": 1, "in_create": 1,
"issingle": 1, "issingle": 1,
"modified": "2015-01-11 21:53:21.253556", "modified": "2015-02-05 05:11:43.010625",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Manufacturing", "module": "Manufacturing",
"name": "Production Planning Tool", "name": "Production Planning Tool",
"owner": "jai@webnotestech.com", "owner": "jai@webnotestech.com",
"permissions": [ "permissions": [
{ {
"create": 1, "create": 1,
"email": 1, "email": 1,
"permlevel": 0, "permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
"report": 0, "report": 0,
"role": "Manufacturing User", "role": "Manufacturing User",
"submit": 0, "share": 1,
"submit": 0,
"write": 1 "write": 1
} }
], ],
"read_only": 1 "read_only": 1
} }

View File

@ -394,7 +394,7 @@ class ProductionPlanningTool(Document):
"sales_order_no": sales_order if sales_order!="No Sales Order" else None "sales_order_no": sales_order if sales_order!="No Sales Order" else None
}) })
pr_doc.ignore_permissions = 1 pr_doc.flags.ignore_permissions = 1
pr_doc.submit() pr_doc.submit()
purchase_request_list.append(pr_doc.name) purchase_request_list.append(pr_doc.name)

View File

@ -138,7 +138,7 @@
], ],
"icon": "icon-wrench", "icon": "icon-wrench",
"idx": 1, "idx": 1,
"modified": "2014-12-24 14:47:06.676335", "modified": "2015-02-05 05:13:38.580439",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Manufacturing", "module": "Manufacturing",
"name": "Workstation", "name": "Workstation",
@ -154,6 +154,7 @@
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Manufacturing User", "role": "Manufacturing User",
"share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
} }

Some files were not shown because too many files have changed in this diff Show More