diff --git a/erpnext/accounts/doctype/gl_entry/gl_entry.json b/erpnext/accounts/doctype/gl_entry/gl_entry.json index 6d772a6d07..14b3c58ecc 100644 --- a/erpnext/accounts/doctype/gl_entry/gl_entry.json +++ b/erpnext/accounts/doctype/gl_entry/gl_entry.json @@ -193,7 +193,7 @@ "icon": "icon-list", "idx": 1, "in_create": 1, - "modified": "2015-06-14 20:57:19.800276", + "modified": "2015-07-09 15:51:04.986518", "modified_by": "Administrator", "module": "Accounts", "name": "GL Entry", @@ -225,6 +225,19 @@ "role": "Accounts Manager", "submit": 0, "write": 0 + }, + { + "create": 0, + "delete": 0, + "email": 0, + "export": 1, + "permlevel": 0, + "print": 0, + "read": 1, + "report": 1, + "role": "Auditor", + "share": 0, + "write": 0 } ], "search_fields": "voucher_no,account,posting_date,against_voucher", diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 489d4889a1..23d4c7380e 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals import frappe -from frappe.utils import cstr, flt, fmt_money, formatdate, getdate +from frappe.utils import cstr, flt, fmt_money, formatdate, getdate, date_diff from frappe import msgprint, _, scrub from erpnext.setup.utils import get_company_currency from erpnext.controllers.accounts_controller import AccountsController @@ -35,7 +35,7 @@ class JournalEntry(AccountsController): self.set_print_format_fields() self.validate_against_sales_order() self.validate_against_purchase_order() - self.check_credit_days() + self.check_due_date() self.validate_expense_claim() self.validate_credit_debit_note() self.validate_empty_accounts_table() @@ -88,23 +88,21 @@ class JournalEntry(AccountsController): for customer in customers: check_credit_limit(customer, self.company) - def check_credit_days(self): - from erpnext.accounts.party import get_credit_days - posting_date = None + def check_due_date(self): if self.cheque_date: for d in self.get("accounts"): if d.party_type and d.party and d.get("credit" if d.party_type=="Customer" else "debit") > 0: + due_date = None if d.against_invoice: - posting_date = frappe.db.get_value("Sales Invoice", d.against_invoice, "posting_date") + due_date = frappe.db.get_value("Sales Invoice", d.against_invoice, "due_date") elif d.against_voucher: - posting_date = frappe.db.get_value("Purchase Invoice", d.against_voucher, "posting_date") + due_date = frappe.db.get_value("Purchase Invoice", d.against_voucher, "due_date") - credit_days = get_credit_days(d.party_type, d.party, self.company) - if posting_date and credit_days: - date_diff = (getdate(self.cheque_date) - getdate(posting_date)).days - if date_diff > flt(credit_days): - msgprint(_("Note: Reference Date exceeds allowed credit days by {0} days for {1} {2}") - .format(date_diff - flt(credit_days), d.party_type, d.party)) + if due_date and getdate(self.cheque_date) > getdate(due_date): + diff = date_diff(self.cheque_date, due_date) + if diff > 0: + msgprint(_("Note: Reference Date exceeds invoice due date by {0} days for {1} {2}") + .format(diff, d.party_type, d.party)) def validate_cheque_info(self): if self.voucher_type in ['Bank Entry']: diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index d404851a18..42a285a29a 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -68,6 +68,32 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ } }, + + posting_date: function() { + var me = this; + if (this.frm.doc.posting_date) { + if (this.frm.doc.supplier) { + return frappe.call({ + method: "erpnext.accounts.party.get_due_date", + args: { + "posting_date": me.frm.doc.posting_date, + "party_type": "Supplier", + "party": me.frm.doc.supplier, + "company": me.frm.doc.company + }, + callback: function(r, rt) { + if(r.message) { + me.frm.set_value("due_date", r.message); + } + erpnext.get_fiscal_year(me.frm.doc.company, me.frm.doc.posting_date); + } + }) + } else { + erpnext.get_fiscal_year(me.frm.doc.company, me.frm.doc.posting_date); + } + } + + }, supplier: function() { var me = this; diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index 3bb9aa0bac..ea33d488ec 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -146,6 +146,33 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte } } }, + + posting_date: function() { + var me = this; + if (this.frm.doc.posting_date) { + if (this.frm.doc.customer) { + return frappe.call({ + method: "erpnext.accounts.party.get_due_date", + args: { + "posting_date": me.frm.doc.posting_date, + "party_type": "Customer", + "party": me.frm.doc.customer, + "company": me.frm.doc.company + }, + callback: function(r, rt) { + if(r.message) { + me.frm.set_value("due_date", r.message); + } + erpnext.get_fiscal_year(me.frm.doc.company, me.frm.doc.posting_date); + } + }) + } else { + erpnext.get_fiscal_year(me.frm.doc.company, me.frm.doc.posting_date); + } + } + + }, + customer: function() { var me = this; diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index f3acc74c00..829478df79 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -138,7 +138,7 @@ class SalesInvoice(SellingController): if not self.debit_to: self.debit_to = get_party_account(self.company, self.customer, "Customer") - if not self.due_date: + if not self.due_date and self.customer: self.due_date = get_due_date(self.posting_date, "Customer", self.customer, self.company) super(SalesInvoice, self).set_missing_values(for_validate) diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 63977b782b..7cdb6df153 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -5,6 +5,7 @@ from __future__ import unicode_literals import frappe import unittest, copy import time +from frappe.utils import nowdate, add_days 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 * @@ -756,14 +757,28 @@ class TestSalesInvoice(unittest.TestCase): # hack! because stock ledger entires are already inserted and are not rolled back! self.assertRaises(SerialNoDuplicateError, si.cancel) + + def test_invoice_due_date_against_customers_credit_days(self): + si = create_sales_invoice() + # set customer's credit days + frappe.db.set_value("Customer", "_Test Customer", "credit_days_based_on", "Fixed Days") + frappe.db.set_value("Customer", "_Test Customer", "credit_days", 10) + + si.validate() + self.assertEqual(si.due_date, add_days(nowdate(), 10)) + + # set customer's credit days is last day of the next month + frappe.db.set_value("Customer", "_Test Customer", "credit_days_based_on", "Last Day of the Next Month") + + si1 = create_sales_invoice(posting_date="2015-07-05") + self.assertEqual(si1.due_date, "2015-08-31") + def create_sales_invoice(**args): si = frappe.new_doc("Sales Invoice") args = frappe._dict(args) if args.posting_date: - si.posting_date = args.posting_date - if args.posting_time: - si.posting_time = args.posting_time + si.posting_date = args.posting_date or nowdate() si.company = args.company or "_Test Company" si.customer = args.customer or "_Test Customer" diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index 08402f3a49..1f655df79e 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -4,9 +4,10 @@ from __future__ import unicode_literals import frappe +import datetime from frappe import _, msgprint, scrub from frappe.defaults import get_user_permissions -from frappe.utils import add_days, getdate, formatdate, flt +from frappe.utils import add_days, getdate, formatdate, flt, get_first_day, date_diff, nowdate from erpnext.utilities.doctype.address.address import get_address_display from erpnext.utilities.doctype.contact.contact import get_contact_details @@ -158,43 +159,54 @@ def get_party_account(company, party, party_type): return account +@frappe.whitelist() def get_due_date(posting_date, party_type, party, company): """Set Due Date = Posting Date + Credit Days""" due_date = None - if posting_date: - credit_days = get_credit_days(party_type, party, company) - due_date = add_days(posting_date, credit_days) if credit_days else posting_date - + if posting_date and party: + due_date = nowdate() + if party_type=="Customer": + credit_days_based_on, credit_days = get_credit_days(party_type, party, company) + if credit_days_based_on == "Fixed Days" and credit_days: + due_date = add_days(posting_date, credit_days) + elif credit_days_based_on == "Last Day of the Next Month": + due_date = (get_first_day(posting_date, 0, 2) + datetime.timedelta(-1)).strftime("%Y-%m-%d") + else: + credit_days = get_credit_days(party_type, party, company) + if credit_days: + due_date = add_days(posting_date, credit_days) + return due_date def get_credit_days(party_type, party, company): - if not party: - return None - - party_group_doctype = "Customer Group" if party_type=="Customer" else "Supplier Type" - credit_days, party_group = frappe.db.get_value(party_type, party, ["credit_days", frappe.scrub(party_group_doctype)]) - - if not credit_days: - credit_days = frappe.db.get_value(party_group_doctype, party_group, "credit_days") or \ - frappe.db.get_value("Company", company, "credit_days") - - return credit_days - -def validate_due_date(posting_date, due_date, party_type, party, company): - credit_days = get_credit_days(party_type, party, company) - - posting_date, due_date = getdate(posting_date), getdate(due_date) - diff = (due_date - posting_date).days - - if diff < 0: - frappe.throw(_("Due Date cannot be before Posting Date")) - elif credit_days is not None and diff > flt(credit_days): - is_credit_controller = frappe.db.get_value("Accounts Settings", None, - "credit_controller") in frappe.get_roles() - - if is_credit_controller: - msgprint(_("Note: Due / Reference Date exceeds allowed customer credit days by {0} day(s)") - .format(diff - flt(credit_days))) + if party_type and party: + if party_type == "Customer": + credit_days_based_on, credit_days, customer_group = \ + frappe.db.get_value(party_type, party, ["credit_days_based_on", "credit_days", "customer_group"]) + + if not credit_days_based_on: + credit_days_based_on, credit_days = \ + frappe.db.get_value("Customer Group", customer_group, ["credit_days_based_on", "credit_days"]) \ + or frappe.db.get_value("Company", company, ["credit_days_based_on", "credit_days"]) + + return credit_days_based_on, credit_days else: - max_due_date = formatdate(add_days(posting_date, credit_days)) - frappe.throw(_("Due / Reference Date cannot be after {0}").format(max_due_date)) + credit_days, supplier_type = frappe.db.get_value(party_type, party, ["credit_days", "supplier_type"]) + if not credit_days: + credit_days = frappe.db.get_value("Supplier Type", supplier_type, "credit_days") \ + or frappe.db.get_value("Company", company, "credit_days") + + return credit_days + +def validate_due_date(posting_date, due_date, party_type, party, company): + if getdate(due_date) < getdate(posting_date): + frappe.throw(_("Due Date cannot be before Posting Date")) + else: + default_due_date = get_due_date(posting_date, party_type, party, company) + if getdate(due_date) > getdate(default_due_date): + is_credit_controller = frappe.db.get_single_value("Accounts Settings", "credit_controller") in frappe.get_roles() + if is_credit_controller: + msgprint(_("Note: Due / Reference Date exceeds allowed customer credit days by {0} day(s)") + .format(date_diff(due_date, default_due_date))) + else: + frappe.throw(_("Due / Reference Date cannot be after {0}").format(formatdate(default_due_date))) \ No newline at end of file diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 91601a4312..1ec84892d3 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -14,7 +14,6 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ $.each({ posting_date: today, - due_date: today, transaction_date: today, currency: currency, price_list_currency: currency, diff --git a/erpnext/selling/doctype/customer/customer.json b/erpnext/selling/doctype/customer/customer.json index f281175924..edae9b4ee5 100644 --- a/erpnext/selling/doctype/customer/customer.json +++ b/erpnext/selling/doctype/customer/customer.json @@ -1,366 +1,375 @@ { - "allow_import": 1, - "allow_rename": 1, - "autoname": "naming_series:", - "creation": "2013-06-11 14:26:44", - "description": "Buyer of Goods and Services.", - "docstatus": 0, - "doctype": "DocType", - "document_type": "Master", + "allow_import": 1, + "allow_rename": 1, + "autoname": "naming_series:", + "creation": "2013-06-11 14:26:44", + "description": "Buyer of Goods and Services.", + "docstatus": 0, + "doctype": "DocType", + "document_type": "Master", "fields": [ { - "fieldname": "basic_info", - "fieldtype": "Section Break", - "label": "", - "oldfieldtype": "Section Break", - "options": "icon-user", - "permlevel": 0, + "fieldname": "basic_info", + "fieldtype": "Section Break", + "label": "", + "oldfieldtype": "Section Break", + "options": "icon-user", + "permlevel": 0, "reqd": 0 - }, + }, { - "fieldname": "naming_series", - "fieldtype": "Select", - "label": "Series", - "no_copy": 1, - "options": "CUST-", - "permlevel": 0, + "fieldname": "naming_series", + "fieldtype": "Select", + "label": "Series", + "no_copy": 1, + "options": "CUST-", + "permlevel": 0, "print_hide": 0 - }, + }, { - "fieldname": "customer_name", - "fieldtype": "Data", - "hidden": 0, - "in_filter": 1, - "in_list_view": 0, - "label": "Full Name", - "no_copy": 1, - "oldfieldname": "customer_name", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, - "report_hide": 0, - "reqd": 1, + "fieldname": "customer_name", + "fieldtype": "Data", + "hidden": 0, + "in_filter": 1, + "in_list_view": 0, + "label": "Full Name", + "no_copy": 1, + "oldfieldname": "customer_name", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 0, + "report_hide": 0, + "reqd": 1, "search_index": 1 - }, + }, { - "fieldname": "customer_type", - "fieldtype": "Select", - "label": "Type", - "oldfieldname": "customer_type", - "oldfieldtype": "Select", - "options": "\nCompany\nIndividual", - "permlevel": 0, + "fieldname": "customer_type", + "fieldtype": "Select", + "label": "Type", + "oldfieldname": "customer_type", + "oldfieldtype": "Select", + "options": "\nCompany\nIndividual", + "permlevel": 0, "reqd": 1 - }, + }, { - "fieldname": "lead_name", - "fieldtype": "Link", - "hidden": 0, - "in_filter": 1, - "label": "From Lead", - "no_copy": 1, - "oldfieldname": "lead_name", - "oldfieldtype": "Link", - "options": "Lead", - "permlevel": 0, - "print_hide": 1, + "fieldname": "lead_name", + "fieldtype": "Link", + "hidden": 0, + "in_filter": 1, + "label": "From Lead", + "no_copy": 1, + "oldfieldname": "lead_name", + "oldfieldtype": "Link", + "options": "Lead", + "permlevel": 0, + "print_hide": 1, "report_hide": 1 - }, + }, { - "fieldname": "column_break0", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "column_break0", + "fieldtype": "Column Break", + "permlevel": 0, "width": "50%" - }, + }, { - "description": "", - "fieldname": "customer_group", - "fieldtype": "Link", - "hidden": 0, - "in_filter": 1, - "in_list_view": 1, - "label": "Customer Group", - "oldfieldname": "customer_group", - "oldfieldtype": "Link", - "options": "Customer Group", - "permlevel": 0, - "print_hide": 0, - "reqd": 1, + "description": "", + "fieldname": "customer_group", + "fieldtype": "Link", + "hidden": 0, + "in_filter": 1, + "in_list_view": 1, + "label": "Customer Group", + "oldfieldname": "customer_group", + "oldfieldtype": "Link", + "options": "Customer Group", + "permlevel": 0, + "print_hide": 0, + "reqd": 1, "search_index": 1 - }, + }, { - "description": "", - "fieldname": "territory", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Territory", - "oldfieldname": "territory", - "oldfieldtype": "Link", - "options": "Territory", - "permlevel": 0, - "print_hide": 1, + "description": "", + "fieldname": "territory", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Territory", + "oldfieldname": "territory", + "oldfieldtype": "Link", + "options": "Territory", + "permlevel": 0, + "print_hide": 1, "reqd": 1 - }, + }, { - "depends_on": "eval:!doc.__islocal", - "fieldname": "address_contacts", - "fieldtype": "Section Break", - "label": "", - "options": "icon-map-marker", + "depends_on": "eval:!doc.__islocal", + "fieldname": "address_contacts", + "fieldtype": "Section Break", + "label": "", + "options": "icon-map-marker", "permlevel": 0 - }, + }, { - "fieldname": "address_html", - "fieldtype": "HTML", - "label": "Address HTML", - "permlevel": 0, + "fieldname": "address_html", + "fieldtype": "HTML", + "label": "Address HTML", + "permlevel": 0, "read_only": 1 - }, + }, { - "fieldname": "column_break1", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "column_break1", + "fieldtype": "Column Break", + "permlevel": 0, "width": "50%" - }, + }, { - "fieldname": "contact_html", - "fieldtype": "HTML", - "label": "Contact HTML", - "oldfieldtype": "HTML", - "permlevel": 0, + "fieldname": "contact_html", + "fieldtype": "HTML", + "label": "Contact HTML", + "oldfieldtype": "HTML", + "permlevel": 0, "read_only": 1 - }, + }, { - "fieldname": "default_receivable_accounts", - "fieldtype": "Section Break", - "label": "Default Receivable Accounts", + "fieldname": "default_receivable_accounts", + "fieldtype": "Section Break", + "label": "Default Receivable Accounts", "permlevel": 0 - }, + }, { - "depends_on": "eval:!doc.__islocal", - "description": "Mention if non-standard receivable account applicable", - "fieldname": "accounts", - "fieldtype": "Table", - "label": "Accounts", - "options": "Party Account", + "depends_on": "eval:!doc.__islocal", + "description": "Mention if non-standard receivable account applicable", + "fieldname": "accounts", + "fieldtype": "Table", + "label": "Accounts", + "options": "Party Account", "permlevel": 0 - }, + }, { - "fieldname": "more_info", - "fieldtype": "Section Break", - "label": "", - "oldfieldtype": "Section Break", - "options": "icon-file-text", + "fieldname": "more_info", + "fieldtype": "Section Break", + "label": "", + "oldfieldtype": "Section Break", + "options": "icon-file-text", "permlevel": 0 - }, + }, { - "fieldname": "column_break2", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "column_break2", + "fieldtype": "Column Break", + "permlevel": 0, "width": "50%" - }, + }, { - "description": "Your Customer's TAX registration numbers (if applicable) or any general information", - "fieldname": "customer_details", - "fieldtype": "Text", - "label": "Customer Details", - "oldfieldname": "customer_details", - "oldfieldtype": "Code", + "description": "Your Customer's TAX registration numbers (if applicable) or any general information", + "fieldname": "customer_details", + "fieldtype": "Text", + "label": "Customer Details", + "oldfieldname": "customer_details", + "oldfieldtype": "Code", "permlevel": 0 - }, + }, { - "fieldname": "column_break3", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "column_break3", + "fieldtype": "Column Break", + "permlevel": 0, "width": "50%" - }, + }, { - "fieldname": "default_currency", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Currency", - "no_copy": 1, - "options": "Currency", + "fieldname": "default_currency", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Currency", + "no_copy": 1, + "options": "Currency", "permlevel": 0 - }, + }, { - "fieldname": "default_price_list", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Price List", - "options": "Price List", + "fieldname": "default_price_list", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Price List", + "options": "Price List", "permlevel": 0 - }, + }, { - "fieldname": "default_taxes_and_charges", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Taxes and Charges", - "options": "Sales Taxes and Charges Template", + "fieldname": "default_taxes_and_charges", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Taxes and Charges", + "options": "Sales Taxes and Charges Template", "permlevel": 0 - }, + }, { - "fieldname": "credit_days", - "fieldtype": "Int", - "label": "Credit Days", - "oldfieldname": "credit_days", - "oldfieldtype": "Int", + "fieldname": "credit_days_based_on", + "fieldtype": "Select", + "label": "Credit Days Based On", + "options": "\nFixed Days\nLast Day of the Next Month", + "permlevel": 0, + "precision": "" + }, + { + "depends_on": "eval:doc.credit_days_based_on=='Fixed Days'", + "fieldname": "credit_days", + "fieldtype": "Int", + "label": "Credit Days", + "oldfieldname": "credit_days", + "oldfieldtype": "Int", "permlevel": 1 - }, + }, { - "fieldname": "credit_limit", - "fieldtype": "Currency", - "label": "Credit Limit", - "oldfieldname": "credit_limit", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", + "fieldname": "credit_limit", + "fieldtype": "Currency", + "label": "Credit Limit", + "oldfieldname": "credit_limit", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", "permlevel": 1 - }, + }, { - "fieldname": "website", - "fieldtype": "Data", - "label": "Website", + "fieldname": "website", + "fieldtype": "Data", + "label": "Website", "permlevel": 0 - }, + }, { - "fieldname": "sales_team_section_break", - "fieldtype": "Section Break", - "label": "", - "oldfieldtype": "Section Break", - "options": "icon-group", + "fieldname": "sales_team_section_break", + "fieldtype": "Section Break", + "label": "", + "oldfieldtype": "Section Break", + "options": "icon-group", "permlevel": 0 - }, + }, { - "fieldname": "default_sales_partner", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Sales Partner", - "oldfieldname": "default_sales_partner", - "oldfieldtype": "Link", - "options": "Sales Partner", + "fieldname": "default_sales_partner", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Sales Partner", + "oldfieldname": "default_sales_partner", + "oldfieldtype": "Link", + "options": "Sales Partner", "permlevel": 0 - }, + }, { - "fieldname": "default_commission_rate", - "fieldtype": "Float", - "label": "Commission Rate", - "oldfieldname": "default_commission_rate", - "oldfieldtype": "Currency", + "fieldname": "default_commission_rate", + "fieldtype": "Float", + "label": "Commission Rate", + "oldfieldname": "default_commission_rate", + "oldfieldtype": "Currency", "permlevel": 0 - }, + }, { - "fieldname": "sales_team", - "fieldtype": "Table", - "label": "Sales Team Details", - "oldfieldname": "sales_team", - "oldfieldtype": "Table", - "options": "Sales Team", + "fieldname": "sales_team", + "fieldtype": "Table", + "label": "Sales Team Details", + "oldfieldname": "sales_team", + "oldfieldtype": "Table", + "options": "Sales Team", "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, - "modified": "2015-02-24 17:32:36.065248", - "modified_by": "Administrator", - "module": "Selling", - "name": "Customer", - "owner": "Administrator", + ], + "icon": "icon-user", + "idx": 1, + "modified": "2015-07-09 12:41:31.037121", + "modified_by": "Administrator", + "module": "Selling", + "name": "Customer", + "owner": "Administrator", "permissions": [ { - "amend": 0, - "apply_user_permissions": 1, - "create": 1, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Sales User", - "share": 1, - "submit": 0, + "amend": 0, + "apply_user_permissions": 1, + "create": 1, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Sales User", + "share": 1, + "submit": 0, "write": 1 - }, + }, { - "cancel": 0, - "delete": 0, - "permlevel": 1, - "read": 1, + "cancel": 0, + "delete": 0, + "permlevel": 1, + "read": 1, "role": "Sales User" - }, + }, { - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, "role": "Sales Manager" - }, + }, { - "amend": 0, - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Sales Master Manager", - "set_user_permissions": 1, - "share": 1, - "submit": 0, + "amend": 0, + "create": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Sales Master Manager", + "set_user_permissions": 1, + "share": 1, + "submit": 0, "write": 1 - }, + }, { - "cancel": 0, - "delete": 0, - "permlevel": 1, - "read": 1, - "role": "Sales Master Manager", + "cancel": 0, + "delete": 0, + "permlevel": 1, + "read": 1, + "role": "Sales Master Manager", "write": 1 - }, + }, { - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, "role": "Material User" - }, + }, { - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, "role": "Material Manager" - }, + }, { - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, "role": "Accounts User" - }, + }, { - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, "role": "Accounts Manager" } - ], - "search_fields": "customer_name,customer_group,territory", + ], + "search_fields": "customer_name,customer_group,territory", "title_field": "customer_name" -} +} \ No newline at end of file diff --git a/erpnext/setup/doctype/company/company.json b/erpnext/setup/doctype/company/company.json index c2d7073565..ca8e694b31 100644 --- a/erpnext/setup/doctype/company/company.json +++ b/erpnext/setup/doctype/company/company.json @@ -246,7 +246,15 @@ "permlevel": 0 }, { - "depends_on": "eval:!doc.__islocal", + "fieldname": "credit_days_based_on", + "fieldtype": "Select", + "label": "Credit Days Based On", + "options": "\nFixed Days\nLast Day of the Next Month", + "permlevel": 0, + "precision": "" + }, + { + "depends_on": "eval:(!doc.__islocal && doc.credit_days_based_on=='Fixed Days')", "fieldname": "credit_days", "fieldtype": "Int", "label": "Credit Days", @@ -432,7 +440,7 @@ ], "icon": "icon-building", "idx": 1, - "modified": "2015-05-28 12:56:18.175509", + "modified": "2015-07-09 14:20:56.619890", "modified_by": "Administrator", "module": "Setup", "name": "Company", diff --git a/erpnext/setup/doctype/customer_group/customer_group.json b/erpnext/setup/doctype/customer_group/customer_group.json index c6ea98c9e4..732e465994 100644 --- a/erpnext/setup/doctype/customer_group/customer_group.json +++ b/erpnext/setup/doctype/customer_group/customer_group.json @@ -57,6 +57,15 @@ "permlevel": 0 }, { + "fieldname": "credit_days_based_on", + "fieldtype": "Select", + "label": "Credit Days Based On", + "options": "\nFixed Days\nLast Day of the Next Month", + "permlevel": 0, + "precision": "" + }, + { + "depends_on": "eval:doc.credit_days_based_on=='Fixed Days'", "fieldname": "credit_days", "fieldtype": "Int", "label": "Credit Days", @@ -128,7 +137,7 @@ "icon": "icon-sitemap", "idx": 1, "in_create": 0, - "modified": "2015-02-24 17:34:40.749511", + "modified": "2015-07-09 12:43:18.846143", "modified_by": "Administrator", "module": "Setup", "name": "Customer Group",