diff --git a/erpnext/accounts/doctype/cost_center/cost_center.json b/erpnext/accounts/doctype/cost_center/cost_center.json index 5f78a5ba8af..ba32439792e 100644 --- a/erpnext/accounts/doctype/cost_center/cost_center.json +++ b/erpnext/accounts/doctype/cost_center/cost_center.json @@ -10,6 +10,7 @@ "docstatus": 0, "doctype": "DocType", "document_type": "Setup", + "editable_grid": 0, "fields": [ { "allow_on_submit": 0, @@ -249,14 +250,15 @@ "hide_toolbar": 0, "icon": "icon-money", "idx": 1, - "in_create": 0, + "image_view": 0, + "in_create": 1, "in_dialog": 0, "is_submittable": 0, "issingle": 0, "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2016-05-16 15:23:14.770933", + "modified": "2016-10-18 14:22:00.207907", "modified_by": "Administrator", "module": "Accounts", "name": "Cost Center", @@ -368,6 +370,5 @@ "read_only_onload": 0, "search_fields": "parent_cost_center, is_group", "sort_order": "ASC", - "track_seen": 0, - "version": 0 + "track_seen": 0 } \ No newline at end of file diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index d741a6008af..042af0bcd3f 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -71,7 +71,7 @@ class PurchaseInvoice(BuyingController): frappe.throw(_("Cash or Bank Account is mandatory for making payment entry")) if flt(self.paid_amount) + flt(self.write_off_amount) \ - - flt(self.base_grand_total) > 1/(10**(self.precision("base_grand_total") + 1)): + - flt(self.grand_total) > 1/(10**(self.precision("base_grand_total") + 1)): frappe.throw(_("""Paid amount + Write Off Amount can not be greater than Grand Total""")) def create_remarks(self): diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_dashboard.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_dashboard.py index 9b950db91f0..d4a82c50e33 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_dashboard.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_dashboard.py @@ -1,31 +1,32 @@ from frappe import _ -data = { - 'fieldname': 'purchase_invoice', - 'non_standard_fieldnames': { - 'Delivery Note': 'against_sales_invoice', - 'Journal Entry': 'reference_name', - 'Payment Entry': 'reference_name', - 'Payment Request': 'reference_name', - 'Landed Cost Voucher': 'receipt_document', - 'Purchase Invoice': 'return_against' - }, - 'internal_links': { - 'Purchase Order': ['items', 'sales_order'], - 'Purchase Receipt': ['items', 'delivery_note'], - }, - 'transactions': [ - { - 'label': _('Payment'), - 'items': ['Payment Entry', 'Payment Request', 'Journal Entry'] +def get_data(): + return { + 'fieldname': 'purchase_invoice', + 'non_standard_fieldnames': { + 'Delivery Note': 'against_sales_invoice', + 'Journal Entry': 'reference_name', + 'Payment Entry': 'reference_name', + 'Payment Request': 'reference_name', + 'Landed Cost Voucher': 'receipt_document', + 'Purchase Invoice': 'return_against' }, - { - 'label': _('Reference'), - 'items': ['Purchase Order', 'Purchase Receipt', 'Asset', 'Landed Cost Voucher'] + 'internal_links': { + 'Purchase Order': ['items', 'sales_order'], + 'Purchase Receipt': ['items', 'delivery_note'], }, - { - 'label': _('Returns'), - 'items': ['Purchase Invoice'] - }, - ] -} \ No newline at end of file + 'transactions': [ + { + 'label': _('Payment'), + 'items': ['Payment Entry', 'Payment Request', 'Journal Entry'] + }, + { + 'label': _('Reference'), + 'items': ['Purchase Order', 'Purchase Receipt', 'Asset', 'Landed Cost Voucher'] + }, + { + 'label': _('Returns'), + 'items': ['Purchase Invoice'] + }, + ] + } \ No newline at end of file diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice_dashboard.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice_dashboard.py index f4943033572..20d46133fd2 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice_dashboard.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice_dashboard.py @@ -1,30 +1,31 @@ from frappe import _ -data = { - 'fieldname': 'sales_invoice', - 'non_standard_fieldnames': { - 'Delivery Note': 'against_sales_invoice', - 'Journal Entry': 'reference_name', - 'Payment Entry': 'reference_name', - 'Payment Request': 'reference_name', - 'Sales Invoice': 'return_against' - }, - 'internal_links': { - 'Sales Order': ['items', 'sales_order'], - 'Delivery Note': ['items', 'delivery_note'], - }, - 'transactions': [ - { - 'label': _('Payment'), - 'items': ['Payment Entry', 'Payment Request', 'Journal Entry'] +def get_data(): + return { + 'fieldname': 'sales_invoice', + 'non_standard_fieldnames': { + 'Delivery Note': 'against_sales_invoice', + 'Journal Entry': 'reference_name', + 'Payment Entry': 'reference_name', + 'Payment Request': 'reference_name', + 'Sales Invoice': 'return_against' }, - { - 'label': _('Reference'), - 'items': ['Timesheet', 'Delivery Note', 'Sales Order'] + 'internal_links': { + 'Sales Order': ['items', 'sales_order'], + 'Delivery Note': ['items', 'delivery_note'], }, - { - 'label': _('Returns'), - 'items': ['Sales Invoice'] - }, - ] -} \ No newline at end of file + 'transactions': [ + { + 'label': _('Payment'), + 'items': ['Payment Entry', 'Payment Request', 'Journal Entry'] + }, + { + 'label': _('Reference'), + 'items': ['Timesheet', 'Delivery Note', 'Sales Order'] + }, + { + 'label': _('Returns'), + 'items': ['Sales Invoice'] + }, + ] + } \ No newline at end of file diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js index b47d6f29f2d..dbcfc2a1f2a 100644 --- a/erpnext/accounts/page/pos/pos.js +++ b/erpnext/accounts/page/pos/pos.js @@ -93,7 +93,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ me.get_data_from_server(function(){ me.load_data(false); me.make_customer(); - me.make_item_list(true); + me.make_item_list(); me.set_missing_values(); }) }); @@ -269,7 +269,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ make: function() { this.make_search(); this.make_customer(); - this.make_item_list(true); + this.make_item_list(); this.make_discount_field() }, @@ -290,7 +290,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ this.search.$input.on("keyup", function() { setTimeout(function() { me.items = me.get_items(); - me.make_item_list(false); + me.make_item_list(); }, 1000); }); @@ -375,7 +375,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ } }, - make_item_list: function(index_search) { + make_item_list: function() { var me = this; if(!this.price_list) { msgprint(__("Price List not found or disabled")); @@ -389,7 +389,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ if (this.items) { $.each(this.items, function(index, obj) { - if(!index_search || index < 16){ + if(index < 30){ $(frappe.render_template("pos_item", { item_code: obj.name, item_price: format_currency(obj.price_list_rate, obj.currency), @@ -435,7 +435,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ key = this.search.$input.val().toLowerCase(); var re = new RegExp('%', 'g'); - var reg = new RegExp(key.replace(re, '\\w*\\s*[a-zA-Z0-9]*')) + var reg = new RegExp(key.replace(re, '[\\w*\\s*[a-zA-Z0-9]*]*')) search_status = true if(key){ diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py index 79b22ae6779..3230cd0f4a1 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/purchase_order.py @@ -302,6 +302,11 @@ def make_purchase_invoice(source_name, target_doc=None): target.amount = flt(obj.amount) - flt(obj.billed_amt) target.base_amount = target.amount * flt(source_parent.conversion_rate) target.qty = target.amount / flt(obj.rate) if (flt(obj.rate) and flt(obj.billed_amt)) else flt(obj.qty) + + item = frappe.db.get_value("Item", target.item_code, ["item_group", "buying_cost_center"], as_dict=1) + target.cost_center = frappe.db.get_value("Project", obj.project, "cost_center") \ + or item.buying_cost_center \ + or frappe.db.get_value("Item Group", item.item_group, "default_cost_center") doc = get_mapped_doc("Purchase Order", source_name, { "Purchase Order": { diff --git a/erpnext/buying/doctype/purchase_order/purchase_order_dashboard.py b/erpnext/buying/doctype/purchase_order/purchase_order_dashboard.py index 61a9700eba7..5e460df4f3e 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order_dashboard.py +++ b/erpnext/buying/doctype/purchase_order/purchase_order_dashboard.py @@ -1,24 +1,25 @@ from frappe import _ -data = { - 'fieldname': 'purchase_order', - 'internal_links': { - 'Material Request': ['items', 'material_request'], - 'Supplier Quotation': ['items', 'supplier_quotation'], - 'Project': ['project'], - }, - 'transactions': [ - { - 'label': _('Related'), - 'items': ['Purchase Receipt', 'Purchase Invoice'] +def get_data(): + return { + 'fieldname': 'purchase_order', + 'internal_links': { + 'Material Request': ['items', 'material_request'], + 'Supplier Quotation': ['items', 'supplier_quotation'], + 'Project': ['project'], }, - { - 'label': _('Reference'), - 'items': ['Material Request', 'Supplier Quotation', 'Project'] - }, - { - 'label': _('Sub-contracting'), - 'items': ['Stock Entry'] - }, - ] -} \ No newline at end of file + 'transactions': [ + { + 'label': _('Related'), + 'items': ['Purchase Receipt', 'Purchase Invoice'] + }, + { + 'label': _('Reference'), + 'items': ['Material Request', 'Supplier Quotation', 'Project'] + }, + { + 'label': _('Sub-contracting'), + 'items': ['Stock Entry'] + }, + ] + } \ No newline at end of file diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation_dashboard.py b/erpnext/buying/doctype/request_for_quotation/request_for_quotation_dashboard.py index 4bb4d76f61a..ba09d3f088e 100644 --- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation_dashboard.py +++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation_dashboard.py @@ -1,12 +1,13 @@ from frappe import _ -data = { - 'docstatus': 1, - 'fieldname': 'request_for_quotation', - 'transactions': [ - { - 'label': _('Related'), - 'items': ['Supplier Quotation'] - }, - ] -} \ No newline at end of file +def get_data(): + return { + 'docstatus': 1, + 'fieldname': 'request_for_quotation', + 'transactions': [ + { + 'label': _('Related'), + 'items': ['Supplier Quotation'] + }, + ] + } \ No newline at end of file diff --git a/erpnext/buying/doctype/supplier/supplier_dashboard.py b/erpnext/buying/doctype/supplier/supplier_dashboard.py index ab123e2d8d5..4f01f58691e 100644 --- a/erpnext/buying/doctype/supplier/supplier_dashboard.py +++ b/erpnext/buying/doctype/supplier/supplier_dashboard.py @@ -1,17 +1,18 @@ from frappe import _ -data = { - 'heatmap': True, - 'heatmap_message': _('This is based on transactions against this Supplier. See timeline below for details'), - 'fieldname': 'supplier', - 'transactions': [ - { - 'label': _('Procurement'), - 'items': ['Request for Quotation', 'Supplier Quotation'] - }, - { - 'label': _('Orders'), - 'items': ['Purchase Order', 'Purchase Receipt', 'Purchase Invoice'] - } - ] -} \ No newline at end of file +def get_data(): + return { + 'heatmap': True, + 'heatmap_message': _('This is based on transactions against this Supplier. See timeline below for details'), + 'fieldname': 'supplier', + 'transactions': [ + { + 'label': _('Procurement'), + 'items': ['Request for Quotation', 'Supplier Quotation'] + }, + { + 'label': _('Orders'), + 'items': ['Purchase Order', 'Purchase Receipt', 'Purchase Invoice'] + } + ] + } \ No newline at end of file diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation_dashboard.py b/erpnext/buying/doctype/supplier_quotation/supplier_quotation_dashboard.py index 6c8ae7c151a..80f946e2204 100644 --- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation_dashboard.py +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation_dashboard.py @@ -1,20 +1,21 @@ from frappe import _ -data = { - 'fieldname': 'supplier_quotation', - 'internal_links': { - 'Material Request': ['items', 'material_request'], - 'Request for Quotation': ['items', 'request_for_quotation'], - 'Project': ['items', 'project'], - }, - 'transactions': [ - { - 'label': _('Related'), - 'items': ['Purchase Order'] +def get_data(): + return { + 'fieldname': 'supplier_quotation', + 'internal_links': { + 'Material Request': ['items', 'material_request'], + 'Request for Quotation': ['items', 'request_for_quotation'], + 'Project': ['items', 'project'], }, - { - 'label': _('Reference'), - 'items': ['Material Request', 'Request for Quotation', 'Project'] - }, - ] -} + 'transactions': [ + { + 'label': _('Related'), + 'items': ['Purchase Order'] + }, + { + 'label': _('Reference'), + 'items': ['Material Request', 'Request for Quotation', 'Project'] + }, + ] + } diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py index d8b5e2ebd80..23691436047 100644 --- a/erpnext/controllers/taxes_and_totals.py +++ b/erpnext/controllers/taxes_and_totals.py @@ -338,7 +338,7 @@ class calculate_taxes_and_totals(object): tax.item_wise_tax_detail = json.dumps(tax.item_wise_tax_detail, separators=(',', ':')) def set_discount_amount(self): - if not self.doc.discount_amount and self.doc.additional_discount_percentage: + if self.doc.additional_discount_percentage: self.doc.discount_amount = flt(flt(self.doc.get(scrub(self.doc.apply_discount_on))) * self.doc.additional_discount_percentage / 100, self.doc.precision("discount_amount")) diff --git a/erpnext/crm/doctype/opportunity/opportunity_dashboard.py b/erpnext/crm/doctype/opportunity/opportunity_dashboard.py index 782acfd9400..5fc83021ff8 100644 --- a/erpnext/crm/doctype/opportunity/opportunity_dashboard.py +++ b/erpnext/crm/doctype/opportunity/opportunity_dashboard.py @@ -1,14 +1,12 @@ from frappe import _ -data = { - 'fieldname': 'opportunity', - 'non_standard_fieldnames': { - 'Quotation': 'prevdoc_docname' - }, - 'transactions': [ - { - 'label': _('Related'), - 'items': ['Quotation', 'Supplier Quotation'] - }, - ] -} \ No newline at end of file +def get_data(): + return { + 'fieldname': 'prevdoc_docname', + 'transactions': [ + { + 'label': _('Related'), + 'items': ['Quotation', 'Supplier Quotation'] + }, + ] + } \ No newline at end of file diff --git a/erpnext/docs/assets/img/accounts/fiscal-year.png b/erpnext/docs/assets/img/accounts/fiscal-year.png index 2dbf0a2e12d..c320a5c1a5b 100644 Binary files a/erpnext/docs/assets/img/accounts/fiscal-year.png and b/erpnext/docs/assets/img/accounts/fiscal-year.png differ diff --git a/erpnext/docs/assets/img/buying/material-request-flowchart.png b/erpnext/docs/assets/img/buying/material-request-flowchart.png new file mode 100644 index 00000000000..8ed0e394435 Binary files /dev/null and b/erpnext/docs/assets/img/buying/material-request-flowchart.png differ diff --git a/erpnext/docs/assets/img/buying/material-request.png b/erpnext/docs/assets/img/buying/material-request.png index 34005b2e878..2bb4c885127 100644 Binary files a/erpnext/docs/assets/img/buying/material-request.png and b/erpnext/docs/assets/img/buying/material-request.png differ diff --git a/erpnext/docs/user/manual/en/accounts/setup/fiscal-year.md b/erpnext/docs/user/manual/en/accounts/setup/fiscal-year.md index 618d20b6f9c..4a1195ade0c 100644 --- a/erpnext/docs/user/manual/en/accounts/setup/fiscal-year.md +++ b/erpnext/docs/user/manual/en/accounts/setup/fiscal-year.md @@ -18,6 +18,11 @@ choose to start its fiscal year on October 1. That way, they know what their income will be for that year, and can adjust their expenses to maintain their desired profit margins. +To set the Fiscal Year as default, click on the 'Default' button. + +In case you have multiple companies sharing the same Fiscal Year, you can add +it into the grid as shown below. + Fiscal Year {next} diff --git a/erpnext/docs/user/manual/en/stock/material-request.md b/erpnext/docs/user/manual/en/stock/material-request.md index 8afda601736..d707dd70106 100644 --- a/erpnext/docs/user/manual/en/stock/material-request.md +++ b/erpnext/docs/user/manual/en/stock/material-request.md @@ -1,7 +1,7 @@ A Material Request is a simple document identifying a requirement of a set of Items (products or services) for a particular reason. -![Workflow]({{docs_base_url}}/assets/old_images/erpnext/material-request-workflow.jpg) +![Workflow]({{docs_base_url}}/assets/img/buying/material-request-flowchart.png) To generate a Material Request manually go to: @@ -25,6 +25,8 @@ A Material Request can be of type: * Material Issue - If the requested material is to be Issued. * Manufacture - If the requested material is to be Produced. +The User can also raise a [Request For Quotation]({{docs_base_url}}/user/manual/en/buying/request-for-quotation.html) against a Material Request. To create a Request For Quotation the user can click on 'Make'. + > Info: Material Request is not mandatory. It is ideal if you have centralized buying so that you can collect this information from various departments. diff --git a/erpnext/hr/doctype/employee/employee_dashboard.py b/erpnext/hr/doctype/employee/employee_dashboard.py index 420c1df3669..7de305d85f6 100644 --- a/erpnext/hr/doctype/employee/employee_dashboard.py +++ b/erpnext/hr/doctype/employee/employee_dashboard.py @@ -1,25 +1,26 @@ from frappe import _ -data = { - 'heatmap': True, - 'heatmap_message': _('This is based on the attendance of this Employee'), - 'fieldname': 'employee', - 'transactions': [ - { - 'label': _('Leave and Attendance'), - 'items': ['Attendance', 'Leave Application', 'Leave Allocation'] - }, - { - 'label': _('Payroll'), - 'items': ['Salary Structure', 'Salary Slip', 'Timesheet'] - }, - { - 'label': _('Expense'), - 'items': ['Expense Claim'] - }, - { - 'label': _('Evaluation'), - 'items': ['Appraisal'] - } - ] -} \ No newline at end of file +def get_data(): + return { + 'heatmap': True, + 'heatmap_message': _('This is based on the attendance of this Employee'), + 'fieldname': 'employee', + 'transactions': [ + { + 'label': _('Leave and Attendance'), + 'items': ['Attendance', 'Leave Application', 'Leave Allocation'] + }, + { + 'label': _('Payroll'), + 'items': ['Salary Structure', 'Salary Slip', 'Timesheet'] + }, + { + 'label': _('Expense'), + 'items': ['Expense Claim'] + }, + { + 'label': _('Evaluation'), + 'items': ['Appraisal'] + } + ] + } \ No newline at end of file diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py index c94788a08a6..a0dc55433da 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.py +++ b/erpnext/manufacturing/doctype/production_order/production_order.py @@ -58,7 +58,8 @@ class ProductionOrder(Document): if so[0].project: self.project = so[0].project - self.validate_production_order_against_so() + if not self.material_request: + self.validate_production_order_against_so() else: frappe.throw(_("Sales Order {0} is not valid").format(self.sales_order)) diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py index 8521b5e8d68..a0b3f4cb4f5 100644 --- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py +++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py @@ -473,20 +473,21 @@ class ProductionPlanningTool(Document): material_request.update({"material_request_type": item_wrapper.default_material_request_type}) for sales_order, requested_qty in items_to_be_requested[item].items(): - material_request.append("items", { - "doctype": "Material Request Item", - "__islocal": 1, - "item_code": item, - "item_name": item_wrapper.item_name, - "description": item_wrapper.description, - "uom": item_wrapper.stock_uom, - "item_group": item_wrapper.item_group, - "brand": item_wrapper.brand, - "qty": requested_qty, - "schedule_date": add_days(nowdate(), cint(item_wrapper.lead_time_days)), - "warehouse": self.purchase_request_for_warehouse, - "sales_order": sales_order if sales_order!="No Sales Order" else None - }) + if sales_order != 'No Sales Order': + material_request.append("items", { + "doctype": "Material Request Item", + "__islocal": 1, + "item_code": item, + "item_name": item_wrapper.item_name, + "description": item_wrapper.description, + "uom": item_wrapper.stock_uom, + "item_group": item_wrapper.item_group, + "brand": item_wrapper.brand, + "qty": requested_qty, + "schedule_date": add_days(nowdate(), cint(item_wrapper.lead_time_days)), + "warehouse": self.purchase_request_for_warehouse, + "sales_order": sales_order if sales_order!="No Sales Order" else None + }) material_request.flags.ignore_permissions = 1 material_request.submit() diff --git a/erpnext/projects/doctype/project/project_dashboard.py b/erpnext/projects/doctype/project/project_dashboard.py index b36df88e4bf..0ac7d6fc394 100644 --- a/erpnext/projects/doctype/project/project_dashboard.py +++ b/erpnext/projects/doctype/project/project_dashboard.py @@ -1,25 +1,26 @@ from frappe import _ -data = { - 'heatmap': True, - 'heatmap_message': _('This is based on the Time Sheets created against this project'), - 'fieldname': 'project', - 'transactions': [ - { - 'label': _('Project'), - 'items': ['Task', 'Timesheet', 'Expense Claim', 'Issue'] - }, - { - 'label': _('Material'), - 'items': ['Material Request', 'BOM', 'Stock Entry'] - }, - { - 'label': _('Sales'), - 'items': ['Sales Order', 'Delivery Note', 'Sales Invoice'] - }, - { - 'label': _('Purchase'), - 'items': ['Purchase Order', 'Purchase Receipt', 'Purchase Invoice'] - }, - ] -} +def get_data(): + return { + 'heatmap': True, + 'heatmap_message': _('This is based on the Time Sheets created against this project'), + 'fieldname': 'project', + 'transactions': [ + { + 'label': _('Project'), + 'items': ['Task', 'Timesheet', 'Expense Claim', 'Issue'] + }, + { + 'label': _('Material'), + 'items': ['Material Request', 'BOM', 'Stock Entry'] + }, + { + 'label': _('Sales'), + 'items': ['Sales Order', 'Delivery Note', 'Sales Invoice'] + }, + { + 'label': _('Purchase'), + 'items': ['Purchase Order', 'Purchase Receipt', 'Purchase Invoice'] + }, + ] + } diff --git a/erpnext/schools/doctype/student/student_dashboard.py b/erpnext/schools/doctype/student/student_dashboard.py index 9322986149f..8b59b6b0133 100644 --- a/erpnext/schools/doctype/student/student_dashboard.py +++ b/erpnext/schools/doctype/student/student_dashboard.py @@ -1,15 +1,16 @@ from frappe import _ -data = { - 'heatmap': True, - 'heatmap_message': _('This is based on the attendance of this Student'), - 'fieldname': 'student', - 'transactions': [ - { - 'items': ['Student Log', 'Student Group', 'Student Attendance'] - }, - { - 'items': ['Program Enrollment', 'Fees', 'Assessment'] - } - ] -} \ No newline at end of file +def get_data(): + { + 'heatmap': True, + 'heatmap_message': _('This is based on the attendance of this Student'), + 'fieldname': 'student', + 'transactions': [ + { + 'items': ['Student Log', 'Student Group', 'Student Attendance'] + }, + { + 'items': ['Program Enrollment', 'Fees', 'Assessment', 'Guardian'] + } + ] + } \ No newline at end of file diff --git a/erpnext/selling/doctype/customer/customer_dashboard.py b/erpnext/selling/doctype/customer/customer_dashboard.py index b65c1995eb1..681b04a2477 100644 --- a/erpnext/selling/doctype/customer/customer_dashboard.py +++ b/erpnext/selling/doctype/customer/customer_dashboard.py @@ -1,25 +1,26 @@ from frappe import _ -data = { - 'heatmap': True, - 'heatmap_message': _('This is based on transactions against this Customer. See timeline below for details'), - 'fieldname': 'customer', - 'transactions': [ - { - 'label': _('Pre Sales'), - 'items': ['Opportunity', 'Quotation'] - }, - { - 'label': _('Orders'), - 'items': ['Sales Order', 'Delivery Note', 'Sales Invoice'] - }, - { - 'label': _('Support'), - 'items': ['Issue'] - }, - { - 'label': _('Projects'), - 'items': ['Project'] - } - ] -} \ No newline at end of file +def get_data(): + return { + 'heatmap': True, + 'heatmap_message': _('This is based on transactions against this Customer. See timeline below for details'), + 'fieldname': 'customer', + 'transactions': [ + { + 'label': _('Pre Sales'), + 'items': ['Opportunity', 'Quotation'] + }, + { + 'label': _('Orders'), + 'items': ['Sales Order', 'Delivery Note', 'Sales Invoice'] + }, + { + 'label': _('Support'), + 'items': ['Issue'] + }, + { + 'label': _('Projects'), + 'items': ['Project'] + } + ] + } \ No newline at end of file diff --git a/erpnext/selling/doctype/quotation/quotation_dashboard.py b/erpnext/selling/doctype/quotation/quotation_dashboard.py index 80dc6aa4224..e572a9238fa 100644 --- a/erpnext/selling/doctype/quotation/quotation_dashboard.py +++ b/erpnext/selling/doctype/quotation/quotation_dashboard.py @@ -1,11 +1,12 @@ from frappe import _ -data = { - 'fieldname': 'prevdoc_docname', - 'transactions': [ - { - 'label': _('Related'), - 'items': ['Sales Order'] - }, - ] -} \ No newline at end of file +def get_data(): + return { + 'fieldname': 'prevdoc_docname', + 'transactions': [ + { + 'label': _('Related'), + 'items': ['Sales Order'] + }, + ] + } \ No newline at end of file diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index 0435141d530..7ff1471ad86 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -442,6 +442,11 @@ def make_sales_invoice(source_name, target_doc=None, ignore_permissions=False): target.amount = flt(source.amount) - flt(source.billed_amt) target.base_amount = target.amount * flt(source_parent.conversion_rate) target.qty = target.amount / flt(source.rate) if (source.rate and source.billed_amt) else source.qty + + item = frappe.db.get_value("Item", target.item_code, ["item_group", "selling_cost_center"], as_dict=1) + target.cost_center = frappe.db.get_value("Project", obj.project, "cost_center") \ + or item.selling_cost_center \ + or frappe.db.get_value("Item Group", item.item_group, "default_cost_center") doclist = get_mapped_doc("Sales Order", source_name, { "Sales Order": { diff --git a/erpnext/selling/doctype/sales_order/sales_order_dashboard.py b/erpnext/selling/doctype/sales_order/sales_order_dashboard.py index feda39d33c2..51f81f89b60 100644 --- a/erpnext/selling/doctype/sales_order/sales_order_dashboard.py +++ b/erpnext/selling/doctype/sales_order/sales_order_dashboard.py @@ -1,33 +1,34 @@ from frappe import _ -data = { - 'fieldname': 'sales_order', - 'non_standard_fieldnames': { - 'Delivery Note': 'against_sales_order', - }, - 'internal_links': { - 'Quotation': ['items', 'prevdoc_docname'] - }, - 'transactions': [ - { - 'label': _('Fulfillment'), - 'items': ['Sales Invoice', 'Delivery Note'] +def get_data(): + return { + 'fieldname': 'sales_order', + 'non_standard_fieldnames': { + 'Delivery Note': 'against_sales_order', }, - { - 'label': _('Purchasing'), - 'items': ['Material Request', 'Purchase Order'] + 'internal_links': { + 'Quotation': ['items', 'prevdoc_docname'] }, - { - 'label': _('Projects'), - 'items': ['Project'] - }, - { - 'label': _('Manufacturing'), - 'items': ['Production Order'] - }, - { - 'label': _('Reference'), - 'items': ['Quotation'] - }, - ] -} \ No newline at end of file + 'transactions': [ + { + 'label': _('Fulfillment'), + 'items': ['Sales Invoice', 'Delivery Note'] + }, + { + 'label': _('Purchasing'), + 'items': ['Material Request', 'Purchase Order'] + }, + { + 'label': _('Projects'), + 'items': ['Project'] + }, + { + 'label': _('Manufacturing'), + 'items': ['Production Order'] + }, + { + 'label': _('Reference'), + 'items': ['Quotation'] + }, + ] + } \ No newline at end of file diff --git a/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py b/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py index c2b54f84767..adbfa4d6088 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py @@ -1,26 +1,27 @@ from frappe import _ -data = { - 'fieldname': 'delivery_note_no', - 'non_standard_fieldnames': { - 'Sales Invoice': 'delivery_note', - 'Packing Slip': 'delivery_note', - }, - 'internal_links': { - 'Sales Order': ['items', 'against_sales_order'], - }, - 'transactions': [ - { - 'label': _('Related'), - 'items': ['Sales Invoice', 'Packing Slip'] +def get_data(): + return { + 'fieldname': 'delivery_note_no', + 'non_standard_fieldnames': { + 'Sales Invoice': 'delivery_note', + 'Packing Slip': 'delivery_note', }, - { - 'label': _('Reference'), - 'items': ['Sales Order', 'Quality Inspection'] + 'internal_links': { + 'Sales Order': ['items', 'against_sales_order'], }, - { - 'label': _('Returns'), - 'items': ['Stock Entry'] - }, - ] -} \ No newline at end of file + 'transactions': [ + { + 'label': _('Related'), + 'items': ['Sales Invoice', 'Packing Slip'] + }, + { + 'label': _('Reference'), + 'items': ['Sales Order', 'Quality Inspection'] + }, + { + 'label': _('Returns'), + 'items': ['Stock Entry'] + }, + ] + } \ No newline at end of file diff --git a/erpnext/stock/doctype/item/item_dashboard.py b/erpnext/stock/doctype/item/item_dashboard.py index e0f1c212b7c..b40b196c57f 100644 --- a/erpnext/stock/doctype/item/item_dashboard.py +++ b/erpnext/stock/doctype/item/item_dashboard.py @@ -1,45 +1,46 @@ from frappe import _ -data = { - 'heatmap': True, - 'heatmap_message': _('This is based on stock movement. See {0} for details')\ - .format('' + _('Stock Ledger') + ''), - 'fieldname': 'item_code', - 'non_standard_fieldnames': { - 'Production Order': 'production_item', - 'Product Bundle': 'new_item_code', - 'BOM': 'item', - 'Batch': 'item' - }, - 'transactions': [ - { - 'label': _('Groups'), - 'items': ['BOM', 'Product Bundle'] +def get_data(): + return { + 'heatmap': True, + 'heatmap_message': _('This is based on stock movement. See {0} for details')\ + .format('' + _('Stock Ledger') + ''), + 'fieldname': 'item_code', + 'non_standard_fieldnames': { + 'Production Order': 'production_item', + 'Product Bundle': 'new_item_code', + 'BOM': 'item', + 'Batch': 'item' }, - { - 'label': _('Pricing'), - 'items': ['Item Price', 'Pricing Rule'] - }, - { - 'label': _('Sell'), - 'items': ['Quotation', 'Sales Order', 'Delivery Note', 'Sales Invoice'] - }, - { - 'label': _('Buy'), - 'items': ['Material Request', 'Supplier Quotation', 'Request for Quotation', - 'Purchase Order', 'Purchase Invoice'] - }, - { - 'label': _('Traceability'), - 'items': ['Serial No', 'Batch'] - }, - { - 'label': _('Move'), - 'items': ['Stock Entry'] - }, - { - 'label': _('Manufacture'), - 'items': ['Production Order'] - } - ] -} \ No newline at end of file + 'transactions': [ + { + 'label': _('Groups'), + 'items': ['BOM', 'Product Bundle'] + }, + { + 'label': _('Pricing'), + 'items': ['Item Price', 'Pricing Rule'] + }, + { + 'label': _('Sell'), + 'items': ['Quotation', 'Sales Order', 'Delivery Note', 'Sales Invoice'] + }, + { + 'label': _('Buy'), + 'items': ['Material Request', 'Supplier Quotation', 'Request for Quotation', + 'Purchase Order', 'Purchase Invoice'] + }, + { + 'label': _('Traceability'), + 'items': ['Serial No', 'Batch'] + }, + { + 'label': _('Move'), + 'items': ['Stock Entry'] + }, + { + 'label': _('Manufacture'), + 'items': ['Production Order'] + } + ] + } \ No newline at end of file diff --git a/erpnext/stock/doctype/material_request/material_request_dashboard.py b/erpnext/stock/doctype/material_request/material_request_dashboard.py index eab38b286c6..751c7237303 100644 --- a/erpnext/stock/doctype/material_request/material_request_dashboard.py +++ b/erpnext/stock/doctype/material_request/material_request_dashboard.py @@ -1,15 +1,17 @@ from frappe import _ -data = { - 'fieldname': 'material_request', - 'transactions': [ - { - 'label': _('Related'), - 'items': ['Request for Quotation', 'Supplier Quotation', 'Purchase Order'] - }, - { - 'label': _('Manufacturing'), - 'items': ['Production Order'] - }, - ] -} \ No newline at end of file + +def get_data(): + return { + 'fieldname': 'material_request', + 'transactions': [ + { + 'label': _('Related'), + 'items': ['Request for Quotation', 'Supplier Quotation', 'Purchase Order'] + }, + { + 'label': _('Manufacturing'), + 'items': ['Production Order'] + } + ] + } \ No newline at end of file diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt_dashboard.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt_dashboard.py index 3278032a9dd..7059c91813e 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt_dashboard.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt_dashboard.py @@ -1,28 +1,29 @@ from frappe import _ -data = { - 'fieldname': 'purchase_receipt_no', - 'non_standard_fieldnames': { - 'Purchase Invoice': 'purchase_receipt', - 'Landed Cost Voucher': 'receipt_document' - }, - 'internal_links': { - 'Purchase Order': ['items', 'purchase_order'], - 'Project': ['items', 'project'], - 'Quality Inspection': ['items', 'qa_no'], - }, - 'transactions': [ - { - 'label': _('Related'), - 'items': ['Purchase Invoice', 'Landed Cost Voucher'] +def get_data(): + return { + 'fieldname': 'purchase_receipt_no', + 'non_standard_fieldnames': { + 'Purchase Invoice': 'purchase_receipt', + 'Landed Cost Voucher': 'receipt_document' }, - { - 'label': _('Reference'), - 'items': ['Purchase Order', 'Quality Inspection', 'Project'] + 'internal_links': { + 'Purchase Order': ['items', 'purchase_order'], + 'Project': ['items', 'project'], + 'Quality Inspection': ['items', 'qa_no'], }, - { - 'label': _('Returns'), - 'items': ['Stock Entry'] - }, - ] -} \ No newline at end of file + 'transactions': [ + { + 'label': _('Related'), + 'items': ['Purchase Invoice', 'Landed Cost Voucher'] + }, + { + 'label': _('Reference'), + 'items': ['Purchase Order', 'Quality Inspection', 'Project'] + }, + { + 'label': _('Returns'), + 'items': ['Stock Entry'] + }, + ] + } \ No newline at end of file