From e3d2643f2bae41de6a0aea1ad14f3e907e352566 Mon Sep 17 00:00:00 2001 From: Sambhaji Kolate Date: Wed, 10 Sep 2014 13:07:59 +0530 Subject: [PATCH 01/42] Changes for Recurring PO/PI --- .../purchase_invoice/purchase_invoice.js | 36 +++++++++++++++++ .../purchase_invoice/purchase_invoice.json | 39 ++++++++++++++----- .../purchase_invoice/purchase_invoice.py | 13 ++++++- .../doctype/purchase_order/purchase_order.js | 33 ++++++++++++++++ .../purchase_order/purchase_order.json | 19 +++++++++ .../doctype/purchase_order/purchase_order.py | 11 ++++++ .../purchase_order/test_purchase_order.py | 5 +++ erpnext/controllers/buying_controller.py | 6 ++- 8 files changed, 150 insertions(+), 12 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index 49ed12cc240..680c6a0bbd9 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -232,6 +232,42 @@ cur_frm.fields_dict['entries'].grid.get_field('project_name').get_query = functi } } +//added by sambhaji + + +cur_frm.cscript.is_recurring = function(doc, dt, dn) { + // set default values for recurring invoices + if(doc.is_recurring) { + var owner_email = doc.owner=="Administrator" + ? frappe.user_info("Administrator").email + : doc.owner; + + doc.notification_email_address = $.map([cstr(owner_email), + cstr(doc.contact_email)], function(v) { return v || null; }).join(", "); + doc.repeat_on_day_of_month = frappe.datetime.str_to_obj(doc.posting_date).getDate(); + } + + refresh_many(["notification_email_address", "repeat_on_day_of_month"]); +} + + +cur_frm.cscript.from_date = function(doc, dt, dn) { + // set to_date + if(doc.from_date) { + var recurring_type_map = {'Monthly': 1, 'Quarterly': 3, 'Half-yearly': 6, + 'Yearly': 12}; + + var months = recurring_type_map[doc.recurring_type]; + if(months) { + var to_date = frappe.datetime.add_months(doc.from_date, + months); + doc.to_date = frappe.datetime.add_days(to_date, -1); + refresh_field('to_date'); + } + } +} + +//end of added by sambhajii cur_frm.cscript.select_print_heading = function(doc,cdt,cdn){ if(doc.select_print_heading){ diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json index 489bc4648a2..dab029f1917 100755 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json @@ -1,4 +1,5 @@ { + "allow_attach": 1, "allow_import": 1, "autoname": "naming_series:", "creation": "2013-05-21 16:16:39", @@ -143,16 +144,34 @@ "search_index": 1 }, { - "fieldname": "amended_from", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Amended From", - "no_copy": 1, - "oldfieldname": "amended_from", - "oldfieldtype": "Link", - "options": "Purchase Invoice", - "permlevel": 0, - "print_hide": 1, + "allow_on_submit": 1, + "description": "Start date of current invoice's period", + "fieldname": "from_date", + "fieldtype": "Date", + "label": "From", + "no_copy": 1, + "permlevel": 0 + }, + { + "allow_on_submit": 1, + "description": "End date of current invoice's period", + "fieldname": "to_date", + "fieldtype": "Date", + "label": "To", + "no_copy": 1, + "permlevel": 0 + }, + { + "fieldname": "amended_from", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Amended From", + "no_copy": 1, + "oldfieldname": "amended_from", + "oldfieldtype": "Link", + "options": "Purchase Invoice", + "permlevel": 0, + "print_hide": 1, "read_only": 1 }, { diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 956dacb55f9..7d35f41c965 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -4,7 +4,10 @@ from __future__ import unicode_literals import frappe -from frappe.utils import cint, cstr, flt, formatdate + +from frappe.utils import add_days, cint, cstr, date_diff, formatdate, flt, getdate, nowdate, \ + get_first_day, get_last_day +from frappe.model.naming import make_autoname from frappe import msgprint, _, throw from erpnext.setup.utils import get_company_currency @@ -14,6 +17,8 @@ import frappe.defaults from erpnext.controllers.buying_controller import BuyingController from erpnext.accounts.party import get_party_account, get_due_date +from erpnext.controllers.recurring_document import * + form_grid_templates = { "entries": "templates/form_grid/item_grid.html" } @@ -61,6 +66,7 @@ class PurchaseInvoice(BuyingController): self.validate_multiple_billing("Purchase Receipt", "pr_detail", "amount", "purchase_receipt_details") self.create_remarks() + validate_recurring_document(self) def create_remarks(self): if not self.remarks: @@ -259,6 +265,11 @@ class PurchaseInvoice(BuyingController): self.update_against_document_in_jv() self.update_prevdoc_status() self.update_billing_status_for_zero_amount_refdoc("Purchase Order") + convert_to_recurring(self, "RECINV.#####", self.posting_date) + + def on_update_after_submit(self): + validate_recurring_document(self) + convert_to_recurring(self, "RECINV.#####", self.posting_date) def make_gl_entries(self): auto_accounting_for_stock = \ diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js index 9433ebe20c5..071d622cdd0 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order.js @@ -205,7 +205,40 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) { cur_frm.email_doc(frappe.boot.notification_settings.purchase_order_message); } } +//added by sambhaji +cur_frm.cscript.is_recurring = function(doc, dt, dn) { + // set default values for recurring orders + if(doc.is_recurring) { + var owner_email = doc.owner=="Administrator" + ? frappe.user_info("Administrator").email + : doc.owner; + + doc.notification_email_address = $.map([cstr(owner_email), + cstr(doc.contact_email)], function(v) { return v || null; }).join(", "); + doc.repeat_on_day_of_month = frappe.datetime.str_to_obj(doc.posting_date).getDate(); + } + + refresh_many(["notification_email_address", "repeat_on_day_of_month"]); +} + +cur_frm.cscript.from_date = function(doc, dt, dn) { + // set to_date + if(doc.from_date) { + var recurring_type_map = {'Monthly': 1, 'Quarterly': 3, 'Half-yearly': 6, + 'Yearly': 12}; + + var months = recurring_type_map[doc.recurring_type]; + if(months) { + var to_date = frappe.datetime.add_months(doc.from_date, + months); + doc.to_date = frappe.datetime.add_days(to_date, -1); + refresh_field('to_date'); + } + } +} + +//end of added by sambhaji cur_frm.cscript.send_sms = function() { frappe.require("assets/erpnext/js/sms_manager.js"); var sms_man = new SMSManager(cur_frm.doc); diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index 647823cab66..289567f34c9 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -1,4 +1,5 @@ { + "allow_attach": 1, "allow_import": 1, "autoname": "naming_series:", "creation": "2013-05-21 16:16:39", @@ -101,6 +102,24 @@ "reqd": 1, "search_index": 1 }, + { + "allow_on_submit": 1, + "description": "Start date of current order's period", + "fieldname": "from_date", + "fieldtype": "Date", + "label": "From", + "no_copy": 1, + "permlevel": 0 + }, + { + "allow_on_submit": 1, + "description": "End date of current order's period", + "fieldname": "to_date", + "fieldtype": "Date", + "label": "To", + "no_copy": 1, + "permlevel": 0 + }, { "fieldname": "amended_from", "fieldtype": "Link", diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py index 6c7c0c6d086..beebf0b1fb1 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/purchase_order.py @@ -6,6 +6,9 @@ import frappe from frappe.utils import cstr, flt from frappe import msgprint, _, throw from frappe.model.mapper import get_mapped_doc + +from erpnext.controllers.recurring_document import convert_to_recurring, validate_recurring_document + from erpnext.controllers.buying_controller import BuyingController form_grid_templates = { @@ -52,6 +55,8 @@ class PurchaseOrder(BuyingController): self.validate_for_subcontracting() self.validate_minimum_order_qty() self.create_raw_materials_supplied("po_raw_material_details") + + validate_recurring_document(self) def validate_with_previous_doc(self): super(PurchaseOrder, self).validate_with_previous_doc(self.tname, { @@ -173,6 +178,8 @@ class PurchaseOrder(BuyingController): purchase_controller.update_last_purchase_rate(self, is_submit = 1) frappe.db.set(self,'status','Submitted') + + convert_to_recurring(self, "SO/REC/.#####", self.transaction_date) def on_cancel(self): pc_obj = frappe.get_doc('Purchase Common') @@ -197,6 +204,10 @@ class PurchaseOrder(BuyingController): def on_update(self): pass +def on_update_after_submit(self): + validate_recurring_document(self) + convert_to_recurring(self, "SO/REC/.#####", self.transaction_date) + def set_missing_values(source, target): target.ignore_pricing_rule = 1 target.run_method("set_missing_values") diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py index d1d183a7a14..0c9f912dbbc 100644 --- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py @@ -107,6 +107,11 @@ class TestPurchaseOrder(unittest.TestCase): po.get("po_details")[0].qty = 3.4 self.assertRaises(UOMMustBeIntegerError, po.insert) + def test_recurring_order(self): + from erpnext.controllers.tests.test_recurring_document import test_recurring_document + + test_recurring_document(self, test_records) + test_dependencies = ["BOM"] diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index 5f418c4df26..a3f59082f69 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -4,7 +4,11 @@ from __future__ import unicode_literals import frappe from frappe import _, msgprint -from frappe.utils import flt, rounded + +from frappe.utils import add_days, cint, cstr, today, date_diff, flt, rounded, getdate, nowdate, \ + get_first_day, get_last_day +from frappe.model.naming import make_autoname + from erpnext.setup.utils import get_company_currency from erpnext.accounts.party import get_party_details From 6b679c45dfc5351a5e74070fb61e42ad65d639d8 Mon Sep 17 00:00:00 2001 From: Sambhaji Kolate Date: Wed, 10 Sep 2014 13:57:45 +0530 Subject: [PATCH 02/42] Updated purchase_invoice.json and purchase_order.json with some missed out changes --- .../purchase_invoice/purchase_invoice.json | 1463 +++++++++-------- .../purchase_order/purchase_order.json | 112 +- 2 files changed, 894 insertions(+), 681 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json index dab029f1917..ea3eb8a0a5b 100755 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json @@ -1,148 +1,147 @@ { - "allow_attach": 1, - "allow_import": 1, - "autoname": "naming_series:", - "creation": "2013-05-21 16:16:39", - "docstatus": 0, - "doctype": "DocType", + "allow_import": 1, + "autoname": "naming_series:", + "creation": "2013-05-21 16:16:39", + "docstatus": 0, + "doctype": "DocType", "fields": [ { - "fieldname": "supplier_section", - "fieldtype": "Section Break", - "label": "Supplier", - "options": "icon-user", + "fieldname": "supplier_section", + "fieldtype": "Section Break", + "label": "Supplier", + "options": "icon-user", "permlevel": 0 - }, + }, { - "fieldname": "column_break0", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, - "read_only": 0, + "fieldname": "column_break0", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "read_only": 0, "width": "50%" - }, + }, { - "fieldname": "naming_series", - "fieldtype": "Select", - "label": "Series", - "no_copy": 1, - "oldfieldname": "naming_series", - "oldfieldtype": "Select", - "options": "PINV-", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "report_hide": 0, + "fieldname": "naming_series", + "fieldtype": "Select", + "label": "Series", + "no_copy": 1, + "oldfieldname": "naming_series", + "oldfieldtype": "Select", + "options": "PINV-", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "report_hide": 0, "reqd": 1 - }, + }, { - "fieldname": "supplier", - "fieldtype": "Link", - "hidden": 0, - "label": "Supplier", - "oldfieldname": "supplier", - "oldfieldtype": "Link", - "options": "Supplier", - "permlevel": 0, - "print_hide": 1, + "fieldname": "supplier", + "fieldtype": "Link", + "hidden": 0, + "label": "Supplier", + "oldfieldname": "supplier", + "oldfieldtype": "Link", + "options": "Supplier", + "permlevel": 0, + "print_hide": 1, "read_only": 0 - }, + }, { - "depends_on": "supplier", - "fieldname": "supplier_name", - "fieldtype": "Data", - "hidden": 0, - "in_list_view": 1, - "label": "Name", - "oldfieldname": "supplier_name", - "oldfieldtype": "Data", - "permlevel": 0, + "depends_on": "supplier", + "fieldname": "supplier_name", + "fieldtype": "Data", + "hidden": 0, + "in_list_view": 1, + "label": "Name", + "oldfieldname": "supplier_name", + "oldfieldtype": "Data", + "permlevel": 0, "read_only": 1 - }, + }, { - "fieldname": "address_display", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Address", - "permlevel": 0, + "fieldname": "address_display", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Address", + "permlevel": 0, "read_only": 1 - }, + }, { - "fieldname": "contact_display", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Contact", - "permlevel": 0, + "fieldname": "contact_display", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Contact", + "permlevel": 0, "read_only": 1 - }, + }, { - "fieldname": "contact_mobile", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Mobile No", - "permlevel": 0, + "fieldname": "contact_mobile", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Mobile No", + "permlevel": 0, "read_only": 1 - }, + }, { - "fieldname": "contact_email", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Contact Email", - "permlevel": 0, - "print_hide": 1, + "fieldname": "contact_email", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Contact Email", + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "fieldname": "column_break1", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, - "read_only": 0, - "reqd": 0, + "fieldname": "column_break1", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "read_only": 0, + "reqd": 0, "width": "50%" - }, + }, { - "default": "Today", - "fieldname": "posting_date", - "fieldtype": "Date", - "in_filter": 1, - "label": "Date", - "no_copy": 0, - "oldfieldname": "posting_date", - "oldfieldtype": "Date", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "reqd": 1, + "default": "Today", + "fieldname": "posting_date", + "fieldtype": "Date", + "in_filter": 1, + "label": "Date", + "no_copy": 0, + "oldfieldname": "posting_date", + "oldfieldtype": "Date", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "reqd": 1, "search_index": 1 - }, + }, { - "description": "", - "fieldname": "bill_no", - "fieldtype": "Data", - "in_filter": 1, - "label": "Supplier Invoice No", - "oldfieldname": "bill_no", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "reqd": 0, + "description": "", + "fieldname": "bill_no", + "fieldtype": "Data", + "in_filter": 1, + "label": "Supplier Invoice No", + "oldfieldname": "bill_no", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "reqd": 0, "search_index": 1 - }, + }, { - "fieldname": "bill_date", - "fieldtype": "Date", - "in_filter": 1, - "label": "Supplier Invoice Date", - "oldfieldname": "bill_date", - "oldfieldtype": "Date", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "reqd": 0, + "fieldname": "bill_date", + "fieldtype": "Date", + "in_filter": 1, + "label": "Supplier Invoice Date", + "oldfieldname": "bill_date", + "oldfieldtype": "Date", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "reqd": 0, "search_index": 1 - }, + }, { "allow_on_submit": 1, "description": "Start date of current invoice's period", @@ -173,698 +172,808 @@ "permlevel": 0, "print_hide": 1, "read_only": 1 - }, + }, { - "fieldname": "company", - "fieldtype": "Link", - "in_filter": 1, - "label": "Company", - "oldfieldname": "company", - "oldfieldtype": "Link", - "options": "Company", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, + "fieldname": "company", + "fieldtype": "Link", + "in_filter": 1, + "label": "Company", + "oldfieldname": "company", + "oldfieldtype": "Link", + "options": "Company", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, "search_index": 1 - }, + }, { - "fieldname": "currency_price_list", - "fieldtype": "Section Break", - "label": "Currency and Price List", - "options": "icon-tag", - "permlevel": 0, + "fieldname": "currency_price_list", + "fieldtype": "Section Break", + "label": "Currency and Price List", + "options": "icon-tag", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "currency", - "fieldtype": "Link", - "label": "Currency", - "oldfieldname": "currency", - "oldfieldtype": "Select", - "options": "Currency", - "permlevel": 0, - "print_hide": 1, + "fieldname": "currency", + "fieldtype": "Link", + "label": "Currency", + "oldfieldname": "currency", + "oldfieldtype": "Select", + "options": "Currency", + "permlevel": 0, + "print_hide": 1, "read_only": 0 - }, + }, { - "description": "The rate at which Bill Currency is converted into company's base currency", - "fieldname": "conversion_rate", - "fieldtype": "Float", - "label": "Exchange Rate", - "oldfieldname": "conversion_rate", - "oldfieldtype": "Currency", - "permlevel": 0, - "print_hide": 1, + "description": "The rate at which Bill Currency is converted into company's base currency", + "fieldname": "conversion_rate", + "fieldtype": "Float", + "label": "Exchange Rate", + "oldfieldname": "conversion_rate", + "oldfieldtype": "Currency", + "permlevel": 0, + "print_hide": 1, "read_only": 0 - }, + }, { - "fieldname": "column_break2", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "column_break2", + "fieldtype": "Column Break", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "buying_price_list", - "fieldtype": "Link", - "label": "Price List", - "options": "Price List", - "permlevel": 0, - "print_hide": 1, + "fieldname": "buying_price_list", + "fieldtype": "Link", + "label": "Price List", + "options": "Price List", + "permlevel": 0, + "print_hide": 1, "read_only": 0 - }, + }, { - "fieldname": "price_list_currency", - "fieldtype": "Link", - "label": "Price List Currency", - "options": "Currency", - "permlevel": 0, - "print_hide": 1, + "fieldname": "price_list_currency", + "fieldtype": "Link", + "label": "Price List Currency", + "options": "Currency", + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "fieldname": "plc_conversion_rate", - "fieldtype": "Float", - "label": "Price List Exchange Rate", - "permlevel": 0, - "print_hide": 1, + "fieldname": "plc_conversion_rate", + "fieldtype": "Float", + "label": "Price List Exchange Rate", + "permlevel": 0, + "print_hide": 1, "read_only": 0 - }, + }, { - "fieldname": "ignore_pricing_rule", - "fieldtype": "Check", - "label": "Ignore Pricing Rule", - "no_copy": 1, - "permlevel": 1, + "fieldname": "ignore_pricing_rule", + "fieldtype": "Check", + "label": "Ignore Pricing Rule", + "no_copy": 1, + "permlevel": 1, "print_hide": 1 - }, + }, { - "fieldname": "items", - "fieldtype": "Section Break", - "label": "Items", - "oldfieldtype": "Section Break", - "options": "icon-shopping-cart", - "permlevel": 0, + "fieldname": "items", + "fieldtype": "Section Break", + "label": "Items", + "oldfieldtype": "Section Break", + "options": "icon-shopping-cart", + "permlevel": 0, "read_only": 0 - }, + }, { - "allow_on_submit": 1, - "fieldname": "entries", - "fieldtype": "Table", - "label": "Entries", - "oldfieldname": "entries", - "oldfieldtype": "Table", - "options": "Purchase Invoice Item", - "permlevel": 0, + "allow_on_submit": 1, + "fieldname": "entries", + "fieldtype": "Table", + "label": "Entries", + "oldfieldname": "entries", + "oldfieldtype": "Table", + "options": "Purchase Invoice Item", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "section_break_26", - "fieldtype": "Section Break", + "fieldname": "section_break_26", + "fieldtype": "Section Break", "permlevel": 0 - }, + }, { - "description": "Will be calculated automatically when you enter the details", - "fieldname": "net_total", - "fieldtype": "Currency", - "label": "Net Total (Company Currency)", - "oldfieldname": "net_total", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, + "description": "Will be calculated automatically when you enter the details", + "fieldname": "net_total", + "fieldtype": "Currency", + "label": "Net Total (Company Currency)", + "oldfieldname": "net_total", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "fieldname": "column_break_28", - "fieldtype": "Column Break", + "fieldname": "column_break_28", + "fieldtype": "Column Break", "permlevel": 0 - }, + }, { - "fieldname": "net_total_import", - "fieldtype": "Currency", - "label": "Net Total", - "oldfieldname": "net_total_import", - "oldfieldtype": "Currency", - "options": "currency", - "permlevel": 0, - "print_hide": 0, + "fieldname": "net_total_import", + "fieldtype": "Currency", + "label": "Net Total", + "oldfieldname": "net_total_import", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "print_hide": 0, "read_only": 1 - }, + }, { - "fieldname": "taxes", - "fieldtype": "Section Break", - "label": "Taxes and Charges", - "oldfieldtype": "Section Break", - "options": "icon-money", - "permlevel": 0, + "fieldname": "taxes", + "fieldtype": "Section Break", + "label": "Taxes and Charges", + "oldfieldtype": "Section Break", + "options": "icon-money", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "taxes_and_charges", - "fieldtype": "Link", - "label": "Taxes and Charges", - "oldfieldname": "purchase_other_charges", - "oldfieldtype": "Link", - "options": "Purchase Taxes and Charges Master", - "permlevel": 0, - "print_hide": 1, + "fieldname": "taxes_and_charges", + "fieldtype": "Link", + "label": "Taxes and Charges", + "oldfieldname": "purchase_other_charges", + "oldfieldtype": "Link", + "options": "Purchase Taxes and Charges Master", + "permlevel": 0, + "print_hide": 1, "read_only": 0 - }, + }, { - "fieldname": "other_charges", - "fieldtype": "Table", - "label": "Purchase Taxes and Charges", - "oldfieldname": "purchase_tax_details", - "oldfieldtype": "Table", - "options": "Purchase Taxes and Charges", - "permlevel": 0, + "fieldname": "other_charges", + "fieldtype": "Table", + "label": "Purchase Taxes and Charges", + "oldfieldname": "purchase_tax_details", + "oldfieldtype": "Table", + "options": "Purchase Taxes and Charges", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "other_charges_calculation", - "fieldtype": "HTML", - "label": "Taxes and Charges Calculation", - "oldfieldtype": "HTML", - "permlevel": 0, - "print_hide": 1, + "fieldname": "other_charges_calculation", + "fieldtype": "HTML", + "label": "Taxes and Charges Calculation", + "oldfieldtype": "HTML", + "permlevel": 0, + "print_hide": 1, "read_only": 0 - }, + }, { - "fieldname": "totals", - "fieldtype": "Section Break", - "label": "Totals", - "oldfieldtype": "Section Break", - "options": "icon-money", - "permlevel": 0, + "fieldname": "totals", + "fieldtype": "Section Break", + "label": "Totals", + "oldfieldtype": "Section Break", + "options": "icon-money", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "other_charges_added", - "fieldtype": "Currency", - "label": "Taxes and Charges Added (Company Currency)", - "oldfieldname": "other_charges_added", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, + "fieldname": "other_charges_added", + "fieldtype": "Currency", + "label": "Taxes and Charges Added (Company Currency)", + "oldfieldname": "other_charges_added", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "fieldname": "other_charges_deducted", - "fieldtype": "Currency", - "label": "Taxes and Charges Deducted (Company Currency)", - "oldfieldname": "other_charges_deducted", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, + "fieldname": "other_charges_deducted", + "fieldtype": "Currency", + "label": "Taxes and Charges Deducted (Company Currency)", + "oldfieldname": "other_charges_deducted", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "fieldname": "grand_total", - "fieldtype": "Currency", - "label": "Grand Total (Company Currency)", - "oldfieldname": "grand_total", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, + "fieldname": "grand_total", + "fieldtype": "Currency", + "label": "Grand Total (Company Currency)", + "oldfieldname": "grand_total", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "description": "In Words will be visible once you save the Purchase Invoice.", - "fieldname": "in_words", - "fieldtype": "Data", - "label": "In Words (Company Currency)", - "oldfieldname": "in_words", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 1, + "description": "In Words will be visible once you save the Purchase Invoice.", + "fieldname": "in_words", + "fieldtype": "Data", + "label": "In Words (Company Currency)", + "oldfieldname": "in_words", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "fieldname": "column_break8", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, + "fieldname": "column_break8", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, "width": "50%" - }, + }, { - "fieldname": "other_charges_added_import", - "fieldtype": "Currency", - "label": "Taxes and Charges Added", - "oldfieldname": "other_charges_added_import", - "oldfieldtype": "Currency", - "options": "currency", - "permlevel": 0, - "print_hide": 1, + "fieldname": "other_charges_added_import", + "fieldtype": "Currency", + "label": "Taxes and Charges Added", + "oldfieldname": "other_charges_added_import", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "fieldname": "other_charges_deducted_import", - "fieldtype": "Currency", - "label": "Taxes and Charges Deducted", - "oldfieldname": "other_charges_deducted_import", - "oldfieldtype": "Currency", - "options": "currency", - "permlevel": 0, - "print_hide": 1, + "fieldname": "other_charges_deducted_import", + "fieldtype": "Currency", + "label": "Taxes and Charges Deducted", + "oldfieldname": "other_charges_deducted_import", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "fieldname": "grand_total_import", - "fieldtype": "Currency", - "in_list_view": 1, - "label": "Grand Total", - "oldfieldname": "grand_total_import", - "oldfieldtype": "Currency", - "options": "currency", - "permlevel": 0, - "print_hide": 0, + "fieldname": "grand_total_import", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Grand Total", + "oldfieldname": "grand_total_import", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "print_hide": 0, "read_only": 1 - }, + }, { - "fieldname": "in_words_import", - "fieldtype": "Data", - "label": "In Words", - "oldfieldname": "in_words_import", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, + "fieldname": "in_words_import", + "fieldtype": "Data", + "label": "In Words", + "oldfieldname": "in_words_import", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 0, "read_only": 1 - }, + }, { - "fieldname": "total_amount_to_pay", - "fieldtype": "Currency", - "hidden": 0, - "label": "Total Amount To Pay", - "no_copy": 1, - "oldfieldname": "total_amount_to_pay", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, + "fieldname": "total_amount_to_pay", + "fieldtype": "Currency", + "hidden": 0, + "label": "Total Amount To Pay", + "no_copy": 1, + "oldfieldname": "total_amount_to_pay", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "fieldname": "total_advance", - "fieldtype": "Currency", - "label": "Total Advance", - "no_copy": 1, - "oldfieldname": "total_advance", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, + "fieldname": "total_advance", + "fieldtype": "Currency", + "label": "Total Advance", + "no_copy": 1, + "oldfieldname": "total_advance", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "fieldname": "total_tax", - "fieldtype": "Currency", - "label": "Total Tax (Company Currency)", - "oldfieldname": "total_tax", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, + "fieldname": "total_tax", + "fieldtype": "Currency", + "label": "Total Tax (Company Currency)", + "oldfieldname": "total_tax", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "fieldname": "outstanding_amount", - "fieldtype": "Currency", - "in_filter": 1, - "in_list_view": 1, - "label": "Outstanding Amount", - "no_copy": 1, - "oldfieldname": "outstanding_amount", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, + "fieldname": "outstanding_amount", + "fieldtype": "Currency", + "in_filter": 1, + "in_list_view": 1, + "label": "Outstanding Amount", + "no_copy": 1, + "oldfieldname": "outstanding_amount", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, "search_index": 1 - }, + }, { - "fieldname": "write_off_amount", - "fieldtype": "Currency", - "label": "Write Off Amount", - "no_copy": 1, - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, + "fieldname": "write_off_amount", + "fieldtype": "Currency", + "label": "Write Off Amount", + "no_copy": 1, + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, "read_only": 0 - }, + }, { - "depends_on": "eval:flt(doc.write_off_amount)!=0", - "fieldname": "write_off_account", - "fieldtype": "Link", - "label": "Write Off Account", - "no_copy": 1, - "options": "Account", - "permlevel": 0, - "print_hide": 1, + "depends_on": "eval:flt(doc.write_off_amount)!=0", + "fieldname": "write_off_account", + "fieldtype": "Link", + "label": "Write Off Account", + "no_copy": 1, + "options": "Account", + "permlevel": 0, + "print_hide": 1, "read_only": 0 - }, + }, { - "depends_on": "eval:flt(doc.write_off_amount)!=0", - "fieldname": "write_off_cost_center", - "fieldtype": "Link", - "label": "Write Off Cost Center", - "no_copy": 1, - "options": "Cost Center", - "permlevel": 0, - "print_hide": 1, + "depends_on": "eval:flt(doc.write_off_amount)!=0", + "fieldname": "write_off_cost_center", + "fieldtype": "Link", + "label": "Write Off Cost Center", + "no_copy": 1, + "options": "Cost Center", + "permlevel": 0, + "print_hide": 1, "read_only": 0 - }, + }, { - "fieldname": "against_expense_account", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Against Expense Account", - "no_copy": 1, - "oldfieldname": "against_expense_account", - "oldfieldtype": "Small Text", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, + "fieldname": "against_expense_account", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Against Expense Account", + "no_copy": 1, + "oldfieldname": "against_expense_account", + "oldfieldtype": "Small Text", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, "report_hide": 0 - }, + }, { - "fieldname": "fold", - "fieldtype": "Fold", + "fieldname": "fold", + "fieldtype": "Fold", "permlevel": 0 - }, + }, { - "fieldname": "advances", - "fieldtype": "Section Break", - "label": "Advances", - "oldfieldtype": "Section Break", - "options": "icon-money", - "permlevel": 0, - "print_hide": 1, + "fieldname": "advances", + "fieldtype": "Section Break", + "label": "Advances", + "oldfieldtype": "Section Break", + "options": "icon-money", + "permlevel": 0, + "print_hide": 1, "read_only": 0 - }, + }, { - "fieldname": "get_advances_paid", - "fieldtype": "Button", - "label": "Get Advances Paid", - "oldfieldtype": "Button", - "options": "get_advances", - "permlevel": 0, - "print_hide": 1, + "fieldname": "get_advances_paid", + "fieldtype": "Button", + "label": "Get Advances Paid", + "oldfieldtype": "Button", + "options": "get_advances", + "permlevel": 0, + "print_hide": 1, "read_only": 0 - }, + }, { - "fieldname": "advance_allocation_details", - "fieldtype": "Table", - "label": "Purchase Invoice Advances", - "no_copy": 1, - "oldfieldname": "advance_allocation_details", - "oldfieldtype": "Table", - "options": "Purchase Invoice Advance", - "permlevel": 0, - "print_hide": 1, + "fieldname": "advance_allocation_details", + "fieldtype": "Table", + "label": "Purchase Invoice Advances", + "no_copy": 1, + "oldfieldname": "advance_allocation_details", + "oldfieldtype": "Table", + "options": "Purchase Invoice Advance", + "permlevel": 0, + "print_hide": 1, "read_only": 0 - }, + }, { - "fieldname": "terms_section_break", - "fieldtype": "Section Break", - "label": "Terms and Conditions", - "options": "icon-legal", + "fieldname": "terms_section_break", + "fieldtype": "Section Break", + "label": "Terms and Conditions", + "options": "icon-legal", "permlevel": 0 - }, + }, { - "fieldname": "tc_name", - "fieldtype": "Link", - "label": "Terms", - "options": "Terms and Conditions", - "permlevel": 0, + "fieldname": "tc_name", + "fieldtype": "Link", + "label": "Terms", + "options": "Terms and Conditions", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "terms", - "fieldtype": "Text Editor", - "label": "Terms and Conditions1", + "fieldname": "terms", + "fieldtype": "Text Editor", + "label": "Terms and Conditions1", "permlevel": 0 - }, + }, { - "depends_on": "supplier", - "fieldname": "contact_section", - "fieldtype": "Section Break", - "label": "Contact Info", - "options": "icon-bullhorn", - "permlevel": 0, + "depends_on": "supplier", + "fieldname": "contact_section", + "fieldtype": "Section Break", + "label": "Contact Info", + "options": "icon-bullhorn", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "supplier_address", - "fieldtype": "Link", - "label": "Supplier Address", - "options": "Address", - "permlevel": 0, - "print_hide": 1, + "fieldname": "supplier_address", + "fieldtype": "Link", + "label": "Supplier Address", + "options": "Address", + "permlevel": 0, + "print_hide": 1, "read_only": 0 - }, + }, { - "fieldname": "col_break23", - "fieldtype": "Column Break", - "permlevel": 0, - "read_only": 0, + "fieldname": "col_break23", + "fieldtype": "Column Break", + "permlevel": 0, + "read_only": 0, "width": "50%" - }, + }, { - "fieldname": "contact_person", - "fieldtype": "Link", - "label": "Contact Person", - "options": "Contact", - "permlevel": 0, - "print_hide": 1, + "fieldname": "contact_person", + "fieldtype": "Link", + "label": "Contact Person", + "options": "Contact", + "permlevel": 0, + "print_hide": 1, "read_only": 0 - }, + }, { - "fieldname": "more_info", - "fieldtype": "Section Break", - "label": "More Info", - "oldfieldtype": "Section Break", - "options": "icon-file-text", - "permlevel": 0, - "print_hide": 1, + "fieldname": "more_info", + "fieldtype": "Section Break", + "label": "More Info", + "oldfieldtype": "Section Break", + "options": "icon-file-text", + "permlevel": 0, + "print_hide": 1, "read_only": 0 - }, + }, { - "description": "Supplier (Payable) Account", - "fieldname": "credit_to", - "fieldtype": "Link", - "in_filter": 1, - "label": "Credit To", - "oldfieldname": "credit_to", - "oldfieldtype": "Link", - "options": "Account", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "reqd": 1, + "description": "Supplier (Payable) Account", + "fieldname": "credit_to", + "fieldtype": "Link", + "in_filter": 1, + "label": "Credit To", + "oldfieldname": "credit_to", + "oldfieldtype": "Link", + "options": "Account", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "reqd": 1, "search_index": 1 - }, + }, { - "default": "No", - "description": "Considered as Opening Balance", - "fieldname": "is_opening", - "fieldtype": "Select", - "in_filter": 1, - "label": "Is Opening", - "oldfieldname": "is_opening", - "oldfieldtype": "Select", - "options": "No\nYes", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, + "default": "No", + "description": "Considered as Opening Balance", + "fieldname": "is_opening", + "fieldtype": "Select", + "in_filter": 1, + "label": "Is Opening", + "oldfieldname": "is_opening", + "oldfieldtype": "Select", + "options": "No\nYes", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, "search_index": 1 - }, + }, { - "description": "Actual Invoice Date", - "fieldname": "aging_date", - "fieldtype": "Date", - "label": "Aging Date", - "oldfieldname": "aging_date", - "oldfieldtype": "Date", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, + "description": "Actual Invoice Date", + "fieldname": "aging_date", + "fieldtype": "Date", + "label": "Aging Date", + "oldfieldname": "aging_date", + "oldfieldtype": "Date", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, "search_index": 0 - }, + }, { - "allow_on_submit": 1, - "fieldname": "select_print_heading", - "fieldtype": "Link", - "label": "Print Heading", - "no_copy": 1, - "oldfieldname": "select_print_heading", - "oldfieldtype": "Link", - "options": "Print Heading", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, + "allow_on_submit": 1, + "fieldname": "select_print_heading", + "fieldtype": "Link", + "label": "Print Heading", + "no_copy": 1, + "oldfieldname": "select_print_heading", + "oldfieldtype": "Link", + "options": "Print Heading", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, "report_hide": 1 - }, + }, { - "fieldname": "due_date", - "fieldtype": "Date", - "in_filter": 1, - "label": "Due Date", - "no_copy": 0, - "oldfieldname": "due_date", - "oldfieldtype": "Date", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, + "fieldname": "due_date", + "fieldtype": "Date", + "in_filter": 1, + "label": "Due Date", + "no_copy": 0, + "oldfieldname": "due_date", + "oldfieldtype": "Date", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, "search_index": 1 - }, + }, { - "fieldname": "mode_of_payment", - "fieldtype": "Link", - "label": "Mode of Payment", - "oldfieldname": "mode_of_payment", - "oldfieldtype": "Select", - "options": "Mode of Payment", - "permlevel": 0, + "fieldname": "mode_of_payment", + "fieldtype": "Link", + "label": "Mode of Payment", + "oldfieldname": "mode_of_payment", + "oldfieldtype": "Select", + "options": "Mode of Payment", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "column_break_63", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "column_break_63", + "fieldtype": "Column Break", + "permlevel": 0, "read_only": 0 - }, + }, { - "allow_on_submit": 1, - "fieldname": "letter_head", - "fieldtype": "Link", - "label": "Letter Head", - "options": "Letter Head", - "permlevel": 0, + "allow_on_submit": 1, + "fieldname": "letter_head", + "fieldtype": "Link", + "label": "Letter Head", + "options": "Letter Head", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "fiscal_year", - "fieldtype": "Link", - "in_filter": 1, - "label": "Fiscal Year", - "oldfieldname": "fiscal_year", - "oldfieldtype": "Select", - "options": "Fiscal Year", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, + "fieldname": "fiscal_year", + "fieldtype": "Link", + "in_filter": 1, + "label": "Fiscal Year", + "oldfieldname": "fiscal_year", + "oldfieldtype": "Select", + "options": "Fiscal Year", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, "search_index": 1 - }, + }, { - "fieldname": "remarks", - "fieldtype": "Small Text", - "label": "Remarks", - "no_copy": 1, - "oldfieldname": "remarks", - "oldfieldtype": "Text", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, + "fieldname": "remarks", + "fieldtype": "Small Text", + "label": "Remarks", + "no_copy": 1, + "oldfieldname": "remarks", + "oldfieldtype": "Text", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, "reqd": 0 + }, + { + "depends_on": "eval:doc.docstatus<2", + "fieldname": "recurring_invoice", + "fieldtype": "Section Break", + "label": "Recurring Invoice", + "options": "icon-time", + "permlevel": 0, + "print_hide": 1 + }, + { + "fieldname": "column_break_77", + "fieldtype": "Column Break", + "permlevel": 0, + "print_hide": 1, + "width": "50%" + }, + { + "allow_on_submit": 1, + "depends_on": "eval:doc.docstatus<2", + "description": "Check if recurring invoice, uncheck to stop recurring or put proper End Date", + "fieldname": "is_recurring", + "fieldtype": "Check", + "label": "Is Recurring", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1 + }, + { + "allow_on_submit": 1, + "description": "Select the period when the invoice will be generated automatically", + "fieldname": "recurring_type", + "fieldtype": "Select", + "label": "Recurring Type", + "no_copy": 1, + "options": "Monthly\nQuarterly\nHalf-yearly\nYearly", + "permlevel": 0, + "print_hide": 1 + }, + { + "allow_on_submit": 1, + "depends_on": "eval:doc.is_recurring==1", + "description": "The day of the month on which auto invoice will be generated e.g. 05, 28 etc", + "fieldname": "repeat_on_day_of_month", + "fieldtype": "Int", + "label": "Repeat on Day of Month", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1 + }, + { + "depends_on": "eval:doc.is_recurring==1", + "description": "The date on which next invoice will be generated. It is generated on submit.", + "fieldname": "next_date", + "fieldtype": "Date", + "label": "Next Date", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "column_break_82", + "fieldtype": "Column Break", + "permlevel": 0, + "print_hide": 1, + "width": "50%" + }, + { + "allow_on_submit": 1, + "depends_on": "eval:doc.is_recurring==1", + "description": "The date on which recurring invoice will be stop", + "fieldname": "end_date", + "fieldtype": "Date", + "label": "End Date", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1 + }, + { + "depends_on": "eval:doc.is_recurring==1", + "description": "The unique id for tracking all recurring invoices. It is generated on submit.", + "fieldname": "recurring_id", + "fieldtype": "Data", + "label": "Recurring Id", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "allow_on_submit": 1, + "depends_on": "eval:doc.is_recurring==1", + "description": "Enter email id separated by commas, invoice will be mailed automatically on particular date", + "fieldname": "notification_email_address", + "fieldtype": "Small Text", + "label": "Notification Email Address", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1 + }, + { + "fieldname": "against_income_account", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Against Income Account", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1, + "report_hide": 1 } - ], - "icon": "icon-file-text", - "idx": 1, - "is_submittable": 1, - "modified": "2014-08-19 12:01:12.133942", - "modified_by": "Administrator", - "module": "Accounts", - "name": "Purchase Invoice", - "owner": "Administrator", + ], + "icon": "icon-file-text", + "idx": 1, + "is_submittable": 1, + "modified": "2014-09-10 12:26:59.555710", + "modified_by": "Administrator", + "module": "Accounts", + "name": "Purchase Invoice", + "owner": "Administrator", "permissions": [ { - "amend": 1, - "apply_user_permissions": 1, - "cancel": 1, - "create": 1, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Accounts User", - "submit": 1, + "amend": 1, + "apply_user_permissions": 1, + "cancel": 1, + "create": 1, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts User", + "submit": 1, "write": 1 - }, + }, { - "amend": 0, - "apply_user_permissions": 1, - "cancel": 0, - "create": 0, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Purchase User", - "submit": 0, + "amend": 0, + "apply_user_permissions": 1, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Purchase User", + "submit": 0, "write": 0 - }, + }, { - "amend": 0, - "apply_user_permissions": 1, - "cancel": 0, - "create": 0, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Supplier", - "submit": 0, + "amend": 0, + "apply_user_permissions": 1, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Supplier", + "submit": 0, "write": 0 - }, + }, { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Accounts Manager", - "submit": 1, + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts Manager", + "submit": 1, "write": 1 - }, + }, { - "amend": 0, - "apply_user_permissions": 1, - "cancel": 0, - "create": 0, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Auditor", - "submit": 0, + "amend": 0, + "apply_user_permissions": 1, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Auditor", + "submit": 0, "write": 0 - }, + }, { - "permlevel": 1, - "read": 1, - "role": "Accounts Manager", + "permlevel": 1, + "read": 1, + "role": "Accounts Manager", "write": 1 } - ], - "read_only_onload": 1, - "search_fields": "posting_date, credit_to, fiscal_year, bill_no, grand_total, outstanding_amount", - "sort_field": "modified", + ], + "read_only_onload": 1, + "search_fields": "posting_date, credit_to, fiscal_year, bill_no, grand_total, outstanding_amount", + "sort_field": "modified", "sort_order": "DESC" } diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index 289567f34c9..5d36c5cb407 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -1,6 +1,5 @@ { - "allow_attach": 1, - "allow_import": 1, + "allow_import": 1, "autoname": "naming_series:", "creation": "2013-05-21 16:16:39", "docstatus": 0, @@ -663,12 +662,117 @@ "permlevel": 0, "print_hide": 1, "read_only": 1 + }, + { + "fieldname": "recurring_order", + "fieldtype": "Section Break", + "label": "Recurring Order", + "options": "icon-time", + "permlevel": 0 + }, + { + "fieldname": "column_break", + "fieldtype": "Column Break", + "label": "Column Break", + "permlevel": 0 + }, + { + "allow_on_submit": 1, + "depends_on": "eval:doc.docstatus<2", + "description": "Check if recurring order, uncheck to stop recurring or put proper End Date", + "fieldname": "is_recurring", + "fieldtype": "Check", + "label": "Is Recurring", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1 + }, + { + "allow_on_submit": 1, + "depends_on": "eval:doc.is_recurring==1", + "fieldname": "recurring_type", + "fieldtype": "Select", + "label": "Recurring Type", + "no_copy": 1, + "options": "Monthly\nQuarterly\nHalf-yearly\nYearly", + "permlevel": 0 + }, + { + "allow_on_submit": 1, + "depends_on": "eval:doc.is_recurring==1", + "description": "The day of the month on which auto order will be generated e.g. 05, 28 etc", + "fieldname": "repeat_on_day_of_month", + "fieldtype": "Int", + "label": "Repeat on Day of Month", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1 + }, + { + "depends_on": "eval:doc.is_recurring==1", + "description": "The date on which next invoice will be generated. It is generated on submit.", + "fieldname": "next_date", + "fieldtype": "Date", + "label": "Next Date", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "allow_on_submit": 1, + "depends_on": "eval:doc.is_recurring==1", + "description": "The date on which recurring order will be stop", + "fieldname": "end_date", + "fieldtype": "Date", + "label": "End Date", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1 + }, + { + "fieldname": "column_break83", + "fieldtype": "Column Break", + "label": "Column Break", + "permlevel": 0, + "print_hide": 1 + }, + { + "depends_on": "eval:doc.is_recurring==1", + "fieldname": "recurring_id", + "fieldtype": "Data", + "label": "Recurring Id", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "allow_on_submit": 1, + "depends_on": "eval:doc.is_recurring==1", + "description": "Enter email id separated by commas, order will be mailed automatically on particular date", + "fieldname": "notification_email_address", + "fieldtype": "Small Text", + "label": "Notification Email Address", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1 + }, + { + "fieldname": "against_income_account", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Against Income Account", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1, + "report_hide": 1 } ], "icon": "icon-file-text", "idx": 1, "is_submittable": 1, - "modified": "2014-08-12 05:22:53.496614", + "modified": "2014-09-10 13:23:02.825233", "modified_by": "Administrator", "module": "Buying", "name": "Purchase Order", @@ -740,4 +844,4 @@ "search_fields": "status, transaction_date, supplier,grand_total", "sort_field": "modified", "sort_order": "DESC" -} \ No newline at end of file +} From b2a3f2d386b6f8b679612269762adb8f0b3e8f83 Mon Sep 17 00:00:00 2001 From: Sambhaji Kolate Date: Wed, 10 Sep 2014 17:40:48 +0530 Subject: [PATCH 03/42] some minor changes get fixed for PO/PI --- .../doctype/purchase_invoice/purchase_invoice.js | 3 +-- .../doctype/purchase_invoice/purchase_invoice.json | 1 + .../doctype/purchase_invoice/purchase_invoice.py | 4 ++-- .../doctype/purchase_order/purchase_order.js | 4 ++-- .../doctype/purchase_order/purchase_order.py | 6 +++--- .../controllers/tests/test_recurring_document.py | 14 ++++++++++++++ 6 files changed, 23 insertions(+), 9 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index 680c6a0bbd9..90f463a38da 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -232,7 +232,6 @@ cur_frm.fields_dict['entries'].grid.get_field('project_name').get_query = functi } } -//added by sambhaji cur_frm.cscript.is_recurring = function(doc, dt, dn) { @@ -267,7 +266,7 @@ cur_frm.cscript.from_date = function(doc, dt, dn) { } } -//end of added by sambhajii + cur_frm.cscript.select_print_heading = function(doc,cdt,cdn){ if(doc.select_print_heading){ diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json index ea3eb8a0a5b..e29d3d91d78 100755 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json @@ -800,6 +800,7 @@ }, { "allow_on_submit": 1, + "depends_on": "eval:doc.is_recurring==1", "description": "Select the period when the invoice will be generated automatically", "fieldname": "recurring_type", "fieldtype": "Select", diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 7d35f41c965..77c7ea97d13 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -265,11 +265,11 @@ class PurchaseInvoice(BuyingController): self.update_against_document_in_jv() self.update_prevdoc_status() self.update_billing_status_for_zero_amount_refdoc("Purchase Order") - convert_to_recurring(self, "RECINV.#####", self.posting_date) + convert_to_recurring(self, "RECPI.#####", self.posting_date) def on_update_after_submit(self): validate_recurring_document(self) - convert_to_recurring(self, "RECINV.#####", self.posting_date) + convert_to_recurring(self, "RECPI.#####", self.posting_date) def make_gl_entries(self): auto_accounting_for_stock = \ diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js index 071d622cdd0..549584500f2 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order.js @@ -205,7 +205,7 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) { cur_frm.email_doc(frappe.boot.notification_settings.purchase_order_message); } } -//added by sambhaji + cur_frm.cscript.is_recurring = function(doc, dt, dn) { // set default values for recurring orders @@ -238,7 +238,7 @@ cur_frm.cscript.from_date = function(doc, dt, dn) { } } -//end of added by sambhaji + cur_frm.cscript.send_sms = function() { frappe.require("assets/erpnext/js/sms_manager.js"); var sms_man = new SMSManager(cur_frm.doc); diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py index beebf0b1fb1..66083be53be 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/purchase_order.py @@ -179,7 +179,7 @@ class PurchaseOrder(BuyingController): frappe.db.set(self,'status','Submitted') - convert_to_recurring(self, "SO/REC/.#####", self.transaction_date) + convert_to_recurring(self, "SO/REP/.#####", self.transaction_date) def on_cancel(self): pc_obj = frappe.get_doc('Purchase Common') @@ -204,9 +204,9 @@ class PurchaseOrder(BuyingController): def on_update(self): pass -def on_update_after_submit(self): + def on_update_after_submit(self): validate_recurring_document(self) - convert_to_recurring(self, "SO/REC/.#####", self.transaction_date) + convert_to_recurring(self, "SO/REP/.#####", self.transaction_date) def set_missing_values(source, target): target.ignore_pricing_rule = 1 diff --git a/erpnext/controllers/tests/test_recurring_document.py b/erpnext/controllers/tests/test_recurring_document.py index 0e7cb1bc5e4..10510824884 100644 --- a/erpnext/controllers/tests/test_recurring_document.py +++ b/erpnext/controllers/tests/test_recurring_document.py @@ -41,6 +41,20 @@ def test_recurring_document(obj, test_records): date_field = "transaction_date" elif base_doc.doctype == "Sales Invoice": date_field = "posting_date" + #for Purchase order/purchase invoice + if base_doc.doctype == "Purchase Order": + base_doc.update({ + "transaction_date": today + }) + elif base_doc.doctype == "Purchase Invoice": + base_doc.update({ + "posting_date": today + }) + + if base_doc.doctype == "Purchase Order": + date_field = "transaction_date" + elif base_doc.doctype == "Purchase Invoice": + date_field = "posting_date" # monthly doc1 = frappe.copy_doc(base_doc) From b14401c320503f1e8273f29a53b80ac618e6a107 Mon Sep 17 00:00:00 2001 From: Sambhaji Kolate Date: Thu, 11 Sep 2014 16:09:05 +0530 Subject: [PATCH 04/42] change convert_to_recurring() to take recurring_id dynamicaly --- .../purchase_invoice/purchase_invoice.py | 4 +-- .../doctype/sales_invoice/sales_invoice.py | 4 +-- .../doctype/purchase_order/purchase_order.py | 4 +-- erpnext/controllers/recurring_document.py | 29 +++++++++++-------- .../doctype/sales_order/sales_order.py | 4 +-- 5 files changed, 25 insertions(+), 20 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 77c7ea97d13..6a41bbab39d 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -265,11 +265,11 @@ class PurchaseInvoice(BuyingController): self.update_against_document_in_jv() self.update_prevdoc_status() self.update_billing_status_for_zero_amount_refdoc("Purchase Order") - convert_to_recurring(self, "RECPI.#####", self.posting_date) + convert_to_recurring(self, self.posting_date) def on_update_after_submit(self): validate_recurring_document(self) - convert_to_recurring(self, "RECPI.#####", self.posting_date) + convert_to_recurring(self, self.posting_date) def make_gl_entries(self): auto_accounting_for_stock = \ diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index a20d906b8c7..dc38c9a8d87 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -103,7 +103,7 @@ class SalesInvoice(SellingController): self.update_c_form() self.update_time_log_batch(self.name) - convert_to_recurring(self, "RECINV.#####", self.posting_date) + convert_to_recurring(self, self.posting_date) def before_cancel(self): self.update_time_log_batch(None) @@ -145,7 +145,7 @@ class SalesInvoice(SellingController): def on_update_after_submit(self): validate_recurring_document(self) - convert_to_recurring(self, "RECINV.#####", self.posting_date) + convert_to_recurring(self, self.posting_date) def get_portal_page(self): return "invoice" if self.docstatus==1 else None diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py index 66083be53be..a8a9d0da2fa 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/purchase_order.py @@ -179,7 +179,7 @@ class PurchaseOrder(BuyingController): frappe.db.set(self,'status','Submitted') - convert_to_recurring(self, "SO/REP/.#####", self.transaction_date) + convert_to_recurring(self, self.transaction_date) def on_cancel(self): pc_obj = frappe.get_doc('Purchase Common') @@ -206,7 +206,7 @@ class PurchaseOrder(BuyingController): def on_update_after_submit(self): validate_recurring_document(self) - convert_to_recurring(self, "SO/REP/.#####", self.transaction_date) + convert_to_recurring(self, self.transaction_date) def set_missing_values(source, target): target.ignore_pricing_rule = 1 diff --git a/erpnext/controllers/recurring_document.py b/erpnext/controllers/recurring_document.py index c7163ae3f87..7b4310badad 100644 --- a/erpnext/controllers/recurring_document.py +++ b/erpnext/controllers/recurring_document.py @@ -2,9 +2,14 @@ from __future__ import unicode_literals import frappe import frappe.utils import frappe.defaults -from frappe.utils import cint, cstr, getdate, nowdate, get_first_day, get_last_day + +from frappe.utils import add_days, cint, cstr, date_diff, flt, getdate, nowdate, \ + get_first_day, get_last_day, comma_and from frappe.model.naming import make_autoname + from frappe import _, msgprint, throw +from erpnext.accounts.party import get_party_account, get_due_date, get_party_details +from frappe.model.mapper import get_mapped_doc month_map = {'Monthly': 1, 'Quarterly': 3, 'Half-yearly': 6, 'Yearly': 12} @@ -46,7 +51,7 @@ def manage_recurring_documents(doctype, next_date=None, commit=True): frappe.db.begin() frappe.db.sql("update `tab%s` \ - set is_recurring = 0 where name = %s" % (doctype, '%s'), + set is_recurring = 0 where name = %s" % (doctype, '%s'), (ref_document)) notify_errors(ref_document, doctype, ref_wrapper.customer, ref_wrapper.owner) frappe.db.commit() @@ -152,18 +157,18 @@ def validate_recurring_document(doc): elif not (doc.from_date and doc.to_date): throw(_("Period From and Period To dates mandatory for recurring %s") % doc.doctype) -def convert_to_recurring(doc, autoname, posting_date): - if doc.is_recurring: - if not doc.recurring_id: - frappe.db.set(doc, "recurring_id", - make_autoname(autoname)) +# +def convert_to_recurring(doc, posting_date): + if doc.is_recurring: + if not doc.recurring_id: + frappe.db.set(doc, "recurring_id", doc.name) - set_next_date(doc, posting_date) + set_next_date(doc, posting_date) - elif doc.recurring_id: - frappe.db.sql("""update `tab%s` - set is_recurring = 0 - where recurring_id = %s""" % (doc.doctype, '%s'), (doc.recurring_id)) + elif doc.recurring_id: + frappe.db.sql("""update `tab%s` set is_recurring = 0 + where recurring_id = %s""" % (doc.doctype, '%s'), (doc.recurring_id)) +# def validate_notification_email_id(doc): if doc.notification_email_address: diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index ff14f9d0c15..b1852f115c7 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -166,7 +166,7 @@ class SalesOrder(SellingController): self.update_prevdoc_status('submit') frappe.db.set(self, 'status', 'Submitted') - convert_to_recurring(self, "SO/REC/.#####", self.transaction_date) + convert_to_recurring(self, self.transaction_date) def on_cancel(self): # Cannot cancel stopped SO @@ -257,7 +257,7 @@ class SalesOrder(SellingController): def on_update_after_submit(self): validate_recurring_document(self) - convert_to_recurring(self, "SO/REC/.#####", self.transaction_date) + convert_to_recurring(self, self.transaction_date) @frappe.whitelist() From 2e07305616aae8702bad27655d64c87bef980de5 Mon Sep 17 00:00:00 2001 From: ankitjavalkarwork Date: Thu, 11 Sep 2014 16:47:19 +0530 Subject: [PATCH 05/42] Update report with Valuation rate, stock values, move to Main report --- erpnext/config/stock.py | 12 +++--- .../warehouse_wise_stock_balance.py | 39 ++++++++++++++----- 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/erpnext/config/stock.py b/erpnext/config/stock.py index bfb4b7fd941..957abecdce8 100644 --- a/erpnext/config/stock.py +++ b/erpnext/config/stock.py @@ -171,6 +171,12 @@ def get_data(): "label": _("Stock Analytics"), "icon": "icon-bar-chart" }, + { + "type": "report", + "is_query_report": True, + "name": "Warehouse-Wise Stock Balance", + "doctype": "Warehouse" + }, ] }, { @@ -222,12 +228,6 @@ def get_data(): "name": "Batch-Wise Balance History", "doctype": "Batch" }, - { - "type": "report", - "is_query_report": True, - "name": "Warehouse-Wise Stock Balance", - "doctype": "Warehouse" - }, { "type": "report", "is_query_report": True, diff --git a/erpnext/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.py b/erpnext/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.py index 16fe3be4721..775f6f11bbe 100644 --- a/erpnext/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.py +++ b/erpnext/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.py @@ -19,9 +19,15 @@ def execute(filters=None): for wh in sorted(iwb_map[company][item]): qty_dict = iwb_map[company][item][wh] data.append([item, item_map[item]["item_name"], + item_map[item]["item_group"], + item_map[item]["brand"], item_map[item]["description"], wh, - qty_dict.opening_qty, qty_dict.in_qty, - qty_dict.out_qty, qty_dict.bal_qty, company + qty_dict.uom, qty_dict.opening_qty, + qty_dict.opening_val, qty_dict.in_qty, + qty_dict.in_val, qty_dict.out_qty, + qty_dict.out_val, qty_dict.bal_qty, + qty_dict.bal_val, qty_dict.val_rate, + company ]) return columns, data @@ -29,9 +35,11 @@ def execute(filters=None): def get_columns(filters): """return columns based on filters""" - columns = ["Item:Link/Item:100", "Item Name::150", "Description::150", \ - "Warehouse:Link/Warehouse:100", "Opening Qty:Float:90", \ - "In Qty:Float:80", "Out Qty:Float:80", "Balance Qty:Float:90", "Company:Link/Company:100"] + columns = ["Item:Link/Item:100", "Item Name::150", "Item Group::100", "Brand::90", \ + "Description::140", "Warehouse:Link/Warehouse:100", "Stock UOM::90", "Opening Qty:Float:100", \ + "Opening Value:Float:110", "In Qty:Float:80", "In Value:Float:80", "Out Qty:Float:80", \ + "Out Value:Float:80", "Balance Qty:Float:100", "Balance Value:Float:100", \ + "Valuation Rate:Float:90", "Company:Link/Company:100"] return columns @@ -50,8 +58,8 @@ def get_conditions(filters): #get all details def get_stock_ledger_entries(filters): conditions = get_conditions(filters) - return frappe.db.sql("""select item_code, warehouse, - posting_date, actual_qty, company + return frappe.db.sql("""select item_code, warehouse, posting_date, + actual_qty, valuation_rate, stock_uom, company from `tabStock Ledger Entry` where docstatus < 2 %s order by item_code, warehouse""" % conditions, as_dict=1) @@ -63,24 +71,37 @@ def get_item_warehouse_map(filters): for d in sle: iwb_map.setdefault(d.company, {}).setdefault(d.item_code, {}).\ setdefault(d.warehouse, frappe._dict({\ - "opening_qty": 0.0, "in_qty": 0.0, "out_qty": 0.0, "bal_qty": 0.0 + "opening_qty": 0.0, "opening_val": 0.0, + "in_qty": 0.0, "in_val": 0.0, + "out_qty": 0.0, "out_val": 0.0, + "bal_qty": 0.0, "bal_val": 0.0, + "val_rate": 0.0, "uom": None })) qty_dict = iwb_map[d.company][d.item_code][d.warehouse] + qty_dict.uom = d.stock_uom + if d.posting_date < filters["from_date"]: qty_dict.opening_qty += flt(d.actual_qty) + qty_dict.opening_val += flt(d.actual_qty * d.valuation_rate) elif d.posting_date >= filters["from_date"] and d.posting_date <= filters["to_date"]: + qty_dict.val_rate = d.valuation_rate + if flt(d.actual_qty) > 0: qty_dict.in_qty += flt(d.actual_qty) + qty_dict.in_val += flt(d.actual_qty * d.valuation_rate) else: qty_dict.out_qty += abs(flt(d.actual_qty)) + qty_dict.out_val += flt(abs(flt(d.actual_qty)) * d.valuation_rate) qty_dict.bal_qty += flt(d.actual_qty) + qty_dict.bal_val += flt(d.actual_qty * d.valuation_rate) return iwb_map def get_item_details(filters): item_map = {} - for d in frappe.db.sql("select name, item_name, description from tabItem", as_dict=1): + for d in frappe.db.sql("select name, item_name, item_group, brand, \ + description from tabItem", as_dict=1): item_map.setdefault(d.name, d) return item_map From 4d3a18890ba395f4eceb81f314ca781b05e37a98 Mon Sep 17 00:00:00 2001 From: Sambhaji Kolate Date: Mon, 15 Sep 2014 12:20:11 +0530 Subject: [PATCH 06/42] fix conflict --- erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json | 2 +- erpnext/buying/doctype/purchase_order/purchase_order.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json index e29d3d91d78..bb393a54df9 100755 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json @@ -886,7 +886,7 @@ "icon": "icon-file-text", "idx": 1, "is_submittable": 1, - "modified": "2014-09-10 12:26:59.555710", + "modified": "2014-09-09 05:35:32.156763", "modified_by": "Administrator", "module": "Accounts", "name": "Purchase Invoice", diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index 5d36c5cb407..f16a548793f 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -772,7 +772,7 @@ "icon": "icon-file-text", "idx": 1, "is_submittable": 1, - "modified": "2014-09-10 13:23:02.825233", + "modified": "2014-09-10 05:35:32.583024", "modified_by": "Administrator", "module": "Buying", "name": "Purchase Order", From d14e15d4328f06669e2415cf78e11463d81574d6 Mon Sep 17 00:00:00 2001 From: Sambhaji Kolate Date: Mon, 15 Sep 2014 12:31:44 +0530 Subject: [PATCH 07/42] fix conflict --- .../purchase_invoice/purchase_invoice.json | 1827 ++++++++--------- .../purchase_order/purchase_order.json | 1576 +++++++------- 2 files changed, 1580 insertions(+), 1823 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json index bb393a54df9..43cb633cee5 100755 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json @@ -1,980 +1,851 @@ { - "allow_import": 1, - "autoname": "naming_series:", - "creation": "2013-05-21 16:16:39", - "docstatus": 0, - "doctype": "DocType", - "fields": [ - { - "fieldname": "supplier_section", - "fieldtype": "Section Break", - "label": "Supplier", - "options": "icon-user", - "permlevel": 0 - }, - { - "fieldname": "column_break0", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, - "read_only": 0, - "width": "50%" - }, - { - "fieldname": "naming_series", - "fieldtype": "Select", - "label": "Series", - "no_copy": 1, - "oldfieldname": "naming_series", - "oldfieldtype": "Select", - "options": "PINV-", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "report_hide": 0, - "reqd": 1 - }, - { - "fieldname": "supplier", - "fieldtype": "Link", - "hidden": 0, - "label": "Supplier", - "oldfieldname": "supplier", - "oldfieldtype": "Link", - "options": "Supplier", - "permlevel": 0, - "print_hide": 1, - "read_only": 0 - }, - { - "depends_on": "supplier", - "fieldname": "supplier_name", - "fieldtype": "Data", - "hidden": 0, - "in_list_view": 1, - "label": "Name", - "oldfieldname": "supplier_name", - "oldfieldtype": "Data", - "permlevel": 0, - "read_only": 1 - }, - { - "fieldname": "address_display", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Address", - "permlevel": 0, - "read_only": 1 - }, - { - "fieldname": "contact_display", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Contact", - "permlevel": 0, - "read_only": 1 - }, - { - "fieldname": "contact_mobile", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Mobile No", - "permlevel": 0, - "read_only": 1 - }, - { - "fieldname": "contact_email", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Contact Email", - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "column_break1", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, - "read_only": 0, - "reqd": 0, - "width": "50%" - }, - { - "default": "Today", - "fieldname": "posting_date", - "fieldtype": "Date", - "in_filter": 1, - "label": "Date", - "no_copy": 0, - "oldfieldname": "posting_date", - "oldfieldtype": "Date", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "reqd": 1, - "search_index": 1 - }, - { - "description": "", - "fieldname": "bill_no", - "fieldtype": "Data", - "in_filter": 1, - "label": "Supplier Invoice No", - "oldfieldname": "bill_no", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "reqd": 0, - "search_index": 1 - }, - { - "fieldname": "bill_date", - "fieldtype": "Date", - "in_filter": 1, - "label": "Supplier Invoice Date", - "oldfieldname": "bill_date", - "oldfieldtype": "Date", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "reqd": 0, - "search_index": 1 - }, - { - "allow_on_submit": 1, - "description": "Start date of current invoice's period", - "fieldname": "from_date", - "fieldtype": "Date", - "label": "From", - "no_copy": 1, - "permlevel": 0 - }, - { - "allow_on_submit": 1, - "description": "End date of current invoice's period", - "fieldname": "to_date", - "fieldtype": "Date", - "label": "To", - "no_copy": 1, - "permlevel": 0 - }, - { - "fieldname": "amended_from", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Amended From", - "no_copy": 1, - "oldfieldname": "amended_from", - "oldfieldtype": "Link", - "options": "Purchase Invoice", - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "company", - "fieldtype": "Link", - "in_filter": 1, - "label": "Company", - "oldfieldname": "company", - "oldfieldtype": "Link", - "options": "Company", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "search_index": 1 - }, - { - "fieldname": "currency_price_list", - "fieldtype": "Section Break", - "label": "Currency and Price List", - "options": "icon-tag", - "permlevel": 0, - "read_only": 0 - }, - { - "fieldname": "currency", - "fieldtype": "Link", - "label": "Currency", - "oldfieldname": "currency", - "oldfieldtype": "Select", - "options": "Currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 0 - }, - { - "description": "The rate at which Bill Currency is converted into company's base currency", - "fieldname": "conversion_rate", - "fieldtype": "Float", - "label": "Exchange Rate", - "oldfieldname": "conversion_rate", - "oldfieldtype": "Currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 0 - }, - { - "fieldname": "column_break2", - "fieldtype": "Column Break", - "permlevel": 0, - "read_only": 0 - }, - { - "fieldname": "buying_price_list", - "fieldtype": "Link", - "label": "Price List", - "options": "Price List", - "permlevel": 0, - "print_hide": 1, - "read_only": 0 - }, - { - "fieldname": "price_list_currency", - "fieldtype": "Link", - "label": "Price List Currency", - "options": "Currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "plc_conversion_rate", - "fieldtype": "Float", - "label": "Price List Exchange Rate", - "permlevel": 0, - "print_hide": 1, - "read_only": 0 - }, - { - "fieldname": "ignore_pricing_rule", - "fieldtype": "Check", - "label": "Ignore Pricing Rule", - "no_copy": 1, - "permlevel": 1, - "print_hide": 1 - }, - { - "fieldname": "items", - "fieldtype": "Section Break", - "label": "Items", - "oldfieldtype": "Section Break", - "options": "icon-shopping-cart", - "permlevel": 0, - "read_only": 0 - }, - { - "allow_on_submit": 1, - "fieldname": "entries", - "fieldtype": "Table", - "label": "Entries", - "oldfieldname": "entries", - "oldfieldtype": "Table", - "options": "Purchase Invoice Item", - "permlevel": 0, - "read_only": 0 - }, - { - "fieldname": "section_break_26", - "fieldtype": "Section Break", - "permlevel": 0 - }, - { - "description": "Will be calculated automatically when you enter the details", - "fieldname": "net_total", - "fieldtype": "Currency", - "label": "Net Total (Company Currency)", - "oldfieldname": "net_total", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "column_break_28", - "fieldtype": "Column Break", - "permlevel": 0 - }, - { - "fieldname": "net_total_import", - "fieldtype": "Currency", - "label": "Net Total", - "oldfieldname": "net_total_import", - "oldfieldtype": "Currency", - "options": "currency", - "permlevel": 0, - "print_hide": 0, - "read_only": 1 - }, - { - "fieldname": "taxes", - "fieldtype": "Section Break", - "label": "Taxes and Charges", - "oldfieldtype": "Section Break", - "options": "icon-money", - "permlevel": 0, - "read_only": 0 - }, - { - "fieldname": "taxes_and_charges", - "fieldtype": "Link", - "label": "Taxes and Charges", - "oldfieldname": "purchase_other_charges", - "oldfieldtype": "Link", - "options": "Purchase Taxes and Charges Master", - "permlevel": 0, - "print_hide": 1, - "read_only": 0 - }, - { - "fieldname": "other_charges", - "fieldtype": "Table", - "label": "Purchase Taxes and Charges", - "oldfieldname": "purchase_tax_details", - "oldfieldtype": "Table", - "options": "Purchase Taxes and Charges", - "permlevel": 0, - "read_only": 0 - }, - { - "fieldname": "other_charges_calculation", - "fieldtype": "HTML", - "label": "Taxes and Charges Calculation", - "oldfieldtype": "HTML", - "permlevel": 0, - "print_hide": 1, - "read_only": 0 - }, - { - "fieldname": "totals", - "fieldtype": "Section Break", - "label": "Totals", - "oldfieldtype": "Section Break", - "options": "icon-money", - "permlevel": 0, - "read_only": 0 - }, - { - "fieldname": "other_charges_added", - "fieldtype": "Currency", - "label": "Taxes and Charges Added (Company Currency)", - "oldfieldname": "other_charges_added", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "other_charges_deducted", - "fieldtype": "Currency", - "label": "Taxes and Charges Deducted (Company Currency)", - "oldfieldname": "other_charges_deducted", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "grand_total", - "fieldtype": "Currency", - "label": "Grand Total (Company Currency)", - "oldfieldname": "grand_total", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "description": "In Words will be visible once you save the Purchase Invoice.", - "fieldname": "in_words", - "fieldtype": "Data", - "label": "In Words (Company Currency)", - "oldfieldname": "in_words", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "column_break8", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "width": "50%" - }, - { - "fieldname": "other_charges_added_import", - "fieldtype": "Currency", - "label": "Taxes and Charges Added", - "oldfieldname": "other_charges_added_import", - "oldfieldtype": "Currency", - "options": "currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "other_charges_deducted_import", - "fieldtype": "Currency", - "label": "Taxes and Charges Deducted", - "oldfieldname": "other_charges_deducted_import", - "oldfieldtype": "Currency", - "options": "currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "grand_total_import", - "fieldtype": "Currency", - "in_list_view": 1, - "label": "Grand Total", - "oldfieldname": "grand_total_import", - "oldfieldtype": "Currency", - "options": "currency", - "permlevel": 0, - "print_hide": 0, - "read_only": 1 - }, - { - "fieldname": "in_words_import", - "fieldtype": "Data", - "label": "In Words", - "oldfieldname": "in_words_import", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, - "read_only": 1 - }, - { - "fieldname": "total_amount_to_pay", - "fieldtype": "Currency", - "hidden": 0, - "label": "Total Amount To Pay", - "no_copy": 1, - "oldfieldname": "total_amount_to_pay", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "total_advance", - "fieldtype": "Currency", - "label": "Total Advance", - "no_copy": 1, - "oldfieldname": "total_advance", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "total_tax", - "fieldtype": "Currency", - "label": "Total Tax (Company Currency)", - "oldfieldname": "total_tax", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "outstanding_amount", - "fieldtype": "Currency", - "in_filter": 1, - "in_list_view": 1, - "label": "Outstanding Amount", - "no_copy": 1, - "oldfieldname": "outstanding_amount", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, - "search_index": 1 - }, - { - "fieldname": "write_off_amount", - "fieldtype": "Currency", - "label": "Write Off Amount", - "no_copy": 1, - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 0 - }, - { - "depends_on": "eval:flt(doc.write_off_amount)!=0", - "fieldname": "write_off_account", - "fieldtype": "Link", - "label": "Write Off Account", - "no_copy": 1, - "options": "Account", - "permlevel": 0, - "print_hide": 1, - "read_only": 0 - }, - { - "depends_on": "eval:flt(doc.write_off_amount)!=0", - "fieldname": "write_off_cost_center", - "fieldtype": "Link", - "label": "Write Off Cost Center", - "no_copy": 1, - "options": "Cost Center", - "permlevel": 0, - "print_hide": 1, - "read_only": 0 - }, - { - "fieldname": "against_expense_account", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Against Expense Account", - "no_copy": 1, - "oldfieldname": "against_expense_account", - "oldfieldtype": "Small Text", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "report_hide": 0 - }, - { - "fieldname": "fold", - "fieldtype": "Fold", - "permlevel": 0 - }, - { - "fieldname": "advances", - "fieldtype": "Section Break", - "label": "Advances", - "oldfieldtype": "Section Break", - "options": "icon-money", - "permlevel": 0, - "print_hide": 1, - "read_only": 0 - }, - { - "fieldname": "get_advances_paid", - "fieldtype": "Button", - "label": "Get Advances Paid", - "oldfieldtype": "Button", - "options": "get_advances", - "permlevel": 0, - "print_hide": 1, - "read_only": 0 - }, - { - "fieldname": "advance_allocation_details", - "fieldtype": "Table", - "label": "Purchase Invoice Advances", - "no_copy": 1, - "oldfieldname": "advance_allocation_details", - "oldfieldtype": "Table", - "options": "Purchase Invoice Advance", - "permlevel": 0, - "print_hide": 1, - "read_only": 0 - }, - { - "fieldname": "terms_section_break", - "fieldtype": "Section Break", - "label": "Terms and Conditions", - "options": "icon-legal", - "permlevel": 0 - }, - { - "fieldname": "tc_name", - "fieldtype": "Link", - "label": "Terms", - "options": "Terms and Conditions", - "permlevel": 0, - "print_hide": 1 - }, - { - "fieldname": "terms", - "fieldtype": "Text Editor", - "label": "Terms and Conditions1", - "permlevel": 0 - }, - { - "depends_on": "supplier", - "fieldname": "contact_section", - "fieldtype": "Section Break", - "label": "Contact Info", - "options": "icon-bullhorn", - "permlevel": 0, - "read_only": 0 - }, - { - "fieldname": "supplier_address", - "fieldtype": "Link", - "label": "Supplier Address", - "options": "Address", - "permlevel": 0, - "print_hide": 1, - "read_only": 0 - }, - { - "fieldname": "col_break23", - "fieldtype": "Column Break", - "permlevel": 0, - "read_only": 0, - "width": "50%" - }, - { - "fieldname": "contact_person", - "fieldtype": "Link", - "label": "Contact Person", - "options": "Contact", - "permlevel": 0, - "print_hide": 1, - "read_only": 0 - }, - { - "fieldname": "more_info", - "fieldtype": "Section Break", - "label": "More Info", - "oldfieldtype": "Section Break", - "options": "icon-file-text", - "permlevel": 0, - "print_hide": 1, - "read_only": 0 - }, - { - "description": "Supplier (Payable) Account", - "fieldname": "credit_to", - "fieldtype": "Link", - "in_filter": 1, - "label": "Credit To", - "oldfieldname": "credit_to", - "oldfieldtype": "Link", - "options": "Account", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "reqd": 1, - "search_index": 1 - }, - { - "default": "No", - "description": "Considered as Opening Balance", - "fieldname": "is_opening", - "fieldtype": "Select", - "in_filter": 1, - "label": "Is Opening", - "oldfieldname": "is_opening", - "oldfieldtype": "Select", - "options": "No\nYes", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "search_index": 1 - }, - { - "description": "Actual Invoice Date", - "fieldname": "aging_date", - "fieldtype": "Date", - "label": "Aging Date", - "oldfieldname": "aging_date", - "oldfieldtype": "Date", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "search_index": 0 - }, - { - "allow_on_submit": 1, - "fieldname": "select_print_heading", - "fieldtype": "Link", - "label": "Print Heading", - "no_copy": 1, - "oldfieldname": "select_print_heading", - "oldfieldtype": "Link", - "options": "Print Heading", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "report_hide": 1 - }, - { - "fieldname": "due_date", - "fieldtype": "Date", - "in_filter": 1, - "label": "Due Date", - "no_copy": 0, - "oldfieldname": "due_date", - "oldfieldtype": "Date", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "search_index": 1 - }, - { - "fieldname": "mode_of_payment", - "fieldtype": "Link", - "label": "Mode of Payment", - "oldfieldname": "mode_of_payment", - "oldfieldtype": "Select", - "options": "Mode of Payment", - "permlevel": 0, - "read_only": 0 - }, - { - "fieldname": "column_break_63", - "fieldtype": "Column Break", - "permlevel": 0, - "read_only": 0 - }, - { - "allow_on_submit": 1, - "fieldname": "letter_head", - "fieldtype": "Link", - "label": "Letter Head", - "options": "Letter Head", - "permlevel": 0, - "print_hide": 1 - }, - { - "fieldname": "fiscal_year", - "fieldtype": "Link", - "in_filter": 1, - "label": "Fiscal Year", - "oldfieldname": "fiscal_year", - "oldfieldtype": "Select", - "options": "Fiscal Year", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "search_index": 1 - }, - { - "fieldname": "remarks", - "fieldtype": "Small Text", - "label": "Remarks", - "no_copy": 1, - "oldfieldname": "remarks", - "oldfieldtype": "Text", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "reqd": 0 - }, - { - "depends_on": "eval:doc.docstatus<2", - "fieldname": "recurring_invoice", - "fieldtype": "Section Break", - "label": "Recurring Invoice", - "options": "icon-time", - "permlevel": 0, - "print_hide": 1 - }, - { - "fieldname": "column_break_77", - "fieldtype": "Column Break", - "permlevel": 0, - "print_hide": 1, - "width": "50%" - }, - { - "allow_on_submit": 1, - "depends_on": "eval:doc.docstatus<2", - "description": "Check if recurring invoice, uncheck to stop recurring or put proper End Date", - "fieldname": "is_recurring", - "fieldtype": "Check", - "label": "Is Recurring", - "no_copy": 1, - "permlevel": 0, - "print_hide": 1 - }, - { - "allow_on_submit": 1, - "depends_on": "eval:doc.is_recurring==1", - "description": "Select the period when the invoice will be generated automatically", - "fieldname": "recurring_type", - "fieldtype": "Select", - "label": "Recurring Type", - "no_copy": 1, - "options": "Monthly\nQuarterly\nHalf-yearly\nYearly", - "permlevel": 0, - "print_hide": 1 - }, - { - "allow_on_submit": 1, - "depends_on": "eval:doc.is_recurring==1", - "description": "The day of the month on which auto invoice will be generated e.g. 05, 28 etc", - "fieldname": "repeat_on_day_of_month", - "fieldtype": "Int", - "label": "Repeat on Day of Month", - "no_copy": 1, - "permlevel": 0, - "print_hide": 1 - }, - { - "depends_on": "eval:doc.is_recurring==1", - "description": "The date on which next invoice will be generated. It is generated on submit.", - "fieldname": "next_date", - "fieldtype": "Date", - "label": "Next Date", - "no_copy": 1, - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "column_break_82", - "fieldtype": "Column Break", - "permlevel": 0, - "print_hide": 1, - "width": "50%" - }, - { - "allow_on_submit": 1, - "depends_on": "eval:doc.is_recurring==1", - "description": "The date on which recurring invoice will be stop", - "fieldname": "end_date", - "fieldtype": "Date", - "label": "End Date", - "no_copy": 1, - "permlevel": 0, - "print_hide": 1 - }, - { - "depends_on": "eval:doc.is_recurring==1", - "description": "The unique id for tracking all recurring invoices. It is generated on submit.", - "fieldname": "recurring_id", - "fieldtype": "Data", - "label": "Recurring Id", - "no_copy": 1, - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "allow_on_submit": 1, - "depends_on": "eval:doc.is_recurring==1", - "description": "Enter email id separated by commas, invoice will be mailed automatically on particular date", - "fieldname": "notification_email_address", - "fieldtype": "Small Text", - "label": "Notification Email Address", - "no_copy": 1, - "permlevel": 0, - "print_hide": 1 - }, - { - "fieldname": "against_income_account", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Against Income Account", - "no_copy": 1, - "permlevel": 0, - "print_hide": 1, - "report_hide": 1 - } - ], - "icon": "icon-file-text", - "idx": 1, - "is_submittable": 1, - "modified": "2014-09-09 05:35:32.156763", - "modified_by": "Administrator", - "module": "Accounts", - "name": "Purchase Invoice", - "owner": "Administrator", - "permissions": [ - { - "amend": 1, - "apply_user_permissions": 1, - "cancel": 1, - "create": 1, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Accounts User", - "submit": 1, - "write": 1 - }, - { - "amend": 0, - "apply_user_permissions": 1, - "cancel": 0, - "create": 0, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Purchase User", - "submit": 0, - "write": 0 - }, - { - "amend": 0, - "apply_user_permissions": 1, - "cancel": 0, - "create": 0, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Supplier", - "submit": 0, - "write": 0 - }, - { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Accounts Manager", - "submit": 1, - "write": 1 - }, - { - "amend": 0, - "apply_user_permissions": 1, - "cancel": 0, - "create": 0, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Auditor", - "submit": 0, - "write": 0 - }, - { - "permlevel": 1, - "read": 1, - "role": "Accounts Manager", - "write": 1 - } - ], - "read_only_onload": 1, - "search_fields": "posting_date, credit_to, fiscal_year, bill_no, grand_total, outstanding_amount", - "sort_field": "modified", - "sort_order": "DESC" +"allow_import": 1, +"autoname": "naming_series:", +"creation": "2013-05-21 16:16:39", +"docstatus": 0, +"doctype": "DocType", +"fields": [ +{ +"fieldname": "supplier_section", +"fieldtype": "Section Break", +"label": "Supplier", +"options": "icon-user", +"permlevel": 0 +}, +{ +"fieldname": "column_break0", +"fieldtype": "Column Break", +"oldfieldtype": "Column Break", +"permlevel": 0, +"read_only": 0, +"width": "50%" +}, +{ +"fieldname": "naming_series", +"fieldtype": "Select", +"label": "Series", +"no_copy": 1, +"oldfieldname": "naming_series", +"oldfieldtype": "Select", +"options": "PINV-", +"permlevel": 0, +"print_hide": 1, +"read_only": 0, +"report_hide": 0, +"reqd": 1 +}, +{ +"fieldname": "supplier", +"fieldtype": "Link", +"hidden": 0, +"label": "Supplier", +"oldfieldname": "supplier", +"oldfieldtype": "Link", +"options": "Supplier", +"permlevel": 0, +"print_hide": 1, +"read_only": 0 +}, +{ +"depends_on": "supplier", +"fieldname": "supplier_name", +"fieldtype": "Data", +"hidden": 0, +"in_list_view": 1, +"label": "Name", +"oldfieldname": "supplier_name", +"oldfieldtype": "Data", +"permlevel": 0, +"read_only": 1 +}, +{ +"fieldname": "address_display", +"fieldtype": "Small Text", +"hidden": 1, +"label": "Address", +"permlevel": 0, +"read_only": 1 +}, +{ +"fieldname": "contact_display", +"fieldtype": "Small Text", +"hidden": 1, +"label": "Contact", +"permlevel": 0, +"read_only": 1 +}, +{ +"fieldname": "contact_mobile", +"fieldtype": "Small Text", +"hidden": 1, +"label": "Mobile No", +"permlevel": 0, +"read_only": 1 +}, +{ +"fieldname": "contact_email", +"fieldtype": "Small Text", +"hidden": 1, +"label": "Contact Email", +"permlevel": 0, +"print_hide": 1, +"read_only": 1 +}, +{ +"fieldname": "column_break1", +"fieldtype": "Column Break", +"oldfieldtype": "Column Break", +"permlevel": 0, +"read_only": 0, +"reqd": 0, +"width": "50%" +}, +{ +"default": "Today", +"fieldname": "posting_date", +"fieldtype": "Date", +"in_filter": 1, +"label": "Date", +"no_copy": 0, +"oldfieldname": "posting_date", +"oldfieldtype": "Date", +"permlevel": 0, +"print_hide": 1, +"read_only": 0, +"reqd": 1, +"search_index": 1 +}, +{ +"description": "", +"fieldname": "bill_no", +"fieldtype": "Data", +"in_filter": 1, +"label": "Supplier Invoice No", +"oldfieldname": "bill_no", +"oldfieldtype": "Data", +"permlevel": 0, +"print_hide": 1, +"read_only": 0, +"reqd": 0, +"search_index": 1 +}, +{ +"fieldname": "bill_date", +"fieldtype": "Date", +"in_filter": 1, +"label": "Supplier Invoice Date", +"oldfieldname": "bill_date", +"oldfieldtype": "Date", +"permlevel": 0, +"print_hide": 1, +"read_only": 0, +"reqd": 0, +"search_index": 1 +}, +{ +"fieldname": "amended_from", +"fieldtype": "Link", +"ignore_user_permissions": 1, +"label": "Amended From", +"no_copy": 1, +"oldfieldname": "amended_from", +"oldfieldtype": "Link", +"options": "Purchase Invoice", +"permlevel": 0, +"print_hide": 1, +"read_only": 1 +}, +{ +"fieldname": "company", +"fieldtype": "Link", +"in_filter": 1, +"label": "Company", +"oldfieldname": "company", +"oldfieldtype": "Link", +"options": "Company", +"permlevel": 0, +"print_hide": 1, +"read_only": 0, +"search_index": 1 +}, +{ +"fieldname": "currency_price_list", +"fieldtype": "Section Break", +"label": "Currency and Price List", +"options": "icon-tag", +"permlevel": 0, +"read_only": 0 +}, +{ +"fieldname": "currency", +"fieldtype": "Link", +"label": "Currency", +"oldfieldname": "currency", +"oldfieldtype": "Select", +"options": "Currency", +"permlevel": 0, +"print_hide": 1, +"read_only": 0 +}, +{ +"description": "The rate at which Bill Currency is converted into company's base currency", +"fieldname": "conversion_rate", +"fieldtype": "Float", +"label": "Exchange Rate", +"oldfieldname": "conversion_rate", +"oldfieldtype": "Currency", +"permlevel": 0, +"print_hide": 1, +"read_only": 0 +}, +{ +"fieldname": "column_break2", +"fieldtype": "Column Break", +"permlevel": 0, +"read_only": 0 +}, +{ +"fieldname": "buying_price_list", +"fieldtype": "Link", +"label": "Price List", +"options": "Price List", +"permlevel": 0, +"print_hide": 1, +"read_only": 0 +}, +{ +"fieldname": "price_list_currency", +"fieldtype": "Link", +"label": "Price List Currency", +"options": "Currency", +"permlevel": 0, +"print_hide": 1, +"read_only": 1 +}, +{ +"fieldname": "plc_conversion_rate", +"fieldtype": "Float", +"label": "Price List Exchange Rate", +"permlevel": 0, +"print_hide": 1, +"read_only": 0 +}, +{ +"fieldname": "ignore_pricing_rule", +"fieldtype": "Check", +"label": "Ignore Pricing Rule", +"no_copy": 1, +"permlevel": 1, +"print_hide": 1 +}, +{ +"fieldname": "items", +"fieldtype": "Section Break", +"label": "Items", +"oldfieldtype": "Section Break", +"options": "icon-shopping-cart", +"permlevel": 0, +"read_only": 0 +}, +{ +"allow_on_submit": 1, +"fieldname": "entries", +"fieldtype": "Table", +"label": "Entries", +"oldfieldname": "entries", +"oldfieldtype": "Table", +"options": "Purchase Invoice Item", +"permlevel": 0, +"read_only": 0 +}, +{ +"fieldname": "section_break_26", +"fieldtype": "Section Break", +"permlevel": 0 +}, +{ +"description": "Will be calculated automatically when you enter the details", +"fieldname": "net_total", +"fieldtype": "Currency", +"label": "Net Total (Company Currency)", +"oldfieldname": "net_total", +"oldfieldtype": "Currency", +"options": "Company:company:default_currency", +"permlevel": 0, +"print_hide": 1, +"read_only": 1 +}, +{ +"fieldname": "column_break_28", +"fieldtype": "Column Break", +"permlevel": 0 +}, +{ +"fieldname": "net_total_import", +"fieldtype": "Currency", +"label": "Net Total", +"oldfieldname": "net_total_import", +"oldfieldtype": "Currency", +"options": "currency", +"permlevel": 0, +"print_hide": 0, +"read_only": 1 +}, +{ +"fieldname": "taxes", +"fieldtype": "Section Break", +"label": "Taxes and Charges", +"oldfieldtype": "Section Break", +"options": "icon-money", +"permlevel": 0, +"read_only": 0 +}, +{ +"fieldname": "taxes_and_charges", +"fieldtype": "Link", +"label": "Taxes and Charges", +"oldfieldname": "purchase_other_charges", +"oldfieldtype": "Link", +"options": "Purchase Taxes and Charges Master", +"permlevel": 0, +"print_hide": 1, +"read_only": 0 +}, +{ +"fieldname": "other_charges", +"fieldtype": "Table", +"label": "Purchase Taxes and Charges", +"oldfieldname": "purchase_tax_details", +"oldfieldtype": "Table", +"options": "Purchase Taxes and Charges", +"permlevel": 0, +"read_only": 0 +}, +{ +"fieldname": "other_charges_calculation", +"fieldtype": "HTML", +"label": "Taxes and Charges Calculation", +"oldfieldtype": "HTML", +"permlevel": 0, +"print_hide": 1, +"read_only": 0 +}, +{ +"fieldname": "totals", +"fieldtype": "Section Break", +"label": "Totals", +"oldfieldtype": "Section Break", +"options": "icon-money", +"permlevel": 0, +"read_only": 0 +}, +{ +"fieldname": "other_charges_added", +"fieldtype": "Currency", +"label": "Taxes and Charges Added (Company Currency)", +"oldfieldname": "other_charges_added", +"oldfieldtype": "Currency", +"options": "Company:company:default_currency", +"permlevel": 0, +"print_hide": 1, +"read_only": 1 +}, +{ +"fieldname": "other_charges_deducted", +"fieldtype": "Currency", +"label": "Taxes and Charges Deducted (Company Currency)", +"oldfieldname": "other_charges_deducted", +"oldfieldtype": "Currency", +"options": "Company:company:default_currency", +"permlevel": 0, +"print_hide": 1, +"read_only": 1 +}, +{ +"fieldname": "grand_total", +"fieldtype": "Currency", +"label": "Grand Total (Company Currency)", +"oldfieldname": "grand_total", +"oldfieldtype": "Currency", +"options": "Company:company:default_currency", +"permlevel": 0, +"print_hide": 1, +"read_only": 1 +}, +{ +"description": "In Words will be visible once you save the Purchase Invoice.", +"fieldname": "in_words", +"fieldtype": "Data", +"label": "In Words (Company Currency)", +"oldfieldname": "in_words", +"oldfieldtype": "Data", +"permlevel": 0, +"print_hide": 1, +"read_only": 1 +}, +{ +"fieldname": "column_break8", +"fieldtype": "Column Break", +"oldfieldtype": "Column Break", +"permlevel": 0, +"print_hide": 1, +"read_only": 0, +"width": "50%" +}, +{ +"fieldname": "other_charges_added_import", +"fieldtype": "Currency", +"label": "Taxes and Charges Added", +"oldfieldname": "other_charges_added_import", +"oldfieldtype": "Currency", +"options": "currency", +"permlevel": 0, +"print_hide": 1, +"read_only": 1 +}, +{ +"fieldname": "other_charges_deducted_import", +"fieldtype": "Currency", +"label": "Taxes and Charges Deducted", +"oldfieldname": "other_charges_deducted_import", +"oldfieldtype": "Currency", +"options": "currency", +"permlevel": 0, +"print_hide": 1, +"read_only": 1 +}, +{ +"fieldname": "grand_total_import", +"fieldtype": "Currency", +"in_list_view": 1, +"label": "Grand Total", +"oldfieldname": "grand_total_import", +"oldfieldtype": "Currency", +"options": "currency", +"permlevel": 0, +"print_hide": 0, +"read_only": 1 +}, +{ +"fieldname": "in_words_import", +"fieldtype": "Data", +"label": "In Words", +"oldfieldname": "in_words_import", +"oldfieldtype": "Data", +"permlevel": 0, +"print_hide": 0, +"read_only": 1 +}, +{ +"fieldname": "total_amount_to_pay", +"fieldtype": "Currency", +"hidden": 0, +"label": "Total Amount To Pay", +"no_copy": 1, +"oldfieldname": "total_amount_to_pay", +"oldfieldtype": "Currency", +"options": "Company:company:default_currency", +"permlevel": 0, +"print_hide": 1, +"read_only": 1 +}, +{ +"fieldname": "total_advance", +"fieldtype": "Currency", +"label": "Total Advance", +"no_copy": 1, +"oldfieldname": "total_advance", +"oldfieldtype": "Currency", +"options": "Company:company:default_currency", +"permlevel": 0, +"print_hide": 1, +"read_only": 1 +}, +{ +"fieldname": "total_tax", +"fieldtype": "Currency", +"label": "Total Tax (Company Currency)", +"oldfieldname": "total_tax", +"oldfieldtype": "Currency", +"options": "Company:company:default_currency", +"permlevel": 0, +"print_hide": 1, +"read_only": 1 +}, +{ +"fieldname": "outstanding_amount", +"fieldtype": "Currency", +"in_filter": 1, +"in_list_view": 1, +"label": "Outstanding Amount", +"no_copy": 1, +"oldfieldname": "outstanding_amount", +"oldfieldtype": "Currency", +"options": "Company:company:default_currency", +"permlevel": 0, +"print_hide": 1, +"read_only": 1, +"search_index": 1 +}, +{ +"fieldname": "write_off_amount", +"fieldtype": "Currency", +"label": "Write Off Amount", +"no_copy": 1, +"options": "Company:company:default_currency", +"permlevel": 0, +"print_hide": 1, +"read_only": 0 +}, +{ +"depends_on": "eval:flt(doc.write_off_amount)!=0", +"fieldname": "write_off_account", +"fieldtype": "Link", +"label": "Write Off Account", +"no_copy": 1, +"options": "Account", +"permlevel": 0, +"print_hide": 1, +"read_only": 0 +}, +{ +"depends_on": "eval:flt(doc.write_off_amount)!=0", +"fieldname": "write_off_cost_center", +"fieldtype": "Link", +"label": "Write Off Cost Center", +"no_copy": 1, +"options": "Cost Center", +"permlevel": 0, +"print_hide": 1, +"read_only": 0 +}, +{ +"fieldname": "against_expense_account", +"fieldtype": "Small Text", +"hidden": 1, +"label": "Against Expense Account", +"no_copy": 1, +"oldfieldname": "against_expense_account", +"oldfieldtype": "Small Text", +"permlevel": 0, +"print_hide": 1, +"read_only": 0, +"report_hide": 0 +}, +{ +"fieldname": "fold", +"fieldtype": "Fold", +"permlevel": 0 +}, +{ +"fieldname": "advances", +"fieldtype": "Section Break", +"label": "Advances", +"oldfieldtype": "Section Break", +"options": "icon-money", +"permlevel": 0, +"print_hide": 1, +"read_only": 0 +}, +{ +"fieldname": "get_advances_paid", +"fieldtype": "Button", +"label": "Get Advances Paid", +"oldfieldtype": "Button", +"options": "get_advances", +"permlevel": 0, +"print_hide": 1, +"read_only": 0 +}, +{ +"fieldname": "advance_allocation_details", +"fieldtype": "Table", +"label": "Purchase Invoice Advances", +"no_copy": 1, +"oldfieldname": "advance_allocation_details", +"oldfieldtype": "Table", +"options": "Purchase Invoice Advance", +"permlevel": 0, +"print_hide": 1, +"read_only": 0 +}, +{ +"fieldname": "terms_section_break", +"fieldtype": "Section Break", +"label": "Terms and Conditions", +"options": "icon-legal", +"permlevel": 0 +}, +{ +"fieldname": "tc_name", +"fieldtype": "Link", +"label": "Terms", +"options": "Terms and Conditions", +"permlevel": 0, +"print_hide": 1 +}, +{ +"fieldname": "terms", +"fieldtype": "Text Editor", +"label": "Terms and Conditions1", +"permlevel": 0 +}, +{ +"depends_on": "supplier", +"fieldname": "contact_section", +"fieldtype": "Section Break", +"label": "Contact Info", +"options": "icon-bullhorn", +"permlevel": 0, +"read_only": 0 +}, +{ +"fieldname": "supplier_address", +"fieldtype": "Link", +"label": "Supplier Address", +"options": "Address", +"permlevel": 0, +"print_hide": 1, +"read_only": 0 +}, +{ +"fieldname": "col_break23", +"fieldtype": "Column Break", +"permlevel": 0, +"read_only": 0, +"width": "50%" +}, +{ +"fieldname": "contact_person", +"fieldtype": "Link", +"label": "Contact Person", +"options": "Contact", +"permlevel": 0, +"print_hide": 1, +"read_only": 0 +}, +{ +"fieldname": "more_info", +"fieldtype": "Section Break", +"label": "More Info", +"oldfieldtype": "Section Break", +"options": "icon-file-text", +"permlevel": 0, +"print_hide": 1, +"read_only": 0 +}, +{ +"description": "Supplier (Payable) Account", +"fieldname": "credit_to", +"fieldtype": "Link", +"in_filter": 1, +"label": "Credit To", +"oldfieldname": "credit_to", +"oldfieldtype": "Link", +"options": "Account", +"permlevel": 0, +"print_hide": 1, +"read_only": 0, +"reqd": 1, +"search_index": 1 +}, +{ +"default": "No", +"description": "Considered as Opening Balance", +"fieldname": "is_opening", +"fieldtype": "Select", +"in_filter": 1, +"label": "Is Opening", +"oldfieldname": "is_opening", +"oldfieldtype": "Select", +"options": "No\nYes", +"permlevel": 0, +"print_hide": 1, +"read_only": 0, +"search_index": 1 +}, +{ +"description": "Actual Invoice Date", +"fieldname": "aging_date", +"fieldtype": "Date", +"label": "Aging Date", +"oldfieldname": "aging_date", +"oldfieldtype": "Date", +"permlevel": 0, +"print_hide": 1, +"read_only": 0, +"search_index": 0 +}, +{ +"allow_on_submit": 1, +"fieldname": "select_print_heading", +"fieldtype": "Link", +"label": "Print Heading", +"no_copy": 1, +"oldfieldname": "select_print_heading", +"oldfieldtype": "Link", +"options": "Print Heading", +"permlevel": 0, +"print_hide": 1, +"read_only": 0, +"report_hide": 1 +}, +{ +"fieldname": "due_date", +"fieldtype": "Date", +"in_filter": 1, +"label": "Due Date", +"no_copy": 0, +"oldfieldname": "due_date", +"oldfieldtype": "Date", +"permlevel": 0, +"print_hide": 1, +"read_only": 0, +"search_index": 1 +}, +{ +"fieldname": "mode_of_payment", +"fieldtype": "Link", +"label": "Mode of Payment", +"oldfieldname": "mode_of_payment", +"oldfieldtype": "Select", +"options": "Mode of Payment", +"permlevel": 0, +"read_only": 0 +}, +{ +"fieldname": "column_break_63", +"fieldtype": "Column Break", +"permlevel": 0, +"read_only": 0 +}, +{ +"allow_on_submit": 1, +"fieldname": "letter_head", +"fieldtype": "Link", +"label": "Letter Head", +"options": "Letter Head", +"permlevel": 0, +"print_hide": 1 +}, +{ +"fieldname": "fiscal_year", +"fieldtype": "Link", +"in_filter": 1, +"label": "Fiscal Year", +"oldfieldname": "fiscal_year", +"oldfieldtype": "Select", +"options": "Fiscal Year", +"permlevel": 0, +"print_hide": 1, +"read_only": 0, +"search_index": 1 +}, +{ +"fieldname": "remarks", +"fieldtype": "Small Text", +"label": "Remarks", +"no_copy": 1, +"oldfieldname": "remarks", +"oldfieldtype": "Text", +"permlevel": 0, +"print_hide": 1, +"read_only": 0, +"reqd": 0 +} +], +"icon": "icon-file-text", +"idx": 1, +"is_submittable": 1, +"modified": "2014-09-09 05:35:32.156763", +"modified_by": "Administrator", +"module": "Accounts", +"name": "Purchase Invoice", +"owner": "Administrator", +"permissions": [ +{ +"amend": 1, +"apply_user_permissions": 1, +"cancel": 1, +"create": 1, +"delete": 0, +"email": 1, +"permlevel": 0, +"print": 1, +"read": 1, +"report": 1, +"role": "Accounts User", +"submit": 1, +"write": 1 +}, +{ +"amend": 0, +"apply_user_permissions": 1, +"cancel": 0, +"create": 0, +"delete": 0, +"email": 1, +"permlevel": 0, +"print": 1, +"read": 1, +"report": 1, +"role": "Purchase User", +"submit": 0, +"write": 0 +}, +{ +"amend": 0, +"apply_user_permissions": 1, +"cancel": 0, +"create": 0, +"delete": 0, +"email": 1, +"permlevel": 0, +"print": 1, +"read": 1, +"report": 1, +"role": "Supplier", +"submit": 0, +"write": 0 +}, +{ +"amend": 1, +"cancel": 1, +"create": 1, +"delete": 1, +"email": 1, +"permlevel": 0, +"print": 1, +"read": 1, +"report": 1, +"role": "Accounts Manager", +"submit": 1, +"write": 1 +}, +{ +"amend": 0, +"apply_user_permissions": 1, +"cancel": 0, +"create": 0, +"delete": 0, +"email": 1, +"permlevel": 0, +"print": 1, +"read": 1, +"report": 1, +"role": "Auditor", +"submit": 0, +"write": 0 +}, +{ +"permlevel": 1, +"read": 1, +"role": "Accounts Manager", +"write": 1 +} +], +"read_only_onload": 1, +"search_fields": "posting_date, credit_to, fiscal_year, bill_no, grand_total, outstanding_amount", +"sort_field": "modified", +"sort_order": "DESC" } diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index f16a548793f..7dcdd456409 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -1,847 +1,733 @@ { - "allow_import": 1, - "autoname": "naming_series:", - "creation": "2013-05-21 16:16:39", - "docstatus": 0, - "doctype": "DocType", - "document_type": "Transaction", - "fields": [ - { - "fieldname": "supplier_section", - "fieldtype": "Section Break", - "label": "Supplier", - "options": "icon-user", - "permlevel": 0 - }, - { - "fieldname": "naming_series", - "fieldtype": "Select", - "label": "Series", - "no_copy": 1, - "oldfieldname": "naming_series", - "oldfieldtype": "Select", - "options": "PO-", - "permlevel": 0, - "print_hide": 1, - "reqd": 1 - }, - { - "description": "Supplier (vendor) name as entered in supplier master", - "fieldname": "supplier", - "fieldtype": "Link", - "in_filter": 1, - "label": "Supplier", - "oldfieldname": "supplier", - "oldfieldtype": "Link", - "options": "Supplier", - "permlevel": 0, - "print_hide": 1, - "reqd": 1, - "search_index": 1 - }, - { - "fieldname": "supplier_name", - "fieldtype": "Data", - "hidden": 0, - "in_list_view": 1, - "label": "Name", - "permlevel": 0, - "read_only": 1 - }, - { - "fieldname": "address_display", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Address", - "permlevel": 0, - "read_only": 1 - }, - { - "fieldname": "contact_display", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Contact", - "permlevel": 0, - "read_only": 1 - }, - { - "fieldname": "contact_mobile", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Mobile No", - "permlevel": 0, - "read_only": 1 - }, - { - "fieldname": "contact_email", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Contact Email", - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "column_break1", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, - "print_hide": 0, - "print_width": "50%", - "width": "50%" - }, - { - "fieldname": "transaction_date", - "fieldtype": "Date", - "in_filter": 1, - "label": "Date", - "oldfieldname": "transaction_date", - "oldfieldtype": "Date", - "permlevel": 0, - "reqd": 1, - "search_index": 1 - }, - { - "allow_on_submit": 1, - "description": "Start date of current order's period", - "fieldname": "from_date", - "fieldtype": "Date", - "label": "From", - "no_copy": 1, - "permlevel": 0 - }, - { - "allow_on_submit": 1, - "description": "End date of current order's period", - "fieldname": "to_date", - "fieldtype": "Date", - "label": "To", - "no_copy": 1, - "permlevel": 0 - }, - { - "fieldname": "amended_from", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 1, - "label": "Amended From", - "no_copy": 1, - "oldfieldname": "amended_from", - "oldfieldtype": "Data", - "options": "Purchase Order", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, - "report_hide": 0 - }, - { - "description": "Select the relevant company name if you have multiple companies", - "fieldname": "company", - "fieldtype": "Link", - "in_filter": 1, - "label": "Company", - "no_copy": 0, - "oldfieldname": "company", - "oldfieldtype": "Link", - "options": "Company", - "permlevel": 0, - "print_hide": 1, - "reqd": 1, - "search_index": 1 - }, - { - "fieldname": "price_list_and_currency", - "fieldtype": "Section Break", - "label": "Currency and Price List", - "options": "icon-tag", - "permlevel": 0 - }, - { - "fieldname": "cb_currency", - "fieldtype": "Column Break", - "permlevel": 0 - }, - { - "fieldname": "currency", - "fieldtype": "Link", - "label": "Currency", - "no_copy": 0, - "oldfieldname": "currency", - "oldfieldtype": "Select", - "options": "Currency", - "permlevel": 0, - "print_hide": 1, - "reqd": 1 - }, - { - "description": "Rate at which supplier's currency is converted to company's base currency", - "fieldname": "conversion_rate", - "fieldtype": "Float", - "hidden": 0, - "label": "Exchange Rate", - "no_copy": 0, - "oldfieldname": "conversion_rate", - "oldfieldtype": "Currency", - "permlevel": 0, - "print_hide": 1, - "reqd": 1 - }, - { - "fieldname": "cb_price_list", - "fieldtype": "Column Break", - "permlevel": 0 - }, - { - "fieldname": "buying_price_list", - "fieldtype": "Link", - "label": "Price List", - "options": "Price List", - "permlevel": 0, - "print_hide": 1 - }, - { - "fieldname": "price_list_currency", - "fieldtype": "Link", - "label": "Price List Currency", - "options": "Currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "plc_conversion_rate", - "fieldtype": "Float", - "label": "Price List Exchange Rate", - "permlevel": 0, - "print_hide": 1 - }, - { - "fieldname": "ignore_pricing_rule", - "fieldtype": "Check", - "label": "Ignore Pricing Rule", - "no_copy": 1, - "permlevel": 1, - "print_hide": 1 - }, - { - "fieldname": "items", - "fieldtype": "Section Break", - "label": "Items", - "oldfieldtype": "Section Break", - "options": "icon-shopping-cart", - "permlevel": 0 - }, - { - "allow_on_submit": 1, - "fieldname": "po_details", - "fieldtype": "Table", - "label": "Purchase Order Items", - "no_copy": 0, - "oldfieldname": "po_details", - "oldfieldtype": "Table", - "options": "Purchase Order Item", - "permlevel": 0 - }, - { - "fieldname": "sb_last_purchase", - "fieldtype": "Section Break", - "permlevel": 0 - }, - { - "fieldname": "net_total", - "fieldtype": "Currency", - "label": "Net Total (Company Currency)", - "no_copy": 1, - "oldfieldname": "net_total", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, - "reqd": 0 - }, - { - "fieldname": "column_break_26", - "fieldtype": "Column Break", - "permlevel": 0 - }, - { - "fieldname": "net_total_import", - "fieldtype": "Currency", - "label": "Net Total", - "no_copy": 0, - "oldfieldname": "net_total_import", - "oldfieldtype": "Currency", - "options": "currency", - "permlevel": 0, - "print_hide": 0, - "read_only": 1 - }, - { - "fieldname": "get_last_purchase_rate", - "fieldtype": "Button", - "label": "Get Last Purchase Rate", - "oldfieldtype": "Button", - "permlevel": 0, - "print_hide": 0 - }, - { - "fieldname": "taxes", - "fieldtype": "Section Break", - "label": "Taxes and Charges", - "oldfieldtype": "Section Break", - "options": "icon-money", - "permlevel": 0, - "print_hide": 0 - }, - { - "description": "If you have created a standard template in Purchase Taxes and Charges Master, select one and click on the button below.", - "fieldname": "taxes_and_charges", - "fieldtype": "Link", - "label": "Taxes and Charges", - "no_copy": 0, - "oldfieldname": "purchase_other_charges", - "oldfieldtype": "Link", - "options": "Purchase Taxes and Charges Master", - "permlevel": 0, - "print_hide": 1 - }, - { - "fieldname": "other_charges", - "fieldtype": "Table", - "label": "Purchase Taxes and Charges", - "no_copy": 0, - "oldfieldname": "purchase_tax_details", - "oldfieldtype": "Table", - "options": "Purchase Taxes and Charges", - "permlevel": 0 - }, - { - "fieldname": "other_charges_calculation", - "fieldtype": "HTML", - "label": "Taxes and Charges Calculation", - "no_copy": 1, - "oldfieldtype": "HTML", - "permlevel": 0, - "print_hide": 1 - }, - { - "fieldname": "totals", - "fieldtype": "Section Break", - "label": "Totals", - "oldfieldtype": "Section Break", - "options": "icon-money", - "permlevel": 0 - }, - { - "fieldname": "other_charges_added", - "fieldtype": "Currency", - "label": "Taxes and Charges Added (Company Currency)", - "no_copy": 0, - "oldfieldname": "other_charges_added", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "other_charges_deducted", - "fieldtype": "Currency", - "label": "Taxes and Charges Deducted (Company Currency)", - "no_copy": 0, - "oldfieldname": "other_charges_deducted", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "total_tax", - "fieldtype": "Currency", - "label": "Total Tax (Company Currency)", - "no_copy": 1, - "oldfieldname": "total_tax", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "grand_total", - "fieldtype": "Currency", - "label": "Grand Total (Company Currency)", - "no_copy": 1, - "oldfieldname": "grand_total", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "description": "In Words will be visible once you save the Purchase Order.", - "fieldname": "in_words", - "fieldtype": "Data", - "label": "In Words (Company Currency)", - "oldfieldname": "in_words", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "rounded_total", - "fieldtype": "Currency", - "label": "Rounded Total (Company Currency)", - "oldfieldname": "rounded_total", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "column_break4", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, - "print_hide": 0 - }, - { - "fieldname": "other_charges_added_import", - "fieldtype": "Currency", - "label": "Taxes and Charges Added", - "no_copy": 0, - "oldfieldname": "other_charges_added_import", - "oldfieldtype": "Currency", - "options": "currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, - "report_hide": 0 - }, - { - "fieldname": "other_charges_deducted_import", - "fieldtype": "Currency", - "label": "Taxes and Charges Deducted", - "no_copy": 0, - "oldfieldname": "other_charges_deducted_import", - "oldfieldtype": "Currency", - "options": "currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, - "report_hide": 0 - }, - { - "fieldname": "grand_total_import", - "fieldtype": "Currency", - "in_list_view": 1, - "label": "Grand Total", - "no_copy": 0, - "oldfieldname": "grand_total_import", - "oldfieldtype": "Currency", - "options": "currency", - "permlevel": 0, - "print_hide": 0, - "read_only": 1, - "report_hide": 0 - }, - { - "fieldname": "in_words_import", - "fieldtype": "Data", - "label": "In Words", - "oldfieldname": "in_words_import", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, - "read_only": 1 - }, - { - "fieldname": "fold", - "fieldtype": "Fold", - "permlevel": 0 - }, - { - "fieldname": "terms_section_break", - "fieldtype": "Section Break", - "label": "Terms and Conditions", - "oldfieldtype": "Section Break", - "options": "icon-legal", - "permlevel": 0 - }, - { - "fieldname": "tc_name", - "fieldtype": "Link", - "label": "Terms", - "oldfieldname": "tc_name", - "oldfieldtype": "Link", - "options": "Terms and Conditions", - "permlevel": 0, - "print_hide": 1 - }, - { - "fieldname": "terms", - "fieldtype": "Text Editor", - "label": "Terms and Conditions", - "oldfieldname": "terms", - "oldfieldtype": "Text Editor", - "permlevel": 0 - }, - { - "depends_on": "supplier", - "fieldname": "contact_section", - "fieldtype": "Section Break", - "label": "Contact Info", - "options": "icon-bullhorn", - "permlevel": 0 - }, - { - "fieldname": "supplier_address", - "fieldtype": "Link", - "in_filter": 1, - "label": "Supplier Address", - "options": "Address", - "permlevel": 0, - "print_hide": 1 - }, - { - "fieldname": "cb_contact", - "fieldtype": "Column Break", - "permlevel": 0 - }, - { - "fieldname": "contact_person", - "fieldtype": "Link", - "in_filter": 1, - "label": "Contact Person", - "options": "Contact", - "permlevel": 0, - "print_hide": 1 - }, - { - "fieldname": "more_info", - "fieldtype": "Section Break", - "label": "More Info", - "oldfieldtype": "Section Break", - "permlevel": 0 - }, - { - "fieldname": "status", - "fieldtype": "Select", - "in_filter": 1, - "label": "Status", - "no_copy": 1, - "oldfieldname": "status", - "oldfieldtype": "Select", - "options": "\nDraft\nSubmitted\nStopped\nCancelled", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, - "reqd": 1, - "search_index": 1 - }, - { - "default": "No", - "fieldname": "is_subcontracted", - "fieldtype": "Select", - "label": "Is Subcontracted", - "options": "\nYes\nNo", - "permlevel": 0, - "print_hide": 1 - }, - { - "fieldname": "ref_sq", - "fieldtype": "Data", - "hidden": 1, - "label": "Ref SQ", - "no_copy": 1, - "oldfieldname": "ref_sq", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "allow_on_submit": 1, - "fieldname": "letter_head", - "fieldtype": "Link", - "label": "Letter Head", - "oldfieldname": "letter_head", - "oldfieldtype": "Select", - "options": "Letter Head", - "permlevel": 0, - "print_hide": 1 - }, - { - "fieldname": "fiscal_year", - "fieldtype": "Link", - "in_filter": 1, - "label": "Fiscal Year", - "no_copy": 0, - "oldfieldname": "fiscal_year", - "oldfieldtype": "Select", - "options": "Fiscal Year", - "permlevel": 0, - "print_hide": 1, - "reqd": 1, - "search_index": 1 - }, - { - "allow_on_submit": 1, - "fieldname": "select_print_heading", - "fieldtype": "Link", - "label": "Print Heading", - "no_copy": 1, - "oldfieldname": "select_print_heading", - "oldfieldtype": "Link", - "options": "Print Heading", - "permlevel": 0, - "print_hide": 1, - "report_hide": 1 - }, - { - "fieldname": "column_break5", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, - "print_hide": 1, - "print_width": "50%", - "width": "50%" - }, - { - "depends_on": "eval:!doc.__islocal", - "description": "% of materials received against this Purchase Order", - "fieldname": "per_received", - "fieldtype": "Percent", - "in_list_view": 1, - "label": "% Received", - "no_copy": 1, - "oldfieldname": "per_received", - "oldfieldtype": "Currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "depends_on": "eval:!doc.__islocal", - "description": "% of materials billed against this Purchase Order.", - "fieldname": "per_billed", - "fieldtype": "Percent", - "in_list_view": 1, - "label": "% Billed", - "no_copy": 1, - "oldfieldname": "per_billed", - "oldfieldtype": "Currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "description": "Required raw materials issued to the supplier for producing a sub - contracted item.", - "fieldname": "raw_material_details", - "fieldtype": "Section Break", - "label": "Raw Materials Supplied", - "oldfieldtype": "Section Break", - "options": "icon-truck", - "permlevel": 0, - "print_hide": 1 - }, - { - "allow_on_submit": 1, - "fieldname": "po_raw_material_details", - "fieldtype": "Table", - "label": "Purchase Order Items Supplied", - "no_copy": 0, - "oldfieldname": "po_raw_material_details", - "oldfieldtype": "Table", - "options": "Purchase Order Item Supplied", - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "recurring_order", - "fieldtype": "Section Break", - "label": "Recurring Order", - "options": "icon-time", - "permlevel": 0 - }, - { - "fieldname": "column_break", - "fieldtype": "Column Break", - "label": "Column Break", - "permlevel": 0 - }, - { - "allow_on_submit": 1, - "depends_on": "eval:doc.docstatus<2", - "description": "Check if recurring order, uncheck to stop recurring or put proper End Date", - "fieldname": "is_recurring", - "fieldtype": "Check", - "label": "Is Recurring", - "no_copy": 1, - "permlevel": 0, - "print_hide": 1 - }, - { - "allow_on_submit": 1, - "depends_on": "eval:doc.is_recurring==1", - "fieldname": "recurring_type", - "fieldtype": "Select", - "label": "Recurring Type", - "no_copy": 1, - "options": "Monthly\nQuarterly\nHalf-yearly\nYearly", - "permlevel": 0 - }, - { - "allow_on_submit": 1, - "depends_on": "eval:doc.is_recurring==1", - "description": "The day of the month on which auto order will be generated e.g. 05, 28 etc", - "fieldname": "repeat_on_day_of_month", - "fieldtype": "Int", - "label": "Repeat on Day of Month", - "no_copy": 1, - "permlevel": 0, - "print_hide": 1 - }, - { - "depends_on": "eval:doc.is_recurring==1", - "description": "The date on which next invoice will be generated. It is generated on submit.", - "fieldname": "next_date", - "fieldtype": "Date", - "label": "Next Date", - "no_copy": 1, - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "allow_on_submit": 1, - "depends_on": "eval:doc.is_recurring==1", - "description": "The date on which recurring order will be stop", - "fieldname": "end_date", - "fieldtype": "Date", - "label": "End Date", - "no_copy": 1, - "permlevel": 0, - "print_hide": 1 - }, - { - "fieldname": "column_break83", - "fieldtype": "Column Break", - "label": "Column Break", - "permlevel": 0, - "print_hide": 1 - }, - { - "depends_on": "eval:doc.is_recurring==1", - "fieldname": "recurring_id", - "fieldtype": "Data", - "label": "Recurring Id", - "no_copy": 1, - "permlevel": 0, - "print_hide": 1, - "read_only": 1 - }, - { - "allow_on_submit": 1, - "depends_on": "eval:doc.is_recurring==1", - "description": "Enter email id separated by commas, order will be mailed automatically on particular date", - "fieldname": "notification_email_address", - "fieldtype": "Small Text", - "label": "Notification Email Address", - "no_copy": 1, - "permlevel": 0, - "print_hide": 1 - }, - { - "fieldname": "against_income_account", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Against Income Account", - "no_copy": 1, - "permlevel": 0, - "print_hide": 1, - "report_hide": 1 - } - ], - "icon": "icon-file-text", - "idx": 1, - "is_submittable": 1, - "modified": "2014-09-10 05:35:32.583024", - "modified_by": "Administrator", - "module": "Buying", - "name": "Purchase Order", - "owner": "Administrator", - "permissions": [ - { - "amend": 0, - "apply_user_permissions": 1, - "cancel": 0, - "create": 0, - "delete": 0, - "email": 0, - "permlevel": 0, - "print": 0, - "read": 1, - "report": 1, - "role": "Material User", - "submit": 0, - "write": 0 - }, - { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Purchase Manager", - "submit": 1, - "write": 1 - }, - { - "amend": 1, - "apply_user_permissions": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Purchase User", - "submit": 1, - "write": 1 - }, - { - "apply_user_permissions": 1, - "cancel": 0, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Supplier" - }, - { - "permlevel": 1, - "read": 1, - "role": "Purchase Manager", - "write": 1 - } - ], - "read_only_onload": 1, - "search_fields": "status, transaction_date, supplier,grand_total", - "sort_field": "modified", - "sort_order": "DESC" +"allow_import": 1, +"autoname": "naming_series:", +"creation": "2013-05-21 16:16:39", +"docstatus": 0, +"doctype": "DocType", +"document_type": "Transaction", +"fields": [ +{ +"fieldname": "supplier_section", +"fieldtype": "Section Break", +"label": "Supplier", +"options": "icon-user", +"permlevel": 0 +}, +{ +"fieldname": "naming_series", +"fieldtype": "Select", +"label": "Series", +"no_copy": 1, +"oldfieldname": "naming_series", +"oldfieldtype": "Select", +"options": "PO-", +"permlevel": 0, +"print_hide": 1, +"reqd": 1 +}, +{ +"description": "Supplier (vendor) name as entered in supplier master", +"fieldname": "supplier", +"fieldtype": "Link", +"in_filter": 1, +"label": "Supplier", +"oldfieldname": "supplier", +"oldfieldtype": "Link", +"options": "Supplier", +"permlevel": 0, +"print_hide": 1, +"reqd": 1, +"search_index": 1 +}, +{ +"fieldname": "supplier_name", +"fieldtype": "Data", +"hidden": 0, +"in_list_view": 1, +"label": "Name", +"permlevel": 0, +"read_only": 1 +}, +{ +"fieldname": "address_display", +"fieldtype": "Small Text", +"hidden": 1, +"label": "Address", +"permlevel": 0, +"read_only": 1 +}, +{ +"fieldname": "contact_display", +"fieldtype": "Small Text", +"hidden": 1, +"label": "Contact", +"permlevel": 0, +"read_only": 1 +}, +{ +"fieldname": "contact_mobile", +"fieldtype": "Small Text", +"hidden": 1, +"label": "Mobile No", +"permlevel": 0, +"read_only": 1 +}, +{ +"fieldname": "contact_email", +"fieldtype": "Small Text", +"hidden": 1, +"label": "Contact Email", +"permlevel": 0, +"print_hide": 1, +"read_only": 1 +}, +{ +"fieldname": "column_break1", +"fieldtype": "Column Break", +"oldfieldtype": "Column Break", +"permlevel": 0, +"print_hide": 0, +"print_width": "50%", +"width": "50%" +}, +{ +"fieldname": "transaction_date", +"fieldtype": "Date", +"in_filter": 1, +"label": "Date", +"oldfieldname": "transaction_date", +"oldfieldtype": "Date", +"permlevel": 0, +"reqd": 1, +"search_index": 1 +}, +{ +"fieldname": "amended_from", +"fieldtype": "Link", +"hidden": 0, +"ignore_user_permissions": 1, +"label": "Amended From", +"no_copy": 1, +"oldfieldname": "amended_from", +"oldfieldtype": "Data", +"options": "Purchase Order", +"permlevel": 0, +"print_hide": 1, +"read_only": 1, +"report_hide": 0 +}, +{ +"description": "Select the relevant company name if you have multiple companies", +"fieldname": "company", +"fieldtype": "Link", +"in_filter": 1, +"label": "Company", +"no_copy": 0, +"oldfieldname": "company", +"oldfieldtype": "Link", +"options": "Company", +"permlevel": 0, +"print_hide": 1, +"reqd": 1, +"search_index": 1 +}, +{ +"fieldname": "price_list_and_currency", +"fieldtype": "Section Break", +"label": "Currency and Price List", +"options": "icon-tag", +"permlevel": 0 +}, +{ +"fieldname": "cb_currency", +"fieldtype": "Column Break", +"permlevel": 0 +}, +{ +"fieldname": "currency", +"fieldtype": "Link", +"label": "Currency", +"no_copy": 0, +"oldfieldname": "currency", +"oldfieldtype": "Select", +"options": "Currency", +"permlevel": 0, +"print_hide": 1, +"reqd": 1 +}, +{ +"description": "Rate at which supplier's currency is converted to company's base currency", +"fieldname": "conversion_rate", +"fieldtype": "Float", +"hidden": 0, +"label": "Exchange Rate", +"no_copy": 0, +"oldfieldname": "conversion_rate", +"oldfieldtype": "Currency", +"permlevel": 0, +"print_hide": 1, +"reqd": 1 +}, +{ +"fieldname": "cb_price_list", +"fieldtype": "Column Break", +"permlevel": 0 +}, +{ +"fieldname": "buying_price_list", +"fieldtype": "Link", +"label": "Price List", +"options": "Price List", +"permlevel": 0, +"print_hide": 1 +}, +{ +"fieldname": "price_list_currency", +"fieldtype": "Link", +"label": "Price List Currency", +"options": "Currency", +"permlevel": 0, +"print_hide": 1, +"read_only": 1 +}, +{ +"fieldname": "plc_conversion_rate", +"fieldtype": "Float", +"label": "Price List Exchange Rate", +"permlevel": 0, +"print_hide": 1 +}, +{ +"fieldname": "ignore_pricing_rule", +"fieldtype": "Check", +"label": "Ignore Pricing Rule", +"no_copy": 1, +"permlevel": 1, +"print_hide": 1 +}, +{ +"fieldname": "items", +"fieldtype": "Section Break", +"label": "Items", +"oldfieldtype": "Section Break", +"options": "icon-shopping-cart", +"permlevel": 0 +}, +{ +"allow_on_submit": 1, +"fieldname": "po_details", +"fieldtype": "Table", +"label": "Purchase Order Items", +"no_copy": 0, +"oldfieldname": "po_details", +"oldfieldtype": "Table", +"options": "Purchase Order Item", +"permlevel": 0 +}, +{ +"fieldname": "sb_last_purchase", +"fieldtype": "Section Break", +"permlevel": 0 +}, +{ +"fieldname": "net_total", +"fieldtype": "Currency", +"label": "Net Total (Company Currency)", +"no_copy": 1, +"oldfieldname": "net_total", +"oldfieldtype": "Currency", +"options": "Company:company:default_currency", +"permlevel": 0, +"print_hide": 1, +"read_only": 1, +"reqd": 0 +}, +{ +"fieldname": "column_break_26", +"fieldtype": "Column Break", +"permlevel": 0 +}, +{ +"fieldname": "net_total_import", +"fieldtype": "Currency", +"label": "Net Total", +"no_copy": 0, +"oldfieldname": "net_total_import", +"oldfieldtype": "Currency", +"options": "currency", +"permlevel": 0, +"print_hide": 0, +"read_only": 1 +}, +{ +"fieldname": "get_last_purchase_rate", +"fieldtype": "Button", +"label": "Get Last Purchase Rate", +"oldfieldtype": "Button", +"permlevel": 0, +"print_hide": 0 +}, +{ +"fieldname": "taxes", +"fieldtype": "Section Break", +"label": "Taxes and Charges", +"oldfieldtype": "Section Break", +"options": "icon-money", +"permlevel": 0, +"print_hide": 0 +}, +{ +"description": "If you have created a standard template in Purchase Taxes and Charges Master, select one and click on the button below.", +"fieldname": "taxes_and_charges", +"fieldtype": "Link", +"label": "Taxes and Charges", +"no_copy": 0, +"oldfieldname": "purchase_other_charges", +"oldfieldtype": "Link", +"options": "Purchase Taxes and Charges Master", +"permlevel": 0, +"print_hide": 1 +}, +{ +"fieldname": "other_charges", +"fieldtype": "Table", +"label": "Purchase Taxes and Charges", +"no_copy": 0, +"oldfieldname": "purchase_tax_details", +"oldfieldtype": "Table", +"options": "Purchase Taxes and Charges", +"permlevel": 0 +}, +{ +"fieldname": "other_charges_calculation", +"fieldtype": "HTML", +"label": "Taxes and Charges Calculation", +"no_copy": 1, +"oldfieldtype": "HTML", +"permlevel": 0, +"print_hide": 1 +}, +{ +"fieldname": "totals", +"fieldtype": "Section Break", +"label": "Totals", +"oldfieldtype": "Section Break", +"options": "icon-money", +"permlevel": 0 +}, +{ +"fieldname": "other_charges_added", +"fieldtype": "Currency", +"label": "Taxes and Charges Added (Company Currency)", +"no_copy": 0, +"oldfieldname": "other_charges_added", +"oldfieldtype": "Currency", +"options": "Company:company:default_currency", +"permlevel": 0, +"print_hide": 1, +"read_only": 1 +}, +{ +"fieldname": "other_charges_deducted", +"fieldtype": "Currency", +"label": "Taxes and Charges Deducted (Company Currency)", +"no_copy": 0, +"oldfieldname": "other_charges_deducted", +"oldfieldtype": "Currency", +"options": "Company:company:default_currency", +"permlevel": 0, +"print_hide": 1, +"read_only": 1 +}, +{ +"fieldname": "total_tax", +"fieldtype": "Currency", +"label": "Total Tax (Company Currency)", +"no_copy": 1, +"oldfieldname": "total_tax", +"oldfieldtype": "Currency", +"options": "Company:company:default_currency", +"permlevel": 0, +"print_hide": 1, +"read_only": 1 +}, +{ +"fieldname": "grand_total", +"fieldtype": "Currency", +"label": "Grand Total (Company Currency)", +"no_copy": 1, +"oldfieldname": "grand_total", +"oldfieldtype": "Currency", +"options": "Company:company:default_currency", +"permlevel": 0, +"print_hide": 1, +"read_only": 1 +}, +{ +"description": "In Words will be visible once you save the Purchase Order.", +"fieldname": "in_words", +"fieldtype": "Data", +"label": "In Words (Company Currency)", +"oldfieldname": "in_words", +"oldfieldtype": "Data", +"permlevel": 0, +"print_hide": 1, +"read_only": 1 +}, +{ +"fieldname": "rounded_total", +"fieldtype": "Currency", +"label": "Rounded Total (Company Currency)", +"oldfieldname": "rounded_total", +"oldfieldtype": "Currency", +"options": "Company:company:default_currency", +"permlevel": 0, +"print_hide": 1, +"read_only": 1 +}, +{ +"fieldname": "advance_paid", +"fieldtype": "Currency", +"label": "Advance Paid", +"permlevel": 0, +"print_hide": 1, +"read_only": 1 +}, +{ +"fieldname": "column_break4", +"fieldtype": "Column Break", +"oldfieldtype": "Column Break", +"permlevel": 0, +"print_hide": 0 +}, +{ +"fieldname": "other_charges_added_import", +"fieldtype": "Currency", +"label": "Taxes and Charges Added", +"no_copy": 0, +"oldfieldname": "other_charges_added_import", +"oldfieldtype": "Currency", +"options": "currency", +"permlevel": 0, +"print_hide": 1, +"read_only": 1, +"report_hide": 0 +}, +{ +"fieldname": "other_charges_deducted_import", +"fieldtype": "Currency", +"label": "Taxes and Charges Deducted", +"no_copy": 0, +"oldfieldname": "other_charges_deducted_import", +"oldfieldtype": "Currency", +"options": "currency", +"permlevel": 0, +"print_hide": 1, +"read_only": 1, +"report_hide": 0 +}, +{ +"fieldname": "grand_total_import", +"fieldtype": "Currency", +"in_list_view": 1, +"label": "Grand Total", +"no_copy": 0, +"oldfieldname": "grand_total_import", +"oldfieldtype": "Currency", +"options": "currency", +"permlevel": 0, +"print_hide": 0, +"read_only": 1, +"report_hide": 0 +}, +{ +"fieldname": "in_words_import", +"fieldtype": "Data", +"label": "In Words", +"oldfieldname": "in_words_import", +"oldfieldtype": "Data", +"permlevel": 0, +"print_hide": 0, +"read_only": 1 +}, +{ +"fieldname": "fold", +"fieldtype": "Fold", +"permlevel": 0 +}, +{ +"fieldname": "terms_section_break", +"fieldtype": "Section Break", +"label": "Terms and Conditions", +"oldfieldtype": "Section Break", +"options": "icon-legal", +"permlevel": 0 +}, +{ +"fieldname": "tc_name", +"fieldtype": "Link", +"label": "Terms", +"oldfieldname": "tc_name", +"oldfieldtype": "Link", +"options": "Terms and Conditions", +"permlevel": 0, +"print_hide": 1 +}, +{ +"fieldname": "terms", +"fieldtype": "Text Editor", +"label": "Terms and Conditions", +"oldfieldname": "terms", +"oldfieldtype": "Text Editor", +"permlevel": 0 +}, +{ +"depends_on": "supplier", +"fieldname": "contact_section", +"fieldtype": "Section Break", +"label": "Contact Info", +"options": "icon-bullhorn", +"permlevel": 0 +}, +{ +"fieldname": "supplier_address", +"fieldtype": "Link", +"in_filter": 1, +"label": "Supplier Address", +"options": "Address", +"permlevel": 0, +"print_hide": 1 +}, +{ +"fieldname": "cb_contact", +"fieldtype": "Column Break", +"permlevel": 0 +}, +{ +"fieldname": "contact_person", +"fieldtype": "Link", +"in_filter": 1, +"label": "Contact Person", +"options": "Contact", +"permlevel": 0, +"print_hide": 1 +}, +{ +"fieldname": "more_info", +"fieldtype": "Section Break", +"label": "More Info", +"oldfieldtype": "Section Break", +"permlevel": 0 +}, +{ +"fieldname": "status", +"fieldtype": "Select", +"in_filter": 1, +"label": "Status", +"no_copy": 1, +"oldfieldname": "status", +"oldfieldtype": "Select", +"options": "\nDraft\nSubmitted\nStopped\nCancelled", +"permlevel": 0, +"print_hide": 1, +"read_only": 1, +"reqd": 1, +"search_index": 1 +}, +{ +"default": "No", +"fieldname": "is_subcontracted", +"fieldtype": "Select", +"label": "Is Subcontracted", +"options": "\nYes\nNo", +"permlevel": 0, +"print_hide": 1 +}, +{ +"fieldname": "ref_sq", +"fieldtype": "Data", +"hidden": 1, +"label": "Ref SQ", +"no_copy": 1, +"oldfieldname": "ref_sq", +"oldfieldtype": "Data", +"permlevel": 0, +"print_hide": 1, +"read_only": 1 +}, +{ +"allow_on_submit": 1, +"fieldname": "letter_head", +"fieldtype": "Link", +"label": "Letter Head", +"oldfieldname": "letter_head", +"oldfieldtype": "Select", +"options": "Letter Head", +"permlevel": 0, +"print_hide": 1 +}, +{ +"fieldname": "fiscal_year", +"fieldtype": "Link", +"in_filter": 1, +"label": "Fiscal Year", +"no_copy": 0, +"oldfieldname": "fiscal_year", +"oldfieldtype": "Select", +"options": "Fiscal Year", +"permlevel": 0, +"print_hide": 1, +"reqd": 1, +"search_index": 1 +}, +{ +"allow_on_submit": 1, +"fieldname": "select_print_heading", +"fieldtype": "Link", +"label": "Print Heading", +"no_copy": 1, +"oldfieldname": "select_print_heading", +"oldfieldtype": "Link", +"options": "Print Heading", +"permlevel": 0, +"print_hide": 1, +"report_hide": 1 +}, +{ +"fieldname": "column_break5", +"fieldtype": "Column Break", +"oldfieldtype": "Column Break", +"permlevel": 0, +"print_hide": 1, +"print_width": "50%", +"width": "50%" +}, +{ +"depends_on": "eval:!doc.__islocal", +"description": "% of materials received against this Purchase Order", +"fieldname": "per_received", +"fieldtype": "Percent", +"in_list_view": 1, +"label": "% Received", +"no_copy": 1, +"oldfieldname": "per_received", +"oldfieldtype": "Currency", +"permlevel": 0, +"print_hide": 1, +"read_only": 1 +}, +{ +"depends_on": "eval:!doc.__islocal", +"description": "% of materials billed against this Purchase Order.", +"fieldname": "per_billed", +"fieldtype": "Percent", +"in_list_view": 1, +"label": "% Billed", +"no_copy": 1, +"oldfieldname": "per_billed", +"oldfieldtype": "Currency", +"permlevel": 0, +"print_hide": 1, +"read_only": 1 +}, +{ +"description": "Required raw materials issued to the supplier for producing a sub - contracted item.", +"fieldname": "raw_material_details", +"fieldtype": "Section Break", +"label": "Raw Materials Supplied", +"oldfieldtype": "Section Break", +"options": "icon-truck", +"permlevel": 0, +"print_hide": 1 +}, +{ +"allow_on_submit": 1, +"fieldname": "po_raw_material_details", +"fieldtype": "Table", +"label": "Purchase Order Items Supplied", +"no_copy": 0, +"oldfieldname": "po_raw_material_details", +"oldfieldtype": "Table", +"options": "Purchase Order Item Supplied", +"permlevel": 0, +"print_hide": 1, +"read_only": 1 } +], +"icon": "icon-file-text", +"idx": 1, +"is_submittable": 1, +"modified": "2014-09-10 05:35:32.583024", +"modified_by": "Administrator", +"module": "Buying", +"name": "Purchase Order", +"owner": "Administrator", +"permissions": [ +{ +"amend": 0, +"apply_user_permissions": 1, +"cancel": 0, +"create": 0, +"delete": 0, +"email": 0, +"permlevel": 0, +"print": 0, +"read": 1, +"report": 1, +"role": "Material User", +"submit": 0, +"write": 0 +}, +{ +"amend": 1, +"cancel": 1, +"create": 1, +"delete": 1, +"email": 1, +"permlevel": 0, +"print": 1, +"read": 1, +"report": 1, +"role": "Purchase Manager", +"submit": 1, +"write": 1 +}, +{ +"amend": 1, +"apply_user_permissions": 1, +"cancel": 1, +"create": 1, +"delete": 1, +"email": 1, +"permlevel": 0, +"print": 1, +"read": 1, +"report": 1, +"role": "Purchase User", +"submit": 1, +"write": 1 +}, +{ +"apply_user_permissions": 1, +"cancel": 0, +"delete": 0, +"email": 1, +"permlevel": 0, +"print": 1, +"read": 1, +"report": 1, +"role": "Supplier" +}, +{ +"permlevel": 1, +"read": 1, +"role": "Purchase Manager", +"write": 1 +} +], +"read_only_onload": 1, +"search_fields": "status, transaction_date, supplier,grand_total", +"sort_field": "modified", +"sort_order": "DESC" +} + From 525ab0a925b35847a5317e1397dea2bcde63aa38 Mon Sep 17 00:00:00 2001 From: Sambhaji Kolate Date: Mon, 15 Sep 2014 12:57:58 +0530 Subject: [PATCH 08/42] fix build --- .../purchase_invoice/purchase_invoice.json | 129 ++++++++++++++++++ .../purchase_order/purchase_order.json | 123 +++++++++++++++++ 2 files changed, 252 insertions(+) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json index 43cb633cee5..3a451367892 100755 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json @@ -143,6 +143,24 @@ "search_index": 1 }, { + "allow_on_submit": 1, + "description": "Start date of current invoice's period", + "fieldname": "from_date", + "fieldtype": "Date", + "label": "From", + "no_copy": 1, + "permlevel": 0 + }, + { + "allow_on_submit": 1, + "description": "End date of current invoice's period", + "fieldname": "to_date", + "fieldtype": "Date", + "label": "To", + "no_copy": 1, + "permlevel": 0 + }, + { "fieldname": "amended_from", "fieldtype": "Link", "ignore_user_permissions": 1, @@ -752,6 +770,117 @@ "print_hide": 1, "read_only": 0, "reqd": 0 + }, + { + "depends_on": "eval:doc.docstatus<2", + "fieldname": "recurring_invoice", + "fieldtype": "Section Break", + "label": "Recurring Invoice", + "options": "icon-time", + "permlevel": 0, + "print_hide": 1 + }, + { + "fieldname": "column_break_77", + "fieldtype": "Column Break", + "permlevel": 0, + "print_hide": 1, + "width": "50%" + }, + { + "allow_on_submit": 1, + "depends_on": "eval:doc.docstatus<2", + "description": "Check if recurring invoice, uncheck to stop recurring or put proper End Date", + "fieldname": "is_recurring", + "fieldtype": "Check", + "label": "Is Recurring", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1 + }, + { + "allow_on_submit": 1, + "depends_on": "eval:doc.is_recurring==1", + "description": "Select the period when the invoice will be generated automatically", + "fieldname": "recurring_type", + "fieldtype": "Select", + "label": "Recurring Type", + "no_copy": 1, + "options": "Monthly\nQuarterly\nHalf-yearly\nYearly", + "permlevel": 0, + "print_hide": 1 + }, + { + "allow_on_submit": 1, + "depends_on": "eval:doc.is_recurring==1", + "description": "The day of the month on which auto invoice will be generated e.g. 05, 28 etc", + "fieldname": "repeat_on_day_of_month", + "fieldtype": "Int", + "label": "Repeat on Day of Month", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1 + }, + { + "depends_on": "eval:doc.is_recurring==1", + "description": "The date on which next invoice will be generated. It is generated on submit.", + "fieldname": "next_date", + "fieldtype": "Date", + "label": "Next Date", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "column_break_82", + "fieldtype": "Column Break", + "permlevel": 0, + "print_hide": 1, + "width": "50%" + }, + { + "allow_on_submit": 1, + "depends_on": "eval:doc.is_recurring==1", + "description": "The date on which recurring invoice will be stop", + "fieldname": "end_date", + "fieldtype": "Date", + "label": "End Date", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1 + }, + { + "depends_on": "eval:doc.is_recurring==1", + "description": "The unique id for tracking all recurring invoices. It is generated on submit.", + "fieldname": "recurring_id", + "fieldtype": "Data", + "label": "Recurring Id", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "allow_on_submit": 1, + "depends_on": "eval:doc.is_recurring==1", + "description": "Enter email id separated by commas, invoice will be mailed automatically on particular date", + "fieldname": "notification_email_address", + "fieldtype": "Small Text", + "label": "Notification Email Address", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1 + }, + { + "fieldname": "against_income_account", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Against Income Account", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1, + "report_hide": 1 } ], "icon": "icon-file-text", diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index 7dcdd456409..7843fb7f57d 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -102,6 +102,24 @@ "search_index": 1 }, { +"allow_on_submit": 1, + "description": "Start date of current order's period", + "fieldname": "from_date", + "fieldtype": "Date", + "label": "From", + "no_copy": 1, + "permlevel": 0 + }, + { + "allow_on_submit": 1, + "description": "End date of current order's period", + "fieldname": "to_date", + "fieldtype": "Date", + "label": "To", + "no_copy": 1, + "permlevel": 0 + }, + { "fieldname": "amended_from", "fieldtype": "Link", "hidden": 0, @@ -652,6 +670,111 @@ "permlevel": 0, "print_hide": 1, "read_only": 1 + }, + { + "fieldname": "recurring_order", + "fieldtype": "Section Break", + "label": "Recurring Order", + "options": "icon-time", + "permlevel": 0 + }, + { + "fieldname": "column_break", + "fieldtype": "Column Break", + "label": "Column Break", + "permlevel": 0 + }, + { + "allow_on_submit": 1, + "depends_on": "eval:doc.docstatus<2", + "description": "Check if recurring order, uncheck to stop recurring or put proper End Date", + "fieldname": "is_recurring", + "fieldtype": "Check", + "label": "Is Recurring", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1 + }, + { + "allow_on_submit": 1, + "depends_on": "eval:doc.is_recurring==1", + "fieldname": "recurring_type", + "fieldtype": "Select", + "label": "Recurring Type", + "no_copy": 1, + "options": "Monthly\nQuarterly\nHalf-yearly\nYearly", + "permlevel": 0 + }, + { + "allow_on_submit": 1, + "depends_on": "eval:doc.is_recurring==1", + "description": "The day of the month on which auto order will be generated e.g. 05, 28 etc", + "fieldname": "repeat_on_day_of_month", + "fieldtype": "Int", + "label": "Repeat on Day of Month", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1 + }, + { + "depends_on": "eval:doc.is_recurring==1", + "description": "The date on which next invoice will be generated. It is generated on submit.", + "fieldname": "next_date", + "fieldtype": "Date", + "label": "Next Date", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "allow_on_submit": 1, + "depends_on": "eval:doc.is_recurring==1", + "description": "The date on which recurring order will be stop", + "fieldname": "end_date", + "fieldtype": "Date", + "label": "End Date", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1 + }, + { + "fieldname": "column_break83", + "fieldtype": "Column Break", + "label": "Column Break", + "permlevel": 0, + "print_hide": 1 + }, + { + "depends_on": "eval:doc.is_recurring==1", + "fieldname": "recurring_id", + "fieldtype": "Data", + "label": "Recurring Id", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "allow_on_submit": 1, + "depends_on": "eval:doc.is_recurring==1", + "description": "Enter email id separated by commas, order will be mailed automatically on particular date", + "fieldname": "notification_email_address", + "fieldtype": "Small Text", + "label": "Notification Email Address", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1 + }, + { + "fieldname": "against_income_account", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Against Income Account", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1, + "report_hide": 1 } ], "icon": "icon-file-text", From f37d4337a486c6bc8ee7976d627f1a039f66ac19 Mon Sep 17 00:00:00 2001 From: Sambhaji Kolate Date: Mon, 15 Sep 2014 13:37:46 +0530 Subject: [PATCH 09/42] fix test for purchase order --- erpnext/controllers/recurring_document.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/erpnext/controllers/recurring_document.py b/erpnext/controllers/recurring_document.py index 7b4310badad..32b1cebd036 100644 --- a/erpnext/controllers/recurring_document.py +++ b/erpnext/controllers/recurring_document.py @@ -16,6 +16,8 @@ month_map = {'Monthly': 1, 'Quarterly': 3, 'Half-yearly': 6, 'Yearly': 12} def create_recurring_documents(): manage_recurring_documents("Sales Order") manage_recurring_documents("Sales Invoice") + manage_recurring_documents("Purchase Order") + manage_recurring_documents("Purchase Invoice") def manage_recurring_documents(doctype, next_date=None, commit=True): """ @@ -28,6 +30,10 @@ def manage_recurring_documents(doctype, next_date=None, commit=True): date_field = "transaction_date" elif doctype == "Sales Invoice": date_field = "posting_date" + elif doctype == "Purchase Order": + date_field = "transaction_date" + elif doctype == "Purchase Invoice": + date_field = "posting_date" recurring_documents = frappe.db.sql("""select name, recurring_id from `tab{}` where ifnull(is_recurring, 0)=1 From 30c5b41398d97a26b598c9111a10ff2cdd73727c Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 15 Sep 2014 16:42:56 +0530 Subject: [PATCH 10/42] [minor] removed Suggest --- erpnext/hr/doctype/employee/employee.json | 1101 ++++++++--------- .../contact_control/contact_control.js | 13 - .../stock/doctype/warehouse/warehouse.json | 351 +++--- .../utilities/doctype/address/address.json | 403 +++--- .../utilities/doctype/contact/contact.json | 548 ++++---- 5 files changed, 1199 insertions(+), 1217 deletions(-) diff --git a/erpnext/hr/doctype/employee/employee.json b/erpnext/hr/doctype/employee/employee.json index 7be1c40afaa..9a9631b46f9 100644 --- a/erpnext/hr/doctype/employee/employee.json +++ b/erpnext/hr/doctype/employee/employee.json @@ -1,731 +1,730 @@ { - "allow_import": 1, - "allow_rename": 1, - "autoname": "naming_series:", - "creation": "2013-03-07 09:04:18", - "docstatus": 0, - "doctype": "DocType", - "document_type": "Master", + "allow_import": 1, + "allow_rename": 1, + "autoname": "naming_series:", + "creation": "2013-03-07 09:04:18", + "docstatus": 0, + "doctype": "DocType", + "document_type": "Master", "fields": [ { - "fieldname": "basic_information", - "fieldtype": "Section Break", - "label": "Basic Information", - "oldfieldtype": "Section Break", + "fieldname": "basic_information", + "fieldtype": "Section Break", + "label": "Basic Information", + "oldfieldtype": "Section Break", "permlevel": 0 - }, + }, { - "fieldname": "column_break0", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "column_break0", + "fieldtype": "Column Break", + "permlevel": 0, "width": "50%" - }, + }, { - "fieldname": "image_view", - "fieldtype": "Image", - "in_list_view": 0, - "label": "Image View", - "options": "image", + "fieldname": "image_view", + "fieldtype": "Image", + "in_list_view": 0, + "label": "Image View", + "options": "image", "permlevel": 0 - }, + }, { - "fieldname": "employee", - "fieldtype": "Data", - "hidden": 1, - "label": "Employee", - "no_copy": 1, - "permlevel": 0, - "print_hide": 1, + "fieldname": "employee", + "fieldtype": "Data", + "hidden": 1, + "label": "Employee", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1, "report_hide": 1 - }, + }, { - "fieldname": "naming_series", - "fieldtype": "Select", - "label": "Series", - "no_copy": 1, - "oldfieldname": "naming_series", - "oldfieldtype": "Select", - "options": "EMP/", - "permlevel": 0, + "fieldname": "naming_series", + "fieldtype": "Select", + "label": "Series", + "no_copy": 1, + "oldfieldname": "naming_series", + "oldfieldtype": "Select", + "options": "EMP/", + "permlevel": 0, "reqd": 0 - }, + }, { - "fieldname": "salutation", - "fieldtype": "Select", - "label": "Salutation", - "oldfieldname": "salutation", - "oldfieldtype": "Select", - "options": "\nMr\nMs", - "permlevel": 0, + "fieldname": "salutation", + "fieldtype": "Select", + "label": "Salutation", + "oldfieldname": "salutation", + "oldfieldtype": "Select", + "options": "\nMr\nMs", + "permlevel": 0, "search_index": 0 - }, + }, { - "fieldname": "employee_name", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Full Name", - "oldfieldname": "employee_name", - "oldfieldtype": "Data", - "permlevel": 0, + "fieldname": "employee_name", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Full Name", + "oldfieldname": "employee_name", + "oldfieldtype": "Data", + "permlevel": 0, "reqd": 1 - }, + }, { - "fieldname": "image", - "fieldtype": "Select", - "label": "Image", - "options": "attach_files:", + "fieldname": "image", + "fieldtype": "Select", + "label": "Image", + "options": "attach_files:", "permlevel": 0 - }, + }, { - "fieldname": "column_break1", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "column_break1", + "fieldtype": "Column Break", + "permlevel": 0, "width": "50%" - }, + }, { - "description": "System User (login) ID. If set, it will become default for all HR forms.", - "fieldname": "user_id", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "User ID", - "options": "User", + "description": "System User (login) ID. If set, it will become default for all HR forms.", + "fieldname": "user_id", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "User ID", + "options": "User", "permlevel": 0 - }, + }, { - "fieldname": "employee_number", - "fieldtype": "Data", - "in_filter": 1, - "label": "Employee Number", - "oldfieldname": "employee_number", - "oldfieldtype": "Data", - "permlevel": 0, + "fieldname": "employee_number", + "fieldtype": "Data", + "in_filter": 1, + "label": "Employee Number", + "oldfieldname": "employee_number", + "oldfieldtype": "Data", + "permlevel": 0, "search_index": 0 - }, + }, { - "fieldname": "date_of_joining", - "fieldtype": "Date", - "label": "Date of Joining", - "oldfieldname": "date_of_joining", - "oldfieldtype": "Date", - "permlevel": 0, + "fieldname": "date_of_joining", + "fieldtype": "Date", + "label": "Date of Joining", + "oldfieldname": "date_of_joining", + "oldfieldtype": "Date", + "permlevel": 0, "reqd": 1 - }, + }, { - "description": "You can enter any date manually", - "fieldname": "date_of_birth", - "fieldtype": "Date", - "in_filter": 1, - "label": "Date of Birth", - "oldfieldname": "date_of_birth", - "oldfieldtype": "Date", - "permlevel": 0, - "reqd": 1, + "description": "You can enter any date manually", + "fieldname": "date_of_birth", + "fieldtype": "Date", + "in_filter": 1, + "label": "Date of Birth", + "oldfieldname": "date_of_birth", + "oldfieldtype": "Date", + "permlevel": 0, + "reqd": 1, "search_index": 0 - }, + }, { - "fieldname": "gender", - "fieldtype": "Select", - "in_filter": 1, - "label": "Gender", - "oldfieldname": "gender", - "oldfieldtype": "Select", - "options": "\nMale\nFemale", - "permlevel": 0, - "reqd": 1, + "fieldname": "gender", + "fieldtype": "Select", + "in_filter": 1, + "label": "Gender", + "oldfieldname": "gender", + "oldfieldtype": "Select", + "options": "\nMale\nFemale", + "permlevel": 0, + "reqd": 1, "search_index": 0 - }, + }, { - "fieldname": "company", - "fieldtype": "Link", - "in_filter": 1, - "label": "Company", - "options": "Company", - "permlevel": 0, - "print_hide": 1, + "fieldname": "company", + "fieldtype": "Link", + "in_filter": 1, + "label": "Company", + "options": "Company", + "permlevel": 0, + "print_hide": 1, "reqd": 1 - }, + }, { - "fieldname": "employment_details", - "fieldtype": "Section Break", - "label": "Employment Details", + "fieldname": "employment_details", + "fieldtype": "Section Break", + "label": "Employment Details", "permlevel": 0 - }, + }, { - "fieldname": "col_break_21", - "fieldtype": "Column Break", + "fieldname": "col_break_21", + "fieldtype": "Column Break", "permlevel": 0 - }, + }, { - "default": "Active", - "fieldname": "status", - "fieldtype": "Select", - "in_filter": 1, - "in_list_view": 1, - "label": "Status", - "oldfieldname": "status", - "oldfieldtype": "Select", - "options": "\nActive\nLeft", - "permlevel": 0, - "reqd": 1, + "default": "Active", + "fieldname": "status", + "fieldtype": "Select", + "in_filter": 1, + "in_list_view": 1, + "label": "Status", + "oldfieldname": "status", + "oldfieldtype": "Select", + "options": "\nActive\nLeft", + "permlevel": 0, + "reqd": 1, "search_index": 1 - }, + }, { - "fieldname": "employment_type", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "in_filter": 1, - "in_list_view": 1, - "label": "Employment Type", - "oldfieldname": "employment_type", - "oldfieldtype": "Link", - "options": "Employment Type", - "permlevel": 0, + "fieldname": "employment_type", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "in_filter": 1, + "in_list_view": 1, + "label": "Employment Type", + "oldfieldname": "employment_type", + "oldfieldtype": "Link", + "options": "Employment Type", + "permlevel": 0, "search_index": 0 - }, + }, { - "description": "Applicable Holiday List", - "fieldname": "holiday_list", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Holiday List", - "oldfieldname": "holiday_list", - "oldfieldtype": "Link", - "options": "Holiday List", + "description": "Applicable Holiday List", + "fieldname": "holiday_list", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Holiday List", + "oldfieldname": "holiday_list", + "oldfieldtype": "Link", + "options": "Holiday List", "permlevel": 0 - }, + }, { - "fieldname": "col_break_22", - "fieldtype": "Column Break", + "fieldname": "col_break_22", + "fieldtype": "Column Break", "permlevel": 0 - }, + }, { - "fieldname": "scheduled_confirmation_date", - "fieldtype": "Date", - "in_filter": 1, - "label": "Offer Date", - "oldfieldname": "scheduled_confirmation_date", - "oldfieldtype": "Date", - "permlevel": 0, + "fieldname": "scheduled_confirmation_date", + "fieldtype": "Date", + "in_filter": 1, + "label": "Offer Date", + "oldfieldname": "scheduled_confirmation_date", + "oldfieldtype": "Date", + "permlevel": 0, "search_index": 0 - }, + }, { - "fieldname": "final_confirmation_date", - "fieldtype": "Date", - "label": "Confirmation Date", - "oldfieldname": "final_confirmation_date", - "oldfieldtype": "Date", - "permlevel": 0, + "fieldname": "final_confirmation_date", + "fieldtype": "Date", + "label": "Confirmation Date", + "oldfieldname": "final_confirmation_date", + "oldfieldtype": "Date", + "permlevel": 0, "search_index": 0 - }, + }, { - "fieldname": "contract_end_date", - "fieldtype": "Date", - "in_filter": 1, - "label": "Contract End Date", - "oldfieldname": "contract_end_date", - "oldfieldtype": "Date", - "permlevel": 0, + "fieldname": "contract_end_date", + "fieldtype": "Date", + "in_filter": 1, + "label": "Contract End Date", + "oldfieldname": "contract_end_date", + "oldfieldtype": "Date", + "permlevel": 0, "search_index": 0 - }, + }, { - "fieldname": "date_of_retirement", - "fieldtype": "Date", - "label": "Date Of Retirement", - "oldfieldname": "date_of_retirement", - "oldfieldtype": "Date", + "fieldname": "date_of_retirement", + "fieldtype": "Date", + "label": "Date Of Retirement", + "oldfieldname": "date_of_retirement", + "oldfieldtype": "Date", "permlevel": 0 - }, + }, { - "fieldname": "job_profile", - "fieldtype": "Section Break", - "label": "Job Profile", + "fieldname": "job_profile", + "fieldtype": "Section Break", + "label": "Job Profile", "permlevel": 0 - }, + }, { - "fieldname": "column_break2", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "column_break2", + "fieldtype": "Column Break", + "permlevel": 0, "width": "50%" - }, + }, { - "fieldname": "branch", - "fieldtype": "Link", - "in_filter": 1, - "label": "Branch", - "oldfieldname": "branch", - "oldfieldtype": "Link", - "options": "Branch", - "permlevel": 0, + "fieldname": "branch", + "fieldtype": "Link", + "in_filter": 1, + "label": "Branch", + "oldfieldname": "branch", + "oldfieldtype": "Link", + "options": "Branch", + "permlevel": 0, "reqd": 0 - }, + }, { - "fieldname": "department", - "fieldtype": "Link", - "in_filter": 1, - "label": "Department", - "oldfieldname": "department", - "oldfieldtype": "Link", - "options": "Department", - "permlevel": 0, + "fieldname": "department", + "fieldtype": "Link", + "in_filter": 1, + "label": "Department", + "oldfieldname": "department", + "oldfieldtype": "Link", + "options": "Department", + "permlevel": 0, "reqd": 0 - }, + }, { - "fieldname": "designation", - "fieldtype": "Link", - "in_filter": 1, - "label": "Designation", - "oldfieldname": "designation", - "oldfieldtype": "Link", - "options": "Designation", - "permlevel": 0, - "reqd": 0, + "fieldname": "designation", + "fieldtype": "Link", + "in_filter": 1, + "label": "Designation", + "oldfieldname": "designation", + "oldfieldtype": "Link", + "options": "Designation", + "permlevel": 0, + "reqd": 0, "search_index": 1 - }, + }, { - "description": "Provide email id registered in company", - "fieldname": "company_email", - "fieldtype": "Data", - "in_filter": 1, - "label": "Company Email", - "oldfieldname": "company_email", - "oldfieldtype": "Data", - "permlevel": 0, + "description": "Provide email id registered in company", + "fieldname": "company_email", + "fieldtype": "Data", + "in_filter": 1, + "label": "Company Email", + "oldfieldname": "company_email", + "oldfieldtype": "Data", + "permlevel": 0, "reqd": 0 - }, + }, { - "fieldname": "notice_number_of_days", - "fieldtype": "Int", - "label": "Notice (days)", - "oldfieldname": "notice_number_of_days", - "oldfieldtype": "Int", + "fieldname": "notice_number_of_days", + "fieldtype": "Int", + "label": "Notice (days)", + "oldfieldname": "notice_number_of_days", + "oldfieldtype": "Int", "permlevel": 0 - }, + }, { - "fieldname": "salary_information", - "fieldtype": "Column Break", - "label": "Salary Information", - "oldfieldtype": "Section Break", - "permlevel": 0, + "fieldname": "salary_information", + "fieldtype": "Column Break", + "label": "Salary Information", + "oldfieldtype": "Section Break", + "permlevel": 0, "width": "50%" - }, + }, { - "fieldname": "salary_mode", - "fieldtype": "Select", - "label": "Salary Mode", - "oldfieldname": "salary_mode", - "oldfieldtype": "Select", - "options": "\nBank\nCash\nCheque", + "fieldname": "salary_mode", + "fieldtype": "Select", + "label": "Salary Mode", + "oldfieldname": "salary_mode", + "oldfieldtype": "Select", + "options": "\nBank\nCash\nCheque", "permlevel": 0 - }, + }, { - "depends_on": "eval:doc.salary_mode == 'Bank'", - "fieldname": "bank_name", - "fieldtype": "Data", - "hidden": 0, - "in_filter": 1, - "label": "Bank Name", - "oldfieldname": "bank_name", - "oldfieldtype": "Link", - "options": "Suggest", + "depends_on": "eval:doc.salary_mode == 'Bank'", + "fieldname": "bank_name", + "fieldtype": "Data", + "hidden": 0, + "in_filter": 1, + "label": "Bank Name", + "oldfieldname": "bank_name", + "oldfieldtype": "Link", "permlevel": 0 - }, + }, { - "depends_on": "eval:doc.salary_mode == 'Bank'", - "fieldname": "bank_ac_no", - "fieldtype": "Data", - "hidden": 0, - "label": "Bank A/C No.", - "oldfieldname": "bank_ac_no", - "oldfieldtype": "Data", + "depends_on": "eval:doc.salary_mode == 'Bank'", + "fieldname": "bank_ac_no", + "fieldtype": "Data", + "hidden": 0, + "label": "Bank A/C No.", + "oldfieldname": "bank_ac_no", + "oldfieldtype": "Data", "permlevel": 0 - }, + }, { - "fieldname": "organization_profile", - "fieldtype": "Section Break", - "label": "Organization Profile", + "fieldname": "organization_profile", + "fieldtype": "Section Break", + "label": "Organization Profile", "permlevel": 0 - }, + }, { - "fieldname": "reports_to", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Reports to", - "oldfieldname": "reports_to", - "oldfieldtype": "Link", - "options": "Employee", + "fieldname": "reports_to", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Reports to", + "oldfieldname": "reports_to", + "oldfieldtype": "Link", + "options": "Employee", "permlevel": 0 - }, + }, { - "description": "The first Leave Approver in the list will be set as the default Leave Approver", - "fieldname": "employee_leave_approvers", - "fieldtype": "Table", - "label": "Leave Approvers", - "options": "Employee Leave Approver", + "description": "The first Leave Approver in the list will be set as the default Leave Approver", + "fieldname": "employee_leave_approvers", + "fieldtype": "Table", + "label": "Leave Approvers", + "options": "Employee Leave Approver", "permlevel": 0 - }, + }, { - "fieldname": "contact_details", - "fieldtype": "Section Break", - "label": "Contact Details", + "fieldname": "contact_details", + "fieldtype": "Section Break", + "label": "Contact Details", "permlevel": 0 - }, + }, { - "fieldname": "column_break3", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "column_break3", + "fieldtype": "Column Break", + "permlevel": 0, "width": "50%" - }, + }, { - "fieldname": "cell_number", - "fieldtype": "Data", - "label": "Cell Number", + "fieldname": "cell_number", + "fieldtype": "Data", + "label": "Cell Number", "permlevel": 0 - }, + }, { - "fieldname": "personal_email", - "fieldtype": "Data", - "label": "Personal Email", + "fieldname": "personal_email", + "fieldtype": "Data", + "label": "Personal Email", "permlevel": 0 - }, + }, { - "fieldname": "unsubscribed", - "fieldtype": "Check", - "label": "Unsubscribed", + "fieldname": "unsubscribed", + "fieldtype": "Check", + "label": "Unsubscribed", "permlevel": 0 - }, + }, { - "fieldname": "emergency_contact_details", - "fieldtype": "HTML", - "label": "Emergency Contact Details", - "options": "

Emergency Contact Details

", + "fieldname": "emergency_contact_details", + "fieldtype": "HTML", + "label": "Emergency Contact Details", + "options": "

Emergency Contact Details

", "permlevel": 0 - }, + }, { - "fieldname": "person_to_be_contacted", - "fieldtype": "Data", - "label": "Emergency Contact", + "fieldname": "person_to_be_contacted", + "fieldtype": "Data", + "label": "Emergency Contact", "permlevel": 0 - }, + }, { - "fieldname": "relation", - "fieldtype": "Data", - "label": "Relation", + "fieldname": "relation", + "fieldtype": "Data", + "label": "Relation", "permlevel": 0 - }, + }, { - "fieldname": "emergency_phone_number", - "fieldtype": "Data", - "label": "Emergency Phone", + "fieldname": "emergency_phone_number", + "fieldtype": "Data", + "label": "Emergency Phone", "permlevel": 0 - }, + }, { - "fieldname": "column_break4", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "column_break4", + "fieldtype": "Column Break", + "permlevel": 0, "width": "50%" - }, + }, { - "fieldname": "permanent_accommodation_type", - "fieldtype": "Select", - "label": "Permanent Address Is", - "options": "\nRented\nOwned", + "fieldname": "permanent_accommodation_type", + "fieldtype": "Select", + "label": "Permanent Address Is", + "options": "\nRented\nOwned", "permlevel": 0 - }, + }, { - "fieldname": "permanent_address", - "fieldtype": "Small Text", - "label": "Permanent Address", + "fieldname": "permanent_address", + "fieldtype": "Small Text", + "label": "Permanent Address", "permlevel": 0 - }, + }, { - "fieldname": "current_accommodation_type", - "fieldtype": "Select", - "label": "Current Address Is", - "options": "\nRented\nOwned", + "fieldname": "current_accommodation_type", + "fieldtype": "Select", + "label": "Current Address Is", + "options": "\nRented\nOwned", "permlevel": 0 - }, + }, { - "fieldname": "current_address", - "fieldtype": "Small Text", - "label": "Current Address", + "fieldname": "current_address", + "fieldtype": "Small Text", + "label": "Current Address", "permlevel": 0 - }, + }, { - "fieldname": "sb53", - "fieldtype": "Section Break", - "label": "Bio", + "fieldname": "sb53", + "fieldtype": "Section Break", + "label": "Bio", "permlevel": 0 - }, + }, { - "description": "Short biography for website and other publications.", - "fieldname": "bio", - "fieldtype": "Text Editor", - "label": "Bio", + "description": "Short biography for website and other publications.", + "fieldname": "bio", + "fieldtype": "Text Editor", + "label": "Bio", "permlevel": 0 - }, + }, { - "fieldname": "personal_details", - "fieldtype": "Section Break", - "label": "Personal Details", + "fieldname": "personal_details", + "fieldtype": "Section Break", + "label": "Personal Details", "permlevel": 0 - }, + }, { - "fieldname": "column_break5", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "column_break5", + "fieldtype": "Column Break", + "permlevel": 0, "width": "50%" - }, + }, { - "fieldname": "passport_number", - "fieldtype": "Data", - "label": "Passport Number", + "fieldname": "passport_number", + "fieldtype": "Data", + "label": "Passport Number", "permlevel": 0 - }, + }, { - "fieldname": "date_of_issue", - "fieldtype": "Date", - "label": "Date of Issue", + "fieldname": "date_of_issue", + "fieldtype": "Date", + "label": "Date of Issue", "permlevel": 0 - }, + }, { - "fieldname": "valid_upto", - "fieldtype": "Date", - "label": "Valid Upto", + "fieldname": "valid_upto", + "fieldtype": "Date", + "label": "Valid Upto", "permlevel": 0 - }, + }, { - "fieldname": "place_of_issue", - "fieldtype": "Data", - "label": "Place of Issue", + "fieldname": "place_of_issue", + "fieldtype": "Data", + "label": "Place of Issue", "permlevel": 0 - }, + }, { - "fieldname": "column_break6", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "column_break6", + "fieldtype": "Column Break", + "permlevel": 0, "width": "50%" - }, + }, { - "fieldname": "marital_status", - "fieldtype": "Select", - "label": "Marital Status", - "options": "\nSingle\nMarried\nDivorced\nWidowed", + "fieldname": "marital_status", + "fieldtype": "Select", + "label": "Marital Status", + "options": "\nSingle\nMarried\nDivorced\nWidowed", "permlevel": 0 - }, + }, { - "fieldname": "blood_group", - "fieldtype": "Select", - "label": "Blood Group", - "options": "\nA+\nA-\nB+\nB-\nAB+\nAB-\nO+\nO-", + "fieldname": "blood_group", + "fieldtype": "Select", + "label": "Blood Group", + "options": "\nA+\nA-\nB+\nB-\nAB+\nAB-\nO+\nO-", "permlevel": 0 - }, + }, { - "description": "Here you can maintain family details like name and occupation of parent, spouse and children", - "fieldname": "family_background", - "fieldtype": "Small Text", - "label": "Family Background", + "description": "Here you can maintain family details like name and occupation of parent, spouse and children", + "fieldname": "family_background", + "fieldtype": "Small Text", + "label": "Family Background", "permlevel": 0 - }, + }, { - "description": "Here you can maintain height, weight, allergies, medical concerns etc", - "fieldname": "health_details", - "fieldtype": "Small Text", - "label": "Health Details", + "description": "Here you can maintain height, weight, allergies, medical concerns etc", + "fieldname": "health_details", + "fieldtype": "Small Text", + "label": "Health Details", "permlevel": 0 - }, + }, { - "fieldname": "educational_qualification", - "fieldtype": "Section Break", - "label": "Educational Qualification", + "fieldname": "educational_qualification", + "fieldtype": "Section Break", + "label": "Educational Qualification", "permlevel": 0 - }, + }, { - "fieldname": "educational_qualification_details", - "fieldtype": "Table", - "label": "Educational Qualification Details", - "options": "Employee Education", + "fieldname": "educational_qualification_details", + "fieldtype": "Table", + "label": "Educational Qualification Details", + "options": "Employee Education", "permlevel": 0 - }, + }, { - "fieldname": "previous_work_experience", - "fieldtype": "Section Break", - "label": "Previous Work Experience", - "options": "Simple", + "fieldname": "previous_work_experience", + "fieldtype": "Section Break", + "label": "Previous Work Experience", + "options": "Simple", "permlevel": 0 - }, + }, { - "fieldname": "previous_experience_details", - "fieldtype": "Table", - "label": "Employee External Work History", - "options": "Employee External Work History", + "fieldname": "previous_experience_details", + "fieldtype": "Table", + "label": "Employee External Work History", + "options": "Employee External Work History", "permlevel": 0 - }, + }, { - "fieldname": "history_in_company", - "fieldtype": "Section Break", - "label": "History In Company", - "options": "Simple", + "fieldname": "history_in_company", + "fieldtype": "Section Break", + "label": "History In Company", + "options": "Simple", "permlevel": 0 - }, + }, { - "fieldname": "experience_in_company_details", - "fieldtype": "Table", - "label": "Employee Internal Work Historys", - "options": "Employee Internal Work History", + "fieldname": "experience_in_company_details", + "fieldtype": "Table", + "label": "Employee Internal Work Historys", + "options": "Employee Internal Work History", "permlevel": 0 - }, + }, { - "fieldname": "exit", - "fieldtype": "Section Break", - "label": "Exit", - "oldfieldtype": "Section Break", + "fieldname": "exit", + "fieldtype": "Section Break", + "label": "Exit", + "oldfieldtype": "Section Break", "permlevel": 0 - }, + }, { - "fieldname": "column_break7", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "column_break7", + "fieldtype": "Column Break", + "permlevel": 0, "width": "50%" - }, + }, { - "fieldname": "resignation_letter_date", - "fieldtype": "Date", - "label": "Resignation Letter Date", - "oldfieldname": "resignation_letter_date", - "oldfieldtype": "Date", + "fieldname": "resignation_letter_date", + "fieldtype": "Date", + "label": "Resignation Letter Date", + "oldfieldname": "resignation_letter_date", + "oldfieldtype": "Date", "permlevel": 0 - }, + }, { - "fieldname": "relieving_date", - "fieldtype": "Date", - "in_filter": 1, - "label": "Relieving Date", - "oldfieldname": "relieving_date", - "oldfieldtype": "Date", + "fieldname": "relieving_date", + "fieldtype": "Date", + "in_filter": 1, + "label": "Relieving Date", + "oldfieldname": "relieving_date", + "oldfieldtype": "Date", "permlevel": 0 - }, + }, { - "fieldname": "reason_for_leaving", - "fieldtype": "Data", - "label": "Reason for Leaving", - "oldfieldname": "reason_for_leaving", - "oldfieldtype": "Data", + "fieldname": "reason_for_leaving", + "fieldtype": "Data", + "label": "Reason for Leaving", + "oldfieldname": "reason_for_leaving", + "oldfieldtype": "Data", "permlevel": 0 - }, + }, { - "fieldname": "leave_encashed", - "fieldtype": "Select", - "label": "Leave Encashed?", - "oldfieldname": "leave_encashed", - "oldfieldtype": "Select", - "options": "\nYes\nNo", + "fieldname": "leave_encashed", + "fieldtype": "Select", + "label": "Leave Encashed?", + "oldfieldname": "leave_encashed", + "oldfieldtype": "Select", + "options": "\nYes\nNo", "permlevel": 0 - }, + }, { - "fieldname": "encashment_date", - "fieldtype": "Date", - "label": "Encashment Date", - "oldfieldname": "encashment_date", - "oldfieldtype": "Date", + "fieldname": "encashment_date", + "fieldtype": "Date", + "label": "Encashment Date", + "oldfieldname": "encashment_date", + "oldfieldtype": "Date", "permlevel": 0 - }, + }, { - "fieldname": "exit_interview_details", - "fieldtype": "Column Break", - "label": "Exit Interview Details", - "oldfieldname": "col_brk6", - "oldfieldtype": "Column Break", - "permlevel": 0, + "fieldname": "exit_interview_details", + "fieldtype": "Column Break", + "label": "Exit Interview Details", + "oldfieldname": "col_brk6", + "oldfieldtype": "Column Break", + "permlevel": 0, "width": "50%" - }, + }, { - "fieldname": "held_on", - "fieldtype": "Date", - "label": "Held On", - "oldfieldname": "held_on", - "oldfieldtype": "Date", + "fieldname": "held_on", + "fieldtype": "Date", + "label": "Held On", + "oldfieldname": "held_on", + "oldfieldtype": "Date", "permlevel": 0 - }, + }, { - "fieldname": "reason_for_resignation", - "fieldtype": "Select", - "label": "Reason for Resignation", - "oldfieldname": "reason_for_resignation", - "oldfieldtype": "Select", - "options": "\nBetter Prospects\nHealth Concerns", + "fieldname": "reason_for_resignation", + "fieldtype": "Select", + "label": "Reason for Resignation", + "oldfieldname": "reason_for_resignation", + "oldfieldtype": "Select", + "options": "\nBetter Prospects\nHealth Concerns", "permlevel": 0 - }, + }, { - "fieldname": "new_workplace", - "fieldtype": "Data", - "label": "New Workplace", - "oldfieldname": "new_workplace", - "oldfieldtype": "Data", + "fieldname": "new_workplace", + "fieldtype": "Data", + "label": "New Workplace", + "oldfieldname": "new_workplace", + "oldfieldtype": "Data", "permlevel": 0 - }, + }, { - "fieldname": "feedback", - "fieldtype": "Small Text", - "label": "Feedback", - "oldfieldname": "feedback", - "oldfieldtype": "Text", + "fieldname": "feedback", + "fieldtype": "Small Text", + "label": "Feedback", + "oldfieldname": "feedback", + "oldfieldtype": "Text", "permlevel": 0 } - ], - "icon": "icon-user", - "idx": 1, - "modified": "2014-08-27 05:55:00.514660", - "modified_by": "Administrator", - "module": "HR", - "name": "Employee", - "owner": "Administrator", + ], + "icon": "icon-user", + "idx": 1, + "modified": "2014-09-15 05:55:00.514660", + "modified_by": "Administrator", + "module": "HR", + "name": "Employee", + "owner": "Administrator", "permissions": [ { - "amend": 0, - "apply_user_permissions": 1, - "create": 0, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Employee", - "submit": 0, + "amend": 0, + "apply_user_permissions": 1, + "create": 0, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Employee", + "submit": 0, "write": 0 - }, + }, { - "amend": 0, - "apply_user_permissions": 1, - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "HR User", - "submit": 0, - "user_permission_doctypes": "[\"Branch\",\"Company\",\"Department\",\"Designation\"]", + "amend": 0, + "apply_user_permissions": 1, + "create": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "HR User", + "submit": 0, + "user_permission_doctypes": "[\"Branch\",\"Company\",\"Department\",\"Designation\"]", "write": 1 - }, + }, { - "amend": 0, - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "HR Manager", - "set_user_permissions": 1, - "submit": 0, + "amend": 0, + "create": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "HR Manager", + "set_user_permissions": 1, + "submit": 0, "write": 1 } - ], - "search_fields": "employee_name", - "sort_field": "modified", - "sort_order": "DESC", + ], + "search_fields": "employee_name", + "sort_field": "modified", + "sort_order": "DESC", "title_field": "employee_name" -} \ No newline at end of file +} diff --git a/erpnext/setup/doctype/contact_control/contact_control.js b/erpnext/setup/doctype/contact_control/contact_control.js index b0535416839..0ca59fc4499 100755 --- a/erpnext/setup/doctype/contact_control/contact_control.js +++ b/erpnext/setup/doctype/contact_control/contact_control.js @@ -1,19 +1,6 @@ // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors // License: GNU General Public License v3. See license.txt -cur_frm.cscript.get_states=function(doc, dt, dn) { - return $c('runserverobj', args={'method': 'check_state', 'docs':doc}, - function(r, rt) { - if(r.message) - set_field_options('state', r.message); - } - ); -} - -cur_frm.cscript.country = function(doc, dt, dn) { - cur_frm.cscript.get_states(doc, dt, dn); -} - if(cur_frm.fields_dict['territory']) { cur_frm.fields_dict['territory'].get_query = function(doc, dt, dn) { return { diff --git a/erpnext/stock/doctype/warehouse/warehouse.json b/erpnext/stock/doctype/warehouse/warehouse.json index 0a4c244eb1c..59951be9274 100644 --- a/erpnext/stock/doctype/warehouse/warehouse.json +++ b/erpnext/stock/doctype/warehouse/warehouse.json @@ -1,224 +1,223 @@ { - "allow_import": 1, - "allow_rename": 1, - "creation": "2013-03-07 18:50:32", - "description": "A logical Warehouse against which stock entries are made.", - "docstatus": 0, - "doctype": "DocType", - "document_type": "Master", + "allow_import": 1, + "allow_rename": 1, + "creation": "2013-03-07 18:50:32", + "description": "A logical Warehouse against which stock entries are made.", + "docstatus": 0, + "doctype": "DocType", + "document_type": "Master", "fields": [ { - "fieldname": "warehouse_detail", - "fieldtype": "Section Break", - "label": "Warehouse Detail", - "oldfieldtype": "Section Break", - "permlevel": 0, + "fieldname": "warehouse_detail", + "fieldtype": "Section Break", + "label": "Warehouse Detail", + "oldfieldtype": "Section Break", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "warehouse_name", - "fieldtype": "Data", - "label": "Warehouse Name", - "oldfieldname": "warehouse_name", - "oldfieldtype": "Data", - "permlevel": 0, - "read_only": 0, + "fieldname": "warehouse_name", + "fieldtype": "Data", + "label": "Warehouse Name", + "oldfieldname": "warehouse_name", + "oldfieldtype": "Data", + "permlevel": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "fieldname": "company", - "fieldtype": "Link", - "in_filter": 1, - "label": "Company", - "oldfieldname": "company", - "oldfieldtype": "Link", - "options": "Company", - "permlevel": 0, - "read_only": 0, - "reqd": 1, + "fieldname": "company", + "fieldtype": "Link", + "in_filter": 1, + "label": "Company", + "oldfieldname": "company", + "oldfieldtype": "Link", + "options": "Company", + "permlevel": 0, + "read_only": 0, + "reqd": 1, "search_index": 1 - }, + }, { - "depends_on": "eval:sys_defaults.auto_accounting_for_stock", - "description": "Account for the warehouse (Perpetual Inventory) will be created under this Account.", - "fieldname": "create_account_under", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Parent Account", - "options": "Account", + "depends_on": "eval:sys_defaults.auto_accounting_for_stock", + "description": "Account for the warehouse (Perpetual Inventory) will be created under this Account.", + "fieldname": "create_account_under", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Parent Account", + "options": "Account", "permlevel": 0 - }, + }, { - "fieldname": "disabled", - "fieldtype": "Check", - "label": "Disabled", + "fieldname": "disabled", + "fieldtype": "Check", + "label": "Disabled", "permlevel": 0 - }, + }, { - "description": "For Reference Only.", - "fieldname": "warehouse_contact_info", - "fieldtype": "Section Break", - "label": "Warehouse Contact Info", - "permlevel": 0, + "description": "For Reference Only.", + "fieldname": "warehouse_contact_info", + "fieldtype": "Section Break", + "label": "Warehouse Contact Info", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "email_id", - "fieldtype": "Data", - "hidden": 1, - "label": "Email Id", - "oldfieldname": "email_id", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, + "fieldname": "email_id", + "fieldtype": "Data", + "hidden": 1, + "label": "Email Id", + "oldfieldname": "email_id", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 0, "read_only": 0 - }, + }, { - "fieldname": "phone_no", - "fieldtype": "Data", - "label": "Phone No", - "oldfieldname": "phone_no", - "oldfieldtype": "Int", - "options": "Phone", - "permlevel": 0, + "fieldname": "phone_no", + "fieldtype": "Data", + "label": "Phone No", + "oldfieldname": "phone_no", + "oldfieldtype": "Int", + "options": "Phone", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "mobile_no", - "fieldtype": "Data", - "label": "Mobile No", - "oldfieldname": "mobile_no", - "oldfieldtype": "Int", - "options": "Phone", - "permlevel": 0, + "fieldname": "mobile_no", + "fieldtype": "Data", + "label": "Mobile No", + "oldfieldname": "mobile_no", + "oldfieldtype": "Int", + "options": "Phone", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "column_break0", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, + "fieldname": "column_break0", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "address_line_1", - "fieldtype": "Data", - "label": "Address Line 1", - "oldfieldname": "address_line_1", - "oldfieldtype": "Data", - "permlevel": 0, + "fieldname": "address_line_1", + "fieldtype": "Data", + "label": "Address Line 1", + "oldfieldname": "address_line_1", + "oldfieldtype": "Data", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "address_line_2", - "fieldtype": "Data", - "label": "Address Line 2", - "oldfieldname": "address_line_2", - "oldfieldtype": "Data", - "permlevel": 0, + "fieldname": "address_line_2", + "fieldtype": "Data", + "label": "Address Line 2", + "oldfieldname": "address_line_2", + "oldfieldtype": "Data", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "city", - "fieldtype": "Data", - "in_list_view": 1, - "label": "City", - "oldfieldname": "city", - "oldfieldtype": "Data", - "permlevel": 0, - "read_only": 0, + "fieldname": "city", + "fieldtype": "Data", + "in_list_view": 1, + "label": "City", + "oldfieldname": "city", + "oldfieldtype": "Data", + "permlevel": 0, + "read_only": 0, "reqd": 0 - }, + }, { - "fieldname": "state", - "fieldtype": "Data", - "label": "State", - "oldfieldname": "state", - "oldfieldtype": "Select", - "options": "Suggest", - "permlevel": 0, + "fieldname": "state", + "fieldtype": "Data", + "label": "State", + "oldfieldname": "state", + "oldfieldtype": "Select", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "pin", - "fieldtype": "Int", - "label": "PIN", - "oldfieldname": "pin", - "oldfieldtype": "Int", - "permlevel": 0, + "fieldname": "pin", + "fieldtype": "Int", + "label": "PIN", + "oldfieldname": "pin", + "oldfieldtype": "Int", + "permlevel": 0, "read_only": 0 } - ], - "icon": "icon-building", - "idx": 1, - "modified": "2014-08-04 02:55:16.750848", - "modified_by": "Administrator", - "module": "Stock", - "name": "Warehouse", - "owner": "Administrator", + ], + "icon": "icon-building", + "idx": 1, + "modified": "2014-09-15 02:55:16.750848", + "modified_by": "Administrator", + "module": "Stock", + "name": "Warehouse", + "owner": "Administrator", "permissions": [ { - "amend": 0, - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Material Master Manager", - "submit": 0, + "amend": 0, + "create": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Material Master Manager", + "submit": 0, "write": 1 - }, + }, { - "amend": 0, - "apply_user_permissions": 1, - "create": 0, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Material User", - "submit": 0, + "amend": 0, + "apply_user_permissions": 1, + "create": 0, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Material User", + "submit": 0, "write": 0 - }, + }, { - "apply_user_permissions": 1, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, + "apply_user_permissions": 1, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, "role": "Sales User" - }, + }, { - "apply_user_permissions": 1, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, + "apply_user_permissions": 1, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, "role": "Purchase User" - }, + }, { - "apply_user_permissions": 1, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, + "apply_user_permissions": 1, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, "role": "Accounts User" - }, + }, { - "apply_user_permissions": 1, - "permlevel": 0, - "read": 1, + "apply_user_permissions": 1, + "permlevel": 0, + "read": 1, "role": "Manufacturing User" } ] -} \ No newline at end of file +} diff --git a/erpnext/utilities/doctype/address/address.json b/erpnext/utilities/doctype/address/address.json index 3692b91c5a7..9a7c322e29a 100644 --- a/erpnext/utilities/doctype/address/address.json +++ b/erpnext/utilities/doctype/address/address.json @@ -1,264 +1,263 @@ { - "allow_import": 1, - "allow_rename": 1, - "creation": "2013-01-10 16:34:32", - "docstatus": 0, - "doctype": "DocType", - "document_type": "Master", + "allow_import": 1, + "allow_rename": 1, + "creation": "2013-01-10 16:34:32", + "docstatus": 0, + "doctype": "DocType", + "document_type": "Master", "fields": [ { - "fieldname": "address_details", - "fieldtype": "Section Break", - "label": "Address Details", - "options": "icon-map-marker", + "fieldname": "address_details", + "fieldtype": "Section Break", + "label": "Address Details", + "options": "icon-map-marker", "permlevel": 0 - }, + }, { - "description": "Name of person or organization that this address belongs to.", - "fieldname": "address_title", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Address Title", - "permlevel": 0, + "description": "Name of person or organization that this address belongs to.", + "fieldname": "address_title", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Address Title", + "permlevel": 0, "reqd": 0 - }, + }, { - "fieldname": "address_type", - "fieldtype": "Select", - "label": "Address Type", - "options": "Billing\nShipping\nOffice\nPersonal\nPlant\nPostal\nShop\nSubsidiary\nWarehouse\nOther", - "permlevel": 0, + "fieldname": "address_type", + "fieldtype": "Select", + "label": "Address Type", + "options": "Billing\nShipping\nOffice\nPersonal\nPlant\nPostal\nShop\nSubsidiary\nWarehouse\nOther", + "permlevel": 0, "reqd": 1 - }, + }, { - "fieldname": "address_line1", - "fieldtype": "Data", - "label": "Address Line 1", - "permlevel": 0, + "fieldname": "address_line1", + "fieldtype": "Data", + "label": "Address Line 1", + "permlevel": 0, "reqd": 1 - }, + }, { - "fieldname": "address_line2", - "fieldtype": "Data", - "label": "Address Line 2", + "fieldname": "address_line2", + "fieldtype": "Data", + "label": "Address Line 2", "permlevel": 0 - }, + }, { - "fieldname": "city", - "fieldtype": "Data", - "in_filter": 1, - "in_list_view": 1, - "label": "City/Town", - "permlevel": 0, - "reqd": 1, + "fieldname": "city", + "fieldtype": "Data", + "in_filter": 1, + "in_list_view": 1, + "label": "City/Town", + "permlevel": 0, + "reqd": 1, "search_index": 1 - }, + }, { - "fieldname": "state", - "fieldtype": "Data", - "in_filter": 1, - "in_list_view": 1, - "label": "State", - "options": "Suggest", - "permlevel": 0, + "fieldname": "state", + "fieldtype": "Data", + "in_filter": 1, + "in_list_view": 1, + "label": "State", + "permlevel": 0, "search_index": 0 - }, + }, { - "fieldname": "pincode", - "fieldtype": "Data", - "in_filter": 1, - "in_list_view": 1, - "label": "Pincode", - "permlevel": 0, + "fieldname": "pincode", + "fieldtype": "Data", + "in_filter": 1, + "in_list_view": 1, + "label": "Pincode", + "permlevel": 0, "search_index": 1 - }, + }, { - "fieldname": "country", - "fieldtype": "Link", - "in_filter": 1, - "in_list_view": 1, - "label": "Country", - "options": "Country", - "permlevel": 0, - "reqd": 1, + "fieldname": "country", + "fieldtype": "Link", + "in_filter": 1, + "in_list_view": 1, + "label": "Country", + "options": "Country", + "permlevel": 0, + "reqd": 1, "search_index": 1 - }, + }, { - "fieldname": "column_break0", - "fieldtype": "Column Break", - "permlevel": 0, - "print_hide": 0, + "fieldname": "column_break0", + "fieldtype": "Column Break", + "permlevel": 0, + "print_hide": 0, "width": "50%" - }, + }, { - "fieldname": "email_id", - "fieldtype": "Data", - "label": "Email Id", + "fieldname": "email_id", + "fieldtype": "Data", + "label": "Email Id", "permlevel": 0 - }, + }, { - "fieldname": "phone", - "fieldtype": "Data", - "label": "Phone", - "permlevel": 0, + "fieldname": "phone", + "fieldtype": "Data", + "label": "Phone", + "permlevel": 0, "reqd": 1 - }, + }, { - "fieldname": "fax", - "fieldtype": "Data", - "in_filter": 1, - "label": "Fax", + "fieldname": "fax", + "fieldtype": "Data", + "in_filter": 1, + "label": "Fax", "permlevel": 0 - }, + }, { - "default": "0", - "description": "Check to make primary address", - "fieldname": "is_primary_address", - "fieldtype": "Check", - "label": "Preferred Billing Address", + "default": "0", + "description": "Check to make primary address", + "fieldname": "is_primary_address", + "fieldtype": "Check", + "label": "Preferred Billing Address", "permlevel": 0 - }, + }, { - "default": "0", - "description": "Check to make Shipping Address", - "fieldname": "is_shipping_address", - "fieldtype": "Check", - "in_list_view": 1, - "label": "Preferred Shipping Address", + "default": "0", + "description": "Check to make Shipping Address", + "fieldname": "is_shipping_address", + "fieldtype": "Check", + "in_list_view": 1, + "label": "Preferred Shipping Address", "permlevel": 0 - }, + }, { - "fieldname": "linked_with", - "fieldtype": "Section Break", - "label": "Reference", - "options": "icon-pushpin", + "fieldname": "linked_with", + "fieldtype": "Section Break", + "label": "Reference", + "options": "icon-pushpin", "permlevel": 0 - }, + }, { - "fieldname": "customer", - "fieldtype": "Link", - "label": "Customer", - "options": "Customer", + "fieldname": "customer", + "fieldtype": "Link", + "label": "Customer", + "options": "Customer", "permlevel": 0 - }, + }, { - "fieldname": "customer_name", - "fieldtype": "Data", - "in_filter": 1, - "in_list_view": 0, - "label": "Customer Name", - "permlevel": 0, + "fieldname": "customer_name", + "fieldtype": "Data", + "in_filter": 1, + "in_list_view": 0, + "label": "Customer Name", + "permlevel": 0, "read_only": 1 - }, + }, { - "fieldname": "supplier", - "fieldtype": "Link", - "label": "Supplier", - "options": "Supplier", + "fieldname": "supplier", + "fieldtype": "Link", + "label": "Supplier", + "options": "Supplier", "permlevel": 0 - }, + }, { - "fieldname": "supplier_name", - "fieldtype": "Data", - "in_filter": 1, - "in_list_view": 0, - "label": "Supplier Name", - "permlevel": 0, - "read_only": 1, + "fieldname": "supplier_name", + "fieldtype": "Data", + "in_filter": 1, + "in_list_view": 0, + "label": "Supplier Name", + "permlevel": 0, + "read_only": 1, "search_index": 0 - }, + }, { - "fieldname": "sales_partner", - "fieldtype": "Link", - "label": "Sales Partner", - "options": "Sales Partner", + "fieldname": "sales_partner", + "fieldtype": "Link", + "label": "Sales Partner", + "options": "Sales Partner", "permlevel": 0 - }, + }, { - "fieldname": "column_break_22", - "fieldtype": "Column Break", + "fieldname": "column_break_22", + "fieldtype": "Column Break", "permlevel": 0 - }, + }, { - "depends_on": "eval:!doc.supplier && !doc.sales_partner", - "fieldname": "lead", - "fieldtype": "Link", - "label": "Lead", - "options": "Lead", + "depends_on": "eval:!doc.supplier && !doc.sales_partner", + "fieldname": "lead", + "fieldtype": "Link", + "label": "Lead", + "options": "Lead", "permlevel": 0 - }, + }, { - "depends_on": "eval:!doc.supplier && !doc.sales_partner", - "fieldname": "lead_name", - "fieldtype": "Data", - "label": "Lead Name", - "permlevel": 0, + "depends_on": "eval:!doc.supplier && !doc.sales_partner", + "fieldname": "lead_name", + "fieldtype": "Data", + "label": "Lead Name", + "permlevel": 0, "read_only": 1 } - ], - "icon": "icon-map-marker", - "idx": 1, - "in_dialog": 0, - "modified": "2014-05-27 03:49:07.273657", - "modified_by": "Administrator", - "module": "Utilities", - "name": "Address", - "owner": "Administrator", + ], + "icon": "icon-map-marker", + "idx": 1, + "in_dialog": 0, + "modified": "2014-09-15 03:49:07.273657", + "modified_by": "Administrator", + "module": "Utilities", + "name": "Address", + "owner": "Administrator", "permissions": [ { - "apply_user_permissions": 1, - "create": 1, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Sales User", - "submit": 0, + "apply_user_permissions": 1, + "create": 1, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Sales User", + "submit": 0, "write": 1 - }, + }, { - "apply_user_permissions": 1, - "create": 1, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Purchase User", - "submit": 0, + "apply_user_permissions": 1, + "create": 1, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Purchase User", + "submit": 0, "write": 1 - }, + }, { - "apply_user_permissions": 1, - "create": 1, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Maintenance User", - "submit": 0, + "apply_user_permissions": 1, + "create": 1, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Maintenance User", + "submit": 0, "write": 1 - }, + }, { - "apply_user_permissions": 1, - "create": 1, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Accounts User", - "submit": 0, + "apply_user_permissions": 1, + "create": 1, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts User", + "submit": 0, "write": 1 } - ], - "search_fields": "customer, supplier, sales_partner, country, state", - "sort_field": "modified", + ], + "search_fields": "customer, supplier, sales_partner, country, state", + "sort_field": "modified", "sort_order": "DESC" -} \ No newline at end of file +} diff --git a/erpnext/utilities/doctype/contact/contact.json b/erpnext/utilities/doctype/contact/contact.json index c52cfdca51d..caa67456619 100644 --- a/erpnext/utilities/doctype/contact/contact.json +++ b/erpnext/utilities/doctype/contact/contact.json @@ -1,349 +1,347 @@ { - "allow_import": 1, - "allow_rename": 1, - "creation": "2013-01-10 16:34:32", - "docstatus": 0, - "doctype": "DocType", - "document_type": "Master", + "allow_import": 1, + "allow_rename": 1, + "creation": "2013-01-10 16:34:32", + "docstatus": 0, + "doctype": "DocType", + "document_type": "Master", "fields": [ { - "fieldname": "contact_section", - "fieldtype": "Section Break", - "label": "Contact Details", - "options": "icon-user", + "fieldname": "contact_section", + "fieldtype": "Section Break", + "label": "Contact Details", + "options": "icon-user", "permlevel": 0 - }, + }, { - "fieldname": "first_name", - "fieldtype": "Data", - "in_list_view": 0, - "label": "First Name", - "oldfieldname": "first_name", - "oldfieldtype": "Data", - "permlevel": 0, + "fieldname": "first_name", + "fieldtype": "Data", + "in_list_view": 0, + "label": "First Name", + "oldfieldname": "first_name", + "oldfieldtype": "Data", + "permlevel": 0, "reqd": 1 - }, + }, { - "fieldname": "last_name", - "fieldtype": "Data", - "in_list_view": 0, - "label": "Last Name", - "oldfieldname": "last_name", - "oldfieldtype": "Data", + "fieldname": "last_name", + "fieldtype": "Data", + "in_list_view": 0, + "label": "Last Name", + "oldfieldname": "last_name", + "oldfieldtype": "Data", "permlevel": 0 - }, + }, { - "fieldname": "cb00", - "fieldtype": "Column Break", + "fieldname": "cb00", + "fieldtype": "Column Break", "permlevel": 0 - }, + }, { - "default": "Passive", - "fieldname": "status", - "fieldtype": "Select", - "in_list_view": 1, - "label": "Status", - "options": "Passive\nOpen\nReplied", + "default": "Passive", + "fieldname": "status", + "fieldtype": "Select", + "in_list_view": 1, + "label": "Status", + "options": "Passive\nOpen\nReplied", "permlevel": 0 - }, + }, { - "fieldname": "email_id", - "fieldtype": "Data", - "in_list_view": 0, - "label": "Email Id", - "oldfieldname": "email_id", - "oldfieldtype": "Data", - "permlevel": 0, - "reqd": 0, + "fieldname": "email_id", + "fieldtype": "Data", + "in_list_view": 0, + "label": "Email Id", + "oldfieldname": "email_id", + "oldfieldtype": "Data", + "permlevel": 0, + "reqd": 0, "search_index": 1 - }, + }, { - "fieldname": "phone", - "fieldtype": "Data", - "label": "Phone", - "oldfieldname": "contact_no", - "oldfieldtype": "Data", - "permlevel": 0, + "fieldname": "phone", + "fieldtype": "Data", + "label": "Phone", + "oldfieldname": "contact_no", + "oldfieldtype": "Data", + "permlevel": 0, "reqd": 0 - }, + }, { - "fieldname": "sb00", - "fieldtype": "Section Break", - "label": "Communication History", - "options": "icon-comments", - "permlevel": 0, + "fieldname": "sb00", + "fieldtype": "Section Break", + "label": "Communication History", + "options": "icon-comments", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "communication_html", - "fieldtype": "HTML", - "label": "Communication HTML", - "permlevel": 0, + "fieldname": "communication_html", + "fieldtype": "HTML", + "label": "Communication HTML", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "contact_details", - "fieldtype": "Section Break", - "label": "Reference", - "options": "icon-pushpin", + "fieldname": "contact_details", + "fieldtype": "Section Break", + "label": "Reference", + "options": "icon-pushpin", "permlevel": 0 - }, + }, { - "depends_on": "eval:!doc.supplier && !doc.sales_partner", - "fieldname": "customer", - "fieldtype": "Link", - "label": "Customer", - "oldfieldname": "customer", - "oldfieldtype": "Link", - "options": "Customer", - "permlevel": 0, + "depends_on": "eval:!doc.supplier && !doc.sales_partner", + "fieldname": "customer", + "fieldtype": "Link", + "label": "Customer", + "oldfieldname": "customer", + "oldfieldtype": "Link", + "options": "Customer", + "permlevel": 0, "print_hide": 0 - }, + }, { - "depends_on": "eval:!doc.supplier && !doc.sales_partner", - "fieldname": "customer_name", - "fieldtype": "Data", - "in_list_view": 0, - "label": "Customer Name", - "permlevel": 0, + "depends_on": "eval:!doc.supplier && !doc.sales_partner", + "fieldname": "customer_name", + "fieldtype": "Data", + "in_list_view": 0, + "label": "Customer Name", + "permlevel": 0, "read_only": 1 - }, + }, { - "fieldname": "column_break1", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, + "fieldname": "column_break1", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, "width": "50%" - }, + }, { - "depends_on": "eval:!doc.customer && !doc.sales_partner", - "fieldname": "supplier", - "fieldtype": "Link", - "label": "Supplier", - "options": "Supplier", + "depends_on": "eval:!doc.customer && !doc.sales_partner", + "fieldname": "supplier", + "fieldtype": "Link", + "label": "Supplier", + "options": "Supplier", "permlevel": 0 - }, + }, { - "allow_on_submit": 0, - "depends_on": "eval:!doc.customer && !doc.sales_partner", - "fieldname": "supplier_name", - "fieldtype": "Data", - "in_list_view": 0, - "label": "Supplier Name", - "permlevel": 0, + "allow_on_submit": 0, + "depends_on": "eval:!doc.customer && !doc.sales_partner", + "fieldname": "supplier_name", + "fieldtype": "Data", + "in_list_view": 0, + "label": "Supplier Name", + "permlevel": 0, "read_only": 1 - }, + }, { - "depends_on": "eval:!doc.customer && !doc.supplier", - "fieldname": "sales_partner", - "fieldtype": "Link", - "label": "Sales Partner", - "options": "Sales Partner", + "depends_on": "eval:!doc.customer && !doc.supplier", + "fieldname": "sales_partner", + "fieldtype": "Link", + "label": "Sales Partner", + "options": "Sales Partner", "permlevel": 0 - }, + }, { - "default": "0", - "depends_on": "eval:(doc.customer || doc.supplier || doc.sales_partner)", - "fieldname": "is_primary_contact", - "fieldtype": "Check", - "label": "Is Primary Contact", - "oldfieldname": "is_primary_contact", - "oldfieldtype": "Select", + "default": "0", + "depends_on": "eval:(doc.customer || doc.supplier || doc.sales_partner)", + "fieldname": "is_primary_contact", + "fieldtype": "Check", + "label": "Is Primary Contact", + "oldfieldname": "is_primary_contact", + "oldfieldtype": "Select", "permlevel": 0 - }, + }, { - "fieldname": "more_info", - "fieldtype": "Section Break", - "label": "More Info", - "options": "icon-file-text", + "fieldname": "more_info", + "fieldtype": "Section Break", + "label": "More Info", + "options": "icon-file-text", "permlevel": 0 - }, + }, { - "fieldname": "mobile_no", - "fieldtype": "Data", - "label": "Mobile No", - "oldfieldname": "mobile_no", - "oldfieldtype": "Data", + "fieldname": "mobile_no", + "fieldtype": "Data", + "label": "Mobile No", + "oldfieldname": "mobile_no", + "oldfieldtype": "Data", "permlevel": 0 - }, + }, { - "description": "Enter department to which this Contact belongs", - "fieldname": "department", - "fieldtype": "Data", - "label": "Department", - "options": "Suggest", + "description": "Enter department to which this Contact belongs", + "fieldname": "department", + "fieldtype": "Data", + "label": "Department", "permlevel": 0 - }, + }, { - "description": "Enter designation of this Contact", - "fieldname": "designation", - "fieldtype": "Data", - "label": "Designation", - "options": "Suggest", + "description": "Enter designation of this Contact", + "fieldname": "designation", + "fieldtype": "Data", + "label": "Designation", "permlevel": 0 - }, + }, { - "fieldname": "unsubscribed", - "fieldtype": "Check", - "label": "Unsubscribed", + "fieldname": "unsubscribed", + "fieldtype": "Check", + "label": "Unsubscribed", "permlevel": 0 - }, + }, { - "fieldname": "communications", - "fieldtype": "Table", - "hidden": 1, - "label": "Communications", - "options": "Communication", - "permlevel": 0, + "fieldname": "communications", + "fieldtype": "Table", + "hidden": 1, + "label": "Communications", + "options": "Communication", + "permlevel": 0, "print_hide": 1 } - ], - "icon": "icon-user", - "idx": 1, - "in_create": 0, - "in_dialog": 0, - "modified": "2014-07-30 05:44:25.767076", - "modified_by": "Administrator", - "module": "Utilities", - "name": "Contact", - "owner": "Administrator", + ], + "icon": "icon-user", + "idx": 1, + "in_create": 0, + "in_dialog": 0, + "modified": "2014-09-15 05:44:25.767076", + "modified_by": "Administrator", + "module": "Utilities", + "name": "Contact", + "owner": "Administrator", "permissions": [ { - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "submit": 0, + "create": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "submit": 0, "write": 1 - }, + }, { - "amend": 0, - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Sales Master Manager", - "submit": 0, + "amend": 0, + "create": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Sales Master Manager", + "submit": 0, "write": 1 - }, + }, { - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Purchase Master Manager", - "submit": 0, + "create": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Purchase Master Manager", + "submit": 0, "write": 1 - }, + }, { - "create": 1, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Sales Manager", - "submit": 0, + "create": 1, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Sales Manager", + "submit": 0, "write": 1 - }, + }, { - "create": 1, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Purchase Manager", - "submit": 0, + "create": 1, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Purchase Manager", + "submit": 0, "write": 1 - }, + }, { - "create": 1, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Maintenance Manager", - "submit": 0, + "create": 1, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Maintenance Manager", + "submit": 0, "write": 1 - }, + }, { - "create": 1, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Accounts Manager", - "submit": 0, + "create": 1, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts Manager", + "submit": 0, "write": 1 - }, + }, { - "apply_user_permissions": 1, - "create": 1, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Sales User", - "submit": 0, + "apply_user_permissions": 1, + "create": 1, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Sales User", + "submit": 0, "write": 1 - }, + }, { - "apply_user_permissions": 1, - "create": 1, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Purchase User", - "submit": 0, + "apply_user_permissions": 1, + "create": 1, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Purchase User", + "submit": 0, "write": 1 - }, + }, { - "apply_user_permissions": 1, - "create": 1, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Maintenance User", - "submit": 0, + "apply_user_permissions": 1, + "create": 1, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Maintenance User", + "submit": 0, "write": 1 - }, + }, { - "apply_user_permissions": 1, - "create": 1, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Accounts User", - "submit": 0, + "apply_user_permissions": 1, + "create": 1, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts User", + "submit": 0, "write": 1 } ] -} \ No newline at end of file +} From c25681c36c36d72751f6ed583cb1839603eb0a8a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 16 Sep 2014 12:08:57 +0530 Subject: [PATCH 11/42] Added item group and brand in sales-person-wise transaction summary report --- .../sales_person_wise_transaction_summary.py | 68 ++++++++++++------- 1 file changed, 42 insertions(+), 26 deletions(-) diff --git a/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py b/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py index f0bed767a71..c970431bece 100644 --- a/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py +++ b/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py @@ -7,34 +7,43 @@ from frappe import msgprint, _ def execute(filters=None): if not filters: filters = {} - + columns = get_columns(filters) - data = get_entries(filters) - + entries = get_entries(filters) + item_details = get_item_details() + data = [] + for d in entries: + data.append([ + d.name, d.customer, d.territory, d.posting_date, d.item_code, + item_details.get(d.item_code, {}).get("item_group"), item_details.get(d.item_code, {}).get("brand"), + d.qty, d.base_amount, d.sales_person, d.allocated_percentage, d.contribution_amt + ]) + return columns, data - + def get_columns(filters): if not filters.get("doc_type"): msgprint(_("Please select the document type first"), raise_exception=1) - - return [filters["doc_type"] + ":Link/" + filters["doc_type"] + ":140", - _("Customer") + ":Link/Customer:140", _("Territory") + ":Link/Territory:100", _("Posting Date") + ":Date:100", - _("Item Code") + ":Link/Item:120", _("Qty") + ":Float:100", _("Amount") + ":Currency:120", - _("Sales Person") + ":Link/Sales Person:140", _("Contribution %") + ":Float:110", + + return [filters["doc_type"] + ":Link/" + filters["doc_type"] + ":140", + _("Customer") + ":Link/Customer:140", _("Territory") + ":Link/Territory:100", _("Posting Date") + ":Date:100", + _("Item Code") + ":Link/Item:120", _("Item Group") + ":Link/Item Group:120", + _("Brand") + ":Link/Brand:120", _("Qty") + ":Float:100", _("Amount") + ":Currency:120", + _("Sales Person") + ":Link/Sales Person:140", _("Contribution %") + ":Float:110", _("Contribution Amount") + ":Currency:140"] - + def get_entries(filters): date_field = filters["doc_type"] == "Sales Order" and "transaction_date" or "posting_date" conditions, items = get_conditions(filters, date_field) - entries = frappe.db.sql("""select dt.name, dt.customer, dt.territory, dt.%s, - dt_item.item_code, dt_item.qty, dt_item.base_amount, st.sales_person, - st.allocated_percentage, dt_item.base_amount*st.allocated_percentage/100 - from `tab%s` dt, `tab%s Item` dt_item, `tabSales Team` st - where st.parent = dt.name and dt.name = dt_item.parent and st.parenttype = %s - and dt.docstatus = 1 %s order by st.sales_person, dt.name desc""" % - (date_field, filters["doc_type"], filters["doc_type"], '%s', conditions), - tuple([filters["doc_type"]] + items), as_list=1) - + entries = frappe.db.sql("""select dt.name, dt.customer, dt.territory, dt.%s as posting_date, + dt_item.item_code, dt_item.qty, dt_item.base_amount, st.sales_person, + st.allocated_percentage, dt_item.base_amount*st.allocated_percentage/100 as contribution_amt + from `tab%s` dt, `tab%s Item` dt_item, `tabSales Team` st + where st.parent = dt.name and dt.name = dt_item.parent and st.parenttype = %s + and dt.docstatus = 1 %s order by st.sales_person, dt.name desc""" % + (date_field, filters["doc_type"], filters["doc_type"], '%s', conditions), + tuple([filters["doc_type"]] + items), as_dict=1) + return entries def get_conditions(filters, date_field): @@ -45,18 +54,18 @@ def get_conditions(filters, date_field): filters["customer"].replace("'", "\'") if filters.get("territory"): conditions += " and dt.territory = '%s'" % \ filters["territory"].replace("'", "\'") - + if filters.get("from_date"): conditions += " and dt.%s >= '%s'" % \ (date_field, filters["from_date"]) if filters.get("to_date"): conditions += " and dt.%s <= '%s'" % (date_field, filters["to_date"]) - + if filters.get("sales_person"): conditions += " and st.sales_person = '%s'" % \ filters["sales_person"].replace("'", "\'") - + items = get_items(filters) if items: conditions += " and dt_item.item_code in (%s)" % ', '.join(['%s']*len(items)) - + return conditions, items def get_items(filters): @@ -66,7 +75,14 @@ def get_items(filters): items = [] if key: - items = frappe.db.sql_list("""select name from tabItem where %s = %s""" % + items = frappe.db.sql_list("""select name from tabItem where %s = %s""" % (key, '%s'), (filters[key])) - - return items \ No newline at end of file + + return items + +def get_item_details(): + item_details = {} + for d in frappe.db.sql("""select name, item_group, brand from `tabItem`""", as_dict=1): + item_details.setdefault(d.name, d) + + return item_details From 9d610214cf4fc57a605eeb5681d65e3446f9819b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 16 Sep 2014 12:25:41 +0530 Subject: [PATCH 12/42] Strip party name before checking for account --- erpnext/accounts/party.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index cd172f19024..de7032e3b10 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -163,7 +163,7 @@ def create_party_account(party, party_type, company): company_details = frappe.db.get_value("Company", company, ["abbr", "receivables_group", "payables_group"], as_dict=True) - if not frappe.db.exists("Account", (party + " - " + company_details.abbr)): + if not frappe.db.exists("Account", (party.strip() + " - " + company_details.abbr)): parent_account = company_details.receivables_group \ if party_type=="Customer" else company_details.payables_group if not parent_account: From 16e943f1203cc1e912ee1ac0b4a3432e81e2b05a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 16 Sep 2014 12:57:31 +0530 Subject: [PATCH 13/42] Removed link of item-wise last purchase rate from buying home page --- erpnext/config/buying.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/erpnext/config/buying.py b/erpnext/config/buying.py index 1b9e5a23b0c..f17020f2b74 100644 --- a/erpnext/config/buying.py +++ b/erpnext/config/buying.py @@ -135,12 +135,6 @@ def get_data(): "name": "Item-wise Purchase History", "doctype": "Item" }, - { - "type": "report", - "is_query_report": True, - "name": "Item-wise Last Purchase Rate", - "doctype": "Item" - }, { "type": "report", "is_query_report": True, From 1db294e837b4334fe4be80b13eff34230d2c8aa8 Mon Sep 17 00:00:00 2001 From: 81552433qqcom <81552433@qq.com> Date: Tue, 16 Sep 2014 16:49:58 +0800 Subject: [PATCH 14/42] hotfix for project wise report translation patch for email digest and support ticket. --- .../project_wise_stock_tracking.py | 2 +- erpnext/setup/doctype/email_digest/email_digest.js | 6 +++--- erpnext/setup/doctype/email_digest/email_digest.py | 8 ++++---- erpnext/support/doctype/support_ticket/support_ticket.js | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/erpnext/projects/report/project_wise_stock_tracking/project_wise_stock_tracking.py b/erpnext/projects/report/project_wise_stock_tracking/project_wise_stock_tracking.py index 69c1bbb4b9d..538b7edd452 100644 --- a/erpnext/projects/report/project_wise_stock_tracking/project_wise_stock_tracking.py +++ b/erpnext/projects/report/project_wise_stock_tracking/project_wise_stock_tracking.py @@ -26,7 +26,7 @@ def get_columns(): _("Cost of Issued Items") + ":Currency:160", _("Cost of Delivered Items") + ":Currency:160", _("Project Name") + "::120", _("Project Status") + "::120", _("Company") + ":Link/Company:100", _("Customer") + ":Link/Customer:140", _("Project Value") + ":Currency:120", - _("Project Start Date") + ":Date:120", _("Completion Date") + ":Date:120"]+ + _("Project Start Date") + ":Date:120", _("Completion Date") + ":Date:120"] def get_project_details(): return frappe.db.sql(""" select name, project_name, status, company, customer, project_value, diff --git a/erpnext/setup/doctype/email_digest/email_digest.js b/erpnext/setup/doctype/email_digest/email_digest.js index fb08f904dd8..cd5626aa2fd 100644 --- a/erpnext/setup/doctype/email_digest/email_digest.js +++ b/erpnext/setup/doctype/email_digest/email_digest.js @@ -73,7 +73,7 @@ cur_frm.cscript.addremove_recipients = function(doc, dt, dn) { var fullname = frappe.user.full_name(v.name); if(fullname !== v.name) v.name = fullname + " <" + v.name + ">"; if(v.enabled==0) { - v.name = repl(" %(name)s (disabled user)", {name: v.name}); + v.name = repl(" %(name)s (" + __("disabled user") + ")", {name: v.name}); } var user = $a($td(tab, i+1, 1), 'span', '', '', v.name); //user.onclick = function() { check.checked = !check.checked; } @@ -81,11 +81,11 @@ cur_frm.cscript.addremove_recipients = function(doc, dt, dn) { // Display add recipients button if(r.user_list.length>15) { - $btn($td(tab, 0, 1), add_or_update + ' Recipients', function() { + $btn($td(tab, 0, 1), __('{0} Recipients',[__(add_or_update)]), function() { cur_frm.cscript.add_to_rec_list(doc, tab, r.user_list.length); }); } - $btn($td(tab, r.user_list.length+1, 1), add_or_update + ' Recipients', function() { + $btn($td(tab, r.user_list.length+1, 1),__('{0} Recipients',[__(add_or_update)]), function() { cur_frm.cscript.add_to_rec_list(doc, tab, r.user_list.length); }); diff --git a/erpnext/setup/doctype/email_digest/email_digest.py b/erpnext/setup/doctype/email_digest/email_digest.py index 59a42cbbafb..16883bf13aa 100644 --- a/erpnext/setup/doctype/email_digest/email_digest.py +++ b/erpnext/setup/doctype/email_digest/email_digest.py @@ -129,7 +129,7 @@ class EmailDigest(Document): with_value = "\n".join(with_value) else: has_updates = False - with_value = "

There were no updates in the items selected for this digest.


" + with_value = "

" + _("There were no updates in the items selected for this digest.") + "


" if not has_updates and send_only_if_updates: return @@ -137,7 +137,7 @@ class EmailDigest(Document): # seperate out no value items no_value = [o[1] for o in out if not o[0]] if no_value: - no_value = """

No Updates For:

""" + "\n".join(no_value) + no_value = """

""" + _("No Updates For") + """:

""" + "\n".join(no_value) date = self.frequency == "Daily" and formatdate(self.from_date) or \ "%s to %s" % (formatdate(self.from_date), formatdate(self.to_date)) @@ -311,9 +311,9 @@ class EmailDigest(Document): (e.subject, datetime_in_user_format(e.starts_on), datetime_in_user_format(e.ends_on)) if html: - return 1, "

Upcoming Calendar Events (max 10):

    " + html + "

" + return 1, "

" + _("Upcoming Calendar Events (max 10)") + ":

    " + html + "

" else: - return 0, "

Calendar Events

" + return 0, "

" + _("Calendar Events") + "

" def get_todo_list(self, user_id): todo_list = frappe.db.sql("""select * diff --git a/erpnext/support/doctype/support_ticket/support_ticket.js b/erpnext/support/doctype/support_ticket/support_ticket.js index d4531dc8b79..4a699a20423 100644 --- a/erpnext/support/doctype/support_ticket/support_ticket.js +++ b/erpnext/support/doctype/support_ticket/support_ticket.js @@ -14,9 +14,9 @@ $.extend(cur_frm.cscript, { cur_frm.cscript.make_listing(doc); if(!doc.__islocal) { if(cur_frm.fields_dict.status.get_status()=="Write") { - if(doc.status!='Closed') cur_frm.add_custom_button('Close', + if(doc.status!='Closed') cur_frm.add_custom_button(__('Close'), cur_frm.cscript['Close Ticket'], "icon-ok", "btn-success"); - if(doc.status=='Closed') cur_frm.add_custom_button('Re-Open Ticket', + if(doc.status=='Closed') cur_frm.add_custom_button(__('Re-Open Ticket'), cur_frm.cscript['Re-Open Ticket'], null, "btn-default"); } From a2c562fea4ba59f3bb10ef533977051fe0a9ca28 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 16 Sep 2014 15:21:43 +0530 Subject: [PATCH 15/42] Update CONTRIBUTING.md --- CONTRIBUTING.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a29e0badeef..ef9d094d936 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,5 +1,9 @@ # Contributing to Frappe / ERPNext +### Update 16-Sep-14 + +Please send pull requests to branch v5.0 + ## Reporting issues We only accept issues that are bug reports or feature requests. Bugs must be isolated and reproducible problems. Please read the following guidelines before opening any issue. From 31c61e7eae6bbd5138daf584b359b51c4782060d Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Tue, 16 Sep 2014 16:28:28 +0600 Subject: [PATCH 16/42] bumped to version 4.4.0 --- erpnext/__version__.py | 2 +- erpnext/hooks.py | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/__version__.py b/erpnext/__version__.py index 5ee6158c526..26a6c390a50 100644 --- a/erpnext/__version__.py +++ b/erpnext/__version__.py @@ -1 +1 @@ -__version__ = '4.3.0' +__version__ = '4.4.0' diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 166d83089ba..5d500452a9c 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -4,7 +4,7 @@ app_publisher = "Web Notes Technologies Pvt. Ltd. and Contributors" app_description = "Open Source Enterprise Resource Planning for Small and Midsized Organizations" app_icon = "icon-th" app_color = "#e74c3c" -app_version = "4.3.0" +app_version = "4.4.0" error_report_email = "support@erpnext.com" diff --git a/setup.py b/setup.py index 5cea41c6f2c..70174bd1043 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages import os -version = "4.3.0" +version = "4.4.0" with open("requirements.txt", "r") as f: install_requires = f.readlines() From 556fbc487d5c405e602b99435e71fc17339e96fc Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 17 Sep 2014 12:13:31 +0530 Subject: [PATCH 17/42] Minor fix in gross profit report --- .../report/gross_profit/gross_profit.py | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py index 76e7b4a1632..21fcb29d98e 100644 --- a/erpnext/accounts/report/gross_profit/gross_profit.py +++ b/erpnext/accounts/report/gross_profit/gross_profit.py @@ -9,29 +9,29 @@ from erpnext.stock.utils import get_buying_amount, get_sales_bom_buying_amount def execute(filters=None): if not filters: filters = {} - + stock_ledger_entries = get_stock_ledger_entries(filters) source = get_source_data(filters) item_sales_bom = get_item_sales_bom() - - columns = [__("Delivery Note/Sales Invoice") + "::120", _("Link") + "::30", _("Posting Date") + ":Date", _("Posting Time"), + + columns = [_("Delivery Note/Sales Invoice") + "::120", _("Link") + "::30", _("Posting Date") + ":Date", _("Posting Time"), _("Item Code") + ":Link/Item", _("Item Name"), _("Description"), _("Warehouse") + ":Link/Warehouse", - _("Qty") + ":Float", _("Selling Rate") + ":Currency", _("Avg. Buying Rate") + ":Currency", + _("Qty") + ":Float", _("Selling Rate") + ":Currency", _("Avg. Buying Rate") + ":Currency", _("Selling Amount") + ":Currency", _("Buying Amount") + ":Currency", _("Gross Profit") + ":Currency", _("Gross Profit %") + ":Percent", _("Project") + ":Link/Project"] data = [] for row in source: selling_amount = flt(row.base_amount) - + item_sales_bom_map = item_sales_bom.get(row.parenttype, {}).get(row.name, frappe._dict()) - + if item_sales_bom_map.get(row.item_code): - buying_amount = get_sales_bom_buying_amount(row.item_code, row.warehouse, + buying_amount = get_sales_bom_buying_amount(row.item_code, row.warehouse, row.parenttype, row.name, row.item_row, stock_ledger_entries, item_sales_bom_map) else: buying_amount = get_buying_amount(row.parenttype, row.name, row.item_row, stock_ledger_entries.get((row.item_code, row.warehouse), [])) - + buying_amount = buying_amount > 0 and buying_amount or 0 gross_profit = selling_amount - buying_amount @@ -39,41 +39,41 @@ def execute(filters=None): gross_profit_percent = (gross_profit / selling_amount) * 100.0 else: gross_profit_percent = 0.0 - + icon = """""" \ % ("/".join(["#Form", row.parenttype, row.name]),) data.append([row.name, icon, row.posting_date, row.posting_time, row.item_code, row.item_name, - row.description, row.warehouse, row.qty, row.base_rate, + row.description, row.warehouse, row.qty, row.base_rate, row.qty and (buying_amount / row.qty) or 0, row.base_amount, buying_amount, gross_profit, gross_profit_percent, row.project]) - + return columns, data - -def get_stock_ledger_entries(filters): + +def get_stock_ledger_entries(filters): query = """select item_code, voucher_type, voucher_no, voucher_detail_no, posting_date, posting_time, stock_value, warehouse, actual_qty as qty from `tabStock Ledger Entry`""" - + if filters.get("company"): query += """ where company=%(company)s""" - + query += " order by item_code desc, warehouse desc, posting_date desc, posting_time desc, name desc" - + res = frappe.db.sql(query, filters, as_dict=True) - + out = {} for r in res: if (r.item_code, r.warehouse) not in out: out[(r.item_code, r.warehouse)] = [] - + out[(r.item_code, r.warehouse)].append(r) return out - + def get_item_sales_bom(): item_sales_bom = {} - + for d in frappe.db.sql("""select parenttype, parent, parent_item, item_code, warehouse, -1*qty as total_qty, parent_detail_docname from `tabPacked Item` where docstatus=1""", as_dict=True): @@ -81,7 +81,7 @@ def get_item_sales_bom(): frappe._dict()).setdefault(d.parent_item, []).append(d) return item_sales_bom - + def get_source_data(filters): conditions = "" if filters.get("company"): @@ -90,9 +90,9 @@ def get_source_data(filters): conditions += " and posting_date>=%(from_date)s" if filters.get("to_date"): conditions += " and posting_date<=%(to_date)s" - - delivery_note_items = frappe.db.sql("""select item.parenttype, dn.name, - dn.posting_date, dn.posting_time, dn.project_name, + + delivery_note_items = frappe.db.sql("""select item.parenttype, dn.name, + dn.posting_date, dn.posting_time, dn.project_name, item.item_code, item.item_name, item.description, item.warehouse, item.qty, item.base_rate, item.base_amount, item.name as "item_row", timestamp(dn.posting_date, dn.posting_time) as posting_datetime @@ -100,7 +100,7 @@ def get_source_data(filters): where item.parent = dn.name and dn.docstatus = 1 %s order by dn.posting_date desc, dn.posting_time desc""" % (conditions,), filters, as_dict=1) - sales_invoice_items = frappe.db.sql("""select item.parenttype, si.name, + sales_invoice_items = frappe.db.sql("""select item.parenttype, si.name, si.posting_date, si.posting_time, si.project_name, item.item_code, item.item_name, item.description, item.warehouse, item.qty, item.base_rate, item.base_amount, item.name as "item_row", @@ -109,9 +109,9 @@ def get_source_data(filters): where item.parent = si.name and si.docstatus = 1 %s and si.update_stock = 1 order by si.posting_date desc, si.posting_time desc""" % (conditions,), filters, as_dict=1) - + source = delivery_note_items + sales_invoice_items if len(source) > len(delivery_note_items): source.sort(key=lambda d: d.posting_datetime, reverse=True) - - return source \ No newline at end of file + + return source From 4073880ecf443d862247b785b9b8e83ac2ad32d1 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 18 Sep 2014 11:01:12 +0530 Subject: [PATCH 18/42] Escaped single quote in authorization control queries --- .../authorization_control.py | 133 +++++++++++------- 1 file changed, 86 insertions(+), 47 deletions(-) diff --git a/erpnext/setup/doctype/authorization_control/authorization_control.py b/erpnext/setup/doctype/authorization_control/authorization_control.py index 03c187b15b4..fa708b5991a 100644 --- a/erpnext/setup/doctype/authorization_control/authorization_control.py +++ b/erpnext/setup/doctype/authorization_control/authorization_control.py @@ -3,19 +3,11 @@ from __future__ import unicode_literals import frappe - -from frappe.utils import cstr, flt, has_common, make_esc, comma_or - +from frappe.utils import cstr, flt, has_common, comma_or from frappe import session, _ - - from erpnext.utilities.transaction_base import TransactionBase class AuthorizationControl(TransactionBase): - - - # Get Names of all Approving Users and Roles - # ------------------------------------------- def get_appr_user_role(self, det, doctype_name, total, based_on, condition, item, company): amt_list, appr_users, appr_roles = [], [], [] users, roles = '','' @@ -24,10 +16,18 @@ class AuthorizationControl(TransactionBase): amt_list.append(flt(x[0])) max_amount = max(amt_list) - app_dtl = frappe.db.sql("select approving_user, approving_role from `tabAuthorization Rule` where transaction = %s and (value = %s or value > %s) and docstatus != 2 and based_on = %s and company = %s %s" % ('%s', '%s', '%s', '%s', '%s', condition), (doctype_name, flt(max_amount), total, based_on, company)) + app_dtl = frappe.db.sql("""select approving_user, approving_role from `tabAuthorization Rule` + where transaction = %s and (value = %s or value > %s) + and docstatus != 2 and based_on = %s and company = %s %s""" % + ('%s', '%s', '%s', '%s', '%s', condition), + (doctype_name, flt(max_amount), total, based_on, company)) if not app_dtl: - app_dtl = frappe.db.sql("select approving_user, approving_role from `tabAuthorization Rule` where transaction = %s and (value = %s or value > %s) and docstatus != 2 and based_on = %s and ifnull(company,'') = '' %s" % ('%s', '%s', '%s', '%s', condition), (doctype_name, flt(max_amount), total, based_on)) + app_dtl = frappe.db.sql("""select approving_user, approving_role from `tabAuthorization Rule` + where transaction = %s and (value = %s or value > %s) and docstatus != 2 + and based_on = %s and ifnull(company,'') = '' %s""" % + ('%s', '%s', '%s', '%s', condition), (doctype_name, flt(max_amount), total, based_on)) + for d in app_dtl: if(d[0]): appr_users.append(d[0]) if(d[1]): appr_roles.append(d[1]) @@ -36,43 +36,56 @@ class AuthorizationControl(TransactionBase): frappe.msgprint(_("Not authroized since {0} exceeds limits").format(_(based_on))) frappe.throw(_("Can be approved by {0}").format(comma_or(appr_roles + appr_users))) - - # Check if authorization rule is set specific to user - # ---------------------------------------------------- def validate_auth_rule(self, doctype_name, total, based_on, cond, company, item = ''): chk = 1 add_cond1,add_cond2 = '','' if based_on == 'Itemwise Discount': - add_cond1 += " and master_name = '"+cstr(item)+"'" - itemwise_exists = frappe.db.sql("select value from `tabAuthorization Rule` where transaction = %s and value <= %s and based_on = %s and company = %s and docstatus != 2 %s %s" % ('%s', '%s', '%s', '%s', cond, add_cond1), (doctype_name, total, based_on, company)) + add_cond1 += " and master_name = '"+cstr(item.replace("'", "\'"))+"'" + itemwise_exists = frappe.db.sql("""select value from `tabAuthorization Rule` + where transaction = %s and value <= %s + and based_on = %s and company = %s and docstatus != 2 %s %s""" % + ('%s', '%s', '%s', '%s', cond, add_cond1), (doctype_name, total, based_on, company)) + if not itemwise_exists: - itemwise_exists = frappe.db.sql("select value from `tabAuthorization Rule` where transaction = %s and value <= %s and based_on = %s and ifnull(company,'') = '' and docstatus != 2 %s %s" % ('%s', '%s', '%s', cond, add_cond1), (doctype_name, total, based_on)) + itemwise_exists = frappe.db.sql("""select value from `tabAuthorization Rule` + where transaction = %s and value <= %s and based_on = %s + and ifnull(company,'') = '' and docstatus != 2 %s %s""" % + ('%s', '%s', '%s', cond, add_cond1), (doctype_name, total, based_on)) + if itemwise_exists: self.get_appr_user_role(itemwise_exists, doctype_name, total, based_on, cond+add_cond1, item,company) chk = 0 if chk == 1: - if based_on == 'Itemwise Discount': add_cond2 += " and ifnull(master_name,'') = ''" - appr = frappe.db.sql("select value from `tabAuthorization Rule` where transaction = %s and value <= %s and based_on = %s and company = %s and docstatus != 2 %s %s" % ('%s', '%s', '%s', '%s', cond, add_cond2), (doctype_name, total, based_on, company)) + if based_on == 'Itemwise Discount': + add_cond2 += " and ifnull(master_name,'') = ''" + + appr = frappe.db.sql("""select value from `tabAuthorization Rule` + where transaction = %s and value <= %s and based_on = %s + and company = %s and docstatus != 2 %s %s""" % + ('%s', '%s', '%s', '%s', cond, add_cond2), (doctype_name, total, based_on, company)) if not appr: - appr = frappe.db.sql("select value from `tabAuthorization Rule` where transaction = %s and value <= %s and based_on = %s and ifnull(company,'') = '' and docstatus != 2 %s %s"% ('%s', '%s', '%s', cond, add_cond2), (doctype_name, total, based_on)) + appr = frappe.db.sql("""select value from `tabAuthorization Rule` + where transaction = %s and value <= %s and based_on = %s + and ifnull(company,'') = '' and docstatus != 2 %s %s""" % + ('%s', '%s', '%s', cond, add_cond2), (doctype_name, total, based_on)) + self.get_appr_user_role(appr, doctype_name, total, based_on, cond+add_cond2, item, company) - - # Bifurcate Authorization based on type - # -------------------------------------- def bifurcate_based_on_type(self, doctype_name, total, av_dis, based_on, doc_obj, val, company): add_cond = '' auth_value = av_dis - if val == 1: add_cond += " and system_user = '"+session['user']+"'" + + if val == 1: add_cond += " and system_user = '"+session['user'].replace("'", "\'")+"'" elif val == 2: add_cond += " and system_role IN %s" % ("('"+"','".join(frappe.user.get_roles())+"')") else: add_cond += " and ifnull(system_user,'') = '' and ifnull(system_role,'') = ''" + if based_on == 'Grand Total': auth_value = total elif based_on == 'Customerwise Discount': if doc_obj: if doc_obj.doctype == 'Sales Invoice': customer = doc_obj.customer else: customer = doc_obj.customer_name - add_cond = " and master_name = '"+make_esc("'")(cstr(customer))+"'" + add_cond = " and master_name = '"+cstr(customer).replace("'", "\'")+"'" if based_on == 'Itemwise Discount': if doc_obj: for t in doc_obj.get(doc_obj.fname): @@ -80,9 +93,6 @@ class AuthorizationControl(TransactionBase): else: self.validate_auth_rule(doctype_name, auth_value, based_on, add_cond, company) - - # Check Approving Authority for transactions other than expense voucher and Appraisal - # ------------------------- def validate_approving_authority(self, doctype_name,company, total, doc_obj = ''): av_dis = 0 if doc_obj: @@ -94,11 +104,12 @@ class AuthorizationControl(TransactionBase): if price_list_rate: av_dis = 100 - flt(base_rate * 100 / price_list_rate) final_based_on = ['Grand Total','Average Discount','Customerwise Discount','Itemwise Discount'] - # Individual User - # ================ - # Check for authorization set for individual user - based_on = [x[0] for x in frappe.db.sql("select distinct based_on from `tabAuthorization Rule` where transaction = %s and system_user = %s and (company = %s or ifnull(company,'')='') and docstatus != 2", (doctype_name, session['user'], company))] + # Check for authorization set for individual user + based_on = [x[0] for x in frappe.db.sql("""select distinct based_on from `tabAuthorization Rule` + where transaction = %s and system_user = %s + and (company = %s or ifnull(company,'')='') and docstatus != 2""", + (doctype_name, session['user'], company))] for d in based_on: self.bifurcate_based_on_type(doctype_name, total, av_dis, d, doc_obj, 1, company) @@ -107,8 +118,6 @@ class AuthorizationControl(TransactionBase): for r in based_on: if r in final_based_on and r != 'Itemwise Discount': final_based_on.remove(r) - # Specific Role - # =============== # Check for authorization set on particular roles based_on = [x[0] for x in frappe.db.sql("""select based_on from `tabAuthorization Rule` @@ -124,19 +133,24 @@ class AuthorizationControl(TransactionBase): for r in based_on: if r in final_based_on and r != 'Itemwise Discount': final_based_on.remove(r) - # Global Rule - # ============= # Check for global authorization for g in final_based_on: self.bifurcate_based_on_type(doctype_name, total, av_dis, g, doc_obj, 0, company) - #======================================================================================================================== - # payroll related check def get_value_based_rule(self,doctype_name,employee,total_claimed_amount,company): val_lst =[] - val = frappe.db.sql("select value from `tabAuthorization Rule` where transaction=%s and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and ifnull(value,0)< %s and company = %s and docstatus!=2",(doctype_name,employee,employee,total_claimed_amount,company)) + val = frappe.db.sql("""select value from `tabAuthorization Rule` + where transaction=%s and (to_emp=%s or + to_designation IN (select designation from `tabEmployee` where name=%s)) + and ifnull(value,0)< %s and company = %s and docstatus!=2""", + (doctype_name,employee,employee,total_claimed_amount,company)) + if not val: - val = frappe.db.sql("select value from `tabAuthorization Rule` where transaction=%s and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and ifnull(value,0)< %s and ifnull(company,'') = '' and docstatus!=2",(doctype_name, employee, employee, total_claimed_amount)) + val = frappe.db.sql("""select value from `tabAuthorization Rule` + where transaction=%s and (to_emp=%s or + to_designation IN (select designation from `tabEmployee` where name=%s)) + and ifnull(value,0)< %s and ifnull(company,'') = '' and docstatus!=2""", + (doctype_name, employee, employee, total_claimed_amount)) if val: val_lst = [y[0] for y in val] @@ -144,13 +158,23 @@ class AuthorizationControl(TransactionBase): val_lst.append(0) max_val = max(val_lst) - rule = frappe.db.sql("select name, to_emp, to_designation, approving_role, approving_user from `tabAuthorization Rule` where transaction=%s and company = %s and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and ifnull(value,0)= %s and docstatus!=2",(doctype_name,company,employee,employee,flt(max_val)), as_dict=1) + rule = frappe.db.sql("""select name, to_emp, to_designation, approving_role, approving_user + from `tabAuthorization Rule` + where transaction=%s and company = %s + and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) + and ifnull(value,0)= %s and docstatus!=2""", + (doctype_name,company,employee,employee,flt(max_val)), as_dict=1) + if not rule: - rule = frappe.db.sql("select name, to_emp, to_designation, approving_role, approving_user from `tabAuthorization Rule` where transaction=%s and ifnull(company,'') = '' and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and ifnull(value,0)= %s and docstatus!=2",(doctype_name,employee,employee,flt(max_val)), as_dict=1) + rule = frappe.db.sql("""select name, to_emp, to_designation, approving_role, approving_user + from `tabAuthorization Rule` + where transaction=%s and ifnull(company,'') = '' + and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) + and ifnull(value,0)= %s and docstatus!=2""", + (doctype_name,employee,employee,flt(max_val)), as_dict=1) return rule - #--------------------------------------------------------------------------------------------------------------------- # related to payroll module only def get_approver_name(self, doctype_name, total, doc_obj=''): app_user=[] @@ -159,11 +183,22 @@ class AuthorizationControl(TransactionBase): if doc_obj: if doctype_name == 'Expense Claim': - rule = self.get_value_based_rule(doctype_name,doc_obj.employee,doc_obj.total_claimed_amount, doc_obj.company) + rule = self.get_value_based_rule(doctype_name, doc_obj.employee, + doc_obj.total_claimed_amount, doc_obj.company) elif doctype_name == 'Appraisal': - rule = frappe.db.sql("select name, to_emp, to_designation, approving_role, approving_user from `tabAuthorization Rule` where transaction=%s and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and company = %s and docstatus!=2",(doctype_name,doc_obj.employee, doc_obj.employee, doc_obj.company),as_dict=1) + rule = frappe.db.sql("""select name, to_emp, to_designation, approving_role, approving_user + from `tabAuthorization Rule` where transaction=%s + and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) + and company = %s and docstatus!=2""", + (doctype_name,doc_obj.employee, doc_obj.employee, doc_obj.company),as_dict=1) + if not rule: - rule = frappe.db.sql("select name, to_emp, to_designation, approving_role, approving_user from `tabAuthorization Rule` where transaction=%s and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and ifnull(company,'') = '' and docstatus!=2",(doctype_name,doc_obj.employee, doc_obj.employee),as_dict=1) + rule = frappe.db.sql("""select name, to_emp, to_designation, approving_role, approving_user + from `tabAuthorization Rule` + where transaction=%s and (to_emp=%s or + to_designation IN (select designation from `tabEmployee` where name=%s)) + and ifnull(company,'') = '' and docstatus!=2""", + (doctype_name,doc_obj.employee, doc_obj.employee), as_dict=1) if rule: for m in rule: @@ -171,7 +206,11 @@ class AuthorizationControl(TransactionBase): if m['approving_user']: app_specific_user.append(m['approving_user']) elif m['approving_role']: - user_lst = [z[0] for z in frappe.db.sql("select distinct t1.name from `tabUser` t1, `tabUserRole` t2 where t2.role=%s and t2.parent=t1.name and t1.name !='Administrator' and t1.name != 'Guest' and t1.docstatus !=2",m['approving_role'])] + user_lst = [z[0] for z in frappe.db.sql("""select distinct t1.name + from `tabUser` t1, `tabUserRole` t2 where t2.role=%s + and t2.parent=t1.name and t1.name !='Administrator' + and t1.name != 'Guest' and t1.docstatus !=2""", m['approving_role'])] + for x in user_lst: if not x in app_user: app_user.append(x) From bbc3d015a3894c8811053ebe82cdaf97617bd005 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 18 Sep 2014 14:09:20 +0530 Subject: [PATCH 19/42] Update authorization_control.py --- .../doctype/authorization_control/authorization_control.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/setup/doctype/authorization_control/authorization_control.py b/erpnext/setup/doctype/authorization_control/authorization_control.py index fa708b5991a..be97964861f 100644 --- a/erpnext/setup/doctype/authorization_control/authorization_control.py +++ b/erpnext/setup/doctype/authorization_control/authorization_control.py @@ -40,7 +40,7 @@ class AuthorizationControl(TransactionBase): chk = 1 add_cond1,add_cond2 = '','' if based_on == 'Itemwise Discount': - add_cond1 += " and master_name = '"+cstr(item.replace("'", "\'"))+"'" + add_cond1 += " and master_name = '"+cstr(item).replace("'", "\'")+"'" itemwise_exists = frappe.db.sql("""select value from `tabAuthorization Rule` where transaction = %s and value <= %s and based_on = %s and company = %s and docstatus != 2 %s %s""" % From e539297e53e214fcbb05256db69aeb214c042e34 Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Thu, 18 Sep 2014 14:49:14 +0600 Subject: [PATCH 20/42] bumped to version 4.4.1 --- erpnext/__version__.py | 2 +- erpnext/hooks.py | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/__version__.py b/erpnext/__version__.py index 26a6c390a50..6dd6cf9b2b6 100644 --- a/erpnext/__version__.py +++ b/erpnext/__version__.py @@ -1 +1 @@ -__version__ = '4.4.0' +__version__ = '4.4.1' diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 5d500452a9c..bf1440122d0 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -4,7 +4,7 @@ app_publisher = "Web Notes Technologies Pvt. Ltd. and Contributors" app_description = "Open Source Enterprise Resource Planning for Small and Midsized Organizations" app_icon = "icon-th" app_color = "#e74c3c" -app_version = "4.4.0" +app_version = "4.4.1" error_report_email = "support@erpnext.com" diff --git a/setup.py b/setup.py index 70174bd1043..855c5239f85 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages import os -version = "4.4.0" +version = "4.4.1" with open("requirements.txt", "r") as f: install_requires = f.readlines() From 48f5fa69f331e5c505c028037ab01ab2ed2dbb91 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 18 Sep 2014 15:03:54 +0530 Subject: [PATCH 21/42] Fetch and validate advance entries in sales/purchase invoice --- .../purchase_invoice/purchase_invoice.py | 3 +- .../doctype/sales_invoice/sales_invoice.py | 3 +- erpnext/controllers/accounts_controller.py | 78 ++++++++++++------- 3 files changed, 56 insertions(+), 28 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 956dacb55f9..7c2bac6d2a5 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -49,6 +49,7 @@ class PurchaseInvoice(BuyingController): self.check_conversion_rate() self.validate_credit_acc() self.clear_unallocated_advances("Purchase Invoice Advance", "advance_allocation_details") + self.validate_advance_jv("advance_allocation_details", "purchase_order") self.check_for_acc_head_of_supplier() self.check_for_stopped_status() self.validate_with_previous_doc() @@ -80,7 +81,7 @@ class PurchaseInvoice(BuyingController): def get_advances(self): super(PurchaseInvoice, self).get_advances(self.credit_to, - "Purchase Invoice Advance", "advance_allocation_details", "debit") + "Purchase Invoice Advance", "advance_allocation_details", "debit", "purchase_order") def check_active_purchase_items(self): for d in self.get('entries'): diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 20d20d7cfc6..5346b91c7ef 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -56,6 +56,7 @@ class SalesInvoice(SellingController): self.validate_debit_acc() self.validate_fixed_asset_account() self.clear_unallocated_advances("Sales Invoice Advance", "advance_adjustment_details") + self.validate_advance_jv("advance_adjustment_details", "sales_order") self.add_remarks() if cint(self.is_pos): @@ -222,7 +223,7 @@ class SalesInvoice(SellingController): def get_advances(self): super(SalesInvoice, self).get_advances(self.debit_to, - "Sales Invoice Advance", "advance_adjustment_details", "credit") + "Sales Invoice Advance", "advance_adjustment_details", "credit", "sales_order") def get_company_abbr(self): return frappe.db.sql("select abbr from tabCompany where name=%s", self.company)[0][0] diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 7fa81c99267..bf6a3431573 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -4,9 +4,7 @@ from __future__ import unicode_literals import frappe from frappe import _, throw -from frappe.utils import add_days, cint, cstr, today, date_diff, flt, getdate, nowdate, \ - get_first_day, get_last_day -from frappe.model.naming import make_autoname +from frappe.utils import cint, today, flt from erpnext.setup.utils import get_company_currency, get_exchange_rate from erpnext.accounts.utils import get_fiscal_year, validate_fiscal_year from erpnext.utilities.transaction_base import TransactionBase @@ -362,38 +360,67 @@ class AccountsController(TransactionBase): frappe.db.sql("""delete from `tab%s` where parentfield=%s and parent = %s and ifnull(allocated_amount, 0) = 0""" % (childtype, '%s', '%s'), (parentfield, self.name)) - def get_advances(self, account_head, child_doctype, parentfield, dr_or_cr): - against_order_list = [] + def get_advances(self, account_head, child_doctype, parentfield, dr_or_cr, against_order_field): + so_list = list(set([d.get(against_order_field) for d in self.get("entries") if d.get(against_order_field)])) + res = frappe.db.sql(""" select - t1.name as jv_no, t1.remark, t2.%s as amount, t2.name as jv_detail_no, t2.%s as order_no + t1.name as jv_no, t1.remark, t2.%s as amount, t2.name as jv_detail_no from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2 where t1.name = t2.parent and t2.account = %s and t2.is_advance = 'Yes' and t1.docstatus = 1 - and ifnull(t2.against_voucher, '') = '' - and ifnull(t2.against_invoice, '') = '' - and ifnull(t2.against_jv, '') = '' + and (( + ifnull(t2.against_voucher, '') = '' + and ifnull(t2.against_invoice, '') = '' + and ifnull(t2.against_jv, '') = '' + and ifnull(t2.against_sales_order, '') = '' + and ifnull(t2.against_purchase_order, '') = '' + ) or ( + ifnull(t2.%s, '') in (%s) + ) + ) order by t1.posting_date""" % - (dr_or_cr, "against_sales_order" if dr_or_cr == "credit" \ - else "against_purchase_order", '%s'), - account_head, as_dict= True) - - if self.get("entries"): - for i in self.get("entries"): - against_order_list.append(i.sales_order if dr_or_cr == "credit" else i.purchase_order) + (dr_or_cr, '%s', "against_" + against_order_field, ', '.join(['%s']*len(so_list))), + tuple([account_head] + so_list), as_dict= True) self.set(parentfield, []) for d in res: - if not against_order_list or d.order_no in against_order_list: - self.append(parentfield, { - "doctype": child_doctype, - "journal_voucher": d.jv_no, - "jv_detail_no": d.jv_detail_no, - "remarks": d.remark, - "advance_amount": flt(d.amount), - "allocate_amount": 0 - }) + self.append(parentfield, { + "doctype": child_doctype, + "journal_voucher": d.jv_no, + "jv_detail_no": d.jv_detail_no, + "remarks": d.remark, + "advance_amount": flt(d.amount), + "allocate_amount": 0 + }) + + def validate_advance_jv(self, advance_table_fieldname, against_order_field): + order_list = list(set([d.get(against_order_field) for d in self.get("entries") if d.get(against_order_field)])) + if order_list: + account = self.get("debit_to" if self.doctype=="Sales Invoice" else "credit_to") + + jv_against_order = frappe.db.sql("""select parent, %s as against_order + from `tabJournal Voucher Detail` + where docstatus=1 and account=%s and ifnull(is_advance, 'No') = 'Yes' + and ifnull(against_sales_order, '') in (%s) + group by parent, against_sales_order""" % + ("against_" + against_order_field, '%s', ', '.join(['%s']*len(order_list))), + tuple([account] + order_list), as_dict=1) + + if jv_against_order: + order_jv_map = {} + for d in jv_against_order: + order_jv_map.setdefault(d.against_order, []).append(d.parent) + + advance_jv_against_si = [d.journal_voucher for d in self.get(advance_table_fieldname)] + + for order, jv_list in order_jv_map.items(): + for jv in jv_list: + if not advance_jv_against_si or jv not in advance_jv_against_si: + frappe.throw(_("Journal Voucher {0} is linked against Order {1}, hence it must be fetched as advance in Invoice as well.") + .format(jv, order)) + def validate_multiple_billing(self, ref_dt, item_ref_dn, based_on, parentfield): from erpnext.controllers.status_updater import get_tolerance_for @@ -421,7 +448,6 @@ class AccountsController(TransactionBase): max_allowed_amt = flt(ref_amt * (100 + tolerance) / 100) if total_billed_amt - max_allowed_amt > 0.01: - reduce_by = total_billed_amt - max_allowed_amt frappe.throw(_("Cannot overbill for Item {0} in row {0} more than {1}. To allow overbilling, please set in Stock Settings").format(item.item_code, item.idx, max_allowed_amt)) def get_company_default(self, fieldname): From 70a31d54020240db0d3343b14be93ffd3367e58a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 19 Sep 2014 11:18:10 +0530 Subject: [PATCH 22/42] Gantt view fix for translations --- erpnext/projects/doctype/task/task_calendar.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/erpnext/projects/doctype/task/task_calendar.js b/erpnext/projects/doctype/task/task_calendar.js index a9d3d6b5663..f372184205a 100644 --- a/erpnext/projects/doctype/task/task_calendar.js +++ b/erpnext/projects/doctype/task/task_calendar.js @@ -6,17 +6,17 @@ frappe.views.calendar["Task"] = { "start": "exp_start_date", "end": "exp_end_date", "id": "name", - "title": __("subject"), + "title": "subject", "allDay": "allDay" }, gantt: true, filters: [ { - "fieldtype": "Link", - "fieldname": "project", - "options": "Project", + "fieldtype": "Link", + "fieldname": "project", + "options": "Project", "label": __("Project") } ], get_events_method: "erpnext.projects.doctype.task.task.get_events" -} \ No newline at end of file +} From 778ff463aff24bc3b6ced063d3364b999b283179 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 19 Sep 2014 11:39:47 +0530 Subject: [PATCH 23/42] Minor fix in authorization control --- .../doctype/authorization_control/authorization_control.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/setup/doctype/authorization_control/authorization_control.py b/erpnext/setup/doctype/authorization_control/authorization_control.py index be97964861f..8e7b0cefb06 100644 --- a/erpnext/setup/doctype/authorization_control/authorization_control.py +++ b/erpnext/setup/doctype/authorization_control/authorization_control.py @@ -40,7 +40,7 @@ class AuthorizationControl(TransactionBase): chk = 1 add_cond1,add_cond2 = '','' if based_on == 'Itemwise Discount': - add_cond1 += " and master_name = '"+cstr(item).replace("'", "\'")+"'" + add_cond1 += " and master_name = '"+cstr(item).replace("'", "\\'")+"'" itemwise_exists = frappe.db.sql("""select value from `tabAuthorization Rule` where transaction = %s and value <= %s and based_on = %s and company = %s and docstatus != 2 %s %s""" % @@ -76,7 +76,7 @@ class AuthorizationControl(TransactionBase): add_cond = '' auth_value = av_dis - if val == 1: add_cond += " and system_user = '"+session['user'].replace("'", "\'")+"'" + if val == 1: add_cond += " and system_user = '"+session['user'].replace("'", "\\'")+"'" elif val == 2: add_cond += " and system_role IN %s" % ("('"+"','".join(frappe.user.get_roles())+"')") else: add_cond += " and ifnull(system_user,'') = '' and ifnull(system_role,'') = ''" @@ -85,7 +85,7 @@ class AuthorizationControl(TransactionBase): if doc_obj: if doc_obj.doctype == 'Sales Invoice': customer = doc_obj.customer else: customer = doc_obj.customer_name - add_cond = " and master_name = '"+cstr(customer).replace("'", "\'")+"'" + add_cond = " and master_name = '"+cstr(customer).replace("'", "\\'")+"'" if based_on == 'Itemwise Discount': if doc_obj: for t in doc_obj.get(doc_obj.fname): From 7c831c3fe59b776a26ad3bfa2276aed8f16e3d14 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 19 Sep 2014 14:31:49 +0530 Subject: [PATCH 24/42] Get advance in sales/purchase invoice --- erpnext/controllers/accounts_controller.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index bf6a3431573..34a342e93f3 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -362,6 +362,9 @@ class AccountsController(TransactionBase): def get_advances(self, account_head, child_doctype, parentfield, dr_or_cr, against_order_field): so_list = list(set([d.get(against_order_field) for d in self.get("entries") if d.get(against_order_field)])) + cond = "" + if so_list: + cond = "or (ifnull(t2.%s, '') in (%s))" % ("against_" + against_order_field, ', '.join(['%s']*len(so_list))) res = frappe.db.sql(""" select @@ -376,12 +379,9 @@ class AccountsController(TransactionBase): and ifnull(t2.against_jv, '') = '' and ifnull(t2.against_sales_order, '') = '' and ifnull(t2.against_purchase_order, '') = '' - ) or ( - ifnull(t2.%s, '') in (%s) - ) - ) + ) %s) order by t1.posting_date""" % - (dr_or_cr, '%s', "against_" + against_order_field, ', '.join(['%s']*len(so_list))), + (dr_or_cr, '%s', cond), tuple([account_head] + so_list), as_dict= True) self.set(parentfield, []) From 14ac8f71b706797aac23d77f10c06c7dc23c2172 Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Fri, 19 Sep 2014 15:16:07 +0600 Subject: [PATCH 25/42] bumped to version 4.4.2 --- erpnext/__version__.py | 2 +- erpnext/hooks.py | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/__version__.py b/erpnext/__version__.py index 6dd6cf9b2b6..31618fca1e7 100644 --- a/erpnext/__version__.py +++ b/erpnext/__version__.py @@ -1 +1 @@ -__version__ = '4.4.1' +__version__ = '4.4.2' diff --git a/erpnext/hooks.py b/erpnext/hooks.py index bf1440122d0..048ec7bd56d 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -4,7 +4,7 @@ app_publisher = "Web Notes Technologies Pvt. Ltd. and Contributors" app_description = "Open Source Enterprise Resource Planning for Small and Midsized Organizations" app_icon = "icon-th" app_color = "#e74c3c" -app_version = "4.4.1" +app_version = "4.4.2" error_report_email = "support@erpnext.com" diff --git a/setup.py b/setup.py index 855c5239f85..60a6d2f1c79 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages import os -version = "4.4.1" +version = "4.4.2" with open("requirements.txt", "r") as f: install_requires = f.readlines() From 1394509343f60185cd38493f0bda7a1db282d13d Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Sun, 21 Sep 2014 19:45:49 +0530 Subject: [PATCH 26/42] Fixes for recurring document --- .../purchase_invoice/purchase_invoice.js | 36 - .../purchase_invoice/purchase_invoice.json | 1722 ++++++++-------- .../purchase_invoice/purchase_invoice.py | 16 +- .../purchase_invoice/test_purchase_invoice.py | 4 + .../doctype/sales_invoice/sales_invoice.js | 31 - .../doctype/sales_invoice/sales_invoice.json | 6 +- .../doctype/sales_invoice/sales_invoice.py | 20 +- .../doctype/purchase_order/purchase_order.js | 33 - .../purchase_order/purchase_order.json | 1475 +++++++------- .../doctype/purchase_order/purchase_order.py | 13 +- .../purchase_order/test_purchase_order.py | 1 - erpnext/controllers/accounts_controller.py | 24 +- erpnext/controllers/buying_controller.py | 5 +- erpnext/controllers/recurring_document.py | 24 +- .../tests/test_recurring_document.py | 37 +- erpnext/public/js/transaction.js | 33 +- .../doctype/sales_order/sales_order.js | 31 - .../doctype/sales_order/sales_order.json | 1786 ++++++++--------- .../doctype/sales_order/sales_order.py | 15 +- .../emails/recurring_document_failed.html | 2 +- 20 files changed, 2564 insertions(+), 2750 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index 90f463a38da..b56351e583f 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -232,42 +232,6 @@ cur_frm.fields_dict['entries'].grid.get_field('project_name').get_query = functi } } - - -cur_frm.cscript.is_recurring = function(doc, dt, dn) { - // set default values for recurring invoices - if(doc.is_recurring) { - var owner_email = doc.owner=="Administrator" - ? frappe.user_info("Administrator").email - : doc.owner; - - doc.notification_email_address = $.map([cstr(owner_email), - cstr(doc.contact_email)], function(v) { return v || null; }).join(", "); - doc.repeat_on_day_of_month = frappe.datetime.str_to_obj(doc.posting_date).getDate(); - } - - refresh_many(["notification_email_address", "repeat_on_day_of_month"]); -} - - -cur_frm.cscript.from_date = function(doc, dt, dn) { - // set to_date - if(doc.from_date) { - var recurring_type_map = {'Monthly': 1, 'Quarterly': 3, 'Half-yearly': 6, - 'Yearly': 12}; - - var months = recurring_type_map[doc.recurring_type]; - if(months) { - var to_date = frappe.datetime.add_months(doc.from_date, - months); - doc.to_date = frappe.datetime.add_days(to_date, -1); - refresh_field('to_date'); - } - } -} - - - cur_frm.cscript.select_print_heading = function(doc,cdt,cdn){ if(doc.select_print_heading){ // print heading diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json index 3a451367892..d91c53ceaac 100755 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json @@ -1,153 +1,153 @@ { -"allow_import": 1, -"autoname": "naming_series:", -"creation": "2013-05-21 16:16:39", -"docstatus": 0, -"doctype": "DocType", -"fields": [ -{ -"fieldname": "supplier_section", -"fieldtype": "Section Break", -"label": "Supplier", -"options": "icon-user", -"permlevel": 0 -}, -{ -"fieldname": "column_break0", -"fieldtype": "Column Break", -"oldfieldtype": "Column Break", -"permlevel": 0, -"read_only": 0, -"width": "50%" -}, -{ -"fieldname": "naming_series", -"fieldtype": "Select", -"label": "Series", -"no_copy": 1, -"oldfieldname": "naming_series", -"oldfieldtype": "Select", -"options": "PINV-", -"permlevel": 0, -"print_hide": 1, -"read_only": 0, -"report_hide": 0, -"reqd": 1 -}, -{ -"fieldname": "supplier", -"fieldtype": "Link", -"hidden": 0, -"label": "Supplier", -"oldfieldname": "supplier", -"oldfieldtype": "Link", -"options": "Supplier", -"permlevel": 0, -"print_hide": 1, -"read_only": 0 -}, -{ -"depends_on": "supplier", -"fieldname": "supplier_name", -"fieldtype": "Data", -"hidden": 0, -"in_list_view": 1, -"label": "Name", -"oldfieldname": "supplier_name", -"oldfieldtype": "Data", -"permlevel": 0, -"read_only": 1 -}, -{ -"fieldname": "address_display", -"fieldtype": "Small Text", -"hidden": 1, -"label": "Address", -"permlevel": 0, -"read_only": 1 -}, -{ -"fieldname": "contact_display", -"fieldtype": "Small Text", -"hidden": 1, -"label": "Contact", -"permlevel": 0, -"read_only": 1 -}, -{ -"fieldname": "contact_mobile", -"fieldtype": "Small Text", -"hidden": 1, -"label": "Mobile No", -"permlevel": 0, -"read_only": 1 -}, -{ -"fieldname": "contact_email", -"fieldtype": "Small Text", -"hidden": 1, -"label": "Contact Email", -"permlevel": 0, -"print_hide": 1, -"read_only": 1 -}, -{ -"fieldname": "column_break1", -"fieldtype": "Column Break", -"oldfieldtype": "Column Break", -"permlevel": 0, -"read_only": 0, -"reqd": 0, -"width": "50%" -}, -{ -"default": "Today", -"fieldname": "posting_date", -"fieldtype": "Date", -"in_filter": 1, -"label": "Date", -"no_copy": 0, -"oldfieldname": "posting_date", -"oldfieldtype": "Date", -"permlevel": 0, -"print_hide": 1, -"read_only": 0, -"reqd": 1, -"search_index": 1 -}, -{ -"description": "", -"fieldname": "bill_no", -"fieldtype": "Data", -"in_filter": 1, -"label": "Supplier Invoice No", -"oldfieldname": "bill_no", -"oldfieldtype": "Data", -"permlevel": 0, -"print_hide": 1, -"read_only": 0, -"reqd": 0, -"search_index": 1 -}, -{ -"fieldname": "bill_date", -"fieldtype": "Date", -"in_filter": 1, -"label": "Supplier Invoice Date", -"oldfieldname": "bill_date", -"oldfieldtype": "Date", -"permlevel": 0, -"print_hide": 1, -"read_only": 0, -"reqd": 0, -"search_index": 1 -}, -{ + "allow_import": 1, + "autoname": "naming_series:", + "creation": "2013-05-21 16:16:39", + "docstatus": 0, + "doctype": "DocType", + "fields": [ + { + "fieldname": "supplier_section", + "fieldtype": "Section Break", + "label": "Supplier", + "options": "icon-user", + "permlevel": 0 + }, + { + "fieldname": "column_break0", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "read_only": 0, + "width": "50%" + }, + { + "fieldname": "naming_series", + "fieldtype": "Select", + "label": "Series", + "no_copy": 1, + "oldfieldname": "naming_series", + "oldfieldtype": "Select", + "options": "PINV-", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "report_hide": 0, + "reqd": 1 + }, + { + "fieldname": "supplier", + "fieldtype": "Link", + "hidden": 0, + "label": "Supplier", + "oldfieldname": "supplier", + "oldfieldtype": "Link", + "options": "Supplier", + "permlevel": 0, + "print_hide": 1, + "read_only": 0 + }, + { + "depends_on": "supplier", + "fieldname": "supplier_name", + "fieldtype": "Data", + "hidden": 0, + "in_list_view": 1, + "label": "Name", + "oldfieldname": "supplier_name", + "oldfieldtype": "Data", + "permlevel": 0, + "read_only": 1 + }, + { + "fieldname": "address_display", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Address", + "permlevel": 0, + "read_only": 1 + }, + { + "fieldname": "contact_display", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Contact", + "permlevel": 0, + "read_only": 1 + }, + { + "fieldname": "contact_mobile", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Mobile No", + "permlevel": 0, + "read_only": 1 + }, + { + "fieldname": "contact_email", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Contact Email", + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "column_break1", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "read_only": 0, + "reqd": 0, + "width": "50%" + }, + { + "default": "Today", + "fieldname": "posting_date", + "fieldtype": "Date", + "in_filter": 1, + "label": "Date", + "no_copy": 0, + "oldfieldname": "posting_date", + "oldfieldtype": "Date", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "reqd": 1, + "search_index": 1 + }, + { + "description": "", + "fieldname": "bill_no", + "fieldtype": "Data", + "in_filter": 1, + "label": "Supplier Invoice No", + "oldfieldname": "bill_no", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "reqd": 0, + "search_index": 1 + }, + { + "fieldname": "bill_date", + "fieldtype": "Date", + "in_filter": 1, + "label": "Supplier Invoice Date", + "oldfieldname": "bill_date", + "oldfieldtype": "Date", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "reqd": 0, + "search_index": 1 + }, + { "allow_on_submit": 1, "description": "Start date of current invoice's period", "fieldname": "from_date", "fieldtype": "Date", - "label": "From", + "label": "From Date", "no_copy": 1, "permlevel": 0 }, @@ -156,620 +156,620 @@ "description": "End date of current invoice's period", "fieldname": "to_date", "fieldtype": "Date", - "label": "To", + "label": "To Date", "no_copy": 1, "permlevel": 0 }, { -"fieldname": "amended_from", -"fieldtype": "Link", -"ignore_user_permissions": 1, -"label": "Amended From", -"no_copy": 1, -"oldfieldname": "amended_from", -"oldfieldtype": "Link", -"options": "Purchase Invoice", -"permlevel": 0, -"print_hide": 1, -"read_only": 1 -}, -{ -"fieldname": "company", -"fieldtype": "Link", -"in_filter": 1, -"label": "Company", -"oldfieldname": "company", -"oldfieldtype": "Link", -"options": "Company", -"permlevel": 0, -"print_hide": 1, -"read_only": 0, -"search_index": 1 -}, -{ -"fieldname": "currency_price_list", -"fieldtype": "Section Break", -"label": "Currency and Price List", -"options": "icon-tag", -"permlevel": 0, -"read_only": 0 -}, -{ -"fieldname": "currency", -"fieldtype": "Link", -"label": "Currency", -"oldfieldname": "currency", -"oldfieldtype": "Select", -"options": "Currency", -"permlevel": 0, -"print_hide": 1, -"read_only": 0 -}, -{ -"description": "The rate at which Bill Currency is converted into company's base currency", -"fieldname": "conversion_rate", -"fieldtype": "Float", -"label": "Exchange Rate", -"oldfieldname": "conversion_rate", -"oldfieldtype": "Currency", -"permlevel": 0, -"print_hide": 1, -"read_only": 0 -}, -{ -"fieldname": "column_break2", -"fieldtype": "Column Break", -"permlevel": 0, -"read_only": 0 -}, -{ -"fieldname": "buying_price_list", -"fieldtype": "Link", -"label": "Price List", -"options": "Price List", -"permlevel": 0, -"print_hide": 1, -"read_only": 0 -}, -{ -"fieldname": "price_list_currency", -"fieldtype": "Link", -"label": "Price List Currency", -"options": "Currency", -"permlevel": 0, -"print_hide": 1, -"read_only": 1 -}, -{ -"fieldname": "plc_conversion_rate", -"fieldtype": "Float", -"label": "Price List Exchange Rate", -"permlevel": 0, -"print_hide": 1, -"read_only": 0 -}, -{ -"fieldname": "ignore_pricing_rule", -"fieldtype": "Check", -"label": "Ignore Pricing Rule", -"no_copy": 1, -"permlevel": 1, -"print_hide": 1 -}, -{ -"fieldname": "items", -"fieldtype": "Section Break", -"label": "Items", -"oldfieldtype": "Section Break", -"options": "icon-shopping-cart", -"permlevel": 0, -"read_only": 0 -}, -{ -"allow_on_submit": 1, -"fieldname": "entries", -"fieldtype": "Table", -"label": "Entries", -"oldfieldname": "entries", -"oldfieldtype": "Table", -"options": "Purchase Invoice Item", -"permlevel": 0, -"read_only": 0 -}, -{ -"fieldname": "section_break_26", -"fieldtype": "Section Break", -"permlevel": 0 -}, -{ -"description": "Will be calculated automatically when you enter the details", -"fieldname": "net_total", -"fieldtype": "Currency", -"label": "Net Total (Company Currency)", -"oldfieldname": "net_total", -"oldfieldtype": "Currency", -"options": "Company:company:default_currency", -"permlevel": 0, -"print_hide": 1, -"read_only": 1 -}, -{ -"fieldname": "column_break_28", -"fieldtype": "Column Break", -"permlevel": 0 -}, -{ -"fieldname": "net_total_import", -"fieldtype": "Currency", -"label": "Net Total", -"oldfieldname": "net_total_import", -"oldfieldtype": "Currency", -"options": "currency", -"permlevel": 0, -"print_hide": 0, -"read_only": 1 -}, -{ -"fieldname": "taxes", -"fieldtype": "Section Break", -"label": "Taxes and Charges", -"oldfieldtype": "Section Break", -"options": "icon-money", -"permlevel": 0, -"read_only": 0 -}, -{ -"fieldname": "taxes_and_charges", -"fieldtype": "Link", -"label": "Taxes and Charges", -"oldfieldname": "purchase_other_charges", -"oldfieldtype": "Link", -"options": "Purchase Taxes and Charges Master", -"permlevel": 0, -"print_hide": 1, -"read_only": 0 -}, -{ -"fieldname": "other_charges", -"fieldtype": "Table", -"label": "Purchase Taxes and Charges", -"oldfieldname": "purchase_tax_details", -"oldfieldtype": "Table", -"options": "Purchase Taxes and Charges", -"permlevel": 0, -"read_only": 0 -}, -{ -"fieldname": "other_charges_calculation", -"fieldtype": "HTML", -"label": "Taxes and Charges Calculation", -"oldfieldtype": "HTML", -"permlevel": 0, -"print_hide": 1, -"read_only": 0 -}, -{ -"fieldname": "totals", -"fieldtype": "Section Break", -"label": "Totals", -"oldfieldtype": "Section Break", -"options": "icon-money", -"permlevel": 0, -"read_only": 0 -}, -{ -"fieldname": "other_charges_added", -"fieldtype": "Currency", -"label": "Taxes and Charges Added (Company Currency)", -"oldfieldname": "other_charges_added", -"oldfieldtype": "Currency", -"options": "Company:company:default_currency", -"permlevel": 0, -"print_hide": 1, -"read_only": 1 -}, -{ -"fieldname": "other_charges_deducted", -"fieldtype": "Currency", -"label": "Taxes and Charges Deducted (Company Currency)", -"oldfieldname": "other_charges_deducted", -"oldfieldtype": "Currency", -"options": "Company:company:default_currency", -"permlevel": 0, -"print_hide": 1, -"read_only": 1 -}, -{ -"fieldname": "grand_total", -"fieldtype": "Currency", -"label": "Grand Total (Company Currency)", -"oldfieldname": "grand_total", -"oldfieldtype": "Currency", -"options": "Company:company:default_currency", -"permlevel": 0, -"print_hide": 1, -"read_only": 1 -}, -{ -"description": "In Words will be visible once you save the Purchase Invoice.", -"fieldname": "in_words", -"fieldtype": "Data", -"label": "In Words (Company Currency)", -"oldfieldname": "in_words", -"oldfieldtype": "Data", -"permlevel": 0, -"print_hide": 1, -"read_only": 1 -}, -{ -"fieldname": "column_break8", -"fieldtype": "Column Break", -"oldfieldtype": "Column Break", -"permlevel": 0, -"print_hide": 1, -"read_only": 0, -"width": "50%" -}, -{ -"fieldname": "other_charges_added_import", -"fieldtype": "Currency", -"label": "Taxes and Charges Added", -"oldfieldname": "other_charges_added_import", -"oldfieldtype": "Currency", -"options": "currency", -"permlevel": 0, -"print_hide": 1, -"read_only": 1 -}, -{ -"fieldname": "other_charges_deducted_import", -"fieldtype": "Currency", -"label": "Taxes and Charges Deducted", -"oldfieldname": "other_charges_deducted_import", -"oldfieldtype": "Currency", -"options": "currency", -"permlevel": 0, -"print_hide": 1, -"read_only": 1 -}, -{ -"fieldname": "grand_total_import", -"fieldtype": "Currency", -"in_list_view": 1, -"label": "Grand Total", -"oldfieldname": "grand_total_import", -"oldfieldtype": "Currency", -"options": "currency", -"permlevel": 0, -"print_hide": 0, -"read_only": 1 -}, -{ -"fieldname": "in_words_import", -"fieldtype": "Data", -"label": "In Words", -"oldfieldname": "in_words_import", -"oldfieldtype": "Data", -"permlevel": 0, -"print_hide": 0, -"read_only": 1 -}, -{ -"fieldname": "total_amount_to_pay", -"fieldtype": "Currency", -"hidden": 0, -"label": "Total Amount To Pay", -"no_copy": 1, -"oldfieldname": "total_amount_to_pay", -"oldfieldtype": "Currency", -"options": "Company:company:default_currency", -"permlevel": 0, -"print_hide": 1, -"read_only": 1 -}, -{ -"fieldname": "total_advance", -"fieldtype": "Currency", -"label": "Total Advance", -"no_copy": 1, -"oldfieldname": "total_advance", -"oldfieldtype": "Currency", -"options": "Company:company:default_currency", -"permlevel": 0, -"print_hide": 1, -"read_only": 1 -}, -{ -"fieldname": "total_tax", -"fieldtype": "Currency", -"label": "Total Tax (Company Currency)", -"oldfieldname": "total_tax", -"oldfieldtype": "Currency", -"options": "Company:company:default_currency", -"permlevel": 0, -"print_hide": 1, -"read_only": 1 -}, -{ -"fieldname": "outstanding_amount", -"fieldtype": "Currency", -"in_filter": 1, -"in_list_view": 1, -"label": "Outstanding Amount", -"no_copy": 1, -"oldfieldname": "outstanding_amount", -"oldfieldtype": "Currency", -"options": "Company:company:default_currency", -"permlevel": 0, -"print_hide": 1, -"read_only": 1, -"search_index": 1 -}, -{ -"fieldname": "write_off_amount", -"fieldtype": "Currency", -"label": "Write Off Amount", -"no_copy": 1, -"options": "Company:company:default_currency", -"permlevel": 0, -"print_hide": 1, -"read_only": 0 -}, -{ -"depends_on": "eval:flt(doc.write_off_amount)!=0", -"fieldname": "write_off_account", -"fieldtype": "Link", -"label": "Write Off Account", -"no_copy": 1, -"options": "Account", -"permlevel": 0, -"print_hide": 1, -"read_only": 0 -}, -{ -"depends_on": "eval:flt(doc.write_off_amount)!=0", -"fieldname": "write_off_cost_center", -"fieldtype": "Link", -"label": "Write Off Cost Center", -"no_copy": 1, -"options": "Cost Center", -"permlevel": 0, -"print_hide": 1, -"read_only": 0 -}, -{ -"fieldname": "against_expense_account", -"fieldtype": "Small Text", -"hidden": 1, -"label": "Against Expense Account", -"no_copy": 1, -"oldfieldname": "against_expense_account", -"oldfieldtype": "Small Text", -"permlevel": 0, -"print_hide": 1, -"read_only": 0, -"report_hide": 0 -}, -{ -"fieldname": "fold", -"fieldtype": "Fold", -"permlevel": 0 -}, -{ -"fieldname": "advances", -"fieldtype": "Section Break", -"label": "Advances", -"oldfieldtype": "Section Break", -"options": "icon-money", -"permlevel": 0, -"print_hide": 1, -"read_only": 0 -}, -{ -"fieldname": "get_advances_paid", -"fieldtype": "Button", -"label": "Get Advances Paid", -"oldfieldtype": "Button", -"options": "get_advances", -"permlevel": 0, -"print_hide": 1, -"read_only": 0 -}, -{ -"fieldname": "advance_allocation_details", -"fieldtype": "Table", -"label": "Purchase Invoice Advances", -"no_copy": 1, -"oldfieldname": "advance_allocation_details", -"oldfieldtype": "Table", -"options": "Purchase Invoice Advance", -"permlevel": 0, -"print_hide": 1, -"read_only": 0 -}, -{ -"fieldname": "terms_section_break", -"fieldtype": "Section Break", -"label": "Terms and Conditions", -"options": "icon-legal", -"permlevel": 0 -}, -{ -"fieldname": "tc_name", -"fieldtype": "Link", -"label": "Terms", -"options": "Terms and Conditions", -"permlevel": 0, -"print_hide": 1 -}, -{ -"fieldname": "terms", -"fieldtype": "Text Editor", -"label": "Terms and Conditions1", -"permlevel": 0 -}, -{ -"depends_on": "supplier", -"fieldname": "contact_section", -"fieldtype": "Section Break", -"label": "Contact Info", -"options": "icon-bullhorn", -"permlevel": 0, -"read_only": 0 -}, -{ -"fieldname": "supplier_address", -"fieldtype": "Link", -"label": "Supplier Address", -"options": "Address", -"permlevel": 0, -"print_hide": 1, -"read_only": 0 -}, -{ -"fieldname": "col_break23", -"fieldtype": "Column Break", -"permlevel": 0, -"read_only": 0, -"width": "50%" -}, -{ -"fieldname": "contact_person", -"fieldtype": "Link", -"label": "Contact Person", -"options": "Contact", -"permlevel": 0, -"print_hide": 1, -"read_only": 0 -}, -{ -"fieldname": "more_info", -"fieldtype": "Section Break", -"label": "More Info", -"oldfieldtype": "Section Break", -"options": "icon-file-text", -"permlevel": 0, -"print_hide": 1, -"read_only": 0 -}, -{ -"description": "Supplier (Payable) Account", -"fieldname": "credit_to", -"fieldtype": "Link", -"in_filter": 1, -"label": "Credit To", -"oldfieldname": "credit_to", -"oldfieldtype": "Link", -"options": "Account", -"permlevel": 0, -"print_hide": 1, -"read_only": 0, -"reqd": 1, -"search_index": 1 -}, -{ -"default": "No", -"description": "Considered as Opening Balance", -"fieldname": "is_opening", -"fieldtype": "Select", -"in_filter": 1, -"label": "Is Opening", -"oldfieldname": "is_opening", -"oldfieldtype": "Select", -"options": "No\nYes", -"permlevel": 0, -"print_hide": 1, -"read_only": 0, -"search_index": 1 -}, -{ -"description": "Actual Invoice Date", -"fieldname": "aging_date", -"fieldtype": "Date", -"label": "Aging Date", -"oldfieldname": "aging_date", -"oldfieldtype": "Date", -"permlevel": 0, -"print_hide": 1, -"read_only": 0, -"search_index": 0 -}, -{ -"allow_on_submit": 1, -"fieldname": "select_print_heading", -"fieldtype": "Link", -"label": "Print Heading", -"no_copy": 1, -"oldfieldname": "select_print_heading", -"oldfieldtype": "Link", -"options": "Print Heading", -"permlevel": 0, -"print_hide": 1, -"read_only": 0, -"report_hide": 1 -}, -{ -"fieldname": "due_date", -"fieldtype": "Date", -"in_filter": 1, -"label": "Due Date", -"no_copy": 0, -"oldfieldname": "due_date", -"oldfieldtype": "Date", -"permlevel": 0, -"print_hide": 1, -"read_only": 0, -"search_index": 1 -}, -{ -"fieldname": "mode_of_payment", -"fieldtype": "Link", -"label": "Mode of Payment", -"oldfieldname": "mode_of_payment", -"oldfieldtype": "Select", -"options": "Mode of Payment", -"permlevel": 0, -"read_only": 0 -}, -{ -"fieldname": "column_break_63", -"fieldtype": "Column Break", -"permlevel": 0, -"read_only": 0 -}, -{ -"allow_on_submit": 1, -"fieldname": "letter_head", -"fieldtype": "Link", -"label": "Letter Head", -"options": "Letter Head", -"permlevel": 0, -"print_hide": 1 -}, -{ -"fieldname": "fiscal_year", -"fieldtype": "Link", -"in_filter": 1, -"label": "Fiscal Year", -"oldfieldname": "fiscal_year", -"oldfieldtype": "Select", -"options": "Fiscal Year", -"permlevel": 0, -"print_hide": 1, -"read_only": 0, -"search_index": 1 -}, -{ -"fieldname": "remarks", -"fieldtype": "Small Text", -"label": "Remarks", -"no_copy": 1, -"oldfieldname": "remarks", -"oldfieldtype": "Text", -"permlevel": 0, -"print_hide": 1, -"read_only": 0, -"reqd": 0 + "fieldname": "amended_from", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Amended From", + "no_copy": 1, + "oldfieldname": "amended_from", + "oldfieldtype": "Link", + "options": "Purchase Invoice", + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "company", + "fieldtype": "Link", + "in_filter": 1, + "label": "Company", + "oldfieldname": "company", + "oldfieldtype": "Link", + "options": "Company", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "search_index": 1 + }, + { + "fieldname": "currency_price_list", + "fieldtype": "Section Break", + "label": "Currency and Price List", + "options": "icon-tag", + "permlevel": 0, + "read_only": 0 + }, + { + "fieldname": "currency", + "fieldtype": "Link", + "label": "Currency", + "oldfieldname": "currency", + "oldfieldtype": "Select", + "options": "Currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 0 + }, + { + "description": "The rate at which Bill Currency is converted into company's base currency", + "fieldname": "conversion_rate", + "fieldtype": "Float", + "label": "Exchange Rate", + "oldfieldname": "conversion_rate", + "oldfieldtype": "Currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 0 + }, + { + "fieldname": "column_break2", + "fieldtype": "Column Break", + "permlevel": 0, + "read_only": 0 + }, + { + "fieldname": "buying_price_list", + "fieldtype": "Link", + "label": "Price List", + "options": "Price List", + "permlevel": 0, + "print_hide": 1, + "read_only": 0 + }, + { + "fieldname": "price_list_currency", + "fieldtype": "Link", + "label": "Price List Currency", + "options": "Currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "plc_conversion_rate", + "fieldtype": "Float", + "label": "Price List Exchange Rate", + "permlevel": 0, + "print_hide": 1, + "read_only": 0 + }, + { + "fieldname": "ignore_pricing_rule", + "fieldtype": "Check", + "label": "Ignore Pricing Rule", + "no_copy": 1, + "permlevel": 1, + "print_hide": 1 + }, + { + "fieldname": "items", + "fieldtype": "Section Break", + "label": "Items", + "oldfieldtype": "Section Break", + "options": "icon-shopping-cart", + "permlevel": 0, + "read_only": 0 + }, + { + "allow_on_submit": 1, + "fieldname": "entries", + "fieldtype": "Table", + "label": "Entries", + "oldfieldname": "entries", + "oldfieldtype": "Table", + "options": "Purchase Invoice Item", + "permlevel": 0, + "read_only": 0 + }, + { + "fieldname": "section_break_26", + "fieldtype": "Section Break", + "permlevel": 0 + }, + { + "description": "Will be calculated automatically when you enter the details", + "fieldname": "net_total", + "fieldtype": "Currency", + "label": "Net Total (Company Currency)", + "oldfieldname": "net_total", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "column_break_28", + "fieldtype": "Column Break", + "permlevel": 0 + }, + { + "fieldname": "net_total_import", + "fieldtype": "Currency", + "label": "Net Total", + "oldfieldname": "net_total_import", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "print_hide": 0, + "read_only": 1 + }, + { + "fieldname": "taxes", + "fieldtype": "Section Break", + "label": "Taxes and Charges", + "oldfieldtype": "Section Break", + "options": "icon-money", + "permlevel": 0, + "read_only": 0 + }, + { + "fieldname": "taxes_and_charges", + "fieldtype": "Link", + "label": "Taxes and Charges", + "oldfieldname": "purchase_other_charges", + "oldfieldtype": "Link", + "options": "Purchase Taxes and Charges Master", + "permlevel": 0, + "print_hide": 1, + "read_only": 0 + }, + { + "fieldname": "other_charges", + "fieldtype": "Table", + "label": "Purchase Taxes and Charges", + "oldfieldname": "purchase_tax_details", + "oldfieldtype": "Table", + "options": "Purchase Taxes and Charges", + "permlevel": 0, + "read_only": 0 + }, + { + "fieldname": "other_charges_calculation", + "fieldtype": "HTML", + "label": "Taxes and Charges Calculation", + "oldfieldtype": "HTML", + "permlevel": 0, + "print_hide": 1, + "read_only": 0 + }, + { + "fieldname": "totals", + "fieldtype": "Section Break", + "label": "Totals", + "oldfieldtype": "Section Break", + "options": "icon-money", + "permlevel": 0, + "read_only": 0 + }, + { + "fieldname": "other_charges_added", + "fieldtype": "Currency", + "label": "Taxes and Charges Added (Company Currency)", + "oldfieldname": "other_charges_added", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "other_charges_deducted", + "fieldtype": "Currency", + "label": "Taxes and Charges Deducted (Company Currency)", + "oldfieldname": "other_charges_deducted", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "grand_total", + "fieldtype": "Currency", + "label": "Grand Total (Company Currency)", + "oldfieldname": "grand_total", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "description": "In Words will be visible once you save the Purchase Invoice.", + "fieldname": "in_words", + "fieldtype": "Data", + "label": "In Words (Company Currency)", + "oldfieldname": "in_words", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "column_break8", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "width": "50%" + }, + { + "fieldname": "other_charges_added_import", + "fieldtype": "Currency", + "label": "Taxes and Charges Added", + "oldfieldname": "other_charges_added_import", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "other_charges_deducted_import", + "fieldtype": "Currency", + "label": "Taxes and Charges Deducted", + "oldfieldname": "other_charges_deducted_import", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "grand_total_import", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Grand Total", + "oldfieldname": "grand_total_import", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "print_hide": 0, + "read_only": 1 + }, + { + "fieldname": "in_words_import", + "fieldtype": "Data", + "label": "In Words", + "oldfieldname": "in_words_import", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 0, + "read_only": 1 + }, + { + "fieldname": "total_amount_to_pay", + "fieldtype": "Currency", + "hidden": 0, + "label": "Total Amount To Pay", + "no_copy": 1, + "oldfieldname": "total_amount_to_pay", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "total_advance", + "fieldtype": "Currency", + "label": "Total Advance", + "no_copy": 1, + "oldfieldname": "total_advance", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "total_tax", + "fieldtype": "Currency", + "label": "Total Tax (Company Currency)", + "oldfieldname": "total_tax", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "outstanding_amount", + "fieldtype": "Currency", + "in_filter": 1, + "in_list_view": 1, + "label": "Outstanding Amount", + "no_copy": 1, + "oldfieldname": "outstanding_amount", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, + "search_index": 1 + }, + { + "fieldname": "write_off_amount", + "fieldtype": "Currency", + "label": "Write Off Amount", + "no_copy": 1, + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 0 + }, + { + "depends_on": "eval:flt(doc.write_off_amount)!=0", + "fieldname": "write_off_account", + "fieldtype": "Link", + "label": "Write Off Account", + "no_copy": 1, + "options": "Account", + "permlevel": 0, + "print_hide": 1, + "read_only": 0 + }, + { + "depends_on": "eval:flt(doc.write_off_amount)!=0", + "fieldname": "write_off_cost_center", + "fieldtype": "Link", + "label": "Write Off Cost Center", + "no_copy": 1, + "options": "Cost Center", + "permlevel": 0, + "print_hide": 1, + "read_only": 0 + }, + { + "fieldname": "against_expense_account", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Against Expense Account", + "no_copy": 1, + "oldfieldname": "against_expense_account", + "oldfieldtype": "Small Text", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "report_hide": 0 + }, + { + "fieldname": "fold", + "fieldtype": "Fold", + "permlevel": 0 + }, + { + "fieldname": "advances", + "fieldtype": "Section Break", + "label": "Advances", + "oldfieldtype": "Section Break", + "options": "icon-money", + "permlevel": 0, + "print_hide": 1, + "read_only": 0 + }, + { + "fieldname": "get_advances_paid", + "fieldtype": "Button", + "label": "Get Advances Paid", + "oldfieldtype": "Button", + "options": "get_advances", + "permlevel": 0, + "print_hide": 1, + "read_only": 0 + }, + { + "fieldname": "advance_allocation_details", + "fieldtype": "Table", + "label": "Purchase Invoice Advances", + "no_copy": 1, + "oldfieldname": "advance_allocation_details", + "oldfieldtype": "Table", + "options": "Purchase Invoice Advance", + "permlevel": 0, + "print_hide": 1, + "read_only": 0 + }, + { + "fieldname": "terms_section_break", + "fieldtype": "Section Break", + "label": "Terms and Conditions", + "options": "icon-legal", + "permlevel": 0 + }, + { + "fieldname": "tc_name", + "fieldtype": "Link", + "label": "Terms", + "options": "Terms and Conditions", + "permlevel": 0, + "print_hide": 1 + }, + { + "fieldname": "terms", + "fieldtype": "Text Editor", + "label": "Terms and Conditions1", + "permlevel": 0 + }, + { + "depends_on": "supplier", + "fieldname": "contact_section", + "fieldtype": "Section Break", + "label": "Contact Info", + "options": "icon-bullhorn", + "permlevel": 0, + "read_only": 0 + }, + { + "fieldname": "supplier_address", + "fieldtype": "Link", + "label": "Supplier Address", + "options": "Address", + "permlevel": 0, + "print_hide": 1, + "read_only": 0 + }, + { + "fieldname": "col_break23", + "fieldtype": "Column Break", + "permlevel": 0, + "read_only": 0, + "width": "50%" + }, + { + "fieldname": "contact_person", + "fieldtype": "Link", + "label": "Contact Person", + "options": "Contact", + "permlevel": 0, + "print_hide": 1, + "read_only": 0 + }, + { + "fieldname": "more_info", + "fieldtype": "Section Break", + "label": "More Info", + "oldfieldtype": "Section Break", + "options": "icon-file-text", + "permlevel": 0, + "print_hide": 1, + "read_only": 0 + }, + { + "description": "Supplier (Payable) Account", + "fieldname": "credit_to", + "fieldtype": "Link", + "in_filter": 1, + "label": "Credit To", + "oldfieldname": "credit_to", + "oldfieldtype": "Link", + "options": "Account", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "reqd": 1, + "search_index": 1 + }, + { + "default": "No", + "description": "Considered as Opening Balance", + "fieldname": "is_opening", + "fieldtype": "Select", + "in_filter": 1, + "label": "Is Opening", + "oldfieldname": "is_opening", + "oldfieldtype": "Select", + "options": "No\nYes", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "search_index": 1 + }, + { + "description": "Actual Invoice Date", + "fieldname": "aging_date", + "fieldtype": "Date", + "label": "Aging Date", + "oldfieldname": "aging_date", + "oldfieldtype": "Date", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "search_index": 0 + }, + { + "allow_on_submit": 1, + "fieldname": "select_print_heading", + "fieldtype": "Link", + "label": "Print Heading", + "no_copy": 1, + "oldfieldname": "select_print_heading", + "oldfieldtype": "Link", + "options": "Print Heading", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "report_hide": 1 + }, + { + "fieldname": "due_date", + "fieldtype": "Date", + "in_filter": 1, + "label": "Due Date", + "no_copy": 0, + "oldfieldname": "due_date", + "oldfieldtype": "Date", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "search_index": 1 + }, + { + "fieldname": "mode_of_payment", + "fieldtype": "Link", + "label": "Mode of Payment", + "oldfieldname": "mode_of_payment", + "oldfieldtype": "Select", + "options": "Mode of Payment", + "permlevel": 0, + "read_only": 0 + }, + { + "fieldname": "column_break_63", + "fieldtype": "Column Break", + "permlevel": 0, + "read_only": 0 + }, + { + "allow_on_submit": 1, + "fieldname": "letter_head", + "fieldtype": "Link", + "label": "Letter Head", + "options": "Letter Head", + "permlevel": 0, + "print_hide": 1 + }, + { + "fieldname": "fiscal_year", + "fieldtype": "Link", + "in_filter": 1, + "label": "Fiscal Year", + "oldfieldname": "fiscal_year", + "oldfieldtype": "Select", + "options": "Fiscal Year", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "search_index": 1 + }, + { + "fieldname": "remarks", + "fieldtype": "Small Text", + "label": "Remarks", + "no_copy": 1, + "oldfieldname": "remarks", + "oldfieldtype": "Text", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "reqd": 0 }, { "depends_on": "eval:doc.docstatus<2", @@ -832,13 +832,6 @@ "print_hide": 1, "read_only": 1 }, - { - "fieldname": "column_break_82", - "fieldtype": "Column Break", - "permlevel": 0, - "print_hide": 1, - "width": "50%" - }, { "allow_on_submit": 1, "depends_on": "eval:doc.is_recurring==1", @@ -850,6 +843,13 @@ "permlevel": 0, "print_hide": 1 }, + { + "fieldname": "column_break_82", + "fieldtype": "Column Break", + "permlevel": 0, + "print_hide": 1, + "width": "50%" + }, { "depends_on": "eval:doc.is_recurring==1", "description": "The unique id for tracking all recurring invoices. It is generated on submit.", @@ -871,110 +871,100 @@ "no_copy": 1, "permlevel": 0, "print_hide": 1 + } + ], + "icon": "icon-file-text", + "idx": 1, + "is_submittable": 1, + "modified": "2014-09-18 03:12:51.994059", + "modified_by": "Administrator", + "module": "Accounts", + "name": "Purchase Invoice", + "owner": "Administrator", + "permissions": [ + { + "amend": 1, + "apply_user_permissions": 1, + "cancel": 1, + "create": 1, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts User", + "submit": 1, + "write": 1 }, { - "fieldname": "against_income_account", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Against Income Account", - "no_copy": 1, + "amend": 0, + "apply_user_permissions": 1, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 1, "permlevel": 0, - "print_hide": 1, - "report_hide": 1 -} -], -"icon": "icon-file-text", -"idx": 1, -"is_submittable": 1, -"modified": "2014-09-09 05:35:32.156763", -"modified_by": "Administrator", -"module": "Accounts", -"name": "Purchase Invoice", -"owner": "Administrator", -"permissions": [ -{ -"amend": 1, -"apply_user_permissions": 1, -"cancel": 1, -"create": 1, -"delete": 0, -"email": 1, -"permlevel": 0, -"print": 1, -"read": 1, -"report": 1, -"role": "Accounts User", -"submit": 1, -"write": 1 -}, -{ -"amend": 0, -"apply_user_permissions": 1, -"cancel": 0, -"create": 0, -"delete": 0, -"email": 1, -"permlevel": 0, -"print": 1, -"read": 1, -"report": 1, -"role": "Purchase User", -"submit": 0, -"write": 0 -}, -{ -"amend": 0, -"apply_user_permissions": 1, -"cancel": 0, -"create": 0, -"delete": 0, -"email": 1, -"permlevel": 0, -"print": 1, -"read": 1, -"report": 1, -"role": "Supplier", -"submit": 0, -"write": 0 -}, -{ -"amend": 1, -"cancel": 1, -"create": 1, -"delete": 1, -"email": 1, -"permlevel": 0, -"print": 1, -"read": 1, -"report": 1, -"role": "Accounts Manager", -"submit": 1, -"write": 1 -}, -{ -"amend": 0, -"apply_user_permissions": 1, -"cancel": 0, -"create": 0, -"delete": 0, -"email": 1, -"permlevel": 0, -"print": 1, -"read": 1, -"report": 1, -"role": "Auditor", -"submit": 0, -"write": 0 -}, -{ -"permlevel": 1, -"read": 1, -"role": "Accounts Manager", -"write": 1 -} -], -"read_only_onload": 1, -"search_fields": "posting_date, credit_to, fiscal_year, bill_no, grand_total, outstanding_amount", -"sort_field": "modified", -"sort_order": "DESC" -} + "print": 1, + "read": 1, + "report": 1, + "role": "Purchase User", + "submit": 0, + "write": 0 + }, + { + "amend": 0, + "apply_user_permissions": 1, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Supplier", + "submit": 0, + "write": 0 + }, + { + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts Manager", + "submit": 1, + "write": 1 + }, + { + "amend": 0, + "apply_user_permissions": 1, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Auditor", + "submit": 0, + "write": 0 + }, + { + "permlevel": 1, + "read": 1, + "role": "Accounts Manager", + "write": 1 + } + ], + "read_only_onload": 1, + "search_fields": "posting_date, credit_to, fiscal_year, bill_no, grand_total, outstanding_amount", + "sort_field": "modified", + "sort_order": "DESC" +} \ 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 6a41bbab39d..b5b3f1dd5eb 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -5,20 +5,14 @@ from __future__ import unicode_literals import frappe -from frappe.utils import add_days, cint, cstr, date_diff, formatdate, flt, getdate, nowdate, \ - get_first_day, get_last_day -from frappe.model.naming import make_autoname - +from frappe.utils import cint, cstr, formatdate, flt from frappe import msgprint, _, throw from erpnext.setup.utils import get_company_currency - import frappe.defaults from erpnext.controllers.buying_controller import BuyingController from erpnext.accounts.party import get_party_account, get_due_date -from erpnext.controllers.recurring_document import * - form_grid_templates = { "entries": "templates/form_grid/item_grid.html" } @@ -66,7 +60,6 @@ class PurchaseInvoice(BuyingController): self.validate_multiple_billing("Purchase Receipt", "pr_detail", "amount", "purchase_receipt_details") self.create_remarks() - validate_recurring_document(self) def create_remarks(self): if not self.remarks: @@ -255,6 +248,8 @@ class PurchaseInvoice(BuyingController): reconcile_against_document(lst) def on_submit(self): + super(PurchaseInvoice, self).on_submit() + self.check_prev_docstatus() frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, @@ -265,11 +260,6 @@ class PurchaseInvoice(BuyingController): self.update_against_document_in_jv() self.update_prevdoc_status() self.update_billing_status_for_zero_amount_refdoc("Purchase Order") - convert_to_recurring(self, self.posting_date) - - def on_update_after_submit(self): - validate_recurring_document(self) - convert_to_recurring(self, self.posting_date) def make_gl_entries(self): auto_accounting_for_stock = \ diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py index bc97b91d300..d4fcfc72be5 100644 --- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py @@ -231,4 +231,8 @@ class TestPurchaseInvoice(unittest.TestCase): self.assertTrue(not frappe.db.sql("""select name from `tabJournal Voucher Detail` where against_voucher=%s""", pi.name)) + def test_recurring_invoice(self): + from erpnext.controllers.tests.test_recurring_document import test_recurring_document + test_recurring_document(self, test_records) + test_records = frappe.get_test_records('Purchase Invoice') diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index 73832cec65d..cc841e2ffcd 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -399,37 +399,6 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) { }) } -cur_frm.cscript.is_recurring = function(doc, dt, dn) { - // set default values for recurring invoices - if(doc.is_recurring) { - var owner_email = doc.owner=="Administrator" - ? frappe.user_info("Administrator").email - : doc.owner; - - doc.notification_email_address = $.map([cstr(owner_email), - cstr(doc.contact_email)], function(v) { return v || null; }).join(", "); - doc.repeat_on_day_of_month = frappe.datetime.str_to_obj(doc.posting_date).getDate(); - } - - refresh_many(["notification_email_address", "repeat_on_day_of_month"]); -} - -cur_frm.cscript.from_date = function(doc, dt, dn) { - // set to_date - if(doc.from_date) { - var recurring_type_map = {'Monthly': 1, 'Quarterly': 3, 'Half-yearly': 6, - 'Yearly': 12}; - - var months = recurring_type_map[doc.recurring_type]; - if(months) { - var to_date = frappe.datetime.add_months(doc.from_date, - months); - doc.to_date = frappe.datetime.add_days(to_date, -1); - refresh_field('to_date'); - } - } -} - cur_frm.cscript.send_sms = function() { frappe.require("assets/erpnext/js/sms_manager.js"); var sms_man = new SMSManager(cur_frm.doc); diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json index 234d048ad5f..4462ac65662 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json @@ -174,7 +174,7 @@ "description": "Start date of current invoice's period", "fieldname": "from_date", "fieldtype": "Date", - "label": "From", + "label": "From Date", "no_copy": 1, "permlevel": 0, "print_hide": 0, @@ -186,7 +186,7 @@ "description": "End date of current invoice's period", "fieldname": "to_date", "fieldtype": "Date", - "label": "To", + "label": "To Date", "no_copy": 1, "permlevel": 0, "print_hide": 0, @@ -1192,7 +1192,7 @@ "icon": "icon-file-text", "idx": 1, "is_submittable": 1, - "modified": "2014-09-09 05:35:34.121045", + "modified": "2014-09-18 03:17:54.976732", "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice", diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 6c5f951caf7..25a0cc86017 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -4,18 +4,12 @@ from __future__ import unicode_literals import frappe import frappe.defaults - -from frappe.utils import add_days, cint, cstr, date_diff, flt, getdate, nowdate, \ - get_first_day, get_last_day -from frappe.model.naming import make_autoname +from frappe.utils import cint, cstr, flt from frappe import _, msgprint, throw from erpnext.accounts.party import get_party_account, get_due_date from erpnext.controllers.stock_controller import update_gl_entries_after from frappe.model.mapper import get_mapped_doc - -from erpnext.controllers.recurring_document import * - from erpnext.controllers.selling_controller import SellingController form_grid_templates = { @@ -77,11 +71,12 @@ class SalesInvoice(SellingController): self.set_against_income_account() self.validate_c_form() self.validate_time_logs_are_submitted() - validate_recurring_document(self) self.validate_multiple_billing("Delivery Note", "dn_detail", "amount", "delivery_note_details") def on_submit(self): + super(SalesInvoice, self).on_submit() + if cint(self.update_stock) == 1: self.update_stock_ledger() else: @@ -104,7 +99,6 @@ class SalesInvoice(SellingController): self.update_against_document_in_jv() self.update_time_log_batch(self.name) - convert_to_recurring(self, self.posting_date) def before_cancel(self): self.update_time_log_batch(None) @@ -145,14 +139,6 @@ class SalesInvoice(SellingController): 'overflow_type': 'delivery' }) - def on_update_after_submit(self): - validate_recurring_document(self) - convert_to_recurring(self, self.posting_date) - - def before_recurring(self): - self.aging_date = None - self.due_date = None - def get_portal_page(self): return "invoice" if self.docstatus==1 else None diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js index 549584500f2..9433ebe20c5 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order.js @@ -206,39 +206,6 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) { } } - -cur_frm.cscript.is_recurring = function(doc, dt, dn) { - // set default values for recurring orders - if(doc.is_recurring) { - var owner_email = doc.owner=="Administrator" - ? frappe.user_info("Administrator").email - : doc.owner; - - doc.notification_email_address = $.map([cstr(owner_email), - cstr(doc.contact_email)], function(v) { return v || null; }).join(", "); - doc.repeat_on_day_of_month = frappe.datetime.str_to_obj(doc.posting_date).getDate(); - } - - refresh_many(["notification_email_address", "repeat_on_day_of_month"]); -} - -cur_frm.cscript.from_date = function(doc, dt, dn) { - // set to_date - if(doc.from_date) { - var recurring_type_map = {'Monthly': 1, 'Quarterly': 3, 'Half-yearly': 6, - 'Yearly': 12}; - - var months = recurring_type_map[doc.recurring_type]; - if(months) { - var to_date = frappe.datetime.add_months(doc.from_date, - months); - doc.to_date = frappe.datetime.add_days(to_date, -1); - refresh_field('to_date'); - } - } -} - - cur_frm.cscript.send_sms = function() { frappe.require("assets/erpnext/js/sms_manager.js"); var sms_man = new SMSManager(cur_frm.doc); diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index 7843fb7f57d..142781c2bdd 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -1,112 +1,112 @@ { -"allow_import": 1, -"autoname": "naming_series:", -"creation": "2013-05-21 16:16:39", -"docstatus": 0, -"doctype": "DocType", -"document_type": "Transaction", -"fields": [ -{ -"fieldname": "supplier_section", -"fieldtype": "Section Break", -"label": "Supplier", -"options": "icon-user", -"permlevel": 0 -}, -{ -"fieldname": "naming_series", -"fieldtype": "Select", -"label": "Series", -"no_copy": 1, -"oldfieldname": "naming_series", -"oldfieldtype": "Select", -"options": "PO-", -"permlevel": 0, -"print_hide": 1, -"reqd": 1 -}, -{ -"description": "Supplier (vendor) name as entered in supplier master", -"fieldname": "supplier", -"fieldtype": "Link", -"in_filter": 1, -"label": "Supplier", -"oldfieldname": "supplier", -"oldfieldtype": "Link", -"options": "Supplier", -"permlevel": 0, -"print_hide": 1, -"reqd": 1, -"search_index": 1 -}, -{ -"fieldname": "supplier_name", -"fieldtype": "Data", -"hidden": 0, -"in_list_view": 1, -"label": "Name", -"permlevel": 0, -"read_only": 1 -}, -{ -"fieldname": "address_display", -"fieldtype": "Small Text", -"hidden": 1, -"label": "Address", -"permlevel": 0, -"read_only": 1 -}, -{ -"fieldname": "contact_display", -"fieldtype": "Small Text", -"hidden": 1, -"label": "Contact", -"permlevel": 0, -"read_only": 1 -}, -{ -"fieldname": "contact_mobile", -"fieldtype": "Small Text", -"hidden": 1, -"label": "Mobile No", -"permlevel": 0, -"read_only": 1 -}, -{ -"fieldname": "contact_email", -"fieldtype": "Small Text", -"hidden": 1, -"label": "Contact Email", -"permlevel": 0, -"print_hide": 1, -"read_only": 1 -}, -{ -"fieldname": "column_break1", -"fieldtype": "Column Break", -"oldfieldtype": "Column Break", -"permlevel": 0, -"print_hide": 0, -"print_width": "50%", -"width": "50%" -}, -{ -"fieldname": "transaction_date", -"fieldtype": "Date", -"in_filter": 1, -"label": "Date", -"oldfieldname": "transaction_date", -"oldfieldtype": "Date", -"permlevel": 0, -"reqd": 1, -"search_index": 1 -}, -{ -"allow_on_submit": 1, + "allow_import": 1, + "autoname": "naming_series:", + "creation": "2013-05-21 16:16:39", + "docstatus": 0, + "doctype": "DocType", + "document_type": "Transaction", + "fields": [ + { + "fieldname": "supplier_section", + "fieldtype": "Section Break", + "label": "Supplier", + "options": "icon-user", + "permlevel": 0 + }, + { + "fieldname": "naming_series", + "fieldtype": "Select", + "label": "Series", + "no_copy": 1, + "oldfieldname": "naming_series", + "oldfieldtype": "Select", + "options": "PO-", + "permlevel": 0, + "print_hide": 1, + "reqd": 1 + }, + { + "description": "Supplier (vendor) name as entered in supplier master", + "fieldname": "supplier", + "fieldtype": "Link", + "in_filter": 1, + "label": "Supplier", + "oldfieldname": "supplier", + "oldfieldtype": "Link", + "options": "Supplier", + "permlevel": 0, + "print_hide": 1, + "reqd": 1, + "search_index": 1 + }, + { + "fieldname": "supplier_name", + "fieldtype": "Data", + "hidden": 0, + "in_list_view": 1, + "label": "Name", + "permlevel": 0, + "read_only": 1 + }, + { + "fieldname": "address_display", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Address", + "permlevel": 0, + "read_only": 1 + }, + { + "fieldname": "contact_display", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Contact", + "permlevel": 0, + "read_only": 1 + }, + { + "fieldname": "contact_mobile", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Mobile No", + "permlevel": 0, + "read_only": 1 + }, + { + "fieldname": "contact_email", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Contact Email", + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "column_break1", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "print_hide": 0, + "print_width": "50%", + "width": "50%" + }, + { + "fieldname": "transaction_date", + "fieldtype": "Date", + "in_filter": 1, + "label": "Date", + "oldfieldname": "transaction_date", + "oldfieldtype": "Date", + "permlevel": 0, + "reqd": 1, + "search_index": 1 + }, + { + "allow_on_submit": 1, "description": "Start date of current order's period", "fieldname": "from_date", "fieldtype": "Date", - "label": "From", + "label": "From Date", "no_copy": 1, "permlevel": 0 }, @@ -115,562 +115,562 @@ "description": "End date of current order's period", "fieldname": "to_date", "fieldtype": "Date", - "label": "To", + "label": "To Date", "no_copy": 1, "permlevel": 0 }, { -"fieldname": "amended_from", -"fieldtype": "Link", -"hidden": 0, -"ignore_user_permissions": 1, -"label": "Amended From", -"no_copy": 1, -"oldfieldname": "amended_from", -"oldfieldtype": "Data", -"options": "Purchase Order", -"permlevel": 0, -"print_hide": 1, -"read_only": 1, -"report_hide": 0 -}, -{ -"description": "Select the relevant company name if you have multiple companies", -"fieldname": "company", -"fieldtype": "Link", -"in_filter": 1, -"label": "Company", -"no_copy": 0, -"oldfieldname": "company", -"oldfieldtype": "Link", -"options": "Company", -"permlevel": 0, -"print_hide": 1, -"reqd": 1, -"search_index": 1 -}, -{ -"fieldname": "price_list_and_currency", -"fieldtype": "Section Break", -"label": "Currency and Price List", -"options": "icon-tag", -"permlevel": 0 -}, -{ -"fieldname": "cb_currency", -"fieldtype": "Column Break", -"permlevel": 0 -}, -{ -"fieldname": "currency", -"fieldtype": "Link", -"label": "Currency", -"no_copy": 0, -"oldfieldname": "currency", -"oldfieldtype": "Select", -"options": "Currency", -"permlevel": 0, -"print_hide": 1, -"reqd": 1 -}, -{ -"description": "Rate at which supplier's currency is converted to company's base currency", -"fieldname": "conversion_rate", -"fieldtype": "Float", -"hidden": 0, -"label": "Exchange Rate", -"no_copy": 0, -"oldfieldname": "conversion_rate", -"oldfieldtype": "Currency", -"permlevel": 0, -"print_hide": 1, -"reqd": 1 -}, -{ -"fieldname": "cb_price_list", -"fieldtype": "Column Break", -"permlevel": 0 -}, -{ -"fieldname": "buying_price_list", -"fieldtype": "Link", -"label": "Price List", -"options": "Price List", -"permlevel": 0, -"print_hide": 1 -}, -{ -"fieldname": "price_list_currency", -"fieldtype": "Link", -"label": "Price List Currency", -"options": "Currency", -"permlevel": 0, -"print_hide": 1, -"read_only": 1 -}, -{ -"fieldname": "plc_conversion_rate", -"fieldtype": "Float", -"label": "Price List Exchange Rate", -"permlevel": 0, -"print_hide": 1 -}, -{ -"fieldname": "ignore_pricing_rule", -"fieldtype": "Check", -"label": "Ignore Pricing Rule", -"no_copy": 1, -"permlevel": 1, -"print_hide": 1 -}, -{ -"fieldname": "items", -"fieldtype": "Section Break", -"label": "Items", -"oldfieldtype": "Section Break", -"options": "icon-shopping-cart", -"permlevel": 0 -}, -{ -"allow_on_submit": 1, -"fieldname": "po_details", -"fieldtype": "Table", -"label": "Purchase Order Items", -"no_copy": 0, -"oldfieldname": "po_details", -"oldfieldtype": "Table", -"options": "Purchase Order Item", -"permlevel": 0 -}, -{ -"fieldname": "sb_last_purchase", -"fieldtype": "Section Break", -"permlevel": 0 -}, -{ -"fieldname": "net_total", -"fieldtype": "Currency", -"label": "Net Total (Company Currency)", -"no_copy": 1, -"oldfieldname": "net_total", -"oldfieldtype": "Currency", -"options": "Company:company:default_currency", -"permlevel": 0, -"print_hide": 1, -"read_only": 1, -"reqd": 0 -}, -{ -"fieldname": "column_break_26", -"fieldtype": "Column Break", -"permlevel": 0 -}, -{ -"fieldname": "net_total_import", -"fieldtype": "Currency", -"label": "Net Total", -"no_copy": 0, -"oldfieldname": "net_total_import", -"oldfieldtype": "Currency", -"options": "currency", -"permlevel": 0, -"print_hide": 0, -"read_only": 1 -}, -{ -"fieldname": "get_last_purchase_rate", -"fieldtype": "Button", -"label": "Get Last Purchase Rate", -"oldfieldtype": "Button", -"permlevel": 0, -"print_hide": 0 -}, -{ -"fieldname": "taxes", -"fieldtype": "Section Break", -"label": "Taxes and Charges", -"oldfieldtype": "Section Break", -"options": "icon-money", -"permlevel": 0, -"print_hide": 0 -}, -{ -"description": "If you have created a standard template in Purchase Taxes and Charges Master, select one and click on the button below.", -"fieldname": "taxes_and_charges", -"fieldtype": "Link", -"label": "Taxes and Charges", -"no_copy": 0, -"oldfieldname": "purchase_other_charges", -"oldfieldtype": "Link", -"options": "Purchase Taxes and Charges Master", -"permlevel": 0, -"print_hide": 1 -}, -{ -"fieldname": "other_charges", -"fieldtype": "Table", -"label": "Purchase Taxes and Charges", -"no_copy": 0, -"oldfieldname": "purchase_tax_details", -"oldfieldtype": "Table", -"options": "Purchase Taxes and Charges", -"permlevel": 0 -}, -{ -"fieldname": "other_charges_calculation", -"fieldtype": "HTML", -"label": "Taxes and Charges Calculation", -"no_copy": 1, -"oldfieldtype": "HTML", -"permlevel": 0, -"print_hide": 1 -}, -{ -"fieldname": "totals", -"fieldtype": "Section Break", -"label": "Totals", -"oldfieldtype": "Section Break", -"options": "icon-money", -"permlevel": 0 -}, -{ -"fieldname": "other_charges_added", -"fieldtype": "Currency", -"label": "Taxes and Charges Added (Company Currency)", -"no_copy": 0, -"oldfieldname": "other_charges_added", -"oldfieldtype": "Currency", -"options": "Company:company:default_currency", -"permlevel": 0, -"print_hide": 1, -"read_only": 1 -}, -{ -"fieldname": "other_charges_deducted", -"fieldtype": "Currency", -"label": "Taxes and Charges Deducted (Company Currency)", -"no_copy": 0, -"oldfieldname": "other_charges_deducted", -"oldfieldtype": "Currency", -"options": "Company:company:default_currency", -"permlevel": 0, -"print_hide": 1, -"read_only": 1 -}, -{ -"fieldname": "total_tax", -"fieldtype": "Currency", -"label": "Total Tax (Company Currency)", -"no_copy": 1, -"oldfieldname": "total_tax", -"oldfieldtype": "Currency", -"options": "Company:company:default_currency", -"permlevel": 0, -"print_hide": 1, -"read_only": 1 -}, -{ -"fieldname": "grand_total", -"fieldtype": "Currency", -"label": "Grand Total (Company Currency)", -"no_copy": 1, -"oldfieldname": "grand_total", -"oldfieldtype": "Currency", -"options": "Company:company:default_currency", -"permlevel": 0, -"print_hide": 1, -"read_only": 1 -}, -{ -"description": "In Words will be visible once you save the Purchase Order.", -"fieldname": "in_words", -"fieldtype": "Data", -"label": "In Words (Company Currency)", -"oldfieldname": "in_words", -"oldfieldtype": "Data", -"permlevel": 0, -"print_hide": 1, -"read_only": 1 -}, -{ -"fieldname": "rounded_total", -"fieldtype": "Currency", -"label": "Rounded Total (Company Currency)", -"oldfieldname": "rounded_total", -"oldfieldtype": "Currency", -"options": "Company:company:default_currency", -"permlevel": 0, -"print_hide": 1, -"read_only": 1 -}, -{ -"fieldname": "advance_paid", -"fieldtype": "Currency", -"label": "Advance Paid", -"permlevel": 0, -"print_hide": 1, -"read_only": 1 -}, -{ -"fieldname": "column_break4", -"fieldtype": "Column Break", -"oldfieldtype": "Column Break", -"permlevel": 0, -"print_hide": 0 -}, -{ -"fieldname": "other_charges_added_import", -"fieldtype": "Currency", -"label": "Taxes and Charges Added", -"no_copy": 0, -"oldfieldname": "other_charges_added_import", -"oldfieldtype": "Currency", -"options": "currency", -"permlevel": 0, -"print_hide": 1, -"read_only": 1, -"report_hide": 0 -}, -{ -"fieldname": "other_charges_deducted_import", -"fieldtype": "Currency", -"label": "Taxes and Charges Deducted", -"no_copy": 0, -"oldfieldname": "other_charges_deducted_import", -"oldfieldtype": "Currency", -"options": "currency", -"permlevel": 0, -"print_hide": 1, -"read_only": 1, -"report_hide": 0 -}, -{ -"fieldname": "grand_total_import", -"fieldtype": "Currency", -"in_list_view": 1, -"label": "Grand Total", -"no_copy": 0, -"oldfieldname": "grand_total_import", -"oldfieldtype": "Currency", -"options": "currency", -"permlevel": 0, -"print_hide": 0, -"read_only": 1, -"report_hide": 0 -}, -{ -"fieldname": "in_words_import", -"fieldtype": "Data", -"label": "In Words", -"oldfieldname": "in_words_import", -"oldfieldtype": "Data", -"permlevel": 0, -"print_hide": 0, -"read_only": 1 -}, -{ -"fieldname": "fold", -"fieldtype": "Fold", -"permlevel": 0 -}, -{ -"fieldname": "terms_section_break", -"fieldtype": "Section Break", -"label": "Terms and Conditions", -"oldfieldtype": "Section Break", -"options": "icon-legal", -"permlevel": 0 -}, -{ -"fieldname": "tc_name", -"fieldtype": "Link", -"label": "Terms", -"oldfieldname": "tc_name", -"oldfieldtype": "Link", -"options": "Terms and Conditions", -"permlevel": 0, -"print_hide": 1 -}, -{ -"fieldname": "terms", -"fieldtype": "Text Editor", -"label": "Terms and Conditions", -"oldfieldname": "terms", -"oldfieldtype": "Text Editor", -"permlevel": 0 -}, -{ -"depends_on": "supplier", -"fieldname": "contact_section", -"fieldtype": "Section Break", -"label": "Contact Info", -"options": "icon-bullhorn", -"permlevel": 0 -}, -{ -"fieldname": "supplier_address", -"fieldtype": "Link", -"in_filter": 1, -"label": "Supplier Address", -"options": "Address", -"permlevel": 0, -"print_hide": 1 -}, -{ -"fieldname": "cb_contact", -"fieldtype": "Column Break", -"permlevel": 0 -}, -{ -"fieldname": "contact_person", -"fieldtype": "Link", -"in_filter": 1, -"label": "Contact Person", -"options": "Contact", -"permlevel": 0, -"print_hide": 1 -}, -{ -"fieldname": "more_info", -"fieldtype": "Section Break", -"label": "More Info", -"oldfieldtype": "Section Break", -"permlevel": 0 -}, -{ -"fieldname": "status", -"fieldtype": "Select", -"in_filter": 1, -"label": "Status", -"no_copy": 1, -"oldfieldname": "status", -"oldfieldtype": "Select", -"options": "\nDraft\nSubmitted\nStopped\nCancelled", -"permlevel": 0, -"print_hide": 1, -"read_only": 1, -"reqd": 1, -"search_index": 1 -}, -{ -"default": "No", -"fieldname": "is_subcontracted", -"fieldtype": "Select", -"label": "Is Subcontracted", -"options": "\nYes\nNo", -"permlevel": 0, -"print_hide": 1 -}, -{ -"fieldname": "ref_sq", -"fieldtype": "Data", -"hidden": 1, -"label": "Ref SQ", -"no_copy": 1, -"oldfieldname": "ref_sq", -"oldfieldtype": "Data", -"permlevel": 0, -"print_hide": 1, -"read_only": 1 -}, -{ -"allow_on_submit": 1, -"fieldname": "letter_head", -"fieldtype": "Link", -"label": "Letter Head", -"oldfieldname": "letter_head", -"oldfieldtype": "Select", -"options": "Letter Head", -"permlevel": 0, -"print_hide": 1 -}, -{ -"fieldname": "fiscal_year", -"fieldtype": "Link", -"in_filter": 1, -"label": "Fiscal Year", -"no_copy": 0, -"oldfieldname": "fiscal_year", -"oldfieldtype": "Select", -"options": "Fiscal Year", -"permlevel": 0, -"print_hide": 1, -"reqd": 1, -"search_index": 1 -}, -{ -"allow_on_submit": 1, -"fieldname": "select_print_heading", -"fieldtype": "Link", -"label": "Print Heading", -"no_copy": 1, -"oldfieldname": "select_print_heading", -"oldfieldtype": "Link", -"options": "Print Heading", -"permlevel": 0, -"print_hide": 1, -"report_hide": 1 -}, -{ -"fieldname": "column_break5", -"fieldtype": "Column Break", -"oldfieldtype": "Column Break", -"permlevel": 0, -"print_hide": 1, -"print_width": "50%", -"width": "50%" -}, -{ -"depends_on": "eval:!doc.__islocal", -"description": "% of materials received against this Purchase Order", -"fieldname": "per_received", -"fieldtype": "Percent", -"in_list_view": 1, -"label": "% Received", -"no_copy": 1, -"oldfieldname": "per_received", -"oldfieldtype": "Currency", -"permlevel": 0, -"print_hide": 1, -"read_only": 1 -}, -{ -"depends_on": "eval:!doc.__islocal", -"description": "% of materials billed against this Purchase Order.", -"fieldname": "per_billed", -"fieldtype": "Percent", -"in_list_view": 1, -"label": "% Billed", -"no_copy": 1, -"oldfieldname": "per_billed", -"oldfieldtype": "Currency", -"permlevel": 0, -"print_hide": 1, -"read_only": 1 -}, -{ -"description": "Required raw materials issued to the supplier for producing a sub - contracted item.", -"fieldname": "raw_material_details", -"fieldtype": "Section Break", -"label": "Raw Materials Supplied", -"oldfieldtype": "Section Break", -"options": "icon-truck", -"permlevel": 0, -"print_hide": 1 -}, -{ -"allow_on_submit": 1, -"fieldname": "po_raw_material_details", -"fieldtype": "Table", -"label": "Purchase Order Items Supplied", -"no_copy": 0, -"oldfieldname": "po_raw_material_details", -"oldfieldtype": "Table", -"options": "Purchase Order Item Supplied", -"permlevel": 0, -"print_hide": 1, -"read_only": 1 - }, + "fieldname": "amended_from", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 1, + "label": "Amended From", + "no_copy": 1, + "oldfieldname": "amended_from", + "oldfieldtype": "Data", + "options": "Purchase Order", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, + "report_hide": 0 + }, + { + "description": "Select the relevant company name if you have multiple companies", + "fieldname": "company", + "fieldtype": "Link", + "in_filter": 1, + "label": "Company", + "no_copy": 0, + "oldfieldname": "company", + "oldfieldtype": "Link", + "options": "Company", + "permlevel": 0, + "print_hide": 1, + "reqd": 1, + "search_index": 1 + }, + { + "fieldname": "price_list_and_currency", + "fieldtype": "Section Break", + "label": "Currency and Price List", + "options": "icon-tag", + "permlevel": 0 + }, + { + "fieldname": "cb_currency", + "fieldtype": "Column Break", + "permlevel": 0 + }, + { + "fieldname": "currency", + "fieldtype": "Link", + "label": "Currency", + "no_copy": 0, + "oldfieldname": "currency", + "oldfieldtype": "Select", + "options": "Currency", + "permlevel": 0, + "print_hide": 1, + "reqd": 1 + }, + { + "description": "Rate at which supplier's currency is converted to company's base currency", + "fieldname": "conversion_rate", + "fieldtype": "Float", + "hidden": 0, + "label": "Exchange Rate", + "no_copy": 0, + "oldfieldname": "conversion_rate", + "oldfieldtype": "Currency", + "permlevel": 0, + "print_hide": 1, + "reqd": 1 + }, + { + "fieldname": "cb_price_list", + "fieldtype": "Column Break", + "permlevel": 0 + }, + { + "fieldname": "buying_price_list", + "fieldtype": "Link", + "label": "Price List", + "options": "Price List", + "permlevel": 0, + "print_hide": 1 + }, + { + "fieldname": "price_list_currency", + "fieldtype": "Link", + "label": "Price List Currency", + "options": "Currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "plc_conversion_rate", + "fieldtype": "Float", + "label": "Price List Exchange Rate", + "permlevel": 0, + "print_hide": 1 + }, + { + "fieldname": "ignore_pricing_rule", + "fieldtype": "Check", + "label": "Ignore Pricing Rule", + "no_copy": 1, + "permlevel": 1, + "print_hide": 1 + }, + { + "fieldname": "items", + "fieldtype": "Section Break", + "label": "Items", + "oldfieldtype": "Section Break", + "options": "icon-shopping-cart", + "permlevel": 0 + }, + { + "allow_on_submit": 1, + "fieldname": "po_details", + "fieldtype": "Table", + "label": "Purchase Order Items", + "no_copy": 0, + "oldfieldname": "po_details", + "oldfieldtype": "Table", + "options": "Purchase Order Item", + "permlevel": 0 + }, + { + "fieldname": "sb_last_purchase", + "fieldtype": "Section Break", + "permlevel": 0 + }, + { + "fieldname": "net_total", + "fieldtype": "Currency", + "label": "Net Total (Company Currency)", + "no_copy": 1, + "oldfieldname": "net_total", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, + "reqd": 0 + }, + { + "fieldname": "column_break_26", + "fieldtype": "Column Break", + "permlevel": 0 + }, + { + "fieldname": "net_total_import", + "fieldtype": "Currency", + "label": "Net Total", + "no_copy": 0, + "oldfieldname": "net_total_import", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "print_hide": 0, + "read_only": 1 + }, + { + "fieldname": "get_last_purchase_rate", + "fieldtype": "Button", + "label": "Get Last Purchase Rate", + "oldfieldtype": "Button", + "permlevel": 0, + "print_hide": 0 + }, + { + "fieldname": "taxes", + "fieldtype": "Section Break", + "label": "Taxes and Charges", + "oldfieldtype": "Section Break", + "options": "icon-money", + "permlevel": 0, + "print_hide": 0 + }, + { + "description": "If you have created a standard template in Purchase Taxes and Charges Master, select one and click on the button below.", + "fieldname": "taxes_and_charges", + "fieldtype": "Link", + "label": "Taxes and Charges", + "no_copy": 0, + "oldfieldname": "purchase_other_charges", + "oldfieldtype": "Link", + "options": "Purchase Taxes and Charges Master", + "permlevel": 0, + "print_hide": 1 + }, + { + "fieldname": "other_charges", + "fieldtype": "Table", + "label": "Purchase Taxes and Charges", + "no_copy": 0, + "oldfieldname": "purchase_tax_details", + "oldfieldtype": "Table", + "options": "Purchase Taxes and Charges", + "permlevel": 0 + }, + { + "fieldname": "other_charges_calculation", + "fieldtype": "HTML", + "label": "Taxes and Charges Calculation", + "no_copy": 1, + "oldfieldtype": "HTML", + "permlevel": 0, + "print_hide": 1 + }, + { + "fieldname": "totals", + "fieldtype": "Section Break", + "label": "Totals", + "oldfieldtype": "Section Break", + "options": "icon-money", + "permlevel": 0 + }, + { + "fieldname": "other_charges_added", + "fieldtype": "Currency", + "label": "Taxes and Charges Added (Company Currency)", + "no_copy": 0, + "oldfieldname": "other_charges_added", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "other_charges_deducted", + "fieldtype": "Currency", + "label": "Taxes and Charges Deducted (Company Currency)", + "no_copy": 0, + "oldfieldname": "other_charges_deducted", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "total_tax", + "fieldtype": "Currency", + "label": "Total Tax (Company Currency)", + "no_copy": 1, + "oldfieldname": "total_tax", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "grand_total", + "fieldtype": "Currency", + "label": "Grand Total (Company Currency)", + "no_copy": 1, + "oldfieldname": "grand_total", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "description": "In Words will be visible once you save the Purchase Order.", + "fieldname": "in_words", + "fieldtype": "Data", + "label": "In Words (Company Currency)", + "oldfieldname": "in_words", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "rounded_total", + "fieldtype": "Currency", + "label": "Rounded Total (Company Currency)", + "oldfieldname": "rounded_total", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "advance_paid", + "fieldtype": "Currency", + "label": "Advance Paid", + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "column_break4", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "print_hide": 0 + }, + { + "fieldname": "other_charges_added_import", + "fieldtype": "Currency", + "label": "Taxes and Charges Added", + "no_copy": 0, + "oldfieldname": "other_charges_added_import", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, + "report_hide": 0 + }, + { + "fieldname": "other_charges_deducted_import", + "fieldtype": "Currency", + "label": "Taxes and Charges Deducted", + "no_copy": 0, + "oldfieldname": "other_charges_deducted_import", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, + "report_hide": 0 + }, + { + "fieldname": "grand_total_import", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Grand Total", + "no_copy": 0, + "oldfieldname": "grand_total_import", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "print_hide": 0, + "read_only": 1, + "report_hide": 0 + }, + { + "fieldname": "in_words_import", + "fieldtype": "Data", + "label": "In Words", + "oldfieldname": "in_words_import", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 0, + "read_only": 1 + }, + { + "fieldname": "fold", + "fieldtype": "Fold", + "permlevel": 0 + }, + { + "fieldname": "terms_section_break", + "fieldtype": "Section Break", + "label": "Terms and Conditions", + "oldfieldtype": "Section Break", + "options": "icon-legal", + "permlevel": 0 + }, + { + "fieldname": "tc_name", + "fieldtype": "Link", + "label": "Terms", + "oldfieldname": "tc_name", + "oldfieldtype": "Link", + "options": "Terms and Conditions", + "permlevel": 0, + "print_hide": 1 + }, + { + "fieldname": "terms", + "fieldtype": "Text Editor", + "label": "Terms and Conditions", + "oldfieldname": "terms", + "oldfieldtype": "Text Editor", + "permlevel": 0 + }, + { + "depends_on": "supplier", + "fieldname": "contact_section", + "fieldtype": "Section Break", + "label": "Contact Info", + "options": "icon-bullhorn", + "permlevel": 0 + }, + { + "fieldname": "supplier_address", + "fieldtype": "Link", + "in_filter": 1, + "label": "Supplier Address", + "options": "Address", + "permlevel": 0, + "print_hide": 1 + }, + { + "fieldname": "cb_contact", + "fieldtype": "Column Break", + "permlevel": 0 + }, + { + "fieldname": "contact_person", + "fieldtype": "Link", + "in_filter": 1, + "label": "Contact Person", + "options": "Contact", + "permlevel": 0, + "print_hide": 1 + }, + { + "fieldname": "more_info", + "fieldtype": "Section Break", + "label": "More Info", + "oldfieldtype": "Section Break", + "permlevel": 0 + }, + { + "fieldname": "status", + "fieldtype": "Select", + "in_filter": 1, + "label": "Status", + "no_copy": 1, + "oldfieldname": "status", + "oldfieldtype": "Select", + "options": "\nDraft\nSubmitted\nStopped\nCancelled", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, + "reqd": 1, + "search_index": 1 + }, + { + "default": "No", + "fieldname": "is_subcontracted", + "fieldtype": "Select", + "label": "Is Subcontracted", + "options": "\nYes\nNo", + "permlevel": 0, + "print_hide": 1 + }, + { + "fieldname": "ref_sq", + "fieldtype": "Data", + "hidden": 1, + "label": "Ref SQ", + "no_copy": 1, + "oldfieldname": "ref_sq", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "allow_on_submit": 1, + "fieldname": "letter_head", + "fieldtype": "Link", + "label": "Letter Head", + "oldfieldname": "letter_head", + "oldfieldtype": "Select", + "options": "Letter Head", + "permlevel": 0, + "print_hide": 1 + }, + { + "fieldname": "fiscal_year", + "fieldtype": "Link", + "in_filter": 1, + "label": "Fiscal Year", + "no_copy": 0, + "oldfieldname": "fiscal_year", + "oldfieldtype": "Select", + "options": "Fiscal Year", + "permlevel": 0, + "print_hide": 1, + "reqd": 1, + "search_index": 1 + }, + { + "allow_on_submit": 1, + "fieldname": "select_print_heading", + "fieldtype": "Link", + "label": "Print Heading", + "no_copy": 1, + "oldfieldname": "select_print_heading", + "oldfieldtype": "Link", + "options": "Print Heading", + "permlevel": 0, + "print_hide": 1, + "report_hide": 1 + }, + { + "fieldname": "column_break5", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "print_hide": 1, + "print_width": "50%", + "width": "50%" + }, + { + "depends_on": "eval:!doc.__islocal", + "description": "% of materials received against this Purchase Order", + "fieldname": "per_received", + "fieldtype": "Percent", + "in_list_view": 1, + "label": "% Received", + "no_copy": 1, + "oldfieldname": "per_received", + "oldfieldtype": "Currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "depends_on": "eval:!doc.__islocal", + "description": "% of materials billed against this Purchase Order.", + "fieldname": "per_billed", + "fieldtype": "Percent", + "in_list_view": 1, + "label": "% Billed", + "no_copy": 1, + "oldfieldname": "per_billed", + "oldfieldtype": "Currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, + { + "description": "Required raw materials issued to the supplier for producing a sub - contracted item.", + "fieldname": "raw_material_details", + "fieldtype": "Section Break", + "label": "Raw Materials Supplied", + "oldfieldtype": "Section Break", + "options": "icon-truck", + "permlevel": 0, + "print_hide": 1 + }, + { + "allow_on_submit": 1, + "fieldname": "po_raw_material_details", + "fieldtype": "Table", + "label": "Purchase Order Items Supplied", + "no_copy": 0, + "oldfieldname": "po_raw_material_details", + "oldfieldtype": "Table", + "options": "Purchase Order Item Supplied", + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + }, { "fieldname": "recurring_order", "fieldtype": "Section Break", @@ -765,92 +765,81 @@ "no_copy": 1, "permlevel": 0, "print_hide": 1 + } + ], + "icon": "icon-file-text", + "idx": 1, + "is_submittable": 1, + "modified": "2014-09-18 03:16:06.299317", + "modified_by": "Administrator", + "module": "Buying", + "name": "Purchase Order", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 1, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 0, + "permlevel": 0, + "print": 0, + "read": 1, + "report": 1, + "role": "Material User", + "submit": 0, + "write": 0 }, { - "fieldname": "against_income_account", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Against Income Account", - "no_copy": 1, + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, "permlevel": 0, - "print_hide": 1, - "report_hide": 1 -} -], -"icon": "icon-file-text", -"idx": 1, -"is_submittable": 1, -"modified": "2014-09-10 05:35:32.583024", -"modified_by": "Administrator", -"module": "Buying", -"name": "Purchase Order", -"owner": "Administrator", -"permissions": [ -{ -"amend": 0, -"apply_user_permissions": 1, -"cancel": 0, -"create": 0, -"delete": 0, -"email": 0, -"permlevel": 0, -"print": 0, -"read": 1, -"report": 1, -"role": "Material User", -"submit": 0, -"write": 0 -}, -{ -"amend": 1, -"cancel": 1, -"create": 1, -"delete": 1, -"email": 1, -"permlevel": 0, -"print": 1, -"read": 1, -"report": 1, -"role": "Purchase Manager", -"submit": 1, -"write": 1 -}, -{ -"amend": 1, -"apply_user_permissions": 1, -"cancel": 1, -"create": 1, -"delete": 1, -"email": 1, -"permlevel": 0, -"print": 1, -"read": 1, -"report": 1, -"role": "Purchase User", -"submit": 1, -"write": 1 -}, -{ -"apply_user_permissions": 1, -"cancel": 0, -"delete": 0, -"email": 1, -"permlevel": 0, -"print": 1, -"read": 1, -"report": 1, -"role": "Supplier" -}, -{ -"permlevel": 1, -"read": 1, -"role": "Purchase Manager", -"write": 1 -} -], -"read_only_onload": 1, -"search_fields": "status, transaction_date, supplier,grand_total", -"sort_field": "modified", -"sort_order": "DESC" -} - + "print": 1, + "read": 1, + "report": 1, + "role": "Purchase Manager", + "submit": 1, + "write": 1 + }, + { + "amend": 1, + "apply_user_permissions": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Purchase User", + "submit": 1, + "write": 1 + }, + { + "apply_user_permissions": 1, + "cancel": 0, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Supplier" + }, + { + "permlevel": 1, + "read": 1, + "role": "Purchase Manager", + "write": 1 + } + ], + "read_only_onload": 1, + "search_fields": "status, transaction_date, supplier,grand_total", + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py index 5ad874718a1..0bfd3e558b7 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/purchase_order.py @@ -6,9 +6,6 @@ import frappe from frappe.utils import cstr, flt from frappe import msgprint, _, throw from frappe.model.mapper import get_mapped_doc - -from erpnext.controllers.recurring_document import convert_to_recurring, validate_recurring_document - from erpnext.controllers.buying_controller import BuyingController form_grid_templates = { @@ -55,8 +52,6 @@ class PurchaseOrder(BuyingController): self.validate_for_subcontracting() self.validate_minimum_order_qty() self.create_raw_materials_supplied("po_raw_material_details") - - validate_recurring_document(self) def validate_with_previous_doc(self): super(PurchaseOrder, self).validate_with_previous_doc(self.tname, { @@ -167,6 +162,8 @@ class PurchaseOrder(BuyingController): msgprint(_("Status of {0} {1} is now {2}").format(self.doctype, self.name, status)) def on_submit(self): + super(PurchaseOrder, self).on_submit() + purchase_controller = frappe.get_doc("Purchase Common") self.update_prevdoc_status() @@ -178,8 +175,6 @@ class PurchaseOrder(BuyingController): purchase_controller.update_last_purchase_rate(self, is_submit = 1) frappe.db.set(self,'status','Submitted') - - convert_to_recurring(self, self.transaction_date) def on_cancel(self): pc_obj = frappe.get_doc('Purchase Common') @@ -204,10 +199,6 @@ class PurchaseOrder(BuyingController): def on_update(self): pass - def on_update_after_submit(self): - validate_recurring_document(self) - convert_to_recurring(self, self.transaction_date) - def set_missing_values(source, target): target.ignore_pricing_rule = 1 target.run_method("set_missing_values") diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py index 0c9f912dbbc..83853dd7f34 100644 --- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py @@ -109,7 +109,6 @@ class TestPurchaseOrder(unittest.TestCase): def test_recurring_order(self): from erpnext.controllers.tests.test_recurring_document import test_recurring_document - test_recurring_document(self, test_records) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 7fa81c99267..4c6c332d371 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -4,12 +4,11 @@ from __future__ import unicode_literals import frappe from frappe import _, throw -from frappe.utils import add_days, cint, cstr, today, date_diff, flt, getdate, nowdate, \ - get_first_day, get_last_day -from frappe.model.naming import make_autoname +from frappe.utils import cint, today, flt from erpnext.setup.utils import get_company_currency, get_exchange_rate from erpnext.accounts.utils import get_fiscal_year, validate_fiscal_year from erpnext.utilities.transaction_base import TransactionBase +from erpnext.controllers.recurring_document import convert_to_recurring, validate_recurring_document import json class AccountsController(TransactionBase): @@ -24,6 +23,24 @@ class AccountsController(TransactionBase): self.validate_for_freezed_account() + if self.meta.get_field("is_recurring"): + validate_recurring_document(self) + + def on_submit(self): + if self.meta.get_field("is_recurring"): + convert_to_recurring(self, self.get("posting_date") or self.get("transaction_date")) + + def on_update_after_submit(self): + if self.meta.get_field("is_recurring"): + validate_recurring_document(self) + convert_to_recurring(self, self.get("posting_date") or self.get("transaction_date")) + + def before_recurring(self): + self.fiscal_year = None + for fieldname in ("due_date", "aging_date"): + if self.meta.get_field(fieldname): + self.set(fieldname, None) + def set_missing_values(self, for_validate=False): for fieldname in ["posting_date", "transaction_date"]: if not self.get(fieldname) and self.meta.get_field(fieldname): @@ -421,7 +438,6 @@ class AccountsController(TransactionBase): max_allowed_amt = flt(ref_amt * (100 + tolerance) / 100) if total_billed_amt - max_allowed_amt > 0.01: - reduce_by = total_billed_amt - max_allowed_amt frappe.throw(_("Cannot overbill for Item {0} in row {0} more than {1}. To allow overbilling, please set in Stock Settings").format(item.item_code, item.idx, max_allowed_amt)) def get_company_default(self, fieldname): diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index a3f59082f69..69ab6616160 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -4,10 +4,7 @@ from __future__ import unicode_literals import frappe from frappe import _, msgprint - -from frappe.utils import add_days, cint, cstr, today, date_diff, flt, rounded, getdate, nowdate, \ - get_first_day, get_last_day -from frappe.model.naming import make_autoname +from frappe.utils import flt, rounded from erpnext.setup.utils import get_company_currency from erpnext.accounts.party import get_party_details diff --git a/erpnext/controllers/recurring_document.py b/erpnext/controllers/recurring_document.py index 7c8321493b5..fa7f275309a 100644 --- a/erpnext/controllers/recurring_document.py +++ b/erpnext/controllers/recurring_document.py @@ -12,6 +12,12 @@ from erpnext.accounts.party import get_party_account, get_due_date, get_party_de from frappe.model.mapper import get_mapped_doc month_map = {'Monthly': 1, 'Quarterly': 3, 'Half-yearly': 6, 'Yearly': 12} +date_field_map = { + "Sales Order": "transaction_date", + "Sales Invoice": "posting_date", + "Purchase Order": "transaction_date", + "Purchase Invoice": "posting_date" +} def create_recurring_documents(): manage_recurring_documents("Sales Order") @@ -26,14 +32,7 @@ def manage_recurring_documents(doctype, next_date=None, commit=True): """ next_date = next_date or nowdate() - if doctype == "Sales Order": - date_field = "transaction_date" - elif doctype == "Sales Invoice": - date_field = "posting_date" - elif doctype == "Purchase Order": - date_field = "transaction_date" - elif doctype == "Purchase Invoice": - date_field = "posting_date" + date_field = date_field_map[doctype] recurring_documents = frappe.db.sql("""select name, recurring_id from `tab{}` where ifnull(is_recurring, 0)=1 @@ -60,9 +59,10 @@ def manage_recurring_documents(doctype, next_date=None, commit=True): frappe.db.begin() frappe.db.sql("update `tab%s` \ - set is_recurring = 0 where name = %s" % (doctype, '%s'), + set is_recurring = 0 where name = %s" % (doctype, '%s'), (ref_document)) - notify_errors(ref_document, doctype, ref_wrapper.customer, ref_wrapper.owner) + notify_errors(ref_document, doctype, ref_wrapper.get("customer") or ref_wrapper.get("supplier"), + ref_wrapper.owner) frappe.db.commit() exception_list.append(frappe.get_traceback()) @@ -129,7 +129,7 @@ def send_notification(new_rv): "fcontent": frappe.get_print_format(new_rv.doctype, new_rv.name, as_pdf=True) }]) -def notify_errors(doc, doctype, customer, owner): +def notify_errors(doc, doctype, party, owner): from frappe.utils.user import get_system_managers recipients = get_system_managers(only_name=True) @@ -138,7 +138,7 @@ def notify_errors(doc, doctype, customer, owner): message = frappe.get_template("templates/emails/recurring_document_failed.html").render({ "type": doctype, "name": doc, - "customer": customer + "party": party })) assign_task_to_owner(doc, doctype, "Recurring Invoice Failed", recipients) diff --git a/erpnext/controllers/tests/test_recurring_document.py b/erpnext/controllers/tests/test_recurring_document.py index 10510824884..e5c6513147e 100644 --- a/erpnext/controllers/tests/test_recurring_document.py +++ b/erpnext/controllers/tests/test_recurring_document.py @@ -2,12 +2,8 @@ # License: GNU General Public License v3. See license.txt import frappe -import unittest, json, copy -from frappe.utils import flt import frappe.permissions -from erpnext.accounts.utils import get_stock_and_account_difference -from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory -from erpnext.projects.doctype.time_log_batch.test_time_log_batch import * +from erpnext.controllers.recurring_document import date_field_map def test_recurring_document(obj, test_records): from frappe.utils import get_first_day, get_last_day, add_to_date, nowdate, getdate, add_days @@ -27,34 +23,11 @@ def test_recurring_document(obj, test_records): "to_date": get_last_day(today) }) - if base_doc.doctype == "Sales Order": - base_doc.update({ - "transaction_date": today, - "delivery_date": add_days(today, 15) - }) - elif base_doc.doctype == "Sales Invoice": - base_doc.update({ - "posting_date": today - }) + date_field = date_field_map[base_doc.doctype] + base_doc.set(date_field, today) if base_doc.doctype == "Sales Order": - date_field = "transaction_date" - elif base_doc.doctype == "Sales Invoice": - date_field = "posting_date" - #for Purchase order/purchase invoice - if base_doc.doctype == "Purchase Order": - base_doc.update({ - "transaction_date": today - }) - elif base_doc.doctype == "Purchase Invoice": - base_doc.update({ - "posting_date": today - }) - - if base_doc.doctype == "Purchase Order": - date_field = "transaction_date" - elif base_doc.doctype == "Purchase Invoice": - date_field = "posting_date" + base_doc.set("delivery_date", add_days(today, 15)) # monthly doc1 = frappe.copy_doc(base_doc) @@ -142,7 +115,7 @@ def _test_recurring_document(obj, base_doc, date_field, first_and_last_day): next_date = get_next_date(base_doc.get(date_field), no_of_months, base_doc.repeat_on_day_of_month) - + manage_recurring_documents(base_doc.doctype, next_date=next_date, commit=False) recurred_documents = frappe.db.sql("""select name from `tab%s` diff --git a/erpnext/public/js/transaction.js b/erpnext/public/js/transaction.js index d5209c18744..3a124850199 100644 --- a/erpnext/public/js/transaction.js +++ b/erpnext/public/js/transaction.js @@ -155,7 +155,7 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ project_name: item.project_name || me.frm.doc.project_name } }, - + callback: function(r) { if(!r.exc) { me.frm.script_manager.trigger("price_list_rate", cdt, cdn); @@ -827,4 +827,35 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ .appendTo($(this.frm.fields_dict.other_charges_calculation.wrapper).empty()); } }, + + is_recurring: function() { + // set default values for recurring documents + if(this.frm.doc.is_recurring) { + var owner_email = this.frm.doc.owner=="Administrator" + ? frappe.user_info("Administrator").email + : this.frm.doc.owner; + + this.frm.doc.notification_email_address = $.map([cstr(owner_email), + cstr(this.frm.doc.contact_email)], function(v) { return v || null; }).join(", "); + this.frm.doc.repeat_on_day_of_month = frappe.datetime.str_to_obj(this.frm.doc.posting_date).getDate(); + } + + refresh_many(["notification_email_address", "repeat_on_day_of_month"]); + }, + + from_date: function() { + // set to_date + if(this.frm.doc.from_date) { + var recurring_type_map = {'Monthly': 1, 'Quarterly': 3, 'Half-yearly': 6, + 'Yearly': 12}; + + var months = recurring_type_map[this.frm.doc.recurring_type]; + if(months) { + var to_date = frappe.datetime.add_months(this.frm.doc.from_date, + months); + this.frm.doc.to_date = frappe.datetime.add_days(to_date, -1); + refresh_field('to_date'); + } + } + } }); diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js index 4797230ad07..628e43e1dfb 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.js +++ b/erpnext/selling/doctype/sales_order/sales_order.js @@ -195,37 +195,6 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) { } }; -cur_frm.cscript.is_recurring = function(doc, dt, dn) { - // set default values for recurring orders - if(doc.is_recurring) { - var owner_email = doc.owner=="Administrator" - ? frappe.user_info("Administrator").email - : doc.owner; - - doc.notification_email_address = $.map([cstr(owner_email), - cstr(doc.contact_email)], function(v) { return v || null; }).join(", "); - doc.repeat_on_day_of_month = frappe.datetime.str_to_obj(doc.posting_date).getDate(); - } - - refresh_many(["notification_email_address", "repeat_on_day_of_month"]); -} - -cur_frm.cscript.from_date = function(doc, dt, dn) { - // set to_date - if(doc.from_date) { - var recurring_type_map = {'Monthly': 1, 'Quarterly': 3, 'Half-yearly': 6, - 'Yearly': 12}; - - var months = recurring_type_map[doc.recurring_type]; - if(months) { - var to_date = frappe.datetime.add_months(doc.from_date, - months); - doc.to_date = frappe.datetime.add_days(to_date, -1); - refresh_field('to_date'); - } - } -} - cur_frm.cscript.send_sms = function() { frappe.require("assets/erpnext/js/sms_manager.js"); var sms_man = new SMSManager(cur_frm.doc); diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json index 844e8cd2e0f..c22ed3f48de 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.json +++ b/erpnext/selling/doctype/sales_order/sales_order.json @@ -1,1122 +1,1112 @@ { - "allow_import": 1, - "autoname": "naming_series:", - "creation": "2013-06-18 12:39:59", - "docstatus": 0, - "doctype": "DocType", - "document_type": "Transaction", + "allow_import": 1, + "autoname": "naming_series:", + "creation": "2013-06-18 12:39:59", + "docstatus": 0, + "doctype": "DocType", + "document_type": "Transaction", "fields": [ { - "fieldname": "customer_section", - "fieldtype": "Section Break", - "label": "Customer", - "options": "icon-user", + "fieldname": "customer_section", + "fieldtype": "Section Break", + "label": "Customer", + "options": "icon-user", "permlevel": 0 - }, + }, { - "fieldname": "column_break0", - "fieldtype": "Column Break", - "in_filter": 0, - "oldfieldtype": "Column Break", - "permlevel": 0, - "search_index": 0, + "fieldname": "column_break0", + "fieldtype": "Column Break", + "in_filter": 0, + "oldfieldtype": "Column Break", + "permlevel": 0, + "search_index": 0, "width": "50%" - }, + }, { - "fieldname": "naming_series", - "fieldtype": "Select", - "label": "Series", - "no_copy": 1, - "oldfieldname": "naming_series", - "oldfieldtype": "Select", - "options": "SO-", - "permlevel": 0, - "print_hide": 1, + "fieldname": "naming_series", + "fieldtype": "Select", + "label": "Series", + "no_copy": 1, + "oldfieldname": "naming_series", + "oldfieldtype": "Select", + "options": "SO-", + "permlevel": 0, + "print_hide": 1, "reqd": 1 - }, + }, { - "fieldname": "customer", - "fieldtype": "Link", - "in_filter": 1, - "in_list_view": 1, - "label": "Customer", - "oldfieldname": "customer", - "oldfieldtype": "Link", - "options": "Customer", - "permlevel": 0, - "print_hide": 1, - "reqd": 1, + "fieldname": "customer", + "fieldtype": "Link", + "in_filter": 1, + "in_list_view": 1, + "label": "Customer", + "oldfieldname": "customer", + "oldfieldtype": "Link", + "options": "Customer", + "permlevel": 0, + "print_hide": 1, + "reqd": 1, "search_index": 1 - }, + }, { - "fieldname": "customer_name", - "fieldtype": "Data", - "hidden": 0, - "label": "Name", - "permlevel": 0, + "fieldname": "customer_name", + "fieldtype": "Data", + "hidden": 0, + "label": "Name", + "permlevel": 0, "read_only": 1 - }, + }, { - "fieldname": "address_display", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Address", - "permlevel": 0, + "fieldname": "address_display", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Address", + "permlevel": 0, "read_only": 1 - }, + }, { - "fieldname": "contact_display", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Contact", - "permlevel": 0, + "fieldname": "contact_display", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Contact", + "permlevel": 0, "read_only": 1 - }, + }, { - "fieldname": "contact_mobile", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Mobile No", - "permlevel": 0, + "fieldname": "contact_mobile", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Mobile No", + "permlevel": 0, "read_only": 1 - }, + }, { - "fieldname": "contact_email", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Contact Email", - "permlevel": 0, - "print_hide": 1, + "fieldname": "contact_email", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Contact Email", + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "default": "Sales", - "fieldname": "order_type", - "fieldtype": "Select", - "in_list_view": 1, - "label": "Order Type", - "oldfieldname": "order_type", - "oldfieldtype": "Select", - "options": "\nSales\nMaintenance\nShopping Cart", - "permlevel": 0, - "print_hide": 1, + "default": "Sales", + "fieldname": "order_type", + "fieldtype": "Select", + "in_list_view": 1, + "label": "Order Type", + "oldfieldname": "order_type", + "oldfieldtype": "Select", + "options": "\nSales\nMaintenance\nShopping Cart", + "permlevel": 0, + "print_hide": 1, "reqd": 1 - }, + }, { - "fieldname": "column_break1", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, + "fieldname": "column_break1", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, "width": "50%" - }, + }, { - "fieldname": "amended_from", - "fieldtype": "Link", - "hidden": 1, - "ignore_user_permissions": 1, - "label": "Amended From", - "no_copy": 1, - "oldfieldname": "amended_from", - "oldfieldtype": "Data", - "options": "Sales Order", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, + "fieldname": "amended_from", + "fieldtype": "Link", + "hidden": 1, + "ignore_user_permissions": 1, + "label": "Amended From", + "no_copy": 1, + "oldfieldname": "amended_from", + "oldfieldtype": "Data", + "options": "Sales Order", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, "width": "150px" - }, + }, { - "description": "Select the relevant company name if you have multiple companies.", - "fieldname": "company", - "fieldtype": "Link", - "in_filter": 1, - "label": "Company", - "oldfieldname": "company", - "oldfieldtype": "Link", - "options": "Company", - "permlevel": 0, - "print_hide": 1, - "reqd": 1, - "search_index": 1, + "description": "Select the relevant company name if you have multiple companies.", + "fieldname": "company", + "fieldtype": "Link", + "in_filter": 1, + "label": "Company", + "oldfieldname": "company", + "oldfieldtype": "Link", + "options": "Company", + "permlevel": 0, + "print_hide": 1, + "reqd": 1, + "search_index": 1, "width": "150px" - }, + }, { - "default": "Today", - "fieldname": "transaction_date", - "fieldtype": "Date", - "in_filter": 1, - "label": "Date", - "no_copy": 1, - "oldfieldname": "transaction_date", - "oldfieldtype": "Date", - "permlevel": 0, - "print_hide": 0, - "reqd": 1, - "search_index": 1, + "default": "Today", + "fieldname": "transaction_date", + "fieldtype": "Date", + "in_filter": 1, + "label": "Date", + "no_copy": 1, + "oldfieldname": "transaction_date", + "oldfieldtype": "Date", + "permlevel": 0, + "print_hide": 0, + "reqd": 1, + "search_index": 1, "width": "160px" - }, + }, { - "depends_on": "eval:doc.order_type == 'Sales'", - "fieldname": "delivery_date", - "fieldtype": "Date", - "hidden": 0, - "in_filter": 1, - "label": "Delivery Date", - "oldfieldname": "delivery_date", - "oldfieldtype": "Date", - "permlevel": 0, - "print_hide": 1, - "reqd": 0, - "search_index": 1, + "depends_on": "eval:doc.order_type == 'Sales'", + "fieldname": "delivery_date", + "fieldtype": "Date", + "hidden": 0, + "in_filter": 1, + "label": "Delivery Date", + "oldfieldname": "delivery_date", + "oldfieldtype": "Date", + "permlevel": 0, + "print_hide": 1, + "reqd": 0, + "search_index": 1, "width": "160px" - }, + }, { - "allow_on_submit": 1, - "description": "Start date of current order's period", - "fieldname": "from_date", - "fieldtype": "Date", - "label": "From", - "no_copy": 1, + "allow_on_submit": 1, + "description": "Start date of current order's period", + "fieldname": "from_date", + "fieldtype": "Date", + "label": "From Date", + "no_copy": 1, "permlevel": 0 - }, + }, { - "allow_on_submit": 1, - "description": "End date of current order's period", - "fieldname": "to_date", - "fieldtype": "Date", - "label": "To", - "no_copy": 1, + "allow_on_submit": 1, + "description": "End date of current order's period", + "fieldname": "to_date", + "fieldtype": "Date", + "label": "To Date", + "no_copy": 1, "permlevel": 0 - }, + }, { - "description": "Customer's Purchase Order Number", - "fieldname": "po_no", - "fieldtype": "Data", - "hidden": 0, - "label": "PO No", - "oldfieldname": "po_no", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, - "reqd": 0, + "description": "Customer's Purchase Order Number", + "fieldname": "po_no", + "fieldtype": "Data", + "hidden": 0, + "label": "PO No", + "oldfieldname": "po_no", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 0, + "reqd": 0, "width": "100px" - }, + }, { - "depends_on": "eval:doc.po_no", - "description": "Customer's Purchase Order Date", - "fieldname": "po_date", - "fieldtype": "Date", - "hidden": 0, - "label": "PO Date", - "oldfieldname": "po_date", - "oldfieldtype": "Date", - "permlevel": 0, - "print_hide": 0, - "reqd": 0, + "depends_on": "eval:doc.po_no", + "description": "Customer's Purchase Order Date", + "fieldname": "po_date", + "fieldtype": "Date", + "hidden": 0, + "label": "PO Date", + "oldfieldname": "po_date", + "oldfieldtype": "Date", + "permlevel": 0, + "print_hide": 0, + "reqd": 0, "width": "100px" - }, + }, { - "fieldname": "shipping_address_name", - "fieldtype": "Link", - "hidden": 1, - "in_filter": 1, - "label": "Shipping Address", - "options": "Address", - "permlevel": 0, - "print_hide": 1, + "fieldname": "shipping_address_name", + "fieldtype": "Link", + "hidden": 1, + "in_filter": 1, + "label": "Shipping Address", + "options": "Address", + "permlevel": 0, + "print_hide": 1, "read_only": 0 - }, + }, { - "fieldname": "shipping_address", - "fieldtype": "Small Text", - "hidden": 1, - "in_filter": 0, - "label": "Shipping Address", - "permlevel": 0, - "print_hide": 1, + "fieldname": "shipping_address", + "fieldtype": "Small Text", + "hidden": 1, + "in_filter": 0, + "label": "Shipping Address", + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "fieldname": "sec_break45", - "fieldtype": "Section Break", - "label": "Currency and Price List", - "options": "icon-tag", - "permlevel": 0, + "fieldname": "sec_break45", + "fieldtype": "Section Break", + "label": "Currency and Price List", + "options": "icon-tag", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "currency", - "fieldtype": "Link", - "label": "Currency", - "oldfieldname": "currency", - "oldfieldtype": "Select", - "options": "Currency", - "permlevel": 0, - "print_hide": 1, - "reqd": 1, + "fieldname": "currency", + "fieldtype": "Link", + "label": "Currency", + "oldfieldname": "currency", + "oldfieldtype": "Select", + "options": "Currency", + "permlevel": 0, + "print_hide": 1, + "reqd": 1, "width": "100px" - }, + }, { - "description": "Rate at which customer's currency is converted to company's base currency", - "fieldname": "conversion_rate", - "fieldtype": "Float", - "label": "Exchange Rate", - "oldfieldname": "conversion_rate", - "oldfieldtype": "Currency", - "permlevel": 0, - "print_hide": 1, - "reqd": 1, + "description": "Rate at which customer's currency is converted to company's base currency", + "fieldname": "conversion_rate", + "fieldtype": "Float", + "label": "Exchange Rate", + "oldfieldname": "conversion_rate", + "oldfieldtype": "Currency", + "permlevel": 0, + "print_hide": 1, + "reqd": 1, "width": "100px" - }, + }, { - "fieldname": "column_break2", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "column_break2", + "fieldtype": "Column Break", + "permlevel": 0, "width": "50%" - }, + }, { - "fieldname": "selling_price_list", - "fieldtype": "Link", - "label": "Price List", - "oldfieldname": "price_list_name", - "oldfieldtype": "Select", - "options": "Price List", - "permlevel": 0, - "print_hide": 1, - "reqd": 1, + "fieldname": "selling_price_list", + "fieldtype": "Link", + "label": "Price List", + "oldfieldname": "price_list_name", + "oldfieldtype": "Select", + "options": "Price List", + "permlevel": 0, + "print_hide": 1, + "reqd": 1, "width": "100px" - }, + }, { - "fieldname": "price_list_currency", - "fieldtype": "Link", - "label": "Price List Currency", - "options": "Currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, + "fieldname": "price_list_currency", + "fieldtype": "Link", + "label": "Price List Currency", + "options": "Currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, "reqd": 1 - }, + }, { - "description": "Rate at which Price list currency is converted to company's base currency", - "fieldname": "plc_conversion_rate", - "fieldtype": "Float", - "label": "Price List Exchange Rate", - "permlevel": 0, - "print_hide": 1, + "description": "Rate at which Price list currency is converted to company's base currency", + "fieldname": "plc_conversion_rate", + "fieldtype": "Float", + "label": "Price List Exchange Rate", + "permlevel": 0, + "print_hide": 1, "reqd": 1 - }, + }, { - "fieldname": "ignore_pricing_rule", - "fieldtype": "Check", - "label": "Ignore Pricing Rule", - "no_copy": 1, - "permlevel": 1, + "fieldname": "ignore_pricing_rule", + "fieldtype": "Check", + "label": "Ignore Pricing Rule", + "no_copy": 1, + "permlevel": 1, "print_hide": 1 - }, + }, { - "fieldname": "items", - "fieldtype": "Section Break", - "label": "Items", - "oldfieldtype": "Section Break", - "options": "icon-shopping-cart", + "fieldname": "items", + "fieldtype": "Section Break", + "label": "Items", + "oldfieldtype": "Section Break", + "options": "icon-shopping-cart", "permlevel": 0 - }, + }, { - "allow_on_submit": 1, - "fieldname": "sales_order_details", - "fieldtype": "Table", - "label": "Sales Order Items", - "oldfieldname": "sales_order_details", - "oldfieldtype": "Table", - "options": "Sales Order Item", - "permlevel": 0, - "print_hide": 0, + "allow_on_submit": 1, + "fieldname": "sales_order_details", + "fieldtype": "Table", + "label": "Sales Order Items", + "oldfieldname": "sales_order_details", + "oldfieldtype": "Table", + "options": "Sales Order Item", + "permlevel": 0, + "print_hide": 0, "reqd": 1 - }, + }, { - "fieldname": "section_break_31", - "fieldtype": "Section Break", + "fieldname": "section_break_31", + "fieldtype": "Section Break", "permlevel": 0 - }, + }, { - "fieldname": "column_break_33a", - "fieldtype": "Column Break", + "fieldname": "column_break_33a", + "fieldtype": "Column Break", "permlevel": 0 - }, + }, { - "fieldname": "column_break_33", - "fieldtype": "Column Break", + "fieldname": "column_break_33", + "fieldtype": "Column Break", "permlevel": 0 - }, + }, { - "fieldname": "net_total_export", - "fieldtype": "Currency", - "label": "Net Total", - "options": "currency", - "permlevel": 0, + "fieldname": "net_total_export", + "fieldtype": "Currency", + "label": "Net Total", + "options": "currency", + "permlevel": 0, "read_only": 1 - }, + }, { - "fieldname": "net_total", - "fieldtype": "Currency", - "label": "Net Total (Company Currency)", - "oldfieldname": "net_total", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, - "reqd": 0, + "fieldname": "net_total", + "fieldtype": "Currency", + "label": "Net Total (Company Currency)", + "oldfieldname": "net_total", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, + "reqd": 0, "width": "150px" - }, + }, { - "fieldname": "taxes", - "fieldtype": "Section Break", - "label": "Taxes and Charges", - "oldfieldtype": "Section Break", - "options": "icon-money", - "permlevel": 0, + "fieldname": "taxes", + "fieldtype": "Section Break", + "label": "Taxes and Charges", + "oldfieldtype": "Section Break", + "options": "icon-money", + "permlevel": 0, "print_hide": 0 - }, + }, { - "fieldname": "taxes_and_charges", - "fieldtype": "Link", - "label": "Taxes and Charges", - "oldfieldname": "charge", - "oldfieldtype": "Link", - "options": "Sales Taxes and Charges Master", - "permlevel": 0, + "fieldname": "taxes_and_charges", + "fieldtype": "Link", + "label": "Taxes and Charges", + "oldfieldname": "charge", + "oldfieldtype": "Link", + "options": "Sales Taxes and Charges Master", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "column_break_38", - "fieldtype": "Column Break", + "fieldname": "column_break_38", + "fieldtype": "Column Break", "permlevel": 0 - }, + }, { - "fieldname": "shipping_rule", - "fieldtype": "Link", - "label": "Shipping Rule", - "oldfieldtype": "Button", - "options": "Shipping Rule", - "permlevel": 0, + "fieldname": "shipping_rule", + "fieldtype": "Link", + "label": "Shipping Rule", + "oldfieldtype": "Button", + "options": "Shipping Rule", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "section_break_40", - "fieldtype": "Section Break", + "fieldname": "section_break_40", + "fieldtype": "Section Break", "permlevel": 0 - }, + }, { - "fieldname": "other_charges", - "fieldtype": "Table", - "label": "Sales Taxes and Charges", - "oldfieldname": "other_charges", - "oldfieldtype": "Table", - "options": "Sales Taxes and Charges", + "fieldname": "other_charges", + "fieldtype": "Table", + "label": "Sales Taxes and Charges", + "oldfieldname": "other_charges", + "oldfieldtype": "Table", + "options": "Sales Taxes and Charges", "permlevel": 0 - }, + }, { - "fieldname": "other_charges_calculation", - "fieldtype": "HTML", - "label": "Taxes and Charges Calculation", - "oldfieldtype": "HTML", - "permlevel": 0, + "fieldname": "other_charges_calculation", + "fieldtype": "HTML", + "label": "Taxes and Charges Calculation", + "oldfieldtype": "HTML", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "section_break_43", - "fieldtype": "Section Break", + "fieldname": "section_break_43", + "fieldtype": "Section Break", "permlevel": 0 - }, + }, { - "fieldname": "other_charges_total_export", - "fieldtype": "Currency", - "label": "Taxes and Charges Total", - "options": "currency", - "permlevel": 0, - "print_hide": 1, + "fieldname": "other_charges_total_export", + "fieldtype": "Currency", + "label": "Taxes and Charges Total", + "options": "currency", + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "fieldname": "column_break_46", - "fieldtype": "Column Break", + "fieldname": "column_break_46", + "fieldtype": "Column Break", "permlevel": 0 - }, + }, { - "fieldname": "other_charges_total", - "fieldtype": "Currency", - "label": "Taxes and Charges Total (Company Currency)", - "oldfieldname": "other_charges_total", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, + "fieldname": "other_charges_total", + "fieldtype": "Currency", + "label": "Taxes and Charges Total (Company Currency)", + "oldfieldname": "other_charges_total", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, "width": "150px" - }, + }, { - "fieldname": "discount_amount", - "fieldtype": "Currency", - "label": "Discount Amount", - "options": "Company:company:default_currency", + "fieldname": "discount_amount", + "fieldtype": "Currency", + "label": "Discount Amount", + "options": "Company:company:default_currency", "permlevel": 0 - }, + }, { - "fieldname": "totals", - "fieldtype": "Section Break", - "label": "Totals", - "oldfieldtype": "Section Break", - "options": "icon-money", - "permlevel": 0, + "fieldname": "totals", + "fieldtype": "Section Break", + "label": "Totals", + "oldfieldtype": "Section Break", + "options": "icon-money", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "grand_total", - "fieldtype": "Currency", - "label": "Grand Total (Company Currency)", - "oldfieldname": "grand_total", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, - "reqd": 0, + "fieldname": "grand_total", + "fieldtype": "Currency", + "label": "Grand Total (Company Currency)", + "oldfieldname": "grand_total", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, + "reqd": 0, "width": "150px" - }, + }, { - "fieldname": "rounded_total", - "fieldtype": "Currency", - "label": "Rounded Total (Company Currency)", - "oldfieldname": "rounded_total", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, + "fieldname": "rounded_total", + "fieldtype": "Currency", + "label": "Rounded Total (Company Currency)", + "oldfieldname": "rounded_total", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, "width": "150px" - }, + }, { - "description": "In Words will be visible once you save the Sales Order.", - "fieldname": "in_words", - "fieldtype": "Data", - "label": "In Words (Company Currency)", - "oldfieldname": "in_words", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, + "description": "In Words will be visible once you save the Sales Order.", + "fieldname": "in_words", + "fieldtype": "Data", + "label": "In Words (Company Currency)", + "oldfieldname": "in_words", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, "width": "200px" - }, + }, { - "fieldname": "advance_paid", - "fieldtype": "Currency", - "label": "Advance Paid", - "permlevel": 0, - "print_hide": 1, + "fieldname": "advance_paid", + "fieldtype": "Currency", + "label": "Advance Paid", + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "fieldname": "column_break3", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, - "print_hide": 1, + "fieldname": "column_break3", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "print_hide": 1, "width": "50%" - }, + }, { - "fieldname": "grand_total_export", - "fieldtype": "Currency", - "label": "Grand Total", - "oldfieldname": "grand_total_export", - "oldfieldtype": "Currency", - "options": "currency", - "permlevel": 0, - "print_hide": 0, - "read_only": 1, - "reqd": 0, + "fieldname": "grand_total_export", + "fieldtype": "Currency", + "label": "Grand Total", + "oldfieldname": "grand_total_export", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "print_hide": 0, + "read_only": 1, + "reqd": 0, "width": "150px" - }, + }, { - "fieldname": "rounded_total_export", - "fieldtype": "Currency", - "label": "Rounded Total", - "oldfieldname": "rounded_total_export", - "oldfieldtype": "Currency", - "options": "currency", - "permlevel": 0, - "print_hide": 0, - "read_only": 1, + "fieldname": "rounded_total_export", + "fieldtype": "Currency", + "label": "Rounded Total", + "oldfieldname": "rounded_total_export", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "print_hide": 0, + "read_only": 1, "width": "150px" - }, + }, { - "fieldname": "in_words_export", - "fieldtype": "Data", - "label": "In Words", - "oldfieldname": "in_words_export", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, - "read_only": 1, + "fieldname": "in_words_export", + "fieldtype": "Data", + "label": "In Words", + "oldfieldname": "in_words_export", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 0, + "read_only": 1, "width": "200px" - }, + }, { - "fieldname": "view_details", - "fieldtype": "Fold", - "label": "View Details", + "fieldname": "view_details", + "fieldtype": "Fold", + "label": "View Details", "permlevel": 0 - }, + }, { - "description": "Display all the individual items delivered with the main items", - "fieldname": "packing_list", - "fieldtype": "Section Break", - "hidden": 0, - "label": "Packing List", - "oldfieldtype": "Section Break", - "options": "icon-suitcase", - "permlevel": 0, + "description": "Display all the individual items delivered with the main items", + "fieldname": "packing_list", + "fieldtype": "Section Break", + "hidden": 0, + "label": "Packing List", + "oldfieldtype": "Section Break", + "options": "icon-suitcase", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "packing_details", - "fieldtype": "Table", - "label": "Packing Details", - "oldfieldname": "packing_details", - "oldfieldtype": "Table", - "options": "Packed Item", - "permlevel": 0, - "print_hide": 1, + "fieldname": "packing_details", + "fieldtype": "Table", + "label": "Packing Details", + "oldfieldname": "packing_details", + "oldfieldtype": "Table", + "options": "Packed Item", + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "fieldname": "terms_section_break", - "fieldtype": "Section Break", - "label": "Terms and Conditions", - "oldfieldtype": "Section Break", - "options": "icon-legal", - "permlevel": 0, + "fieldname": "terms_section_break", + "fieldtype": "Section Break", + "label": "Terms and Conditions", + "oldfieldtype": "Section Break", + "options": "icon-legal", + "permlevel": 0, "print_hide": 0 - }, + }, { - "fieldname": "tc_name", - "fieldtype": "Link", - "label": "Terms", - "oldfieldname": "tc_name", - "oldfieldtype": "Link", - "options": "Terms and Conditions", - "permlevel": 0, - "print_hide": 1, + "fieldname": "tc_name", + "fieldtype": "Link", + "label": "Terms", + "oldfieldname": "tc_name", + "oldfieldtype": "Link", + "options": "Terms and Conditions", + "permlevel": 0, + "print_hide": 1, "search_index": 0 - }, + }, { - "fieldname": "terms", - "fieldtype": "Text Editor", - "label": "Terms and Conditions Details", - "oldfieldname": "terms", - "oldfieldtype": "Text Editor", - "permlevel": 0, + "fieldname": "terms", + "fieldtype": "Text Editor", + "label": "Terms and Conditions Details", + "oldfieldname": "terms", + "oldfieldtype": "Text Editor", + "permlevel": 0, "print_hide": 0 - }, + }, { - "depends_on": "customer", - "fieldname": "contact_info", - "fieldtype": "Section Break", - "label": "Contact Info", - "options": "icon-bullhorn", + "depends_on": "customer", + "fieldname": "contact_info", + "fieldtype": "Section Break", + "label": "Contact Info", + "options": "icon-bullhorn", "permlevel": 0 - }, + }, { - "fieldname": "col_break45", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "col_break45", + "fieldtype": "Column Break", + "permlevel": 0, "width": "50%" - }, + }, { - "description": "Add / Edit", - "fieldname": "territory", - "fieldtype": "Link", - "in_filter": 1, - "label": "Territory", - "options": "Territory", - "permlevel": 0, - "print_hide": 1, - "reqd": 1, + "description": "Add / Edit", + "fieldname": "territory", + "fieldtype": "Link", + "in_filter": 1, + "label": "Territory", + "options": "Territory", + "permlevel": 0, + "print_hide": 1, + "reqd": 1, "search_index": 1 - }, + }, { - "description": "Add / Edit", - "fieldname": "customer_group", - "fieldtype": "Link", - "in_filter": 1, - "label": "Customer Group", - "options": "Customer Group", - "permlevel": 0, - "print_hide": 1, - "reqd": 1, + "description": "Add / Edit", + "fieldname": "customer_group", + "fieldtype": "Link", + "in_filter": 1, + "label": "Customer Group", + "options": "Customer Group", + "permlevel": 0, + "print_hide": 1, + "reqd": 1, "search_index": 1 - }, + }, { - "fieldname": "col_break46", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "col_break46", + "fieldtype": "Column Break", + "permlevel": 0, "width": "50%" - }, + }, { - "fieldname": "customer_address", - "fieldtype": "Link", - "hidden": 0, - "in_filter": 1, - "label": "Customer Address", - "options": "Address", - "permlevel": 0, + "fieldname": "customer_address", + "fieldtype": "Link", + "hidden": 0, + "in_filter": 1, + "label": "Customer Address", + "options": "Address", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "contact_person", - "fieldtype": "Link", - "in_filter": 1, - "label": "Contact Person", - "options": "Contact", - "permlevel": 0, + "fieldname": "contact_person", + "fieldtype": "Link", + "in_filter": 1, + "label": "Contact Person", + "options": "Contact", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "more_info", - "fieldtype": "Section Break", - "label": "More Info", - "oldfieldtype": "Section Break", - "options": "icon-file-text", - "permlevel": 0, + "fieldname": "more_info", + "fieldtype": "Section Break", + "label": "More Info", + "oldfieldtype": "Section Break", + "options": "icon-file-text", + "permlevel": 0, "print_hide": 1 - }, + }, { - "description": "Track this Sales Order against any Project", - "fieldname": "project_name", - "fieldtype": "Link", - "in_filter": 1, - "label": "Project Name", - "oldfieldname": "project_name", - "oldfieldtype": "Link", - "options": "Project", - "permlevel": 0, + "description": "Track this Sales Order against any Project", + "fieldname": "project_name", + "fieldtype": "Link", + "in_filter": 1, + "label": "Project Name", + "oldfieldname": "project_name", + "oldfieldtype": "Link", + "options": "Project", + "permlevel": 0, "search_index": 1 - }, + }, { - "depends_on": "eval:doc.source == 'Campaign'", - "fieldname": "campaign", - "fieldtype": "Link", - "label": "Campaign", - "oldfieldname": "campaign", - "oldfieldtype": "Link", - "options": "Campaign", - "permlevel": 0, + "depends_on": "eval:doc.source == 'Campaign'", + "fieldname": "campaign", + "fieldtype": "Link", + "label": "Campaign", + "oldfieldname": "campaign", + "oldfieldtype": "Link", + "options": "Campaign", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "source", - "fieldtype": "Select", - "label": "Source", - "oldfieldname": "source", - "oldfieldtype": "Select", - "options": "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign", - "permlevel": 0, + "fieldname": "source", + "fieldtype": "Select", + "label": "Source", + "oldfieldname": "source", + "oldfieldtype": "Select", + "options": "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "column_break4", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, - "print_hide": 1, + "fieldname": "column_break4", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "print_hide": 1, "width": "50%" - }, + }, { - "allow_on_submit": 1, - "fieldname": "letter_head", - "fieldtype": "Link", - "label": "Letter Head", - "oldfieldname": "letter_head", - "oldfieldtype": "Select", - "options": "Letter Head", - "permlevel": 0, + "allow_on_submit": 1, + "fieldname": "letter_head", + "fieldtype": "Link", + "label": "Letter Head", + "oldfieldname": "letter_head", + "oldfieldtype": "Select", + "options": "Letter Head", + "permlevel": 0, "print_hide": 1 - }, + }, { - "allow_on_submit": 1, - "fieldname": "select_print_heading", - "fieldtype": "Link", - "label": "Print Heading", - "no_copy": 1, - "oldfieldname": "select_print_heading", - "oldfieldtype": "Link", - "options": "Print Heading", - "permlevel": 0, - "print_hide": 1, + "allow_on_submit": 1, + "fieldname": "select_print_heading", + "fieldtype": "Link", + "label": "Print Heading", + "no_copy": 1, + "oldfieldname": "select_print_heading", + "oldfieldtype": "Link", + "options": "Print Heading", + "permlevel": 0, + "print_hide": 1, "report_hide": 1 - }, + }, { - "fieldname": "fiscal_year", - "fieldtype": "Link", - "in_filter": 1, - "label": "Fiscal Year", - "oldfieldname": "fiscal_year", - "oldfieldtype": "Select", - "options": "Fiscal Year", - "permlevel": 0, - "print_hide": 1, - "reqd": 1, - "search_index": 1, + "fieldname": "fiscal_year", + "fieldtype": "Link", + "in_filter": 1, + "label": "Fiscal Year", + "oldfieldname": "fiscal_year", + "oldfieldtype": "Select", + "options": "Fiscal Year", + "permlevel": 0, + "print_hide": 1, + "reqd": 1, + "search_index": 1, "width": "150px" - }, + }, { - "fieldname": "section_break_78", - "fieldtype": "Section Break", - "oldfieldtype": "Column Break", - "permlevel": 0, - "print_hide": 1, + "fieldname": "section_break_78", + "fieldtype": "Section Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "print_hide": 1, "width": "50%" - }, + }, { - "default": "Draft", - "fieldname": "status", - "fieldtype": "Select", - "in_filter": 1, - "in_list_view": 1, - "label": "Status", - "no_copy": 1, - "oldfieldname": "status", - "oldfieldtype": "Select", - "options": "\nDraft\nSubmitted\nStopped\nCancelled", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, - "reqd": 1, - "search_index": 1, + "default": "Draft", + "fieldname": "status", + "fieldtype": "Select", + "in_filter": 1, + "in_list_view": 1, + "label": "Status", + "no_copy": 1, + "oldfieldname": "status", + "oldfieldtype": "Select", + "options": "\nDraft\nSubmitted\nStopped\nCancelled", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, + "reqd": 1, + "search_index": 1, "width": "100px" - }, + }, { - "fieldname": "delivery_status", - "fieldtype": "Select", - "hidden": 1, - "label": "Delivery Status", - "no_copy": 1, - "options": "Not Delivered\nFully Delivered\nPartly Delivered\nClosed\nNot Applicable", - "permlevel": 0, + "fieldname": "delivery_status", + "fieldtype": "Select", + "hidden": 1, + "label": "Delivery Status", + "no_copy": 1, + "options": "Not Delivered\nFully Delivered\nPartly Delivered\nClosed\nNot Applicable", + "permlevel": 0, "print_hide": 1 - }, + }, { - "depends_on": "eval:!doc.__islocal", - "description": "% of materials delivered against this Sales Order", - "fieldname": "per_delivered", - "fieldtype": "Percent", - "in_filter": 1, - "in_list_view": 1, - "label": "% Delivered", - "no_copy": 1, - "oldfieldname": "per_delivered", - "oldfieldtype": "Currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, + "depends_on": "eval:!doc.__islocal", + "description": "% of materials delivered against this Sales Order", + "fieldname": "per_delivered", + "fieldtype": "Percent", + "in_filter": 1, + "in_list_view": 1, + "label": "% Delivered", + "no_copy": 1, + "oldfieldname": "per_delivered", + "oldfieldtype": "Currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, "width": "100px" - }, + }, { - "fieldname": "column_break_81", - "fieldtype": "Column Break", + "fieldname": "column_break_81", + "fieldtype": "Column Break", "permlevel": 0 - }, + }, { - "depends_on": "eval:!doc.__islocal", - "description": "% of materials billed against this Sales Order", - "fieldname": "per_billed", - "fieldtype": "Percent", - "in_filter": 1, - "in_list_view": 1, - "label": "% Amount Billed", - "no_copy": 1, - "oldfieldname": "per_billed", - "oldfieldtype": "Currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, + "depends_on": "eval:!doc.__islocal", + "description": "% of materials billed against this Sales Order", + "fieldname": "per_billed", + "fieldtype": "Percent", + "in_filter": 1, + "in_list_view": 1, + "label": "% Amount Billed", + "no_copy": 1, + "oldfieldname": "per_billed", + "oldfieldtype": "Currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, "width": "100px" - }, + }, { - "fieldname": "billing_status", - "fieldtype": "Select", - "hidden": 1, - "label": "Billing Status", - "no_copy": 1, - "options": "Not Billed\nFully Billed\nPartly Billed\nClosed", - "permlevel": 0, + "fieldname": "billing_status", + "fieldtype": "Select", + "hidden": 1, + "label": "Billing Status", + "no_copy": 1, + "options": "Not Billed\nFully Billed\nPartly Billed\nClosed", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "sales_team_section_break", - "fieldtype": "Section Break", - "label": "Sales Team", - "oldfieldtype": "Section Break", - "options": "icon-group", - "permlevel": 0, + "fieldname": "sales_team_section_break", + "fieldtype": "Section Break", + "label": "Sales Team", + "oldfieldtype": "Section Break", + "options": "icon-group", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "sales_partner", - "fieldtype": "Link", - "in_filter": 1, - "label": "Sales Partner", - "oldfieldname": "sales_partner", - "oldfieldtype": "Link", - "options": "Sales Partner", - "permlevel": 0, - "print_hide": 1, - "search_index": 1, + "fieldname": "sales_partner", + "fieldtype": "Link", + "in_filter": 1, + "label": "Sales Partner", + "oldfieldname": "sales_partner", + "oldfieldtype": "Link", + "options": "Sales Partner", + "permlevel": 0, + "print_hide": 1, + "search_index": 1, "width": "150px" - }, + }, { - "fieldname": "column_break7", - "fieldtype": "Column Break", - "permlevel": 0, - "print_hide": 1, + "fieldname": "column_break7", + "fieldtype": "Column Break", + "permlevel": 0, + "print_hide": 1, "width": "50%" - }, + }, { - "fieldname": "commission_rate", - "fieldtype": "Float", - "label": "Commission Rate", - "oldfieldname": "commission_rate", - "oldfieldtype": "Currency", - "permlevel": 0, - "print_hide": 1, + "fieldname": "commission_rate", + "fieldtype": "Float", + "label": "Commission Rate", + "oldfieldname": "commission_rate", + "oldfieldtype": "Currency", + "permlevel": 0, + "print_hide": 1, "width": "100px" - }, + }, { - "fieldname": "total_commission", - "fieldtype": "Currency", - "label": "Total Commission", - "oldfieldname": "total_commission", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, + "fieldname": "total_commission", + "fieldtype": "Currency", + "label": "Total Commission", + "oldfieldname": "total_commission", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "section_break1", - "fieldtype": "Section Break", - "permlevel": 0, + "fieldname": "section_break1", + "fieldtype": "Section Break", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "sales_team", - "fieldtype": "Table", - "label": "Sales Team1", - "oldfieldname": "sales_team", - "oldfieldtype": "Table", - "options": "Sales Team", - "permlevel": 0, + "fieldname": "sales_team", + "fieldtype": "Table", + "label": "Sales Team1", + "oldfieldname": "sales_team", + "oldfieldtype": "Table", + "options": "Sales Team", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "recurring_order", - "fieldtype": "Section Break", - "label": "Recurring Order", - "options": "icon-time", + "fieldname": "recurring_order", + "fieldtype": "Section Break", + "label": "Recurring Order", + "options": "icon-time", "permlevel": 0 - }, + }, { - "fieldname": "column_break82", - "fieldtype": "Column Break", - "label": "Column Break", + "fieldname": "column_break82", + "fieldtype": "Column Break", + "label": "Column Break", "permlevel": 0 - }, + }, { - "allow_on_submit": 1, - "depends_on": "eval:doc.docstatus<2", - "description": "Check if recurring order, uncheck to stop recurring or put proper End Date", - "fieldname": "is_recurring", - "fieldtype": "Check", - "label": "Is Recurring", - "no_copy": 1, - "permlevel": 0, + "allow_on_submit": 1, + "depends_on": "eval:doc.docstatus<2", + "description": "Check if recurring order, uncheck to stop recurring or put proper End Date", + "fieldname": "is_recurring", + "fieldtype": "Check", + "label": "Is Recurring", + "no_copy": 1, + "permlevel": 0, "print_hide": 1 - }, + }, { - "allow_on_submit": 1, - "depends_on": "eval:doc.is_recurring==1", - "description": "Select the period when the invoice will be generated automatically", - "fieldname": "recurring_type", - "fieldtype": "Select", - "label": "Recurring Type", - "no_copy": 1, - "options": "\nMonthly\nQuarterly\nHalf-yearly\nYearly", - "permlevel": 0, + "allow_on_submit": 1, + "depends_on": "eval:doc.is_recurring==1", + "description": "Select the period when the invoice will be generated automatically", + "fieldname": "recurring_type", + "fieldtype": "Select", + "label": "Recurring Type", + "no_copy": 1, + "options": "\nMonthly\nQuarterly\nHalf-yearly\nYearly", + "permlevel": 0, "print_hide": 1 - }, + }, { - "allow_on_submit": 1, - "depends_on": "eval:doc.is_recurring==1", - "description": "The day of the month on which auto order will be generated e.g. 05, 28 etc ", - "fieldname": "repeat_on_day_of_month", - "fieldtype": "Int", - "label": "Repeat on Day of Month", - "no_copy": 1, - "permlevel": 0, + "allow_on_submit": 1, + "depends_on": "eval:doc.is_recurring==1", + "description": "The day of the month on which auto order will be generated e.g. 05, 28 etc ", + "fieldname": "repeat_on_day_of_month", + "fieldtype": "Int", + "label": "Repeat on Day of Month", + "no_copy": 1, + "permlevel": 0, "print_hide": 1 - }, + }, { - "depends_on": "eval:doc.is_recurring==1", - "description": "The date on which next invoice will be generated. It is generated on submit.", - "fieldname": "next_date", - "fieldtype": "Date", - "label": "Next Date", - "no_copy": 1, - "permlevel": 0, - "print_hide": 1, + "depends_on": "eval:doc.is_recurring==1", + "description": "The date on which next invoice will be generated. It is generated on submit.", + "fieldname": "next_date", + "fieldtype": "Date", + "label": "Next Date", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "allow_on_submit": 1, - "depends_on": "eval:doc.is_recurring==1", - "description": "The date on which recurring order will be stop", - "fieldname": "end_date", - "fieldtype": "Date", - "label": "End Date", - "no_copy": 1, - "permlevel": 0, + "allow_on_submit": 1, + "depends_on": "eval:doc.is_recurring==1", + "description": "The date on which recurring order will be stop", + "fieldname": "end_date", + "fieldtype": "Date", + "label": "End Date", + "no_copy": 1, + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "column_break83", - "fieldtype": "Column Break", - "label": "Column Break", - "permlevel": 0, + "fieldname": "column_break83", + "fieldtype": "Column Break", + "label": "Column Break", + "permlevel": 0, "print_hide": 1 - }, + }, { - "depends_on": "eval:doc.is_recurring==1", - "fieldname": "recurring_id", - "fieldtype": "Data", - "label": "Recurring Id", - "no_copy": 1, - "permlevel": 0, - "print_hide": 1, + "depends_on": "eval:doc.is_recurring==1", + "fieldname": "recurring_id", + "fieldtype": "Data", + "label": "Recurring Id", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "allow_on_submit": 1, - "depends_on": "eval:doc.is_recurring==1", - "description": "Enter email id separated by commas, order will be mailed automatically on particular date", - "fieldname": "notification_email_address", - "fieldtype": "Small Text", - "ignore_user_permissions": 0, - "label": "Notification Email Address", - "no_copy": 1, - "permlevel": 0, + "allow_on_submit": 1, + "depends_on": "eval:doc.is_recurring==1", + "description": "Enter email id separated by commas, order will be mailed automatically on particular date", + "fieldname": "notification_email_address", + "fieldtype": "Small Text", + "ignore_user_permissions": 0, + "label": "Notification Email Address", + "no_copy": 1, + "permlevel": 0, "print_hide": 1 - }, - { - "fieldname": "against_income_account", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Against Income Account", - "no_copy": 1, - "permlevel": 0, - "print_hide": 1, - "report_hide": 1 } - ], - "icon": "icon-file-text", - "idx": 1, - "is_submittable": 1, - "issingle": 0, - "modified": "2014-09-10 05:35:34.761247", - "modified_by": "Administrator", - "module": "Selling", - "name": "Sales Order", - "owner": "Administrator", + ], + "icon": "icon-file-text", + "idx": 1, + "is_submittable": 1, + "issingle": 0, + "modified": "2014-09-18 03:17:33.241162", + "modified_by": "Administrator", + "module": "Selling", + "name": "Sales Order", + "owner": "Administrator", "permissions": [ { - "amend": 1, - "apply_user_permissions": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Sales User", - "submit": 1, + "amend": 1, + "apply_user_permissions": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Sales User", + "submit": 1, "write": 1 - }, + }, { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "import": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Sales Manager", - "set_user_permissions": 1, - "submit": 1, + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "import": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Sales Manager", + "set_user_permissions": 1, + "submit": 1, "write": 1 - }, + }, { - "amend": 1, - "apply_user_permissions": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Maintenance User", - "submit": 1, + "amend": 1, + "apply_user_permissions": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Maintenance User", + "submit": 1, "write": 1 - }, + }, { - "apply_user_permissions": 1, - "cancel": 0, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, + "apply_user_permissions": 1, + "cancel": 0, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, "role": "Accounts User" - }, + }, { - "apply_user_permissions": 1, - "cancel": 0, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, + "apply_user_permissions": 1, + "cancel": 0, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, "role": "Customer" - }, + }, { - "apply_user_permissions": 1, - "permlevel": 0, - "read": 1, - "report": 1, + "apply_user_permissions": 1, + "permlevel": 0, + "read": 1, + "report": 1, "role": "Material User" - }, + }, { - "permlevel": 1, - "read": 1, - "role": "Sales Manager", + "permlevel": 1, + "read": 1, + "role": "Sales Manager", "write": 1 } - ], - "read_only_onload": 1, - "search_fields": "status,transaction_date,customer,customer_name, territory,order_type,company", - "sort_field": "modified", + ], + "read_only_onload": 1, + "search_fields": "status,transaction_date,customer,customer_name, territory,order_type,company", + "sort_field": "modified", "sort_order": "DESC" -} +} \ 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 c14d06d50c8..bffa5816396 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -4,14 +4,10 @@ from __future__ import unicode_literals import frappe import frappe.utils - from frappe.utils import cstr, flt, getdate, comma_and - from frappe import _ from frappe.model.mapper import get_mapped_doc -from erpnext.controllers.recurring_document import convert_to_recurring, validate_recurring_document - from erpnext.controllers.selling_controller import SellingController form_grid_templates = { @@ -122,8 +118,6 @@ class SalesOrder(SellingController): if not self.billing_status: self.billing_status = 'Not Billed' if not self.delivery_status: self.delivery_status = 'Not Delivered' - validate_recurring_document(self) - def validate_warehouse(self): from erpnext.stock.utils import validate_warehouse_company @@ -157,6 +151,8 @@ class SalesOrder(SellingController): doc.set_status(update=True) def on_submit(self): + super(SalesOrder, self).on_submit() + self.update_stock_ledger(update_stock = 1) self.check_credit(self.grand_total) @@ -165,8 +161,6 @@ class SalesOrder(SellingController): self.update_prevdoc_status('submit') frappe.db.set(self, 'status', 'Submitted') - - convert_to_recurring(self, self.transaction_date) def on_cancel(self): # Cannot cancel stopped SO @@ -255,11 +249,6 @@ class SalesOrder(SellingController): def get_portal_page(self): return "order" if self.docstatus==1 else None - def on_update_after_submit(self): - validate_recurring_document(self) - convert_to_recurring(self, self.transaction_date) - - @frappe.whitelist() def make_material_request(source_name, target_doc=None): def postprocess(source, doc): diff --git a/erpnext/templates/emails/recurring_document_failed.html b/erpnext/templates/emails/recurring_document_failed.html index a216e286a54..56d8b80f088 100644 --- a/erpnext/templates/emails/recurring_document_failed.html +++ b/erpnext/templates/emails/recurring_document_failed.html @@ -1,6 +1,6 @@

Recurring {{ type }} Failed

-

An error occured while creating recurring {{ type }} {{ name }} for {{ customer }}.

+

An error occured while creating recurring {{ type }} {{ name }} for {{ party }}.

This could be because of some invalid email ids in the {{ type }}.

To stop sending repetitive error notifications from the system, we have unchecked "Convert into Recurring" field in the {{ type }} {{ name }}.

From 996a1010cb107dfed1cfac8f7743f235d38c03fb Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 23 Sep 2014 14:53:30 +0530 Subject: [PATCH 27/42] Moved Installation note from tools to documents section --- erpnext/config/stock.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/erpnext/config/stock.py b/erpnext/config/stock.py index 957abecdce8..7a4345e4d22 100644 --- a/erpnext/config/stock.py +++ b/erpnext/config/stock.py @@ -26,6 +26,11 @@ def get_data(): "name": "Purchase Receipt", "description": _("Goods received from Suppliers."), }, + { + "type": "doctype", + "name": "Installation Note", + "description": _("Installation record for a Serial No.") + }, { "type": "doctype", "name": "Item", @@ -57,11 +62,6 @@ def get_data(): "name": "Stock Reconciliation", "description": _("Upload stock balance via csv.") }, - { - "type": "doctype", - "name": "Installation Note", - "description": _("Installation record for a Serial No.") - }, { "type": "doctype", "name": "Packing Slip", From b783f519eeae3164618ec85ac261c2f86a0ef1bd Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 24 Sep 2014 11:03:39 +0530 Subject: [PATCH 28/42] Fixes in sales/purchase invoice trends report --- .../report/sales_invoice_trends/sales_invoice_trends.py | 2 +- erpnext/public/js/purchase_trends_filters.js | 2 +- erpnext/public/js/sales_trends_filters.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/report/sales_invoice_trends/sales_invoice_trends.py b/erpnext/accounts/report/sales_invoice_trends/sales_invoice_trends.py index 4e90168d372..e9a9bd06a0a 100644 --- a/erpnext/accounts/report/sales_invoice_trends/sales_invoice_trends.py +++ b/erpnext/accounts/report/sales_invoice_trends/sales_invoice_trends.py @@ -11,4 +11,4 @@ def execute(filters=None): conditions = get_columns(filters, "Sales Invoice") data = get_data(filters, conditions) - return conditions["columns"], data \ No newline at end of file + return conditions["columns"], data diff --git a/erpnext/public/js/purchase_trends_filters.js b/erpnext/public/js/purchase_trends_filters.js index cab8bbfc243..d609cf81303 100644 --- a/erpnext/public/js/purchase_trends_filters.js +++ b/erpnext/public/js/purchase_trends_filters.js @@ -24,7 +24,7 @@ var get_filters = function(){ { "value": "Item Group", "label": __("Item Group") }, { "value": "Supplier", "label": __("Supplier") }, { "value": "Supplier Type", "label": __("Supplier Type") }, - { "value": "Supplier Type", "label": __("Project") } + { "value": "Project", "label": __("Project") } ], "default": "Item" }, diff --git a/erpnext/public/js/sales_trends_filters.js b/erpnext/public/js/sales_trends_filters.js index 46070b4768a..05031338907 100644 --- a/erpnext/public/js/sales_trends_filters.js +++ b/erpnext/public/js/sales_trends_filters.js @@ -25,7 +25,7 @@ var get_filters = function(){ { "value": "Customer", "label": __("Customer") }, { "value": "Customer Group", "label": __("Customer Group") }, { "value": "Territory", "label": __("Territory") }, - { "value": "Supplier Type", "label": __("Project") } + { "value": "Project", "label": __("Project") } ], "default": "Item" }, From 95f1fe92e2c010e3ad7471f3b1e779c346fd861f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 26 Sep 2014 11:38:44 +0530 Subject: [PATCH 29/42] Maintenance visit search field issue fixed --- .../support/doctype/maintenance_visit/maintenance_visit.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/support/doctype/maintenance_visit/maintenance_visit.json b/erpnext/support/doctype/maintenance_visit/maintenance_visit.json index 743d210861f..2612776eedb 100644 --- a/erpnext/support/doctype/maintenance_visit/maintenance_visit.json +++ b/erpnext/support/doctype/maintenance_visit/maintenance_visit.json @@ -279,7 +279,7 @@ "icon": "icon-file-text", "idx": 1, "is_submittable": 1, - "modified": "2014-06-23 07:55:49.200714", + "modified": "2014-09-26 11:37:41.026433", "modified_by": "Administrator", "module": "Support", "name": "Maintenance Visit", @@ -301,7 +301,7 @@ "write": 1 } ], - "search_fields": "status,maintenance_type,customer,customer_name, address,mntc_date,company,fiscal_year", + "search_fields": "status,maintenance_type,customer,customer_name,mntc_date,company,fiscal_year", "sort_field": "modified", "sort_order": "DESC" } \ No newline at end of file From 18ccc27b1b7028e25e72f844db396f4cb7f53597 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 26 Sep 2014 11:57:16 +0530 Subject: [PATCH 30/42] Minor fix in naming naming series --- erpnext/setup/doctype/naming_series/naming_series.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/erpnext/setup/doctype/naming_series/naming_series.py b/erpnext/setup/doctype/naming_series/naming_series.py index cb0d43780fd..09a019c71de 100644 --- a/erpnext/setup/doctype/naming_series/naming_series.py +++ b/erpnext/setup/doctype/naming_series/naming_series.py @@ -48,11 +48,10 @@ class NamingSeries(Document): # validate names for i in options: self.validate_series_name(i) - if self.user_must_always_select: + if options and self.user_must_always_select: options = [''] + options - default = '' - else: - default = options[0] + + default = options[0] if options else '' # update in property setter prop_dict = {'options': "\n".join(options), 'default': default} From b9e04815f89514ca9b87a3175e53069dab508da4 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 26 Sep 2014 14:22:18 +0530 Subject: [PATCH 31/42] Repost gl entries for future stock vouchers --- .../doctype/sales_invoice/sales_invoice.py | 7 +- erpnext/controllers/stock_controller.py | 97 +++---------------- 2 files changed, 15 insertions(+), 89 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 3b4c92d2cf8..a2bf78c4490 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -6,10 +6,10 @@ import frappe import frappe.defaults from frappe.utils import cint, cstr, flt from frappe import _, msgprint, throw - from erpnext.accounts.party import get_party_account, get_due_date from erpnext.controllers.stock_controller import update_gl_entries_after from frappe.model.mapper import get_mapped_doc + from erpnext.controllers.selling_controller import SellingController form_grid_templates = { @@ -473,9 +473,8 @@ class SalesInvoice(SellingController): if repost_future_gle and cint(self.update_stock) \ and cint(frappe.defaults.get_global_default("auto_accounting_for_stock")): - items, warehouse_account = self.get_items_and_warehouse_accounts() - update_gl_entries_after(self.posting_date, self.posting_time, - warehouse_account, items) + items, warehouses = self.get_items_and_warehouses() + update_gl_entries_after(self.posting_date, self.posting_time, warehouses, items) def get_gl_entries(self, warehouse_account=None): from erpnext.accounts.general_ledger import merge_similar_entries diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py index 1a113083494..575525399fc 100644 --- a/erpnext/controllers/stock_controller.py +++ b/erpnext/controllers/stock_controller.py @@ -16,16 +16,15 @@ class StockController(AccountsController): delete_gl_entries(voucher_type=self.doctype, voucher_no=self.name) if cint(frappe.defaults.get_global_default("auto_accounting_for_stock")): - warehouse_account = self.get_warehouse_account() + warehouse_account = get_warehouse_account() if self.docstatus==1: gl_entries = self.get_gl_entries(warehouse_account) make_gl_entries(gl_entries) if repost_future_gle: - items, warehouse_account = self.get_items_and_warehouse_accounts(warehouse_account) - update_gl_entries_after(self.posting_date, self.posting_time, - warehouse_account, items) + items, warehouses = self.get_items_and_warehouses() + update_gl_entries_after(self.posting_date, self.posting_time, warehouses, items, warehouse_account) def get_gl_entries(self, warehouse_account=None, default_expense_account=None, default_cost_center=None): @@ -88,10 +87,8 @@ class StockController(AccountsController): return details - def get_items_and_warehouse_accounts(self, warehouse_account=None): + def get_items_and_warehouses(self): items, warehouses = [], [] - if not warehouse_account: - warehouse_account = get_warehouse_account() if hasattr(self, "fname"): item_doclist = self.get(self.fname) @@ -117,10 +114,7 @@ class StockController(AccountsController): if d.get("t_warehouse") and d.t_warehouse not in warehouses: warehouses.append(d.t_warehouse) - warehouse_account = {wh: warehouse_account[wh] for wh in warehouses - if warehouse_account.get(wh)} - - return items, warehouse_account + return items, warehouses def get_stock_ledger_details(self): stock_ledger = {} @@ -130,73 +124,6 @@ class StockController(AccountsController): stock_ledger.setdefault(sle.voucher_detail_no, []).append(sle) return stock_ledger - def get_warehouse_account(self): - warehouse_account = dict(frappe.db.sql("""select master_name, name from tabAccount - where account_type = 'Warehouse' and ifnull(master_name, '') != ''""")) - return warehouse_account - - def update_gl_entries_after(self, warehouse_account=None): - future_stock_vouchers = self.get_future_stock_vouchers() - gle = self.get_voucherwise_gl_entries(future_stock_vouchers) - if not warehouse_account: - warehouse_account = self.get_warehouse_account() - for voucher_type, voucher_no in future_stock_vouchers: - existing_gle = gle.get((voucher_type, voucher_no), []) - voucher_obj = frappe.get_doc(voucher_type, voucher_no) - expected_gle = voucher_obj.get_gl_entries(warehouse_account) - if expected_gle: - matched = True - if existing_gle: - for entry in expected_gle: - for e in existing_gle: - if entry.account==e.account \ - and entry.against_account==e.against_account\ - and entry.cost_center==e.cost_center: - if entry.debit != e.debit or entry.credit != e.credit: - matched = False - break - else: - matched = False - - if not matched: - self.delete_gl_entries(voucher_type, voucher_no) - voucher_obj.make_gl_entries(repost_future_gle=False) - else: - self.delete_gl_entries(voucher_type, voucher_no) - - - def get_future_stock_vouchers(self): - condition = "" - item_list = [] - if getattr(self, "fname", None): - item_list = [d.item_code for d in self.get(self.fname)] - if item_list: - condition = "and item_code in ({})".format(", ".join(["%s"] * len(item_list))) - - future_stock_vouchers = frappe.db.sql("""select distinct sle.voucher_type, sle.voucher_no - from `tabStock Ledger Entry` sle - where timestamp(sle.posting_date, sle.posting_time) >= timestamp(%s, %s) {condition} - order by timestamp(sle.posting_date, sle.posting_time) asc, name asc""".format( - condition=condition), tuple([self.posting_date, self.posting_date] + item_list), - as_list=True) - - return future_stock_vouchers - - def get_voucherwise_gl_entries(self, future_stock_vouchers): - gl_entries = {} - if future_stock_vouchers: - for d in frappe.db.sql("""select * from `tabGL Entry` - where posting_date >= %s and voucher_no in (%s)""" % - ('%s', ', '.join(['%s']*len(future_stock_vouchers))), - tuple([self.posting_date] + [d[1] for d in future_stock_vouchers]), as_dict=1): - gl_entries.setdefault((d.voucher_type, d.voucher_no), []).append(d) - - return gl_entries - - def delete_gl_entries(self, voucher_type, voucher_no): - frappe.db.sql("""delete from `tabGL Entry` - where voucher_type=%s and voucher_no=%s""", (voucher_type, voucher_no)) - def make_adjustment_entry(self, expected_gle, voucher_obj): from erpnext.accounts.utils import get_stock_and_account_difference account_list = [d.account for d in expected_gle] @@ -287,15 +214,15 @@ class StockController(AccountsController): return serialized_items -def update_gl_entries_after(posting_date, posting_time, warehouse_account=None, for_items=None): +def update_gl_entries_after(posting_date, posting_time, for_warehouses=None, for_items=None, warehouse_account=None): def _delete_gl_entries(voucher_type, voucher_no): frappe.db.sql("""delete from `tabGL Entry` where voucher_type=%s and voucher_no=%s""", (voucher_type, voucher_no)) if not warehouse_account: warehouse_account = get_warehouse_account() - future_stock_vouchers = get_future_stock_vouchers(posting_date, posting_time, - warehouse_account, for_items) + + future_stock_vouchers = get_future_stock_vouchers(posting_date, posting_time, for_warehouses, for_items) gle = get_voucherwise_gl_entries(future_stock_vouchers, posting_date) for voucher_type, voucher_no in future_stock_vouchers: @@ -321,7 +248,7 @@ def compare_existing_and_expected_gle(existing_gle, expected_gle): break return matched -def get_future_stock_vouchers(posting_date, posting_time, warehouse_account=None, for_items=None): +def get_future_stock_vouchers(posting_date, posting_time, for_warehouses=None, for_items=None): future_stock_vouchers = [] values = [] @@ -330,9 +257,9 @@ def get_future_stock_vouchers(posting_date, posting_time, warehouse_account=None condition += " and item_code in ({})".format(", ".join(["%s"] * len(for_items))) values += for_items - if warehouse_account: - condition += " and warehouse in ({})".format(", ".join(["%s"] * len(warehouse_account.keys()))) - values += warehouse_account.keys() + if for_warehouses: + condition += " and warehouse in ({})".format(", ".join(["%s"] * len(for_warehouses))) + values += for_warehouses for d in frappe.db.sql("""select distinct sle.voucher_type, sle.voucher_no from `tabStock Ledger Entry` sle From b0bd99266dba82673792bbe3adbcca660d95093b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 26 Sep 2014 14:30:02 +0530 Subject: [PATCH 32/42] Fix in landed cost voucher --- .../doctype/landed_cost_voucher/landed_cost_voucher.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py index e6bb68b13ba..b4fa9712f93 100644 --- a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py +++ b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py @@ -15,7 +15,7 @@ class LandedCostVoucher(Document): self.set("landed_cost_items", []) for pr in self.get("landed_cost_purchase_receipts"): pr_items = frappe.db.sql("""select pr_item.item_code, pr_item.description, - pr_item.qty, pr_item.rate, pr_item.amount, pr_item.name + pr_item.qty, pr_item.base_rate, pr_item.base_amount, pr_item.name from `tabPurchase Receipt Item` pr_item where parent = %s and exists(select name from tabItem where name = pr_item.item_code and is_stock_item = 'Yes')""", pr.purchase_receipt, as_dict=True) @@ -25,8 +25,8 @@ class LandedCostVoucher(Document): item.item_code = d.item_code item.description = d.description item.qty = d.qty - item.rate = d.rate - item.amount = d.amount + item.rate = d.base_rate + item.amount = d.base_amount item.purchase_receipt = pr.purchase_receipt item.purchase_receipt_item = d.name From 16edacebc7c2fc08f46122b58d9e37b6fafa754e Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Fri, 26 Sep 2014 17:19:59 +0600 Subject: [PATCH 33/42] bumped to version 4.5.0 --- erpnext/__version__.py | 2 +- erpnext/hooks.py | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/__version__.py b/erpnext/__version__.py index 31618fca1e7..330025d8062 100644 --- a/erpnext/__version__.py +++ b/erpnext/__version__.py @@ -1 +1 @@ -__version__ = '4.4.2' +__version__ = '4.5.0' diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 048ec7bd56d..686b351adac 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -4,7 +4,7 @@ app_publisher = "Web Notes Technologies Pvt. Ltd. and Contributors" app_description = "Open Source Enterprise Resource Planning for Small and Midsized Organizations" app_icon = "icon-th" app_color = "#e74c3c" -app_version = "4.4.2" +app_version = "4.5.0" error_report_email = "support@erpnext.com" diff --git a/setup.py b/setup.py index 60a6d2f1c79..1e7adf69664 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages import os -version = "4.4.2" +version = "4.5.0" with open("requirements.txt", "r") as f: install_requires = f.readlines() From 9b50b0a7623f3de2d02aed12f6e0d98e749cf50b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 29 Sep 2014 10:48:45 +0530 Subject: [PATCH 34/42] Fixes for item list view --- erpnext/stock/doctype/item/item_list.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/item/item_list.js b/erpnext/stock/doctype/item/item_list.js index 330faedf625..e1cd020b5ff 100644 --- a/erpnext/stock/doctype/item/item_list.js +++ b/erpnext/stock/doctype/item/item_list.js @@ -1,5 +1,5 @@ frappe.listview_settings['Item'] = { - add_fields: ["item_name", "stock_uom", "item_group", "image", - "is_stock_item", "is_sales_item", "is_purchase_item", - "is_manufactured_item", "show_in_website"] + add_fields: ["`tabItem`.`item_name`", "`tabItem`.`stock_uom`", "`tabItem`.`item_group`", "`tabItem`.`image`", + "`tabItem`.`is_stock_item`", "`tabItem`.`is_sales_item`", "`tabItem`.`is_purchase_item`", + "`tabItem`.`is_manufactured_item`", "`tabItem`.`show_in_website`"] }; From d60235e2397c9d0885342dee5d683213827f48f4 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 29 Sep 2014 11:35:52 +0530 Subject: [PATCH 35/42] minor fix in warehouse-wise stock balance report --- .../warehouse_wise_stock_balance.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/erpnext/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.py b/erpnext/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.py index 775f6f11bbe..dc552cb7739 100644 --- a/erpnext/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.py +++ b/erpnext/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.py @@ -71,10 +71,10 @@ def get_item_warehouse_map(filters): for d in sle: iwb_map.setdefault(d.company, {}).setdefault(d.item_code, {}).\ setdefault(d.warehouse, frappe._dict({\ - "opening_qty": 0.0, "opening_val": 0.0, - "in_qty": 0.0, "in_val": 0.0, - "out_qty": 0.0, "out_val": 0.0, - "bal_qty": 0.0, "bal_val": 0.0, + "opening_qty": 0.0, "opening_val": 0.0, + "in_qty": 0.0, "in_val": 0.0, + "out_qty": 0.0, "out_val": 0.0, + "bal_qty": 0.0, "bal_val": 0.0, "val_rate": 0.0, "uom": None })) qty_dict = iwb_map[d.company][d.item_code][d.warehouse] @@ -82,19 +82,19 @@ def get_item_warehouse_map(filters): if d.posting_date < filters["from_date"]: qty_dict.opening_qty += flt(d.actual_qty) - qty_dict.opening_val += flt(d.actual_qty * d.valuation_rate) + qty_dict.opening_val += flt(d.actual_qty) * flt(d.valuation_rate) elif d.posting_date >= filters["from_date"] and d.posting_date <= filters["to_date"]: qty_dict.val_rate = d.valuation_rate if flt(d.actual_qty) > 0: qty_dict.in_qty += flt(d.actual_qty) - qty_dict.in_val += flt(d.actual_qty * d.valuation_rate) + qty_dict.in_val += flt(d.actual_qty) * flt(d.valuation_rate) else: qty_dict.out_qty += abs(flt(d.actual_qty)) - qty_dict.out_val += flt(abs(flt(d.actual_qty)) * d.valuation_rate) + qty_dict.out_val += flt(abs(flt(d.actual_qty) * flt(d.valuation_rate))) qty_dict.bal_qty += flt(d.actual_qty) - qty_dict.bal_val += flt(d.actual_qty * d.valuation_rate) + qty_dict.bal_val += flt(d.actual_qty) * flt(d.valuation_rate) return iwb_map From 82d7c0c9eb8bdc75cf46907f393eadfad2d28641 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 29 Sep 2014 15:07:51 +0530 Subject: [PATCH 36/42] Patch: Fix gl entries for stock transactions --- .../fix_gl_entries_for_stock_transactions.py | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 erpnext/patches/v4_2/fix_gl_entries_for_stock_transactions.py diff --git a/erpnext/patches/v4_2/fix_gl_entries_for_stock_transactions.py b/erpnext/patches/v4_2/fix_gl_entries_for_stock_transactions.py new file mode 100644 index 00000000000..e065d2d42f4 --- /dev/null +++ b/erpnext/patches/v4_2/fix_gl_entries_for_stock_transactions.py @@ -0,0 +1,26 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe + +def execute(): + warehouses_with_account = frappe.db.sql_list("""select master_name from tabAccount + where ifnull(account_type, '') = 'Warehouse'""") + + stock_vouchers_without_gle = frappe.db.sql("""select distinct sle.voucher_type, sle.voucher_no + from `tabStock Ledger Entry` sle + where sle.warehouse in (%s) + and not exists(select name from `tabGL Entry` + where voucher_type=sle.voucher_type and voucher_no=sle.voucher_no) + order by sle.posting_date""" % + ', '.join(['%s']*len(warehouses_with_account)), tuple(warehouses_with_account)) + + for voucher_type, voucher_no in stock_vouchers_without_gle: + print voucher_type, voucher_no + frappe.db.sql("""delete from `tabGL Entry` + where voucher_type=%s and voucher_no=%s""", (voucher_type, voucher_no)) + + voucher = frappe.get_doc(voucher_type, voucher_no) + voucher.make_gl_entries() + frappe.db.commit() From 4e81e4065b924aa49d5e1bd396c890db0334dcfb Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Mon, 29 Sep 2014 16:10:04 +0600 Subject: [PATCH 37/42] bumped to version 4.5.1 --- erpnext/__version__.py | 2 +- erpnext/hooks.py | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/__version__.py b/erpnext/__version__.py index 330025d8062..ef6eca30666 100644 --- a/erpnext/__version__.py +++ b/erpnext/__version__.py @@ -1 +1 @@ -__version__ = '4.5.0' +__version__ = '4.5.1' diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 686b351adac..a8e57327524 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -4,7 +4,7 @@ app_publisher = "Web Notes Technologies Pvt. Ltd. and Contributors" app_description = "Open Source Enterprise Resource Planning for Small and Midsized Organizations" app_icon = "icon-th" app_color = "#e74c3c" -app_version = "4.5.0" +app_version = "4.5.1" error_report_email = "support@erpnext.com" diff --git a/setup.py b/setup.py index 1e7adf69664..681b6f7e44c 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages import os -version = "4.5.0" +version = "4.5.1" with open("requirements.txt", "r") as f: install_requires = f.readlines() From 4c058f405614cecf03a5d4a076ab327b30e6cf24 Mon Sep 17 00:00:00 2001 From: Aditya Duggal Date: Mon, 29 Sep 2014 17:41:19 +0530 Subject: [PATCH 38/42] Added the dynamic link and removed the link column --- .../report/accounts_receivable/accounts_receivable.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py index 2891b053f02..34dccd0ce00 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py @@ -21,7 +21,7 @@ class AccountsReceivableReport(object): def get_columns(self, customer_naming_by): columns = [ _("Posting Date") + ":Date:80", _("Account") + ":Link/Account:150", - _("Voucher Type") + "::110", _("Voucher No") + "::120", "::30", + _("Voucher Type") + "::110", _("Voucher No") + ":Dynamic Link/Voucher Type:120", _("Due Date") + ":Date:80", _("Invoiced Amount") + ":Currency:100", _("Payment Received") + ":Currency:100", _("Outstanding Amount") + ":Currency:100", _("Age") + ":Int:50", "0-30:Currency:100", @@ -64,9 +64,9 @@ class AccountsReceivableReport(object): row += [self.get_territory(gle.account), gle.remarks] data.append(row) - for i in range(0, len(data)): - data[i].insert(4, """""" \ - % ("/".join(["#Form", data[i][2], data[i][3]]),)) + #for i in range(0, len(data)): + # data[i].insert(4, """""" \ + # % ("/".join(["#Form", data[i][2], data[i][3]]),)) return data From a2c9d35efb4acb3f9cd5aaf75dcdc9dea1375fe7 Mon Sep 17 00:00:00 2001 From: Aditya Duggal Date: Mon, 29 Sep 2014 17:44:28 +0530 Subject: [PATCH 39/42] Added the dynamic link field. --- .../report/accounts_receivable/accounts_receivable.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py index 34dccd0ce00..3a0fb31dea7 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py @@ -63,11 +63,6 @@ class AccountsReceivableReport(object): row += [self.get_territory(gle.account), gle.remarks] data.append(row) - - #for i in range(0, len(data)): - # data[i].insert(4, """""" \ - # % ("/".join(["#Form", data[i][2], data[i][3]]),)) - return data def get_entries_after(self, report_date): From 3b90de558f93d7956af8936297be9ae211a73f69 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Tue, 30 Sep 2014 12:57:09 +0530 Subject: [PATCH 40/42] Has Batch No field should be freezed #2023 --- erpnext/stock/doctype/batch/batch.py | 11 +++++++++-- erpnext/stock/doctype/batch/test_batch.py | 14 ++++++++++++++ erpnext/stock/doctype/item/item.js | 4 ++-- erpnext/stock/doctype/item/item.py | 5 +++-- .../stock/doctype/item_price/test_item_price.py | 2 +- 5 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 erpnext/stock/doctype/batch/test_batch.py diff --git a/erpnext/stock/doctype/batch/batch.py b/erpnext/stock/doctype/batch/batch.py index 365cb38b60a..8b6aed7560a 100644 --- a/erpnext/stock/doctype/batch/batch.py +++ b/erpnext/stock/doctype/batch/batch.py @@ -3,8 +3,15 @@ from __future__ import unicode_literals import frappe - +from frappe import _ from frappe.model.document import Document class Batch(Document): - pass \ No newline at end of file + + def validate(self): + self.item_has_batch_enabled() + + def item_has_batch_enabled(self): + has_batch_no = frappe.db.get_value("Item",self.item,"has_batch_no") + if has_batch_no =='No': + frappe.throw(_("The selected item cannot have Batch")) \ No newline at end of file diff --git a/erpnext/stock/doctype/batch/test_batch.py b/erpnext/stock/doctype/batch/test_batch.py new file mode 100644 index 00000000000..d664721ba79 --- /dev/null +++ b/erpnext/stock/doctype/batch/test_batch.py @@ -0,0 +1,14 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +import frappe +from frappe.exceptions import ValidationError +import unittest + +class TestBatch(unittest.TestCase): + def test_item_has_batch_enabled(self): + self.assertRaises(ValidationError, frappe.get_doc({ + "doctype": "Batch", + "name": "_test Batch", + "item": "_Test Item" + }).save) \ No newline at end of file diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js index c80d19ec9cd..fce8dfaf5ba 100644 --- a/erpnext/stock/doctype/item/item.js +++ b/erpnext/stock/doctype/item/item.js @@ -19,7 +19,7 @@ cur_frm.cscript.refresh = function(doc) { cur_frm.cscript.edit_prices_button(); if (!doc.__islocal && doc.is_stock_item == 'Yes') { - cur_frm.toggle_enable(['has_serial_no', 'is_stock_item', 'valuation_method'], + cur_frm.toggle_enable(['has_serial_no', 'is_stock_item', 'valuation_method', 'has_batch_no'], (doc.__onload && doc.__onload.sle_exists=="exists") ? false : true); } @@ -185,4 +185,4 @@ cur_frm.cscript.image = function() { else { msgprint(__("You may need to update: {0}", [frappe.meta.get_docfield(cur_frm.doc.doctype, "description_html").label])); } -} +} \ No newline at end of file diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index 17fe0ae0a03..b8a31909ceb 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -187,13 +187,14 @@ class Item(WebsiteGenerator): def cant_change(self): if not self.get("__islocal"): vals = frappe.db.get_value("Item", self.name, - ["has_serial_no", "is_stock_item", "valuation_method"], as_dict=True) + ["has_serial_no", "is_stock_item", "valuation_method", "has_batch_no"], as_dict=True) if vals and ((self.is_stock_item == "No" and vals.is_stock_item == "Yes") or vals.has_serial_no != self.has_serial_no or + vals.has_batch_no != self.has_batch_no or cstr(vals.valuation_method) != cstr(self.valuation_method)): if self.check_if_sle_exists() == "exists": - frappe.throw(_("As there are existing stock transactions for this item, you can not change the values of 'Has Serial No', 'Is Stock Item' and 'Valuation Method'")) + frappe.throw(_("As there are existing stock transactions for this item, you can not change the values of 'Has Serial No', 'Has Batch No', 'Is Stock Item' and 'Valuation Method'")) def validate_item_type_for_reorder(self): if self.re_order_level or len(self.get("item_reorder", {"material_request_type": "Purchase"})): diff --git a/erpnext/stock/doctype/item_price/test_item_price.py b/erpnext/stock/doctype/item_price/test_item_price.py index 1a430bf9f05..7106a5364eb 100644 --- a/erpnext/stock/doctype/item_price/test_item_price.py +++ b/erpnext/stock/doctype/item_price/test_item_price.py @@ -9,6 +9,6 @@ class TestItem(unittest.TestCase): def test_duplicate_item(self): from erpnext.stock.doctype.item_price.item_price import ItemPriceDuplicateItem doc = frappe.copy_doc(test_records[0]) - self.assertRaises(ItemPriceDuplicateItem, doc.insert) + self.assertRaises(ItemPriceDuplicateItem, doc.save) test_records = frappe.get_test_records('Item Price') \ No newline at end of file From 29d1a1c593f38b57b024b8c4a930ab65b10d2bdd Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Tue, 16 Sep 2014 12:28:24 +0530 Subject: [PATCH 41/42] manufacturing and repack sepreted, test cases fixed, patch fixed --- .../production_order/production_order.js | 2 +- .../production_order/production_order.json | 18 +- .../production_order/production_order.py | 4 +- .../production_order/test_production_order.py | 4 +- ...issued_items_against_production_order.json | 4 +- erpnext/patches.txt | 3 +- .../v4_2/seprate_manufacture_and_repack.py | 9 + .../stock/doctype/stock_entry/stock_entry.js | 11 +- .../doctype/stock_entry/stock_entry.json | 1124 ++++++++--------- .../stock/doctype/stock_entry/stock_entry.py | 34 +- .../doctype/stock_entry/stock_entry_list.html | 3 +- .../doctype/stock_entry/test_records.json | 2 +- .../doctype/stock_entry/test_stock_entry.py | 2 +- 13 files changed, 617 insertions(+), 603 deletions(-) create mode 100644 erpnext/patches/v4_2/seprate_manufacture_and_repack.py diff --git a/erpnext/manufacturing/doctype/production_order/production_order.js b/erpnext/manufacturing/doctype/production_order/production_order.js index 89ef846212c..fbb9a269c1d 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.js +++ b/erpnext/manufacturing/doctype/production_order/production_order.js @@ -96,7 +96,7 @@ cur_frm.cscript['Transfer Raw Materials'] = function() { } cur_frm.cscript['Update Finished Goods'] = function() { - cur_frm.cscript.make_se('Manufacture/Repack'); + cur_frm.cscript.make_se('Manufacture'); } cur_frm.fields_dict['production_item'].get_query = function(doc) { diff --git a/erpnext/manufacturing/doctype/production_order/production_order.json b/erpnext/manufacturing/doctype/production_order/production_order.json index 3c17973f453..b8f65cd0ec2 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.json +++ b/erpnext/manufacturing/doctype/production_order/production_order.json @@ -109,15 +109,15 @@ "permlevel": 0 }, { - "depends_on": "eval:doc.docstatus==1", - "description": "Automatically updated via Stock Entry of type Manufacture/Repack", - "fieldname": "produced_qty", - "fieldtype": "Float", - "label": "Manufactured Qty", - "no_copy": 1, - "oldfieldname": "produced_qty", - "oldfieldtype": "Currency", - "permlevel": 0, + "depends_on": "eval:doc.docstatus==1", + "description": "Automatically updated via Stock Entry of type Manufacture or Repack", + "fieldname": "produced_qty", + "fieldtype": "Float", + "label": "Manufactured Qty", + "no_copy": 1, + "oldfieldname": "produced_qty", + "oldfieldtype": "Currency", + "permlevel": 0, "read_only": 1 }, { diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py index 03fdf79ec7d..309f47c388c 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.py +++ b/erpnext/manufacturing/doctype/production_order/production_order.py @@ -103,7 +103,7 @@ class ProductionOrder(Document): status = "Submitted" if stock_entries: status = "In Process" - produced_qty = stock_entries.get("Manufacture/Repack") + produced_qty = stock_entries.get("Manufacture") if flt(produced_qty) == flt(self.qty): status = "Completed" @@ -113,7 +113,7 @@ class ProductionOrder(Document): def update_produced_qty(self): produced_qty = frappe.db.sql("""select sum(fg_completed_qty) from `tabStock Entry` where production_order=%s and docstatus=1 - and purpose='Manufacture/Repack'""", self.name) + and purpose='Manufacture'""", self.name) produced_qty = flt(produced_qty[0][0]) if produced_qty else 0 if produced_qty > self.qty: diff --git a/erpnext/manufacturing/doctype/production_order/test_production_order.py b/erpnext/manufacturing/doctype/production_order/test_production_order.py index 55125cf848c..a9975c1e6f3 100644 --- a/erpnext/manufacturing/doctype/production_order/test_production_order.py +++ b/erpnext/manufacturing/doctype/production_order/test_production_order.py @@ -31,7 +31,7 @@ class TestProductionOrder(unittest.TestCase): s.submit() # from wip to fg - s = frappe.get_doc(make_stock_entry(pro_doc.name, "Manufacture/Repack", 4)) + s = frappe.get_doc(make_stock_entry(pro_doc.name, "Manufacture", 4)) s.insert() s.submit() @@ -49,7 +49,7 @@ class TestProductionOrder(unittest.TestCase): test_stock_entry.make_stock_entry("_Test Item", None, "_Test Warehouse - _TC", 100, 100) test_stock_entry.make_stock_entry("_Test Item Home Desktop 100", None, "_Test Warehouse - _TC", 100, 100) - s = frappe.get_doc(make_stock_entry(pro_doc.name, "Manufacture/Repack", 7)) + s = frappe.get_doc(make_stock_entry(pro_doc.name, "Manufacture", 7)) s.insert() self.assertRaises(StockOverProductionError, s.submit) diff --git a/erpnext/manufacturing/report/issued_items_against_production_order/issued_items_against_production_order.json b/erpnext/manufacturing/report/issued_items_against_production_order/issued_items_against_production_order.json index cf539036b5e..fe738592986 100644 --- a/erpnext/manufacturing/report/issued_items_against_production_order/issued_items_against_production_order.json +++ b/erpnext/manufacturing/report/issued_items_against_production_order/issued_items_against_production_order.json @@ -6,12 +6,12 @@ "doctype": "Report", "idx": 1, "is_standard": "Yes", - "modified": "2014-06-03 07:18:17.082436", + "modified": "2014-09-17 12:41:55.740299", "modified_by": "Administrator", "module": "Manufacturing", "name": "Issued Items Against Production Order", "owner": "Administrator", - "query": "select\n ste.production_order as \"Production Order:Link/Production Order:120\",\n ste.posting_date as \"Issue Date:Date:140\",\n ste_item.item_code as \"Item Code:Link/Item:120\",\n\tste_item.description as \"Description::150\",\n\tste_item.transfer_qty as \"Qty:Float:100\",\n\tste_item.stock_uom as \"UOM:Link/UOM:80\",\n\tste_item.amount as \"Amount:Currency:120\",\n\tste_item.serial_no as \"Serial No:Link/Serial No:80\",\n\tste_item.s_warehouse as \"Source Warehouse:Link/Warehouse:120\",\n\tste_item.t_warehouse as \"Target Warehouse:Link/Warehouse:120\",\n\tpro.production_item as \"Finished Goods:Link/Item:120\", \n\tste.name as \"Stock Entry:Link/Stock Entry:120\"\nfrom\n\t`tabStock Entry` ste, `tabStock Entry Detail` ste_item, `tabProduction Order` pro\nwhere\n\tifnull(ste.production_order, '') != '' and ste.name = ste_item.parent \n\tand ste.production_order = pro.name and ste.docstatus = 1 \n\tand ste.purpose = 'Manufacture/Repack'\norder by ste.posting_date, ste.production_order, ste_item.item_code", + "query": "select\n ste.production_order as \"Production Order:Link/Production Order:120\",\n ste.posting_date as \"Issue Date:Date:140\",\n ste_item.item_code as \"Item Code:Link/Item:120\",\n\tste_item.description as \"Description::150\",\n\tste_item.transfer_qty as \"Qty:Float:100\",\n\tste_item.stock_uom as \"UOM:Link/UOM:80\",\n\tste_item.amount as \"Amount:Currency:120\",\n\tste_item.serial_no as \"Serial No:Link/Serial No:80\",\n\tste_item.s_warehouse as \"Source Warehouse:Link/Warehouse:120\",\n\tste_item.t_warehouse as \"Target Warehouse:Link/Warehouse:120\",\n\tpro.production_item as \"Finished Goods:Link/Item:120\", \n\tste.name as \"Stock Entry:Link/Stock Entry:120\"\nfrom\n\t`tabStock Entry` ste, `tabStock Entry Detail` ste_item, `tabProduction Order` pro\nwhere\n\tifnull(ste.production_order, '') != '' and ste.name = ste_item.parent \n\tand ste.production_order = pro.name and ste.docstatus = 1 \n\tand ste.purpose = 'Manufacture' or 'Repack'\norder by ste.posting_date, ste.production_order, ste_item.item_code", "ref_doctype": "Production Order", "report_name": "Issued Items Against Production Order", "report_type": "Query Report" diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 2f0dd2ef5e8..29049f7def9 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -80,4 +80,5 @@ execute:frappe.delete_doc("DocType", "Landed Cost Wizard") erpnext.patches.v4_2.default_website_style erpnext.patches.v4_2.set_company_country erpnext.patches.v4_2.update_sales_order_invoice_field_name -erpnext.patches.v4_2.cost_of_production_cycle \ No newline at end of file +erpnext.patches.v4_2.cost_of_production_cycle +erpnext.patches.v4_2.seprate_manufacture_and_repack \ No newline at end of file diff --git a/erpnext/patches/v4_2/seprate_manufacture_and_repack.py b/erpnext/patches/v4_2/seprate_manufacture_and_repack.py new file mode 100644 index 00000000000..68cb4303cd2 --- /dev/null +++ b/erpnext/patches/v4_2/seprate_manufacture_and_repack.py @@ -0,0 +1,9 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe + +def execute(): + frappe.db.sql("""update `tabStock Entry` set purpose='Manufacture' where purpose='Manufacture/Repack' and production_order ifnull(purpose,"")!="" """) + frappe.db.sql("""update `tabStock Entry` set purpose='Repack' where purpose='Manufacture/Repack' and production_order ifnull(purpose,"")="" """) \ No newline at end of file diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index 2faa28830c5..96dee3da4f5 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -120,7 +120,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({ clean_up: function() { // Clear Production Order record from locals, because it is updated via Stock Entry if(this.frm.doc.production_order && - this.frm.doc.purpose == "Manufacture/Repack") { + this.frm.doc.purpose == "Manufacture") { frappe.model.remove_from_locals("Production Order", this.frm.doc.production_order); } @@ -162,7 +162,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({ }, toggle_enable_bom: function() { - this.frm.toggle_enable("bom_no", !this.frm.doc.production_order); + this.frm.toggle_enable("bom_no", this.frm.doc.purpose!="Manufacture"); }, get_doctype_docname: function() { @@ -339,6 +339,8 @@ cur_frm.cscript.toggle_related_fields = function(doc) { cur_frm.fields_dict["mtn_details"].grid.set_column_disp("s_warehouse", !disable_from_warehouse); cur_frm.fields_dict["mtn_details"].grid.set_column_disp("t_warehouse", !disable_to_warehouse); + cur_frm.cscript.toggle_enable_bom(); + if(doc.purpose == 'Purchase Return') { doc.customer = doc.customer_name = doc.customer_address = doc.delivery_note_no = doc.sales_invoice_no = null; @@ -351,6 +353,8 @@ cur_frm.cscript.toggle_related_fields = function(doc) { doc.delivery_note_no = doc.sales_invoice_no = doc.supplier = doc.supplier_name = doc.supplier_address = doc.purchase_receipt_no = null; } + + } cur_frm.fields_dict['production_order'].get_query = function(doc) { @@ -457,4 +461,5 @@ cur_frm.fields_dict.customer.get_query = function(doc, cdt, cdn) { cur_frm.fields_dict.supplier.get_query = function(doc, cdt, cdn) { return { query: "erpnext.controllers.queries.supplier_query" } } -cur_frm.add_fetch('production_order', 'total_fixed_cost', 'total_fixed_cost'); \ No newline at end of file +cur_frm.add_fetch('production_order', 'total_fixed_cost', 'total_fixed_cost'); +cur_frm.add_fetch('bom_no', 'total_fixed_cost', 'total_fixed_cost'); \ No newline at end of file diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.json b/erpnext/stock/doctype/stock_entry/stock_entry.json index ad4d9ddce10..5f78758c6c6 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.json +++ b/erpnext/stock/doctype/stock_entry/stock_entry.json @@ -1,658 +1,658 @@ { - "allow_copy": 0, - "allow_import": 1, - "allow_rename": 0, - "autoname": "naming_series:", - "creation": "2013-04-09 11:43:55", - "docstatus": 0, - "doctype": "DocType", + "allow_copy": 0, + "allow_import": 1, + "allow_rename": 0, + "autoname": "naming_series:", + "creation": "2013-04-09 11:43:55", + "docstatus": 0, + "doctype": "DocType", "fields": [ { - "fieldname": "col1", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, - "print_width": "50%", - "read_only": 0, + "fieldname": "col1", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "print_width": "50%", + "read_only": 0, "width": "50%" - }, + }, { - "allow_on_submit": 0, - "fieldname": "naming_series", - "fieldtype": "Select", - "hidden": 0, - "in_filter": 0, - "label": "Series", - "no_copy": 1, - "oldfieldname": "naming_series", - "oldfieldtype": "Select", - "options": "STE-", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "report_hide": 0, - "reqd": 1, + "allow_on_submit": 0, + "fieldname": "naming_series", + "fieldtype": "Select", + "hidden": 0, + "in_filter": 0, + "label": "Series", + "no_copy": 1, + "oldfieldname": "naming_series", + "oldfieldtype": "Select", + "options": "STE-", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "report_hide": 0, + "reqd": 1, "search_index": 0 - }, + }, { - "allow_on_submit": 0, - "default": "Material Issue", - "fieldname": "purpose", - "fieldtype": "Select", - "hidden": 0, - "in_filter": 1, - "in_list_view": 1, - "label": "Purpose", - "no_copy": 0, - "oldfieldname": "purpose", - "oldfieldtype": "Select", - "options": "Material Issue\nMaterial Receipt\nMaterial Transfer\nManufacture/Repack\nSubcontract\nSales Return\nPurchase Return", - "permlevel": 0, - "print_hide": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 1, + "allow_on_submit": 0, + "default": "Material Issue", + "fieldname": "purpose", + "fieldtype": "Select", + "hidden": 0, + "in_filter": 1, + "in_list_view": 1, + "label": "Purpose", + "no_copy": 0, + "oldfieldname": "purpose", + "oldfieldtype": "Select", + "options": "Material Issue\nMaterial Receipt\nMaterial Transfer\nManufacture\nRepack\nSubcontract\nSales Return\nPurchase Return", + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, "search_index": 0 - }, + }, { - "allow_on_submit": 0, - "depends_on": "eval:doc.purpose==\"Sales Return\"", - "fieldname": "delivery_note_no", - "fieldtype": "Link", - "hidden": 0, - "in_filter": 0, - "label": "Delivery Note No", - "no_copy": 1, - "oldfieldname": "delivery_note_no", - "oldfieldtype": "Link", - "options": "Delivery Note", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "report_hide": 0, - "reqd": 0, + "allow_on_submit": 0, + "depends_on": "eval:doc.purpose==\"Sales Return\"", + "fieldname": "delivery_note_no", + "fieldtype": "Link", + "hidden": 0, + "in_filter": 0, + "label": "Delivery Note No", + "no_copy": 1, + "oldfieldname": "delivery_note_no", + "oldfieldtype": "Link", + "options": "Delivery Note", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "report_hide": 0, + "reqd": 0, "search_index": 1 - }, + }, { - "depends_on": "eval:doc.purpose==\"Sales Return\"", - "fieldname": "sales_invoice_no", - "fieldtype": "Link", - "hidden": 0, - "label": "Sales Invoice No", - "no_copy": 1, - "options": "Sales Invoice", - "permlevel": 0, - "print_hide": 1, + "depends_on": "eval:doc.purpose==\"Sales Return\"", + "fieldname": "sales_invoice_no", + "fieldtype": "Link", + "hidden": 0, + "label": "Sales Invoice No", + "no_copy": 1, + "options": "Sales Invoice", + "permlevel": 0, + "print_hide": 1, "read_only": 0 - }, + }, { - "allow_on_submit": 0, - "depends_on": "eval:doc.purpose==\"Purchase Return\"", - "fieldname": "purchase_receipt_no", - "fieldtype": "Link", - "hidden": 0, - "in_filter": 0, - "label": "Purchase Receipt No", - "no_copy": 1, - "oldfieldname": "purchase_receipt_no", - "oldfieldtype": "Link", - "options": "Purchase Receipt", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "report_hide": 0, - "reqd": 0, + "allow_on_submit": 0, + "depends_on": "eval:doc.purpose==\"Purchase Return\"", + "fieldname": "purchase_receipt_no", + "fieldtype": "Link", + "hidden": 0, + "in_filter": 0, + "label": "Purchase Receipt No", + "no_copy": 1, + "oldfieldname": "purchase_receipt_no", + "oldfieldtype": "Link", + "options": "Purchase Receipt", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "report_hide": 0, + "reqd": 0, "search_index": 1 - }, + }, { - "fieldname": "col2", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, - "print_width": "50%", - "read_only": 0, + "fieldname": "col2", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "print_width": "50%", + "read_only": 0, "width": "50%" - }, + }, { - "allow_on_submit": 0, - "default": "Today", - "fieldname": "posting_date", - "fieldtype": "Date", - "hidden": 0, - "in_filter": 1, - "in_list_view": 0, - "label": "Posting Date", - "no_copy": 1, - "oldfieldname": "posting_date", - "oldfieldtype": "Date", - "permlevel": 0, - "print_hide": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 1, + "allow_on_submit": 0, + "default": "Today", + "fieldname": "posting_date", + "fieldtype": "Date", + "hidden": 0, + "in_filter": 1, + "in_list_view": 0, + "label": "Posting Date", + "no_copy": 1, + "oldfieldname": "posting_date", + "oldfieldtype": "Date", + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, "search_index": 1 - }, + }, { - "allow_on_submit": 0, - "fieldname": "posting_time", - "fieldtype": "Time", - "hidden": 0, - "in_filter": 0, - "label": "Posting Time", - "no_copy": 1, - "oldfieldname": "posting_time", - "oldfieldtype": "Time", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "report_hide": 0, - "reqd": 1, + "allow_on_submit": 0, + "fieldname": "posting_time", + "fieldtype": "Time", + "hidden": 0, + "in_filter": 0, + "label": "Posting Time", + "no_copy": 1, + "oldfieldname": "posting_time", + "oldfieldtype": "Time", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "report_hide": 0, + "reqd": 1, "search_index": 0 - }, + }, { - "fieldname": "items_section", - "fieldtype": "Section Break", - "label": "Items", - "oldfieldtype": "Section Break", - "permlevel": 0, + "fieldname": "items_section", + "fieldtype": "Section Break", + "label": "Items", + "oldfieldtype": "Section Break", + "permlevel": 0, "read_only": 0 - }, + }, { - "allow_on_submit": 0, - "fieldname": "from_warehouse", - "fieldtype": "Link", - "hidden": 0, - "in_filter": 0, - "in_list_view": 1, - "label": "Default Source Warehouse", - "no_copy": 1, - "oldfieldname": "from_warehouse", - "oldfieldtype": "Link", - "options": "Warehouse", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "report_hide": 0, - "reqd": 0, + "allow_on_submit": 0, + "fieldname": "from_warehouse", + "fieldtype": "Link", + "hidden": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Default Source Warehouse", + "no_copy": 1, + "oldfieldname": "from_warehouse", + "oldfieldtype": "Link", + "options": "Warehouse", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "report_hide": 0, + "reqd": 0, "search_index": 0 - }, + }, { - "fieldname": "cb0", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "cb0", + "fieldtype": "Column Break", + "permlevel": 0, "read_only": 0 - }, + }, { - "allow_on_submit": 0, - "fieldname": "to_warehouse", - "fieldtype": "Link", - "hidden": 0, - "in_filter": 0, - "in_list_view": 1, - "label": "Default Target Warehouse", - "no_copy": 1, - "oldfieldname": "to_warehouse", - "oldfieldtype": "Link", - "options": "Warehouse", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "report_hide": 0, - "reqd": 0, + "allow_on_submit": 0, + "fieldname": "to_warehouse", + "fieldtype": "Link", + "hidden": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Default Target Warehouse", + "no_copy": 1, + "oldfieldname": "to_warehouse", + "oldfieldtype": "Link", + "options": "Warehouse", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "report_hide": 0, + "reqd": 0, "search_index": 0 - }, + }, { - "fieldname": "sb0", - "fieldtype": "Section Break", - "options": "Simple", - "permlevel": 0, + "fieldname": "sb0", + "fieldtype": "Section Break", + "options": "Simple", + "permlevel": 0, "read_only": 0 - }, + }, { - "allow_on_submit": 0, - "fieldname": "mtn_details", - "fieldtype": "Table", - "hidden": 0, - "in_filter": 0, - "label": "MTN Details", - "no_copy": 0, - "oldfieldname": "mtn_details", - "oldfieldtype": "Table", - "options": "Stock Entry Detail", - "permlevel": 0, - "print_hide": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, + "allow_on_submit": 0, + "fieldname": "mtn_details", + "fieldtype": "Table", + "hidden": 0, + "in_filter": 0, + "label": "MTN Details", + "no_copy": 0, + "oldfieldname": "mtn_details", + "oldfieldtype": "Table", + "options": "Stock Entry Detail", + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, "search_index": 0 - }, + }, { - "description": "Get valuation rate and available stock at source/target warehouse on mentioned posting date-time. If serialized item, please press this button after entering serial nos.", - "fieldname": "get_stock_and_rate", - "fieldtype": "Button", - "label": "Get Stock and Rate", - "oldfieldtype": "Button", - "options": "get_stock_and_rate", - "permlevel": 0, - "print_hide": 1, + "description": "Get valuation rate and available stock at source/target warehouse on mentioned posting date-time. If serialized item, please press this button after entering serial nos.", + "fieldname": "get_stock_and_rate", + "fieldtype": "Button", + "label": "Get Stock and Rate", + "oldfieldtype": "Button", + "options": "get_stock_and_rate", + "permlevel": 0, + "print_hide": 1, "read_only": 0 - }, + }, { - "fieldname": "fold", - "fieldtype": "Fold", + "fieldname": "fold", + "fieldtype": "Fold", "permlevel": 0 - }, + }, { - "depends_on": "eval:(doc.purpose!==\"Sales Return\" && doc.purpose!==\"Purchase Return\")", - "fieldname": "sb1", - "fieldtype": "Section Break", - "label": "From Bill of Materials", - "permlevel": 0, + "depends_on": "eval:(doc.purpose!==\"Sales Return\" && doc.purpose!==\"Purchase Return\")", + "fieldname": "sb1", + "fieldtype": "Section Break", + "label": "From Bill of Materials", + "permlevel": 0, "read_only": 0 - }, + }, { - "allow_on_submit": 0, - "depends_on": "eval:inList([\"Material Transfer\", \"Manufacture/Repack\"], doc.purpose)", - "fieldname": "production_order", - "fieldtype": "Link", - "hidden": 0, - "in_filter": 1, - "label": "Production Order", - "no_copy": 0, - "oldfieldname": "production_order", - "oldfieldtype": "Link", - "options": "Production Order", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "report_hide": 0, - "reqd": 0, + "allow_on_submit": 0, + "depends_on": "eval:inList([\"Material Transfer\", \"Manufacture\"], doc.purpose)", + "fieldname": "production_order", + "fieldtype": "Link", + "hidden": 0, + "in_filter": 1, + "label": "Production Order", + "no_copy": 0, + "oldfieldname": "production_order", + "oldfieldtype": "Link", + "options": "Production Order", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "report_hide": 0, + "reqd": 0, "search_index": 1 - }, + }, { - "depends_on": "eval:!inList([\"Sales Return\", \"Purchase Return\"], doc.purpose)", - "fieldname": "bom_no", - "fieldtype": "Link", - "label": "BOM No", - "options": "BOM", - "permlevel": 0, + "depends_on": "eval:!inList([\"Sales Return\", \"Purchase Return\"], doc.purpose)", + "fieldname": "bom_no", + "fieldtype": "Link", + "label": "BOM No", + "options": "BOM", + "permlevel": 0, "read_only": 0 - }, + }, { - "allow_on_submit": 0, - "depends_on": "eval:!inList([\"Sales Return\", \"Purchase Return\"], doc.purpose)", - "description": "As per Stock UOM", - "fieldname": "fg_completed_qty", - "fieldtype": "Float", - "hidden": 0, - "in_filter": 0, - "label": "Manufacturing Quantity", - "no_copy": 0, - "oldfieldname": "fg_completed_qty", - "oldfieldtype": "Currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "report_hide": 0, - "reqd": 0, + "allow_on_submit": 0, + "depends_on": "eval:!inList([\"Sales Return\", \"Purchase Return\"], doc.purpose)", + "description": "As per Stock UOM", + "fieldname": "fg_completed_qty", + "fieldtype": "Float", + "hidden": 0, + "in_filter": 0, + "label": "Manufacturing Quantity", + "no_copy": 0, + "oldfieldname": "fg_completed_qty", + "oldfieldtype": "Currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "report_hide": 0, + "reqd": 0, "search_index": 0 - }, + }, { - "depends_on": "eval:doc.purpose==\"Manufacture/Repack\"", - "fieldname": "total_fixed_cost", - "fieldtype": "Float", - "label": "Total Fixed Cost", - "permlevel": 0, + "depends_on": "eval:inList([\"Manufacture\", \"Repack\"], doc.purpose)", + "fieldname": "total_fixed_cost", + "fieldtype": "Float", + "label": "Total Fixed Cost", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "cb1", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "cb1", + "fieldtype": "Column Break", + "permlevel": 0, "read_only": 0 - }, + }, { - "default": "1", - "depends_on": "eval:!inList([\"Sales Return\", \"Purchase Return\"], doc.purpose)", - "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", - "fieldtype": "Check", - "label": "Use Multi-Level BOM", - "permlevel": 0, - "print_hide": 1, + "default": "1", + "depends_on": "eval:!inList([\"Sales Return\", \"Purchase Return\"], doc.purpose)", + "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", + "fieldtype": "Check", + "label": "Use Multi-Level BOM", + "permlevel": 0, + "print_hide": 1, "read_only": 0 - }, + }, { - "allow_on_submit": 0, - "depends_on": "eval:!inList([\"Sales Return\", \"Purchase Return\"], doc.purpose)", - "fieldname": "get_items", - "fieldtype": "Button", - "hidden": 0, - "in_filter": 0, - "label": "Get Items", - "no_copy": 0, - "oldfieldtype": "Button", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "report_hide": 0, - "reqd": 0, + "allow_on_submit": 0, + "depends_on": "eval:!inList([\"Sales Return\", \"Purchase Return\"], doc.purpose)", + "fieldname": "get_items", + "fieldtype": "Button", + "hidden": 0, + "in_filter": 0, + "label": "Get Items", + "no_copy": 0, + "oldfieldtype": "Button", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "report_hide": 0, + "reqd": 0, "search_index": 0 - }, + }, { - "depends_on": "eval:(doc.purpose==\"Sales Return\" || doc.purpose==\"Purchase Return\")", - "fieldname": "contact_section", - "fieldtype": "Section Break", - "label": "Contact Info", - "permlevel": 0, + "depends_on": "eval:(doc.purpose==\"Sales Return\" || doc.purpose==\"Purchase Return\")", + "fieldname": "contact_section", + "fieldtype": "Section Break", + "label": "Contact Info", + "permlevel": 0, "read_only": 0 - }, + }, { - "allow_on_submit": 0, - "depends_on": "eval:doc.purpose==\"Purchase Return\"", - "fieldname": "supplier", - "fieldtype": "Link", - "hidden": 0, - "in_filter": 0, - "label": "Supplier", - "no_copy": 1, - "oldfieldname": "supplier", - "oldfieldtype": "Link", - "options": "Supplier", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "report_hide": 0, - "reqd": 0, + "allow_on_submit": 0, + "depends_on": "eval:doc.purpose==\"Purchase Return\"", + "fieldname": "supplier", + "fieldtype": "Link", + "hidden": 0, + "in_filter": 0, + "label": "Supplier", + "no_copy": 1, + "oldfieldname": "supplier", + "oldfieldtype": "Link", + "options": "Supplier", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "report_hide": 0, + "reqd": 0, "search_index": 0 - }, + }, { - "allow_on_submit": 0, - "depends_on": "eval:doc.purpose==\"Purchase Return\"", - "fieldname": "supplier_name", - "fieldtype": "Data", - "hidden": 0, - "in_filter": 0, - "label": "Supplier Name", - "no_copy": 1, - "oldfieldname": "supplier_name", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, - "read_only": 1, - "report_hide": 0, - "reqd": 0, + "allow_on_submit": 0, + "depends_on": "eval:doc.purpose==\"Purchase Return\"", + "fieldname": "supplier_name", + "fieldtype": "Data", + "hidden": 0, + "in_filter": 0, + "label": "Supplier Name", + "no_copy": 1, + "oldfieldname": "supplier_name", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, "search_index": 0 - }, + }, { - "allow_on_submit": 0, - "depends_on": "eval:doc.purpose==\"Purchase Return\"", - "fieldname": "supplier_address", - "fieldtype": "Small Text", - "hidden": 0, - "in_filter": 0, - "label": "Supplier Address", - "no_copy": 1, - "oldfieldname": "supplier_address", - "oldfieldtype": "Small Text", - "permlevel": 0, - "print_hide": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, + "allow_on_submit": 0, + "depends_on": "eval:doc.purpose==\"Purchase Return\"", + "fieldname": "supplier_address", + "fieldtype": "Small Text", + "hidden": 0, + "in_filter": 0, + "label": "Supplier Address", + "no_copy": 1, + "oldfieldname": "supplier_address", + "oldfieldtype": "Small Text", + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, "search_index": 0 - }, + }, { - "allow_on_submit": 0, - "depends_on": "eval:doc.purpose==\"Sales Return\"", - "fieldname": "customer", - "fieldtype": "Link", - "hidden": 0, - "in_filter": 0, - "label": "Customer", - "no_copy": 1, - "oldfieldname": "customer", - "oldfieldtype": "Link", - "options": "Customer", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "report_hide": 0, - "reqd": 0, + "allow_on_submit": 0, + "depends_on": "eval:doc.purpose==\"Sales Return\"", + "fieldname": "customer", + "fieldtype": "Link", + "hidden": 0, + "in_filter": 0, + "label": "Customer", + "no_copy": 1, + "oldfieldname": "customer", + "oldfieldtype": "Link", + "options": "Customer", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "report_hide": 0, + "reqd": 0, "search_index": 0 - }, + }, { - "allow_on_submit": 0, - "depends_on": "eval:doc.purpose==\"Sales Return\"", - "fieldname": "customer_name", - "fieldtype": "Data", - "hidden": 0, - "in_filter": 0, - "label": "Customer Name", - "no_copy": 1, - "oldfieldname": "customer_name", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, - "read_only": 1, - "report_hide": 0, - "reqd": 0, + "allow_on_submit": 0, + "depends_on": "eval:doc.purpose==\"Sales Return\"", + "fieldname": "customer_name", + "fieldtype": "Data", + "hidden": 0, + "in_filter": 0, + "label": "Customer Name", + "no_copy": 1, + "oldfieldname": "customer_name", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, "search_index": 0 - }, + }, { - "allow_on_submit": 0, - "depends_on": "eval:doc.purpose==\"Sales Return\"", - "fieldname": "customer_address", - "fieldtype": "Small Text", - "hidden": 0, - "in_filter": 0, - "label": "Customer Address", - "no_copy": 1, - "oldfieldname": "customer_address", - "oldfieldtype": "Small Text", - "permlevel": 0, - "print_hide": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, + "allow_on_submit": 0, + "depends_on": "eval:doc.purpose==\"Sales Return\"", + "fieldname": "customer_address", + "fieldtype": "Small Text", + "hidden": 0, + "in_filter": 0, + "label": "Customer Address", + "no_copy": 1, + "oldfieldname": "customer_address", + "oldfieldtype": "Small Text", + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, "search_index": 0 - }, + }, { - "fieldname": "more_info", - "fieldtype": "Section Break", - "label": "More Info", - "oldfieldtype": "Section Break", - "permlevel": 0, + "fieldname": "more_info", + "fieldtype": "Section Break", + "label": "More Info", + "oldfieldtype": "Section Break", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "project_name", - "fieldtype": "Link", - "in_filter": 1, - "label": "Project Name", - "oldfieldname": "project_name", - "oldfieldtype": "Link", - "options": "Project", - "permlevel": 0, + "fieldname": "project_name", + "fieldtype": "Link", + "in_filter": 1, + "label": "Project Name", + "oldfieldname": "project_name", + "oldfieldtype": "Link", + "options": "Project", + "permlevel": 0, "read_only": 0 - }, + }, { - "allow_on_submit": 0, - "fieldname": "remarks", - "fieldtype": "Text", - "hidden": 0, - "in_filter": 0, - "label": "Remarks", - "no_copy": 1, - "oldfieldname": "remarks", - "oldfieldtype": "Text", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "report_hide": 0, - "reqd": 0, + "allow_on_submit": 0, + "fieldname": "remarks", + "fieldtype": "Text", + "hidden": 0, + "in_filter": 0, + "label": "Remarks", + "no_copy": 1, + "oldfieldname": "remarks", + "oldfieldtype": "Text", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "report_hide": 0, + "reqd": 0, "search_index": 0 - }, + }, { - "fieldname": "col5", - "fieldtype": "Column Break", - "permlevel": 0, - "print_width": "50%", - "read_only": 0, + "fieldname": "col5", + "fieldtype": "Column Break", + "permlevel": 0, + "print_width": "50%", + "read_only": 0, "width": "50%" - }, + }, { - "fieldname": "total_amount", - "fieldtype": "Currency", - "label": "Total Amount", - "options": "Company:company:default_currency", - "permlevel": 0, + "fieldname": "total_amount", + "fieldtype": "Currency", + "label": "Total Amount", + "options": "Company:company:default_currency", + "permlevel": 0, "read_only": 1 - }, + }, { - "fieldname": "fiscal_year", - "fieldtype": "Link", - "in_filter": 0, - "label": "Fiscal Year", - "options": "Fiscal Year", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, + "fieldname": "fiscal_year", + "fieldtype": "Link", + "in_filter": 0, + "label": "Fiscal Year", + "options": "Fiscal Year", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, "reqd": 1 - }, + }, { - "allow_on_submit": 0, - "fieldname": "company", - "fieldtype": "Link", - "hidden": 0, - "in_filter": 1, - "label": "Company", - "no_copy": 0, - "oldfieldname": "company", - "oldfieldtype": "Link", - "options": "Company", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "report_hide": 0, - "reqd": 1, + "allow_on_submit": 0, + "fieldname": "company", + "fieldtype": "Link", + "hidden": 0, + "in_filter": 1, + "label": "Company", + "no_copy": 0, + "oldfieldname": "company", + "oldfieldtype": "Link", + "options": "Company", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "report_hide": 0, + "reqd": 1, "search_index": 0 - }, + }, { - "allow_on_submit": 1, - "fieldname": "select_print_heading", - "fieldtype": "Link", - "hidden": 0, - "in_filter": 0, - "label": "Print Heading", - "no_copy": 0, - "oldfieldname": "select_print_heading", - "oldfieldtype": "Link", - "options": "Print Heading", - "permlevel": 0, - "print_hide": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, + "allow_on_submit": 1, + "fieldname": "select_print_heading", + "fieldtype": "Link", + "hidden": 0, + "in_filter": 0, + "label": "Print Heading", + "no_copy": 0, + "oldfieldname": "select_print_heading", + "oldfieldtype": "Link", + "options": "Print Heading", + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, "search_index": 0 - }, + }, { - "allow_on_submit": 0, - "fieldname": "amended_from", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 1, - "in_filter": 0, - "label": "Amended From", - "no_copy": 1, - "oldfieldname": "amended_from", - "oldfieldtype": "Link", - "options": "Stock Entry", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, - "report_hide": 0, - "reqd": 0, + "allow_on_submit": 0, + "fieldname": "amended_from", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 1, + "in_filter": 0, + "label": "Amended From", + "no_copy": 1, + "oldfieldname": "amended_from", + "oldfieldtype": "Link", + "options": "Stock Entry", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, + "report_hide": 0, + "reqd": 0, "search_index": 0 } - ], - "hide_heading": 0, - "hide_toolbar": 0, - "icon": "icon-file-text", - "idx": 1, - "in_create": 0, - "in_dialog": 0, - "is_submittable": 1, - "issingle": 0, - "max_attachments": 0, - "modified": "2014-09-16 05:35:39.352951", - "modified_by": "Administrator", - "module": "Stock", - "name": "Stock Entry", - "owner": "Administrator", + ], + "hide_heading": 0, + "hide_toolbar": 0, + "icon": "icon-file-text", + "idx": 1, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 1, + "issingle": 0, + "max_attachments": 0, + "modified": "2014-09-16 15:56:37.514676", + "modified_by": "Administrator", + "module": "Stock", + "name": "Stock Entry", + "owner": "Administrator", "permissions": [ { - "amend": 1, - "apply_user_permissions": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Material User", - "submit": 1, + "amend": 1, + "apply_user_permissions": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Material User", + "submit": 1, "write": 1 - }, + }, { - "amend": 1, - "apply_user_permissions": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Manufacturing User", - "submit": 1, + "amend": 1, + "apply_user_permissions": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Manufacturing User", + "submit": 1, "write": 1 - }, + }, { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Manufacturing Manager", - "submit": 1, + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Manufacturing Manager", + "submit": 1, "write": 1 - }, + }, { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Material Manager", - "submit": 1, + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Material Manager", + "submit": 1, "write": 1 } - ], - "read_only": 0, - "read_only_onload": 0, - "search_fields": "posting_date, from_warehouse, to_warehouse, purpose, remarks", - "sort_field": "modified", + ], + "read_only": 0, + "read_only_onload": 0, + "search_fields": "posting_date, from_warehouse, to_warehouse, purpose, remarks", + "sort_field": "modified", "sort_order": "DESC" -} +} \ No newline at end of file diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index c3aab6acd71..4f3480c0bb4 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -43,7 +43,7 @@ class StockEntry(StockController): self.validate_uom_is_integer("uom", "qty") self.validate_uom_is_integer("stock_uom", "transfer_qty") self.validate_warehouse(pro_obj) - self.validate_production_order(pro_obj) + self.validate_production_order() self.get_stock_and_rate() self.validate_incoming_rate() self.validate_bom() @@ -54,6 +54,7 @@ class StockEntry(StockController): self.validate_valuation_rate() self.set_total_amount() + def on_submit(self): self.update_stock_ledger() @@ -74,7 +75,7 @@ class StockEntry(StockController): def validate_purpose(self): valid_purposes = ["Material Issue", "Material Receipt", "Material Transfer", - "Manufacture/Repack", "Subcontract", "Sales Return", "Purchase Return"] + "Manufacture", "Repack", "Subcontract", "Sales Return", "Purchase Return"] if self.purpose not in valid_purposes: frappe.throw(_("Purpose must be one of {0}").format(comma_or(valid_purposes))) @@ -137,7 +138,7 @@ class StockEntry(StockController): if self.purpose in target_mandatory and not d.t_warehouse: frappe.throw(_("Target warehouse is mandatory for row {0}").format(d.idx)) - if self.purpose == "Manufacture/Repack": + if self.purpose in ["Manufacture", "Repack"]: if validate_for_manufacture_repack: if d.bom_no: d.s_warehouse = None @@ -156,14 +157,11 @@ class StockEntry(StockController): if cstr(d.s_warehouse) == cstr(d.t_warehouse): frappe.throw(_("Source and target warehouse cannot be same for row {0}").format(d.idx)) - def validate_production_order(self, pro_obj=None): - if not pro_obj: - if self.production_order: - pro_obj = frappe.get_doc('Production Order', self.production_order) - else: - return - - if self.purpose == "Manufacture/Repack": + def validate_production_order(self): + if self.purpose == "Manufacture": + # check if production order is entered + if not self.production_order: + frappe.throw(_("Production order number is mandatory for stock entry purpose manufacture")) # check for double entry self.check_duplicate_entry_for_production_order() elif self.purpose != "Material Transfer": @@ -192,7 +190,7 @@ class StockEntry(StockController): + self.production_order + ":" + ", ".join(other_ste), DuplicateEntryForProductionOrderError) def validate_valuation_rate(self): - if self.purpose == "Manufacture/Repack": + if self.purpose in ["Manufacture", "Repack"]: valuation_at_source, valuation_at_target = 0, 0 for d in self.get("mtn_details"): if d.s_warehouse and not d.t_warehouse: @@ -248,7 +246,7 @@ class StockEntry(StockController): raw_material_cost += flt(d.amount) # set incoming rate for fg item - if self.purpose == "Manufacture/Repack": + if self.purpose in ["Manufacture", "Repack"]: number_of_fg_items = len([t.t_warehouse for t in self.get("mtn_details") if t.t_warehouse]) for d in self.get("mtn_details"): if d.bom_no or (d.t_warehouse and number_of_fg_items == 1): @@ -391,7 +389,7 @@ class StockEntry(StockController): pro_doc = frappe.get_doc("Production Order", self.production_order) _validate_production_order(pro_doc) pro_doc.run_method("update_status") - if self.purpose == "Manufacture/Repack": + if self.purpose == "Manufacture": pro_doc.run_method("update_produced_qty") self.update_planned_qty(pro_doc) @@ -463,20 +461,20 @@ class StockEntry(StockController): def get_items(self): self.set('mtn_details', []) + self.validate_production_order() pro_obj = None if self.production_order: # common validations pro_obj = frappe.get_doc('Production Order', self.production_order) if pro_obj: - self.validate_production_order(pro_obj) self.bom_no = pro_obj.bom_no else: # invalid production order self.production_order = None if self.bom_no: - if self.purpose in ["Material Issue", "Material Transfer", "Manufacture/Repack", + if self.purpose in ["Material Issue", "Material Transfer", "Manufacture", "Repack", "Subcontract"]: if self.production_order and self.purpose == "Material Transfer": item_dict = self.get_pending_raw_materials(pro_obj) @@ -493,7 +491,7 @@ class StockEntry(StockController): self.add_to_stock_entry_detail(item_dict) # add finished good item to Stock Entry Detail table -- along with bom_no - if self.production_order and self.purpose == "Manufacture/Repack": + if self.production_order and self.purpose == "Manufacture": item = frappe.db.get_value("Item", pro_obj.production_item, ["item_name", "description", "stock_uom", "expense_account", "buying_cost_center"], as_dict=1) self.add_to_stock_entry_detail({ @@ -509,7 +507,7 @@ class StockEntry(StockController): } }, bom_no=pro_obj.bom_no) - elif self.purpose in ["Material Receipt", "Manufacture/Repack"]: + elif self.purpose in ["Material Receipt", "Repack"]: if self.purpose=="Material Receipt": self.from_warehouse = "" diff --git a/erpnext/stock/doctype/stock_entry/stock_entry_list.html b/erpnext/stock/doctype/stock_entry/stock_entry_list.html index 21794cfbef3..e59b3326079 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry_list.html +++ b/erpnext/stock/doctype/stock_entry/stock_entry_list.html @@ -6,7 +6,8 @@ "Material Issue": "icon-arrow-right", "Material Receipt": "icon-arrow-left", "Material Transfer": "icon-resize-horizontal", - "Manufacture/Repack": "icon-wrench", + "Manufacture": "icon-wrench", + "Repack": "icon-wrench", "Sales Return": "icon-warning-sign", "Purchase Return": "icon-warning-sign", "Subcontract": "icon-truck" diff --git a/erpnext/stock/doctype/stock_entry/test_records.json b/erpnext/stock/doctype/stock_entry/test_records.json index 4a4ca0e65a0..f743991eb77 100644 --- a/erpnext/stock/doctype/stock_entry/test_records.json +++ b/erpnext/stock/doctype/stock_entry/test_records.json @@ -108,6 +108,6 @@ ], "posting_date": "2013-01-25", "posting_time": "17:14:24", - "purpose": "Manufacture/Repack" + "purpose": "Repack" } ] \ No newline at end of file diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py index b9a6abd7b78..038606cc1d6 100644 --- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py @@ -843,7 +843,7 @@ class TestStockEntry(unittest.TestCase): stock_entry = frappe.new_doc("Stock Entry") stock_entry.update({ - "purpose": "Manufacture/Repack", + "purpose": "Manufacture", "production_order": production_order.name, "bom_no": bom_no, "fg_completed_qty": "1", From 3a19a71262939ffbc993e77907b7591c94383602 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Tue, 30 Sep 2014 14:48:38 +0530 Subject: [PATCH 42/42] patch fixed --- erpnext/patches/v4_2/seprate_manufacture_and_repack.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/patches/v4_2/seprate_manufacture_and_repack.py b/erpnext/patches/v4_2/seprate_manufacture_and_repack.py index 68cb4303cd2..5b36289bc91 100644 --- a/erpnext/patches/v4_2/seprate_manufacture_and_repack.py +++ b/erpnext/patches/v4_2/seprate_manufacture_and_repack.py @@ -5,5 +5,5 @@ from __future__ import unicode_literals import frappe def execute(): - frappe.db.sql("""update `tabStock Entry` set purpose='Manufacture' where purpose='Manufacture/Repack' and production_order ifnull(purpose,"")!="" """) - frappe.db.sql("""update `tabStock Entry` set purpose='Repack' where purpose='Manufacture/Repack' and production_order ifnull(purpose,"")="" """) \ No newline at end of file + frappe.db.sql("""update `tabStock Entry` set purpose='Manufacture' where purpose='Manufacture/Repack' and ifnull(production_order,"")!="" """) + frappe.db.sql("""update `tabStock Entry` set purpose='Repack' where purpose='Manufacture/Repack' and ifnull(production_order,"")="" """) \ No newline at end of file