diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a29e0badee..ef9d094d93 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. diff --git a/erpnext/__version__.py b/erpnext/__version__.py index 5ee6158c52..26a6c390a5 100644 --- a/erpnext/__version__.py +++ b/erpnext/__version__.py @@ -1 +1 @@ -__version__ = '4.3.0' +__version__ = '4.4.0' diff --git a/erpnext/accounts/doctype/account/account.py b/erpnext/accounts/doctype/account/account.py index e067c70bf0..7195db8a94 100644 --- a/erpnext/accounts/doctype/account/account.py +++ b/erpnext/accounts/doctype/account/account.py @@ -169,15 +169,13 @@ class Account(Document): def validate_due_date(self, posting_date, due_date): credit_days = (self.credit_days or frappe.db.get_value("Company", self.company, "credit_days")) - if credit_days is None: - return - 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 diff > credit_days: + + elif credit_days is not None and diff > credit_days: is_credit_controller = frappe.db.get_value("Accounts Settings", None, "credit_controller") in frappe.user.get_roles() diff --git a/erpnext/accounts/doctype/c_form/c_form.py b/erpnext/accounts/doctype/c_form/c_form.py index 88ced9a813..c18d28ad84 100644 --- a/erpnext/accounts/doctype/c_form/c_form.py +++ b/erpnext/accounts/doctype/c_form/c_form.py @@ -17,15 +17,19 @@ class CForm(Document): inv = frappe.db.sql("""select c_form_applicable, c_form_no from `tabSales Invoice` where name = %s and docstatus = 1""", d.invoice_no) - if inv[0][0] != 'Yes': + if inv and inv[0][0] != 'Yes': frappe.throw("C-form is not applicable for Invoice: %s" % d.invoice_no) - elif inv[0][1] and inv[0][1] != self.name: + elif inv and inv[0][1] and inv[0][1] != self.name: frappe.throw("""Invoice %s is tagged in another C-form: %s. If you want to change C-form no for this invoice, please remove invoice no from the previous c-form and then try again""" % (d.invoice_no, inv[0][1])) + elif not inv: + frappe.throw("Row %s: Invoice %s is invalid, it might be cancelled / does not exist. \ + Please enter a valid Invoice" % d.idx, d.invoice_no) + def on_update(self): """ Update C-Form No on invoices""" self.set_total_invoiced_amount() diff --git a/erpnext/accounts/doctype/gl_entry/gl_entry.py b/erpnext/accounts/doctype/gl_entry/gl_entry.py index 7cd27977d0..dab2d82092 100644 --- a/erpnext/accounts/doctype/gl_entry/gl_entry.py +++ b/erpnext/accounts/doctype/gl_entry/gl_entry.py @@ -25,7 +25,8 @@ class GLEntry(Document): validate_balance_type(self.account, adv_adj) # Update outstanding amt on against voucher - if self.against_voucher and update_outstanding == 'Yes': + if self.against_voucher_type in ['Journal Voucher', 'Sales Invoice', 'Purchase Invoice'] \ + and self.against_voucher and update_outstanding == 'Yes': update_outstanding_amt(self.account, self.against_voucher_type, self.against_voucher) diff --git a/erpnext/accounts/doctype/journal_voucher/journal_voucher.json b/erpnext/accounts/doctype/journal_voucher/journal_voucher.json index 0351fd1da8..1638296c5c 100644 --- a/erpnext/accounts/doctype/journal_voucher/journal_voucher.json +++ b/erpnext/accounts/doctype/journal_voucher/journal_voucher.json @@ -339,6 +339,7 @@ "read_only": 0 }, { + "allow_on_submit": 1, "fieldname": "letter_head", "fieldtype": "Link", "label": "Letter Head", @@ -446,7 +447,7 @@ "icon": "icon-file-text", "idx": 1, "is_submittable": 1, - "modified": "2014-08-14 01:37:14.822939", + "modified": "2014-09-09 05:35:31.217863", "modified_by": "Administrator", "module": "Accounts", "name": "Journal Voucher", diff --git a/erpnext/accounts/doctype/journal_voucher/journal_voucher.py b/erpnext/accounts/doctype/journal_voucher/journal_voucher.py index 03bedc708d..7bf6fcc54e 100644 --- a/erpnext/accounts/doctype/journal_voucher/journal_voucher.py +++ b/erpnext/accounts/doctype/journal_voucher/journal_voucher.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals import frappe from frappe.utils import cint, cstr, flt, fmt_money, formatdate, getdate -from frappe import msgprint, _ +from frappe import msgprint, _, scrub from erpnext.setup.utils import get_company_currency from erpnext.controllers.accounts_controller import AccountsController @@ -35,18 +35,35 @@ class JournalVoucher(AccountsController): self.create_remarks() self.set_aging_date() self.set_print_format_fields() + self.validate_against_sales_order() + self.validate_against_purchase_order() def on_submit(self): if self.voucher_type in ['Bank Voucher', 'Contra Voucher', 'Journal Entry']: self.check_credit_days() self.make_gl_entries() self.check_credit_limit() + self.update_advance_paid() + + def update_advance_paid(self): + advance_paid = frappe._dict() + for d in self.get("entries"): + if d.is_advance: + if d.against_sales_order: + advance_paid.setdefault("Sales Order", []).append(d.against_sales_order) + elif d.against_purchase_order: + advance_paid.setdefault("Purchase Order", []).append(d.against_purchase_order) + + for voucher_type, order_list in advance_paid.items(): + for voucher_no in list(set(order_list)): + frappe.get_doc(voucher_type, voucher_no).set_total_advance_paid() def on_cancel(self): from erpnext.accounts.utils import remove_against_link_from_jv remove_against_link_from_jv(self.doctype, self.name, "against_jv") self.make_gl_entries(1) + self.update_advance_paid() def validate_cheque_info(self): if self.voucher_type in ['Bank Voucher']: @@ -64,7 +81,8 @@ class JournalVoucher(AccountsController): master_type = frappe.db.get_value("Account", d.account, "master_type") if (master_type == 'Customer' and flt(d.credit) > 0) or \ (master_type == 'Supplier' and flt(d.debit) > 0): - msgprint(_("Please check 'Is Advance' against Account {0} if this is an advance entry.").format(d.account)) + msgprint(_("Row {0}: Please check 'Is Advance' against Account {1} if this \ + is an advance entry.").format(d.idx, d.account)) def validate_against_jv(self): for d in self.get('entries'): @@ -90,24 +108,86 @@ class JournalVoucher(AccountsController): .format(d.against_jv, dr_or_cr)) def validate_against_sales_invoice(self): - for d in self.get("entries"): - if d.against_invoice: - if d.debit > 0: - frappe.throw(_("Row {0}: Debit entry can not be linked with a Sales Invoice") - .format(d.idx)) - if frappe.db.get_value("Sales Invoice", d.against_invoice, "debit_to") != d.account: - frappe.throw(_("Row {0}: Account does not match with \ - Sales Invoice Debit To account").format(d.idx, d.account)) + payment_against_voucher = self.validate_account_in_against_voucher("against_invoice", "Sales Invoice") + self.validate_against_invoice_fields("Sales Invoice", payment_against_voucher) def validate_against_purchase_invoice(self): + payment_against_voucher = self.validate_account_in_against_voucher("against_voucher", "Purchase Invoice") + self.validate_against_invoice_fields("Purchase Invoice", payment_against_voucher) + + def validate_against_sales_order(self): + payment_against_voucher = self.validate_account_in_against_voucher("against_sales_order", "Sales Order") + self.validate_against_order_fields("Sales Order", payment_against_voucher) + + def validate_against_purchase_order(self): + payment_against_voucher = self.validate_account_in_against_voucher("against_purchase_order", "Purchase Order") + self.validate_against_order_fields("Purchase Order", payment_against_voucher) + + def validate_account_in_against_voucher(self, against_field, doctype): + payment_against_voucher = frappe._dict() + field_dict = {'Sales Invoice': "Debit To", + 'Purchase Invoice': "Credit To", + 'Sales Order': "Customer", + 'Purchase Order': "Supplier" + } + for d in self.get("entries"): - if d.against_voucher: - if flt(d.credit) > 0: - frappe.throw(_("Row {0}: Credit entry can not be linked with a Purchase Invoice") - .format(d.idx)) - if frappe.db.get_value("Purchase Invoice", d.against_voucher, "credit_to") != d.account: - frappe.throw(_("Row {0}: Account does not match with \ - Purchase Invoice Credit To account").format(d.idx, d.account)) + if d.get(against_field): + dr_or_cr = "credit" if against_field in ["against_invoice", "against_sales_order"] \ + else "debit" + if against_field in ["against_invoice", "against_sales_order"] \ + and flt(d.debit) > 0: + frappe.throw(_("Row {0}: Debit entry can not be linked with a {1}").format(d.idx, doctype)) + + if against_field in ["against_voucher", "against_purchase_order"] \ + and flt(d.credit) > 0: + frappe.throw(_("Row {0}: Credit entry can not be linked with a {1}").format(d.idx, doctype)) + + voucher_account = frappe.db.get_value(doctype, d.get(against_field), \ + scrub(field_dict.get(doctype))) + + account_master_name = frappe.db.get_value("Account", d.account, "master_name") + + if against_field in ["against_invoice", "against_voucher"] \ + and voucher_account != d.account: + frappe.throw(_("Row {0}: Account {1} does not match with {2} {3} account") \ + .format(d.idx, d.account, doctype, field_dict.get(doctype))) + + if against_field in ["against_sales_order", "against_purchase_order"]: + if voucher_account != account_master_name: + frappe.throw(_("Row {0}: Account {1} does not match with {2} {3} Name") \ + .format(d.idx, d.account, doctype, field_dict.get(doctype))) + elif d.is_advance == "Yes": + payment_against_voucher.setdefault(d.get(against_field), []).append(flt(d.get(dr_or_cr))) + + return payment_against_voucher + + def validate_against_invoice_fields(self, doctype, payment_against_voucher): + for voucher_no, payment_list in payment_against_voucher.items(): + voucher_properties = frappe.db.get_value(doctype, voucher_no, + ["docstatus", "outstanding_amount"]) + + if voucher_properties[0] != 1: + frappe.throw(_("{0} {1} is not submitted").format(doctype, voucher_no)) + + if flt(voucher_properties[1]) < flt(sum(payment_list)): + frappe.throw(_("Payment against {0} {1} cannot be greater \ + than Outstanding Amount {2}").format(doctype, voucher_no, voucher_properties[1])) + + def validate_against_order_fields(self, doctype, payment_against_voucher): + for voucher_no, payment_list in payment_against_voucher.items(): + voucher_properties = frappe.db.get_value(doctype, voucher_no, + ["docstatus", "per_billed", "advance_paid", "grand_total"]) + + if voucher_properties[0] != 1: + frappe.throw(_("{0} {1} is not submitted").format(doctype, voucher_no)) + + if flt(voucher_properties[1]) >= 100: + frappe.throw(_("{0} {1} is fully billed").format(doctype, voucher_no)) + + if flt(voucher_properties[3]) < flt(voucher_properties[2]) + flt(sum(payment_list)): + frappe.throw(_("Advance paid against {0} {1} cannot be greater \ + than Grand Total {2}").format(doctype, voucher_no, voucher_properties[3])) def set_against_account(self): accounts_debited, accounts_credited = [], [] @@ -147,7 +227,13 @@ class JournalVoucher(AccountsController): for d in self.get('entries'): if d.against_invoice and d.credit: currency = frappe.db.get_value("Sales Invoice", d.against_invoice, "currency") - r.append(_("{0} {1} against Invoice {2}").format(currency, fmt_money(flt(d.credit)), d.against_invoice)) + r.append(_("{0} against Sales Invoice {1}").format(fmt_money(flt(d.credit), currency = currency), \ + d.against_invoice)) + + if d.against_sales_order and d.credit: + currency = frappe.db.get_value("Sales Order", d.against_sales_order, "currency") + r.append(_("{0} against Sales Order {1}").format(fmt_money(flt(d.credit), currency = currency), \ + d.against_sales_order)) if d.against_voucher and d.debit: bill_no = frappe.db.sql("""select bill_no, bill_date, currency @@ -158,13 +244,17 @@ class JournalVoucher(AccountsController): fmt_money(flt(d.debit)), bill_no[0][0], bill_no[0][1] and formatdate(bill_no[0][1].strftime('%Y-%m-%d')))) + if d.against_purchase_order and d.debit: + currency = frappe.db.get_value("Purchase Order", d.against_purchase_order, "currency") + r.append(_("{0} against Purchase Order {1}").format(fmt_money(flt(d.credit), currency = currency), \ + d.against_purchase_order)) + if self.user_remark: r.append(_("Note: {0}").format(self.user_remark)) if r: - self.remark = ("\n").join(r) - else: - frappe.msgprint(_("User Remarks is mandatory"), raise_exception=frappe.MandatoryError) + self.remark = ("\n").join(r) #User Remarks is not mandatory + def set_aging_date(self): if self.is_opening != 'Yes': @@ -264,14 +354,18 @@ class JournalVoucher(AccountsController): "against": d.against_account, "debit": flt(d.debit, self.precision("debit", "entries")), "credit": flt(d.credit, self.precision("credit", "entries")), - "against_voucher_type": ((d.against_voucher and "Purchase Invoice") - or (d.against_invoice and "Sales Invoice") - or (d.against_jv and "Journal Voucher")), - "against_voucher": d.against_voucher or d.against_invoice or d.against_jv, + "against_voucher_type": (("Purchase Invoice" if d.against_voucher else None) + or ("Sales Invoice" if d.against_invoice else None) + or ("Journal Voucher" if d.against_jv else None) + or ("Sales Order" if d.against_sales_order else None) + or ("Purchase Order" if d.against_purchase_order else None)), + "against_voucher": d.against_voucher or d.against_invoice or d.against_jv + or d.against_sales_order or d.against_purchase_order, "remarks": self.remark, "cost_center": d.cost_center }) ) + if gl_map: make_gl_entries(gl_map, cancel=cancel, adv_adj=adv_adj) diff --git a/erpnext/accounts/doctype/journal_voucher/test_journal_voucher.py b/erpnext/accounts/doctype/journal_voucher/test_journal_voucher.py index 425baf16f4..2aac2b6942 100644 --- a/erpnext/accounts/doctype/journal_voucher/test_journal_voucher.py +++ b/erpnext/accounts/doctype/journal_voucher/test_journal_voucher.py @@ -1,41 +1,88 @@ # 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 unittest -import frappe +import unittest, frappe +from frappe.utils import flt class TestJournalVoucher(unittest.TestCase): def test_journal_voucher_with_against_jv(self): - self.clear_account_balance() + jv_invoice = frappe.copy_doc(test_records[2]) - jv_invoice.insert() - jv_invoice.submit() + base_jv = frappe.copy_doc(test_records[0]) + self.jv_against_voucher_testcase(base_jv, jv_invoice) - self.assertTrue(frappe.db.sql("""select name from `tabJournal Voucher Detail` - where account = %s and docstatus = 1 and parent = %s""", - ("_Test Customer - _TC", jv_invoice.name))) + def test_jv_against_sales_order(self): + from erpnext.selling.doctype.sales_order.test_sales_order \ + import test_records as so_test_records + + sales_order = frappe.copy_doc(so_test_records[0]) + base_jv = frappe.copy_doc(test_records[0]) + self.jv_against_voucher_testcase(base_jv, sales_order) + + def test_jv_against_purchase_order(self): + from erpnext.buying.doctype.purchase_order.test_purchase_order \ + import test_records as po_test_records + + purchase_order = frappe.copy_doc(po_test_records[0]) + base_jv = frappe.copy_doc(test_records[1]) + self.jv_against_voucher_testcase(base_jv, purchase_order) + + def jv_against_voucher_testcase(self, base_jv, test_voucher): + dr_or_cr = "credit" if test_voucher.doctype in ["Sales Order", "Journal Voucher"] else "debit" + field_dict = {'Journal Voucher': "against_jv", + 'Sales Order': "against_sales_order", + 'Purchase Order': "against_purchase_order" + } + + self.clear_account_balance() + test_voucher.insert() + test_voucher.submit() + + if test_voucher.doctype == "Journal Voucher": + self.assertTrue(frappe.db.sql("""select name from `tabJournal Voucher Detail` + where account = %s and docstatus = 1 and parent = %s""", + ("_Test Customer - _TC", test_voucher.name))) self.assertTrue(not frappe.db.sql("""select name from `tabJournal Voucher Detail` - where against_jv=%s""", jv_invoice.name)) + where %s=%s""" % (field_dict.get(test_voucher.doctype), '%s'), (test_voucher.name))) - jv_payment = frappe.copy_doc(test_records[0]) - jv_payment.get("entries")[0].against_jv = jv_invoice.name - jv_payment.insert() - jv_payment.submit() + base_jv.get("entries")[0].is_advance = "Yes" if (test_voucher.doctype in ["Sales Order", "Purchase Order"]) else "No" + base_jv.get("entries")[0].set(field_dict.get(test_voucher.doctype), test_voucher.name) + base_jv.insert() + base_jv.submit() + + submitted_voucher = frappe.get_doc(test_voucher.doctype, test_voucher.name) self.assertTrue(frappe.db.sql("""select name from `tabJournal Voucher Detail` - where against_jv=%s""", jv_invoice.name)) + where %s=%s""" % (field_dict.get(test_voucher.doctype), '%s'), (submitted_voucher.name))) self.assertTrue(frappe.db.sql("""select name from `tabJournal Voucher Detail` - where against_jv=%s and credit=400""", jv_invoice.name)) + where %s=%s and %s=400""" % (field_dict.get(submitted_voucher.doctype), '%s', dr_or_cr), (submitted_voucher.name))) - # cancel jv_invoice - jv_invoice.cancel() + if base_jv.get("entries")[0].is_advance == "Yes": + self.advance_paid_testcase(base_jv, submitted_voucher, dr_or_cr) + self.cancel_against_voucher_testcase(submitted_voucher) - self.assertTrue(not frappe.db.sql("""select name from `tabJournal Voucher Detail` - where against_jv=%s""", jv_invoice.name)) + def advance_paid_testcase(self, base_jv, test_voucher, dr_or_cr): + #Test advance paid field + advance_paid = frappe.db.sql("""select advance_paid from `tab%s` + where name=%s""" % (test_voucher.doctype, '%s'), (test_voucher.name)) + payment_against_order = base_jv.get("entries")[0].get(dr_or_cr) + + self.assertTrue(flt(advance_paid[0][0]) == flt(payment_against_order)) + + def cancel_against_voucher_testcase(self, test_voucher): + if test_voucher.doctype == "Journal Voucher": + # if test_voucher is a Journal Voucher, test cancellation of test_voucher + test_voucher.cancel() + self.assertTrue(not frappe.db.sql("""select name from `tabJournal Voucher Detail` + where against_jv=%s""", test_voucher.name)) + + elif test_voucher.doctype in ["Sales Order", "Purchase Order"]: + # if test_voucher is a Sales Order/Purchase Order, test error on cancellation of test_voucher + submitted_voucher = frappe.get_doc(test_voucher.doctype, test_voucher.name) + self.assertRaises(frappe.LinkExistsError, submitted_voucher.cancel) def test_jv_against_stock_account(self): from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory diff --git a/erpnext/accounts/doctype/journal_voucher_detail/journal_voucher_detail.json b/erpnext/accounts/doctype/journal_voucher_detail/journal_voucher_detail.json index a751ed9c66..2f15b0ba1e 100644 --- a/erpnext/accounts/doctype/journal_voucher_detail/journal_voucher_detail.json +++ b/erpnext/accounts/doctype/journal_voucher_detail/journal_voucher_detail.json @@ -117,11 +117,6 @@ "print_hide": 0, "search_index": 1 }, - { - "fieldname": "col_break3", - "fieldtype": "Column Break", - "permlevel": 0 - }, { "fieldname": "against_jv", "fieldtype": "Link", @@ -135,6 +130,25 @@ "print_hide": 0, "search_index": 1 }, + { + "fieldname": "col_break3", + "fieldtype": "Column Break", + "permlevel": 0 + }, + { + "fieldname": "against_sales_order", + "fieldtype": "Link", + "label": "Against Sales Order", + "options": "Sales Order", + "permlevel": 0 + }, + { + "fieldname": "against_purchase_order", + "fieldtype": "Link", + "label": "Against Purchase Order", + "options": "Purchase Order", + "permlevel": 0 + }, { "fieldname": "is_advance", "fieldtype": "Select", @@ -160,7 +174,7 @@ ], "idx": 1, "istable": 1, - "modified": "2014-07-25 03:16:51.149899", + "modified": "2014-08-20 12:19:55.049973", "modified_by": "Administrator", "module": "Accounts", "name": "Journal Voucher Detail", diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js index c495a35825..97484da468 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js +++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js @@ -36,8 +36,8 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext } }); - var help_content = ' Note:
'+ - ''; + var help_content = ' ' + __("Note") + ':
'+ + ''; this.frm.set_value("reconcile_help", help_content); }, diff --git a/erpnext/accounts/doctype/payment_tool/__init__.py b/erpnext/accounts/doctype/payment_tool/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/accounts/doctype/payment_tool/payment_tool.js b/erpnext/accounts/doctype/payment_tool/payment_tool.js new file mode 100644 index 0000000000..3e0d2eec9f --- /dev/null +++ b/erpnext/accounts/doctype/payment_tool/payment_tool.js @@ -0,0 +1,217 @@ +// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors +// For license information, please see license.txt + +frappe.provide("erpnext.payment_tool"); + +// Help content +frappe.ui.form.on("Payment Tool", "onload", function(frm) { + frm.set_value("make_jv_help", ' ' + + __("Note: If payment is not made against any reference, make Journal Voucher manually.")); + + frm.set_query("payment_account", function() { + return { + filters: [ + ['Account', 'account_type', 'in', 'Bank, Cash'], + ['Account', 'group_or_ledger', '=', 'Ledger'], + ['Account', 'company', '=', frm.doc.company] + ] + } + }); + + frm.set_query("against_voucher_type", "payment_tool_details", function() { + return { + filters: {"name": ["in", ["Sales Invoice", "Purchase Invoice", "Journal Voucher", "Sales Order", "Purchase Order"]]} + }; + }); +}); + +frappe.ui.form.on("Payment Tool", "refresh", function(frm) { + frappe.ui.form.trigger("Payment Tool", "party_type"); +}); + +frappe.ui.form.on("Payment Tool", "party_type", function(frm) { + frm.toggle_reqd("customer", frm.doc.party_type == "Customer"); + frm.toggle_reqd("supplier", frm.doc.party_type == "Supplier"); +}); + +frappe.ui.form.on("Payment Tool", "company", function(frm) { + erpnext.payment_tool.check_mandatory_to_set_button(frm); +}); + +frappe.ui.form.on("Payment Tool", "received_or_paid", function(frm) { + erpnext.payment_tool.check_mandatory_to_set_button(frm); +}); + +// Fetch bank/cash account based on payment mode +cur_frm.add_fetch("payment_mode", "default_account", "payment_account"); + +// Set party account name +frappe.ui.form.on("Payment Tool", "customer", function(frm) { + erpnext.payment_tool.set_party_account(frm); + erpnext.payment_tool.check_mandatory_to_set_button(frm); +}); + +frappe.ui.form.on("Payment Tool", "supplier", function(frm) { + erpnext.payment_tool.set_party_account(frm); + erpnext.payment_tool.check_mandatory_to_set_button(frm); +}); + +erpnext.payment_tool.check_mandatory_to_set_button = function(frm) { + if (frm.doc.company && frm.doc.party_type && frm.doc.received_or_paid && (frm.doc.customer || frm.doc.supplier)) { + frm.fields_dict.get_outstanding_vouchers.$input.addClass("btn-primary"); + } +} + +//Set Button color +erpnext.payment_tool.set_party_account = function(frm) { + if(frm.doc.party_type == "Customer") { + var party_name = frm.doc.customer; + } else { + var party_name = frm.doc.supplier; + } + return frappe.call({ + method: 'erpnext.accounts.doctype.payment_tool.payment_tool.get_party_account', + args: { + party_type: frm.doc.party_type, + party_name: party_name + }, + callback: function(r, rt) { + if(!r.exc) { + frm.set_value("party_account", r.message); + } + } + }); +} + +// Get outstanding vouchers +frappe.ui.form.on("Payment Tool", "get_outstanding_vouchers", function(frm) { + erpnext.payment_tool.check_mandatory_to_fetch(frm.doc); + + frm.set_value("payment_tool_details", []); + + return frappe.call({ + method: 'erpnext.accounts.doctype.payment_tool.payment_tool.get_outstanding_vouchers', + args: { + args: { + "company": frm.doc.company, + "party_type": frm.doc.party_type, + "received_or_paid": frm.doc.received_or_paid, + "party_name": frm.doc.party_type == "Customer" ? frm.doc.customer : frm.doc.supplier, + "party_account": frm.doc.party_account + } + }, + callback: function(r, rt) { + if(r.message) { + frm.fields_dict.get_outstanding_vouchers.$input.removeClass("btn-primary"); + frm.fields_dict.make_journal_voucher.$input.addClass("btn-primary"); + + frappe.model.clear_table(frm.doc, "payment_tool_details"); + $.each(r.message, function(i, d) { + var invoice_detail = frappe.model.add_child(frm.doc, "Payment Tool Detail", "payment_tool_details"); + invoice_detail.against_voucher_type = d.voucher_type; + invoice_detail.against_voucher_no = d.voucher_no; + invoice_detail.total_amount = d.invoice_amount; + invoice_detail.outstanding_amount = d.outstanding_amount; + }); + } + refresh_field("payment_tool_details"); + erpnext.payment_tool.set_total_payment_amount(frm); + } + }); +}); + +// validate against_voucher_type +frappe.ui.form.on("Payment Tool Detail", "against_voucher_type", function(frm) { + erpnext.payment_tool.validate_against_voucher(frm); +}); + +erpnext.payment_tool.validate_against_voucher = function(frm) { + $.each(frm.doc.payment_tool_details || [], function(i, row) { + if(frm.doc.party_type=="Customer" + && !in_list(["Sales Order", "Sales Invoice", "Journal Voucher"], row.against_voucher_type)) { + frappe.model.set_value(row.doctype, row.name, "against_voucher_type", ""); + frappe.throw(__("Against Voucher Type must be one of Sales Order, Sales Invoice or Journal Voucher")) + } + + if(frm.doc.party_type=="Supplier" + && !in_list(["Purchase Order", "Purchase Invoice", "Journal Voucher"], row.against_voucher_type)) { + frappe.model.set_value(row.doctype, row.name, "against_voucher_type", ""); + frappe.throw(__("Against Voucher Type must be one of Purchase Order, Purchase Invoice or Journal Voucher")) + } + + }); +} + +// validate against_voucher_type +frappe.ui.form.on("Payment Tool Detail", "against_voucher_no", function(frm, cdt, cdn) { + var row = locals[cdt][cdn]; + frappe.call({ + method: 'erpnext.accounts.doctype.payment_tool.payment_tool.get_against_voucher_amount', + args: { + "against_voucher_type": row.against_voucher_type, + "against_voucher_no": row.against_voucher_no + }, + callback: function(r) { + if(!r.exc) { + $.each(r.message, function(k, v) { + frappe.model.set_value(cdt, cdn, k, v); + }); + } + } + }); +}); + +// Set total payment amount +frappe.ui.form.on("Payment Tool Detail", "payment_amount", function(frm) { + erpnext.payment_tool.set_total_payment_amount(frm); +}); + +frappe.ui.form.on("Payment Tool Detail", "payment_tool_details_remove", function(frm) { + erpnext.payment_tool.set_total_payment_amount(frm); +}); + +erpnext.payment_tool.set_total_payment_amount = function(frm) { + var total_amount = 0.00; + $.each(frm.doc.payment_tool_details || [], function(i, row) { + if (row.payment_amount && (row.payment_amount <= row.outstanding_amount)) { + total_amount = total_amount + row.payment_amount; + } else { + if(row.payment_amount < 0) + msgprint(__("Row {0}: Payment amount can not be negative", [row.idx])); + else if(row.payment_amount >= row.outstanding_amount) + msgprint(__("Row {0}: Payment Amount cannot be greater than Outstanding Amount", [__(row.idx)])); + + frappe.model.set_value(row.doctype, row.name, "payment_amount", 0.0); + } + }); + frm.set_value("total_payment_amount", total_amount); +} + + +// Make Journal voucher +frappe.ui.form.on("Payment Tool", "make_journal_voucher", function(frm) { + erpnext.payment_tool.check_mandatory_to_fetch(frm.doc); + + return frappe.call({ + method: 'make_journal_voucher', + doc: frm.doc, + callback: function(r) { + frm.fields_dict.make_journal_voucher.$input.addClass("btn-primary"); + var doclist = frappe.model.sync(r.message); + frappe.set_route("Form", doclist[0].doctype, doclist[0].name); + } + }); +}); + +erpnext.payment_tool.check_mandatory_to_fetch = function(doc) { + var check_fields = [ + ['Company', doc.company], + ['Party Type', doc.party_type], + ['Received Or Paid', doc.received_or_paid], + ['Customer / Supplier', doc.party_type == "Customer" ? doc.customer : doc.supplier] + ]; + + $.each(check_fields, function(i, v) { + if(!v[1]) frappe.throw(__("Please select {0} first", [v[0]])); + }); +} diff --git a/erpnext/accounts/doctype/payment_tool/payment_tool.json b/erpnext/accounts/doctype/payment_tool/payment_tool.json new file mode 100644 index 0000000000..b2949a99a9 --- /dev/null +++ b/erpnext/accounts/doctype/payment_tool/payment_tool.json @@ -0,0 +1,381 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "creation": "2014-07-23 15:12:27.746665", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "fields": [ + { + "fieldname": "sec_break1", + "fieldtype": "Section Break", + "label": "Party Details", + "permlevel": 0 + }, + { + "fieldname": "company", + "fieldtype": "Link", + "label": "Company", + "options": "Company", + "permlevel": 0, + "reqd": 1 + }, + { + "allow_on_submit": 0, + "default": "Customer", + "fieldname": "party_type", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Party Type", + "no_copy": 0, + "options": "Customer\nSupplier", + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0 + }, + { + "allow_on_submit": 0, + "depends_on": "eval:(doc.party_type == 'Customer')", + "fieldname": "customer", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Customer", + "no_copy": 0, + "options": "Customer", + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0 + }, + { + "allow_on_submit": 0, + "depends_on": "eval:(doc.party_type == 'Supplier')", + "fieldname": "supplier", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Supplier", + "no_copy": 0, + "options": "Supplier", + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0 + }, + { + "fieldname": "party_account", + "fieldtype": "Link", + "hidden": 1, + "label": "Party Account", + "no_copy": 1, + "options": "Account", + "permlevel": 0, + "read_only": 1 + }, + { + "allow_on_submit": 0, + "fieldname": "received_or_paid", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Received Or Paid", + "no_copy": 0, + "options": "Received\nPaid", + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0 + }, + { + "allow_on_submit": 0, + "fieldname": "get_outstanding_vouchers", + "fieldtype": "Button", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Get Outstanding Vouchers", + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0 + }, + { + "allow_on_submit": 0, + "fieldname": "col_break1", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Column Break 1", + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0 + }, + { + "allow_on_submit": 0, + "fieldname": "payment_mode", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Payment Mode", + "no_copy": 0, + "options": "Mode of Payment", + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0 + }, + { + "allow_on_submit": 0, + "fieldname": "payment_account", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Payment Account", + "no_copy": 0, + "options": "Account", + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0 + }, + { + "allow_on_submit": 0, + "fieldname": "reference_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Reference No", + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0 + }, + { + "allow_on_submit": 0, + "fieldname": "reference_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Reference Date", + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0 + }, + { + "allow_on_submit": 0, + "depends_on": "eval:(doc.company && doc.party_type && doc.received_or_paid && (doc.customer || doc.supplier))", + "fieldname": "sec_break3", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Against Voucher", + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0 + }, + { + "allow_on_submit": 0, + "fieldname": "payment_tool_details", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Payment Tool Details", + "no_copy": 0, + "options": "Payment Tool Detail", + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0 + }, + { + "depends_on": "eval:(doc.company && doc.party_type && doc.received_or_paid && (doc.customer || doc.supplier))", + "fieldname": "section_break_19", + "fieldtype": "Section Break", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "total_payment_amount", + "fieldtype": "Currency", + "label": "Total Payment Amount", + "permlevel": 0, + "read_only": 1 + }, + { + "allow_on_submit": 0, + "fieldname": "make_journal_voucher", + "fieldtype": "Button", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Make Journal Voucher", + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0 + }, + { + "fieldname": "data_22", + "fieldtype": "Column Break", + "permlevel": 0, + "precision": "" + }, + { + "depends_on": "eval:(doc.company && doc.party_type && doc.received_or_paid && (doc.customer || doc.supplier))", + "fieldname": "section_break_21", + "fieldtype": "Section Break", + "permlevel": 0, + "precision": "" + }, + { + "allow_on_submit": 0, + "fieldname": "make_jv_help", + "fieldtype": "Small Text", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 1, + "icon": "icon-magic", + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 1, + "istable": 0, + "modified": "2014-09-12 04:43:05.963218", + "modified_by": "Administrator", + "module": "Accounts", + "name": "Payment Tool", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 0, + "email": 0, + "export": 0, + "import": 0, + "permlevel": 0, + "print": 0, + "read": 1, + "report": 0, + "role": "Accounts Manager", + "set_user_permissions": 0, + "submit": 0, + "write": 1 + }, + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 0, + "email": 0, + "export": 0, + "import": 0, + "permlevel": 0, + "print": 0, + "read": 1, + "report": 0, + "role": "Accounts User", + "set_user_permissions": 0, + "submit": 0, + "write": 1 + } + ], + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/erpnext/accounts/doctype/payment_tool/payment_tool.py b/erpnext/accounts/doctype/payment_tool/payment_tool.py new file mode 100644 index 0000000000..d8d6df3da2 --- /dev/null +++ b/erpnext/accounts/doctype/payment_tool/payment_tool.py @@ -0,0 +1,118 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _, scrub +from frappe.utils import flt +from frappe.model.document import Document +import json + +class PaymentTool(Document): + def make_journal_voucher(self): + from erpnext.accounts.utils import get_balance_on + total_payment_amount = 0.00 + invoice_voucher_type = { + 'Sales Invoice': 'against_invoice', + 'Purchase Invoice': 'against_voucher', + 'Journal Voucher': 'against_jv', + 'Sales Order': 'against_sales_order', + 'Purchase Order': 'against_purchase_order', + } + + jv = frappe.new_doc('Journal Voucher') + jv.voucher_type = 'Journal Entry' + jv.company = self.company + jv.cheque_no = self.reference_no + jv.cheque_date = self.reference_date + + if not self.total_payment_amount: + frappe.throw(_("Please enter Payment Amount in atleast one row")) + + for v in self.get("payment_tool_details"): + if not frappe.db.get_value(v.against_voucher_type, {"name": v.against_voucher_no}): + frappe.throw(_("Row {0}: {1} is not a valid {2}").format(v.idx, v.against_voucher_no, + v.against_voucher_type)) + + if v.payment_amount: + d1 = jv.append("entries") + d1.account = self.party_account + d1.balance = get_balance_on(self.party_account) + d1.set("debit" if self.received_or_paid=="Paid" else "credit", flt(v.payment_amount)) + d1.set(invoice_voucher_type.get(v.against_voucher_type), v.against_voucher_no) + d1.set('is_advance', 'Yes' if v.against_voucher_type in ['Sales Order', 'Purchase Order'] else 'No') + total_payment_amount = flt(total_payment_amount) + flt(d1.debit) - flt(d1.credit) + + d2 = jv.append("entries") + d2.account = self.payment_account + d2.set('debit' if total_payment_amount < 0 else 'credit', abs(total_payment_amount)) + if self.payment_account: + d2.balance = get_balance_on(self.payment_account) + + return jv.as_dict() + +@frappe.whitelist() +def get_party_account(party_type, party_name): + return frappe.db.get_value("Account", {"master_type": party_type, "master_name": party_name}) + +@frappe.whitelist() +def get_outstanding_vouchers(args): + from erpnext.accounts.utils import get_outstanding_invoices + + if not frappe.has_permission("Payment Tool"): + frappe.throw(_("No permission to use Payment Tool"), frappe.PermissionError) + + args = json.loads(args) + + if args.get("party_type") == "Customer" and args.get("received_or_paid") == "Received": + amount_query = "ifnull(debit, 0) - ifnull(credit, 0)" + elif args.get("party_type") == "Supplier" and args.get("received_or_paid") == "Paid": + amount_query = "ifnull(credit, 0) - ifnull(debit, 0)" + else: + frappe.throw(_("Please enter the Against Vouchers manually")) + + # Get all outstanding sales /purchase invoices + outstanding_invoices = get_outstanding_invoices(amount_query, args.get("party_account")) + + # Get all SO / PO which are not fully billed or aginst which full advance not paid + orders_to_be_billed = get_orders_to_be_billed(args.get("party_type"), args.get("party_name")) + return outstanding_invoices + orders_to_be_billed + +def get_orders_to_be_billed(party_type, party_name): + voucher_type = 'Sales Order' if party_type == "Customer" else 'Purchase Order' + orders = frappe.db.sql(""" + select + name as voucher_no, + ifnull(grand_total, 0) as invoice_amount, + (ifnull(grand_total, 0) - ifnull(advance_paid, 0)) as outstanding_amount, + transaction_date as posting_date + from + `tab%s` + where + %s = %s + and docstatus = 1 + and ifnull(grand_total, 0) > ifnull(advance_paid, 0) + and ifnull(per_billed, 0) < 100.0 + """ % (voucher_type, 'customer' if party_type == "Customer" else 'supplier', '%s'), + party_name, as_dict = True) + + order_list = [] + for d in orders: + d["voucher_type"] = voucher_type + order_list.append(d) + + return order_list + +@frappe.whitelist() +def get_against_voucher_amount(against_voucher_type, against_voucher_no): + if against_voucher_type in ["Sales Order", "Purchase Order"]: + select_cond = "grand_total as total_amount, ifnull(grand_total, 0) - ifnull(advance_paid, 0) as outstanding_amount" + elif against_voucher_type in ["Sales Invoice", "Purchase Invoice"]: + select_cond = "grand_total as total_amount, outstanding_amount" + elif against_voucher_type == "Journal Voucher": + select_cond = "total_debit as total_amount" + + details = frappe.db.sql("""select {0} from `tab{1}` where name = %s""" + .format(select_cond, against_voucher_type), against_voucher_no, as_dict=1) + + return details[0] if details else {} diff --git a/erpnext/accounts/doctype/payment_tool/test_payment_tool.py b/erpnext/accounts/doctype/payment_tool/test_payment_tool.py new file mode 100644 index 0000000000..c91a5de2e1 --- /dev/null +++ b/erpnext/accounts/doctype/payment_tool/test_payment_tool.py @@ -0,0 +1,193 @@ +# 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 unittest, frappe, json +from frappe.utils import flt + +test_dependencies = ["Item"] + +class TestPaymentTool(unittest.TestCase): + def test_make_journal_voucher(self): + from erpnext.accounts.doctype.journal_voucher.test_journal_voucher \ + import test_records as jv_test_records + from erpnext.selling.doctype.sales_order.test_sales_order \ + import test_records as so_test_records + from erpnext.buying.doctype.purchase_order.test_purchase_order \ + import test_records as po_test_records + from erpnext.accounts.doctype.sales_invoice.test_sales_invoice \ + import test_records as si_test_records + from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice \ + import test_records as pi_test_records + + self.clear_table_entries() + + base_customer_jv = self.create_against_jv(jv_test_records[2], { "account": "_Test Customer 3 - _TC"}) + base_supplier_jv = self.create_against_jv(jv_test_records[1], { "account": "_Test Supplier 1 - _TC"}) + + + #Create SO with partial outstanding + so1 = self.create_voucher(so_test_records[0], { + "customer": "_Test Customer 3" + }) + + jv_against_so1 = self.create_against_jv(jv_test_records[0], { + "account": "_Test Customer 3 - _TC", + "against_sales_order": so1.name + }) + + + #Create SO with no outstanding + so2 = self.create_voucher(so_test_records[0], { + "customer": "_Test Customer 3" + }) + + jv_against_so2 = self.create_against_jv(jv_test_records[0], { + "account": "_Test Customer 3 - _TC", + "against_sales_order": so2.name, + "credit": 1000 + }) + po = self.create_voucher(po_test_records[1], { + "supplier": "_Test Supplier 1" + }) + + #Create SI with partial outstanding + si1 = self.create_voucher(si_test_records[0], { + "customer": "_Test Customer 3", + "debit_to": "_Test Customer 3 - _TC" + }) + + jv_against_si1 = self.create_against_jv(jv_test_records[0], { + "account": "_Test Customer 3 - _TC", + "against_invoice": si1.name + }) + #Create SI with no outstanding + si2 = self.create_voucher(si_test_records[0], { + "customer": "_Test Customer 3", + "debit_to": "_Test Customer 3 - _TC" + }) + + jv_against_si2 = self.create_against_jv(jv_test_records[0], { + "account": "_Test Customer 3 - _TC", + "against_invoice": si2.name, + "credit": 561.80 + }) + + pi = self.create_voucher(pi_test_records[0], { + "supplier": "_Test Supplier 1", + "credit_to": "_Test Supplier 1 - _TC" + }) + + #Create a dict containing properties and expected values + expected_outstanding = { + "Journal Voucher" : [base_customer_jv.name, 400.00], + "Sales Invoice" : [si1.name, 161.80], + "Purchase Invoice" : [pi.name, 1512.30], + "Sales Order" : [so1.name, 600.00], + "Purchase Order" : [po.name, 5000.00] + } + + args = { + "company": "_Test Company", + "party_type": "Customer", + "received_or_paid": "Received", + "customer": "_Test Customer", + "party_account": "_Test Customer 3 - _TC", + "payment_mode": "Cheque", + "payment_account": "_Test Account Bank Account - _TC", + "reference_no": "123456", + "reference_date": "2013-02-14" + } + + self.make_voucher_for_party(args, expected_outstanding) + + args.update({ + "party_type": "Supplier", + "received_or_paid": "Paid", + "supplier": "_Test Supplier 1", + "party_account": "_Test Supplier 1 - _TC" + }) + expected_outstanding["Journal Voucher"] = [base_supplier_jv.name, 400.00] + self.make_voucher_for_party(args, expected_outstanding) + + def create_voucher(self, test_record, args): + doc = frappe.copy_doc(test_record) + doc.update(args) + doc.insert() + doc.submit() + return doc + + def create_against_jv(self, test_record, args): + jv = frappe.copy_doc(test_record) + jv.get("entries")[0].update(args) + if args.get("debit"): + jv.get("entries")[1].credit = args["debit"] + elif args.get("credit"): + jv.get("entries")[1].debit = args["credit"] + + jv.insert() + jv.submit() + return jv + + def make_voucher_for_party(self, args, expected_outstanding): + #Make Journal Voucher for Party + payment_tool_doc = frappe.new_doc("Payment Tool") + + for k, v in args.items(): + payment_tool_doc.set(k, v) + + self.check_outstanding_vouchers(payment_tool_doc, args, expected_outstanding) + + + def check_outstanding_vouchers(self, doc, args, expected_outstanding): + from erpnext.accounts.doctype.payment_tool.payment_tool import get_outstanding_vouchers + + outstanding_entries = get_outstanding_vouchers(json.dumps(args)) + + for d in outstanding_entries: + self.assertEquals(flt(d.get("outstanding_amount"), 2), expected_outstanding.get(d.get("voucher_type"))[1]) + + self.check_jv_entries(doc, outstanding_entries, expected_outstanding) + + def check_jv_entries(self, paytool, outstanding_entries, expected_outstanding): + for e in outstanding_entries: + d1 = paytool.append("payment_tool_details") + d1.against_voucher_type = e.get("voucher_type") + d1.against_voucher_no = e.get("voucher_no") + d1.total_amount = e.get("invoice_amount") + d1.outstanding_amount = e.get("outstanding_amount") + d1.payment_amount = 100.00 + paytool.total_payment_amount = 300 + + new_jv = paytool.make_journal_voucher() + + #Create a list of expected values as [party account, payment against, against_jv, against_invoice, + #against_voucher, against_sales_order, against_purchase_order] + expected_values = [ + [paytool.party_account, 100.00, expected_outstanding.get("Journal Voucher")[0], None, None, None, None], + [paytool.party_account, 100.00, None, expected_outstanding.get("Sales Invoice")[0], None, None, None], + [paytool.party_account, 100.00, None, None, expected_outstanding.get("Purchase Invoice")[0], None, None], + [paytool.party_account, 100.00, None, None, None, expected_outstanding.get("Sales Order")[0], None], + [paytool.party_account, 100.00, None, None, None, None, expected_outstanding.get("Purchase Order")[0]] + ] + + for jv_entry in new_jv.get("entries"): + if paytool.party_account == jv_entry.get("account"): + row = [ + jv_entry.get("account"), + jv_entry.get("debit" if paytool.party_type=="Supplier" else "credit"), + jv_entry.get("against_jv"), + jv_entry.get("against_invoice"), + jv_entry.get("against_voucher"), + jv_entry.get("against_sales_order"), + jv_entry.get("against_purchase_order"), + ] + self.assertTrue(row in expected_values) + + self.assertEquals(new_jv.get("cheque_no"), paytool.reference_no) + self.assertEquals(new_jv.get("cheque_date"), paytool.reference_date) + + def clear_table_entries(self): + frappe.db.sql("""delete from `tabGL Entry` where (account = "_Test Customer 3 - _TC" or account = "_Test Supplier 1 - _TC")""") + frappe.db.sql("""delete from `tabSales Order` where customer_name = "_Test Customer 3" """) + frappe.db.sql("""delete from `tabPurchase Order` where supplier_name = "_Test Supplier 1" """) diff --git a/erpnext/accounts/doctype/payment_tool_detail/__init__.py b/erpnext/accounts/doctype/payment_tool_detail/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/accounts/doctype/payment_tool_detail/payment_tool_detail.json b/erpnext/accounts/doctype/payment_tool_detail/payment_tool_detail.json new file mode 100644 index 0000000000..5f0e7ecb6f --- /dev/null +++ b/erpnext/accounts/doctype/payment_tool_detail/payment_tool_detail.json @@ -0,0 +1,130 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "creation": "2014-08-11 14:27:54.463897", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "fields": [ + { + "allow_on_submit": 0, + "fieldname": "against_voucher_type", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Against Voucher Type", + "no_copy": 0, + "options": "DocType", + "permlevel": 0, + "print_hide": 0, + "print_width": "", + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "width": "" + }, + { + "allow_on_submit": 0, + "fieldname": "against_voucher_no", + "fieldtype": "Dynamic Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Against Voucher No", + "no_copy": 0, + "options": "against_voucher_type", + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0 + }, + { + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "permlevel": 0, + "precision": "" + }, + { + "allow_on_submit": 0, + "fieldname": "total_amount", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Total Amount", + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0 + }, + { + "allow_on_submit": 0, + "fieldname": "outstanding_amount", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Outstanding Amount", + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0 + }, + { + "allow_on_submit": 0, + "fieldname": "payment_amount", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Payment Amount", + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "modified": "2014-09-11 08:55:34.384017", + "modified_by": "Administrator", + "module": "Accounts", + "name": "Payment Tool Detail", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/erpnext/accounts/doctype/payment_tool_detail/payment_tool_detail.py b/erpnext/accounts/doctype/payment_tool_detail/payment_tool_detail.py new file mode 100644 index 0000000000..80c5532842 --- /dev/null +++ b/erpnext/accounts/doctype/payment_tool_detail/payment_tool_detail.py @@ -0,0 +1,9 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class PaymentToolDetail(Document): + pass diff --git a/erpnext/accounts/doctype/pos_setting/pos_setting.json b/erpnext/accounts/doctype/pos_setting/pos_setting.json index d0a338c92a..fece8c0ec9 100755 --- a/erpnext/accounts/doctype/pos_setting/pos_setting.json +++ b/erpnext/accounts/doctype/pos_setting/pos_setting.json @@ -171,6 +171,7 @@ "read_only": 0 }, { + "allow_on_submit": 1, "fieldname": "letter_head", "fieldtype": "Link", "label": "Letter Head", @@ -192,6 +193,7 @@ "read_only": 0 }, { + "allow_on_submit": 1, "fieldname": "select_print_heading", "fieldtype": "Link", "in_filter": 0, @@ -205,7 +207,7 @@ ], "icon": "icon-cog", "idx": 1, - "modified": "2014-06-23 16:40:59.510132", + "modified": "2014-09-09 05:35:31.969193", "modified_by": "Administrator", "module": "Accounts", "name": "POS Setting", diff --git a/erpnext/accounts/doctype/pos_setting/test_pos_setting.py b/erpnext/accounts/doctype/pos_setting/test_pos_setting.py new file mode 100644 index 0000000000..8cbf5acdba --- /dev/null +++ b/erpnext/accounts/doctype/pos_setting/test_pos_setting.py @@ -0,0 +1,10 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and Contributors +# See license.txt + +import frappe +import unittest + +test_records = frappe.get_test_records('POS Setting') + +class TestPOSSetting(unittest.TestCase): + pass diff --git a/erpnext/accounts/doctype/pos_setting/test_records.json b/erpnext/accounts/doctype/pos_setting/test_records.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/erpnext/accounts/doctype/pos_setting/test_records.json @@ -0,0 +1 @@ +[] diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json index 489bc4648a..9c70892dad 100755 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json @@ -1,851 +1,851 @@ { - "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 - }, + }, { - "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, + "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, + "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 } - ], - "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-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, + "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" -} +} \ No newline at end of file diff --git a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json index c81d065f02..76c305fd9b 100755 --- a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json +++ b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json @@ -399,7 +399,7 @@ ], "idx": 1, "istable": 1, - "modified": "2014-09-08 08:06:30.027289", + "modified": "2014-09-09 05:35:35.712453", "modified_by": "Administrator", "module": "Accounts", "name": "Purchase Invoice Item", diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json index c26583b737..234d048ad5 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json @@ -1,5 +1,4 @@ { - "allow_attach": 1, "allow_import": 1, "autoname": "naming_series:", "creation": "2013-05-24 19:29:05", @@ -1193,7 +1192,7 @@ "icon": "icon-file-text", "idx": 1, "is_submittable": 1, - "modified": "2014-08-28 11:21:00.726344", + "modified": "2014-09-09 05:35:34.121045", "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 a20d906b8c..20d20d7cfc 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -71,7 +71,9 @@ class SalesInvoice(SellingController): self.is_opening = 'No' self.set_aging_date() + frappe.get_doc("Account", self.debit_to).validate_due_date(self.posting_date, self.due_date) + self.set_against_income_account() self.validate_c_form() self.validate_time_logs_are_submitted() @@ -101,7 +103,6 @@ class SalesInvoice(SellingController): if not cint(self.is_pos) == 1: self.update_against_document_in_jv() - self.update_c_form() self.update_time_log_batch(self.name) convert_to_recurring(self, "RECINV.#####", self.posting_date) @@ -120,6 +121,7 @@ class SalesInvoice(SellingController): self.update_status_updater_args() self.update_prevdoc_status() self.update_billing_status_for_zero_amount_refdoc("Sales Order") + self.validate_c_form_on_cancel() self.make_gl_entries_on_cancel() @@ -147,6 +149,10 @@ class SalesInvoice(SellingController): validate_recurring_document(self) convert_to_recurring(self, "RECINV.#####", 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 @@ -376,6 +382,12 @@ class SalesInvoice(SellingController): frappe.db.set(self, 'c_form_no', '') + def validate_c_form_on_cancel(self): + """ Display message if C-Form no exists on cancellation of Sales Invoice""" + if self.c_form_applicable == 'Yes' and self.c_form_no: + msgprint(_("Please remove this Invoice {0} from C-Form {1}") + .format(self.name, self.c_form_no), raise_exception = 1) + def update_current_stock(self): for d in self.get('entries'): if d.item_code and d.warehouse: @@ -584,14 +596,6 @@ class SalesInvoice(SellingController): }) ) - def update_c_form(self): - """Update amended id in C-form""" - if self.c_form_no and self.amended_from: - frappe.db.sql("""update `tabC-Form Invoice Detail` set invoice_no = %s, - invoice_date = %s, territory = %s, net_total = %s, - grand_total = %s where invoice_no = %s and parent = %s""", - (self.name, self.amended_from, self.c_form_no)) - @frappe.whitelist() def get_bank_cash_account(mode_of_payment): val = frappe.db.get_value("Mode of Payment", mode_of_payment, "default_account") diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json index 19c124f617..2baa06a8a2 100644 --- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json +++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json @@ -439,7 +439,7 @@ ], "idx": 1, "istable": 1, - "modified": "2014-09-08 08:06:30.382092", + "modified": "2014-09-09 05:35:36.019576", "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice Item", diff --git a/erpnext/accounts/page/accounts_browser/accounts_browser.js b/erpnext/accounts/page/accounts_browser/accounts_browser.js index ba8d747d72..8802093f44 100644 --- a/erpnext/accounts/page/accounts_browser/accounts_browser.js +++ b/erpnext/accounts/page/accounts_browser/accounts_browser.js @@ -45,7 +45,7 @@ pscript['onload_Accounts Browser'] = function(wrapper){ 'icon-plus'); } - wrapper.appframe.set_title_right('Refresh', function() { + wrapper.appframe.set_title_right(__('Refresh'), function() { wrapper.$company_select.change(); }); diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js index 0d06de1152..e394410766 100644 --- a/erpnext/accounts/page/pos/pos.js +++ b/erpnext/accounts/page/pos/pos.js @@ -1,7 +1,7 @@ frappe.pages['pos'].onload = function(wrapper) { frappe.ui.make_app_page({ parent: wrapper, - title: 'Start POS', + title: __('Start POS'), single_column: true }); diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index cd172f1902..de7032e3b1 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: diff --git a/erpnext/accounts/report/accounts_payable/accounts_payable.py b/erpnext/accounts/report/accounts_payable/accounts_payable.py index b65c1e8ba8..3ae741e772 100644 --- a/erpnext/accounts/report/accounts_payable/accounts_payable.py +++ b/erpnext/accounts/report/accounts_payable/accounts_payable.py @@ -67,12 +67,12 @@ def execute(filters=None): def get_columns(supplier_naming_by): columns = [ - "Posting Date:Date:80", "Account:Link/Account:150", "Voucher Type::110", - "Voucher No::120", "::30", "Due Date:Date:80", "Bill No::80", "Bill Date:Date:80", - "Invoiced Amount:Currency:100", "Paid Amount:Currency:100", - "Outstanding Amount:Currency:100", "Age:Int:50", "0-30:Currency:100", - "30-60:Currency:100", "60-90:Currency:100", "90-Above:Currency:100", - "Supplier:Link/Supplier:150" + _("Posting Date") + ":Date:80", _("Account") + ":Link/Account:150", _("Voucher Type") + "::110", + _("Voucher No") + "::120", "::30", _("Due Date") + ":Date:80", _("Bill No") + "::80", _("Bill Date") + ":Date:80", + _("Invoiced Amount") + ":Currency:100", _("Paid Amount") + ":Currency:100", + _("Outstanding Amount") + ":Currency:100", _("Age") + ":Int:50", "0-30:Currency:100", + "30-60:Currency:100", "60-90:Currency:100", _("90-Above") + ":Currency:100", + _("Supplier") + ":Link/Supplier:150" ] if supplier_naming_by == "Naming Series": diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py index 427669fba8..2891b053f0 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py @@ -20,13 +20,13 @@ 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", - "Due Date:Date:80", - "Invoiced Amount:Currency:100", "Payment Received:Currency:100", - "Outstanding Amount:Currency:100", "Age:Int:50", "0-30:Currency:100", - "30-60:Currency:100", "60-90:Currency:100", "90-Above:Currency:100", - "Customer:Link/Customer:200" + _("Posting Date") + ":Date:80", _("Account") + ":Link/Account:150", + _("Voucher Type") + "::110", _("Voucher No") + "::120", "::30", + _("Due Date") + ":Date:80", + _("Invoiced Amount") + ":Currency:100", _("Payment Received") + ":Currency:100", + _("Outstanding Amount") + ":Currency:100", _("Age") + ":Int:50", "0-30:Currency:100", + "30-60:Currency:100", "60-90:Currency:100", _("90-Above") + ":Currency:100", + _("Customer") + ":Link/Customer:200" ] if customer_naming_by == "Naming Series": diff --git a/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py b/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py index f86c932422..dbf86e352d 100644 --- a/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py +++ b/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py @@ -14,9 +14,9 @@ def execute(filters=None): return columns, data def get_columns(): - return ["Journal Voucher:Link/Journal Voucher:140", "Account:Link/Account:140", - "Posting Date:Date:100", "Clearance Date:Date:110", "Against Account:Link/Account:200", - "Debit:Currency:120", "Credit:Currency:120" + return [_("Journal Voucher") + ":Link/Journal Voucher:140", _("Account") + ":Link/Account:140", + _("Posting Date") + ":Date:100", _("Clearance Date") + ":Date:110", _("Against Account") + ":Link/Account:200", + _("Debit") + ":Currency:120", _("Credit") + ":Currency:120" ] def get_conditions(filters): diff --git a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.html b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.html index d05bffac12..9d67ba3630 100644 --- a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.html +++ b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.html @@ -16,31 +16,31 @@ {% for(var i=0, l=data.length; i - {%= dateutil.str_to_user(data[i].posting_date) %} - {%= data[i].journal_voucher %} - {%= __("Against") %}: {%= data[i].against_account %} - {% if (data[i].reference) { %} -
{%= __("Reference") %}: {%= data[i].reference %} - {% if (data[i].ref_date) { %} -
{%= __("Reference Date") %}: {%= dateutil.str_to_user(data[i].ref_date) %} + {%= dateutil.str_to_user(data[i][__("Posting Date")]) %} + {%= data[i][__("Journal Voucher")] %} + {%= __("Against") %}: {%= data[i][__("Against Account")] %} + {% if (data[i][__("Reference")]) { %} +
{%= __("Reference") %}: {%= data[i][__("Reference")] %} + {% if (data[i][__("Ref Date")]) { %} +
{%= __("Reference Date") %}: {%= dateutil.str_to_user(data[i][__("Ref Date")]) %} {% } %} {% } %} - {% if (data[i].clearance_date) { %} -
{%= __("Clearance Date") %}: {%= dateutil.str_to_user(data[i].clearance_date) %} + {% if (data[i][__("Clearance Date")]) { %} +
{%= __("Clearance Date") %}: {%= dateutil.str_to_user(data[i][__("Clearance Date")]) %} {% } %} - {%= format_currency(data[i].debit) %} - {%= format_currency(data[i].credit) %} + {%= format_currency(data[i][__("Debit")]) %} + {%= format_currency(data[i][__("Credit")]) %} {% } else { %} - {%= data[i].journal_voucher %} - {%= format_currency(data[i].debit) %} - {%= format_currency(data[i].credit) %} + {%= data[i][__("Journal Voucher")] %} + {%= format_currency(data[i][__("Debit")]) %} + {%= format_currency(data[i][__("Credit")]) %} {% } %} {% } %} diff --git a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py index 4fda0300b6..cbe5988c14 100644 --- a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py +++ b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py @@ -26,7 +26,7 @@ def execute(filters=None): amounts_not_reflected_in_system = frappe.db.sql("""select sum(ifnull(jvd.debit, 0) - ifnull(jvd.credit, 0)) from `tabJournal Voucher Detail` jvd, `tabJournal Voucher` jv where jvd.parent = jv.name and jv.docstatus=1 and jvd.account=%s - and jv.posting_date > %s and jv.clearance_date <= %s + and jv.posting_date > %s and jv.clearance_date <= %s and ifnull(jv.is_opening, 'No') = 'No' """, (filters["account"], filters["report_date"], filters["report_date"])) amounts_not_reflected_in_system = flt(amounts_not_reflected_in_system[0][0]) \ @@ -47,9 +47,9 @@ def execute(filters=None): return columns, data def get_columns(): - return ["Posting Date:Date:100", "Journal Voucher:Link/Journal Voucher:220", - "Debit:Currency:120", "Credit:Currency:120", - "Against Account:Link/Account:200", "Reference::100", "Ref Date:Date:110", "Clearance Date:Date:110" + return [_("Posting Date") + ":Date:100", _("Journal Voucher") + ":Link/Journal Voucher:220", + _("Debit") + ":Currency:120", _("Credit") + ":Currency:120", + _("Against Account") + ":Link/Account:200", _("Reference") + "::100", _("Ref Date") + ":Date:110", _("Clearance Date") + ":Date:110" ] def get_entries(filters): @@ -61,6 +61,7 @@ def get_entries(filters): where jvd.parent = jv.name and jv.docstatus=1 and jvd.account = %(account)s and jv.posting_date <= %(report_date)s and ifnull(jv.clearance_date, '4000-01-01') > %(report_date)s + and ifnull(jv.is_opening, 'No') = 'No' order by jv.name DESC""", filters, as_list=1) return entries diff --git a/erpnext/accounts/report/budget_variance_report/budget_variance_report.py b/erpnext/accounts/report/budget_variance_report/budget_variance_report.py index c98d2054f3..d64c374822 100644 --- a/erpnext/accounts/report/budget_variance_report/budget_variance_report.py +++ b/erpnext/accounts/report/budget_variance_report/budget_variance_report.py @@ -5,6 +5,7 @@ from __future__ import unicode_literals import frappe from frappe import _, msgprint from frappe.utils import flt +from frappe.utils import formatdate import time from erpnext.accounts.utils import get_fiscal_year from erpnext.controllers.trends import get_period_date_ranges, get_period_month_ranges @@ -44,21 +45,21 @@ def get_columns(filters): msgprint(_("Please specify") + ": " + label, raise_exception=True) - columns = ["Cost Center:Link/Cost Center:120", "Account:Link/Account:120"] + columns = [_("Cost Center") + ":Link/Cost Center:120", _("Account") + ":Link/Account:120"] group_months = False if filters["period"] == "Monthly" else True for from_date, to_date in get_period_date_ranges(filters["period"], filters["fiscal_year"]): - for label in ["Target (%s)", "Actual (%s)", "Variance (%s)"]: + for label in [_("Target") + " (%s)", _("Actual") + " (%s)", _("Variance") + " (%s)"]: if group_months: - label = label % (from_date.strftime("%b") + " - " + to_date.strftime("%b")) + label = label % (formatdate(from_date, format_string="MMM") + " - " + formatdate(from_date, format_string="MMM")) else: - label = label % from_date.strftime("%b") + label = label % formatdate(from_date, format_string="MMM") columns.append(label+":Float:120") - return columns + ["Total Target:Float:120", "Total Actual:Float:120", - "Total Variance:Float:120"] + return columns + [_("Total Target") + ":Float:120", _("Total Actual") + ":Float:120", + _("Total Variance") + ":Float:120"] #Get cost center & target details def get_costcenter_target_details(filters): diff --git a/erpnext/accounts/report/general_ledger/general_ledger.html b/erpnext/accounts/report/general_ledger/general_ledger.html index eb596d2f92..5c6b0f19bb 100644 --- a/erpnext/accounts/report/general_ledger/general_ledger.html +++ b/erpnext/accounts/report/general_ledger/general_ledger.html @@ -22,23 +22,23 @@ {% for(var i=0, l=data.length; i - {% if(data[i].posting_date) { %} - {%= dateutil.str_to_user(data[i].posting_date) %} - {%= data[i].voucher_type%} -
{%= data[i].voucher_no %} - {%= data[i].account %} -
{%= __("Against") %}: {%= data[i].against_account %} -
{%= __("Remarks") %}: {%= data[i].remarks %} - {%= format_currency(data[i].debit) %} - {%= format_currency(data[i].credit) %} + {% if(data[i][__("Posting Date")]) { %} + {%= dateutil.str_to_user(data[i][__("Posting Date")]) %} + {%= data[i][__("Voucher Type")] %} +
{%= data[i][__("Voucher No")] %} + {%= data[i][__("Account")] %} +
{%= __("Against") %}: {%= data[i][__("Against Account")] %} +
{%= __("Remarks") %}: {%= data[i][__("Remarks")] %} + {%= format_currency(data[i][__("Debit")]) %} + {%= format_currency(data[i][__("Credit")]) %} {% } else { %} - {%= data[i].account || " " %} + {%= data[i][__("Account")] || " " %} - {%= data[i].account && format_currency(data[i].debit) %} + {%= data[i][__("Account")] && format_currency(data[i][__("Debit")]) %} - {%= data[i].account && format_currency(data[i].credit) %} + {%= data[i][__("Account")] && format_currency(data[i][__("Credit")]) %} {% } %} {% } %} diff --git a/erpnext/accounts/report/general_ledger/general_ledger.py b/erpnext/accounts/report/general_ledger/general_ledger.py index d1ea4421a5..362f42e5e5 100644 --- a/erpnext/accounts/report/general_ledger/general_ledger.py +++ b/erpnext/accounts/report/general_ledger/general_ledger.py @@ -34,9 +34,9 @@ def validate_filters(filters, account_details): frappe.throw(_("From Date must be before To Date")) def get_columns(): - return ["Posting Date:Date:100", "Account:Link/Account:200", "Debit:Float:100", - "Credit:Float:100", "Voucher Type::120", "Voucher No::160", "Link::20", - "Against Account::120", "Cost Center:Link/Cost Center:100", "Remarks::400"] + return [_("Posting Date") + ":Date:100", _("Account") + ":Link/Account:200", _("Debit") + ":Float:100", + _("Credit") + ":Float:100", _("Voucher Type") + "::120", _("Voucher No") + "::160", _("Link") + "::20", + _("Against Account") + "::120", _("Cost Center") + ":Link/Cost Center:100", _("Remarks") + "::400"] def get_result(filters, account_details): gl_entries = get_gl_entries(filters) diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py index 1bbf2d116e..76e7b4a163 100644 --- a/erpnext/accounts/report/gross_profit/gross_profit.py +++ b/erpnext/accounts/report/gross_profit/gross_profit.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals import frappe +from frappe import _ from frappe.utils import flt from erpnext.stock.utils import get_buying_amount, get_sales_bom_buying_amount @@ -13,11 +14,11 @@ def execute(filters=None): 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", - "Item Code:Link/Item", "Item Name", "Description", "Warehouse:Link/Warehouse", - "Qty:Float", "Selling Rate:Currency", "Avg. Buying Rate:Currency", - "Selling Amount:Currency", "Buying Amount:Currency", - "Gross Profit:Currency", "Gross Profit %:Percent", "Project:Link/Project"] + 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", + _("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) diff --git a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py index 8e74873d47..127e9cb61f 100644 --- a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py +++ b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals import frappe +from frappe import msgprint, _ from frappe.utils import flt def execute(filters=None): @@ -33,12 +34,12 @@ def execute(filters=None): def get_columns(): - return ["Item Code:Link/Item:120", "Item Name::120", "Item Group:Link/Item Group:100", - "Invoice:Link/Purchase Invoice:120", "Posting Date:Date:80", "Supplier:Link/Customer:120", - "Supplier Account:Link/Account:120", "Project:Link/Project:80", "Company:Link/Company:100", - "Purchase Order:Link/Purchase Order:100", "Purchase Receipt:Link/Purchase Receipt:100", - "Expense Account:Link/Account:140", "Qty:Float:120", "Rate:Currency:120", - "Amount:Currency:120"] + return [_("Item Code") + ":Link/Item:120", _("Item Name") + "::120", _("Item Group") + ":Link/Item Group:100", + _("Invoice") + ":Link/Purchase Invoice:120", _("Posting Date") + ":Date:80", _("Supplier") + ":Link/Customer:120", + _("Supplier Account") + ":Link/Account:120", _("Project") + ":Link/Project:80", _("Company") + ":Link/Company:100", + _("Purchase Order") + ":Link/Purchase Order:100", _("Purchase Receipt") + ":Link/Purchase Receipt:100", + _("Expense Account") + ":Link/Account:140", _("Qty") + ":Float:120", _("Rate") + ":Currency:120", + _("Amount") + ":Currency:120"] def get_conditions(filters): conditions = "" diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py index 6a0d051c2c..2840291c70 100644 --- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py +++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals import frappe +from frappe import msgprint, _ from frappe.utils import flt def execute(filters=None): @@ -32,12 +33,12 @@ def execute(filters=None): def get_columns(): return [ - "Item Code:Link/Item:120", "Item Name::120", "Item Group:Link/Item Group:100", - "Invoice:Link/Sales Invoice:120", "Posting Date:Date:80", "Customer:Link/Customer:120", - "Customer Account:Link/Account:120", "Territory:Link/Territory:80", - "Project:Link/Project:80", "Company:Link/Company:100", "Sales Order:Link/Sales Order:100", - "Delivery Note:Link/Delivery Note:100", "Income Account:Link/Account:140", - "Qty:Float:120", "Rate:Currency:120", "Amount:Currency:120" + _("Item Code") + ":Link/Item:120", _("Item Name") + "::120", _("Item Group") + ":Link/Item Group:100", + _("Invoice") + ":Link/Sales Invoice:120", _("Posting Date") + ":Date:80", _("Customer") + ":Link/Customer:120", + _("Customer Account") + ":Link/Account:120", _("Territory") + ":Link/Territory:80", + _("Project") + ":Link/Project:80", _("Company") + ":Link/Company:100", _("Sales Order") + ":Link/Sales Order:100", + _("Delivery Note") + ":Link/Delivery Note:100", _("Income Account") + ":Link/Account:140", + _("Qty") + ":Float:120", _("Rate") + ":Currency:120", _("Amount") + ":Currency:120" ] def get_conditions(filters): diff --git a/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.py b/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.py index b70c1dda8e..b1d74373fc 100644 --- a/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.py +++ b/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.py @@ -37,11 +37,11 @@ def execute(filters=None): return columns, data def get_columns(): - return ["Journal Voucher:Link/Journal Voucher:140", "Account:Link/Account:140", - "Posting Date:Date:100", "Against Invoice:Link/Purchase Invoice:130", - "Against Invoice Posting Date:Date:130", "Debit:Currency:120", "Credit:Currency:120", - "Reference No::100", "Reference Date:Date:100", "Remarks::150", "Age:Int:40", - "0-30:Currency:100", "30-60:Currency:100", "60-90:Currency:100", "90-Above:Currency:100" + return [_("Journal Voucher") + ":Link/Journal Voucher:140", _("Account") + ":Link/Account:140", + _("Posting Date") + ":Date:100", _("Against Invoice") + ":Link/Purchase Invoice:130", + _("Against Invoice Posting Date") + ":Date:130", _("Debit") + ":Currency:120", _("Credit") + ":Currency:120", + _("Reference No") + "::100", _("Reference Date") + ":Date:100", _("Remarks") + "::150", _("Age") +":Int:40", + "0-30:Currency:100", "30-60:Currency:100", "60-90:Currency:100", _("90-Above") + ":Currency:100" ] def get_conditions(filters): diff --git a/erpnext/accounts/report/purchase_register/purchase_register.py b/erpnext/accounts/report/purchase_register/purchase_register.py index a82ec29935..40006575c4 100644 --- a/erpnext/accounts/report/purchase_register/purchase_register.py +++ b/erpnext/accounts/report/purchase_register/purchase_register.py @@ -63,11 +63,11 @@ def execute(filters=None): def get_columns(invoice_list): """return columns based on filters""" columns = [ - "Invoice:Link/Purchase Invoice:120", "Posting Date:Date:80", "Supplier Id::120", - "Supplier Name::120", "Supplier Account:Link/Account:120", - "Account Group:LInk/Account:120", "Project:Link/Project:80", "Bill No::120", - "Bill Date:Date:80", "Remarks::150", - "Purchase Order:Link/Purchase Order:100", "Purchase Receipt:Link/Purchase Receipt:100" + _("Invoice") + ":Link/Purchase Invoice:120", _("Posting Date") + ":Date:80", _("Supplier Id") + "::120", + _("Supplier Name") + "::120", _("Supplier Account") + ":Link/Account:120", + _("Account Group") + ":Link/Account:120", _("Project") + ":Link/Project:80", _("Bill No") + "::120", + _("Bill Date") + ":Date:80", _("Remarks") + "::150", + _("Purchase Order") + ":Link/Purchase Order:100", _("Purchase Receipt") + ":Link/Purchase Receipt:100" ] expense_accounts = tax_accounts = expense_columns = tax_columns = [] diff --git a/erpnext/accounts/report/sales_register/sales_register.py b/erpnext/accounts/report/sales_register/sales_register.py index 4131ee2c0a..1bde11002d 100644 --- a/erpnext/accounts/report/sales_register/sales_register.py +++ b/erpnext/accounts/report/sales_register/sales_register.py @@ -63,10 +63,10 @@ def execute(filters=None): def get_columns(invoice_list): """return columns based on filters""" columns = [ - "Invoice:Link/Sales Invoice:120", "Posting Date:Date:80", "Customer Id::120", - "Customer Name::120", "Customer Account:Link/Account:120", "Account Group:LInk/Account:120", - "Territory:Link/Territory:80", "Project:Link/Project:80", "Remarks::150", - "Sales Order:Link/Sales Order:100", "Delivery Note:Link/Delivery Note:100" + _("Invoice") + ":Link/Sales Invoice:120", _("Posting Date") + ":Date:80", _("Customer Id") + "::120", + _("Customer Name") + "::120", _("Customer Account") + ":Link/Account:120", _("Account Group") + ":Link/Account:120", + _("Territory") + ":Link/Territory:80", _("Project") + ":Link/Project:80", _("Remarks") + "::150", + _("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100" ] income_accounts = tax_accounts = income_columns = tax_columns = [] diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index d1b65846d5..c658cdd09f 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -391,3 +391,42 @@ def get_stock_rbnb_difference(posting_date, company): # Amount should be credited return flt(stock_rbnb) + flt(sys_bal) + +def get_outstanding_invoices(amount_query, account): + all_outstanding_vouchers = [] + outstanding_voucher_list = frappe.db.sql(""" + select + voucher_no, voucher_type, posting_date, + ifnull(sum({amount_query}), 0) as invoice_amount + from + `tabGL Entry` + where + account = %s and {amount_query} > 0 + group by voucher_type, voucher_no + """.format(amount_query = amount_query), account, as_dict = True) + + for d in outstanding_voucher_list: + payment_amount = frappe.db.sql(""" + select ifnull(sum(ifnull({amount_query}, 0)), 0) + from + `tabGL Entry` + where + account = %s and {amount_query} < 0 + and against_voucher_type = %s and ifnull(against_voucher, '') = %s + """.format(**{ + "amount_query": amount_query + }), (account, d.voucher_type, d.voucher_no)) + + payment_amount = -1*payment_amount[0][0] if payment_amount else 0 + + if d.invoice_amount > payment_amount: + + all_outstanding_vouchers.append({ + 'voucher_no': d.voucher_no, + 'voucher_type': d.voucher_type, + 'posting_date': d.posting_date, + 'invoice_amount': flt(d.invoice_amount), + 'outstanding_amount': d.invoice_amount - payment_amount + }) + + return all_outstanding_vouchers diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index 647823cab6..2224db7ca2 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -1,724 +1,732 @@ { - "allow_import": 1, - "autoname": "naming_series:", - "creation": "2013-05-21 16:16:39", - "docstatus": 0, - "doctype": "DocType", - "document_type": "Transaction", + "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", + "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, + "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, + "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, + "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, + "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, - "print_hide": 0, - "print_width": "50%", + "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, + "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, + "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, + "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", + "fieldname": "price_list_and_currency", + "fieldtype": "Section Break", + "label": "Currency and Price List", + "options": "icon-tag", "permlevel": 0 - }, + }, { - "fieldname": "cb_currency", - "fieldtype": "Column Break", + "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, + "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, + "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", + "fieldname": "cb_price_list", + "fieldtype": "Column Break", "permlevel": 0 - }, + }, { - "fieldname": "buying_price_list", - "fieldtype": "Link", - "label": "Price List", - "options": "Price List", - "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, + "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, + "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, + "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": "po_details", - "fieldtype": "Table", - "label": "Purchase Order Items", - "no_copy": 0, - "oldfieldname": "po_details", - "oldfieldtype": "Table", - "options": "Purchase Order Item", + "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", + "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, + "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", + "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, + "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, + "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, + "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, + "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", + "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, + "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", + "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, + "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, + "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, + "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, + "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, + "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, + "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, + "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, + "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, + "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, + "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, + "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", + "fieldname": "fold", + "fieldtype": "Fold", "permlevel": 0 - }, + }, { - "fieldname": "terms_section_break", - "fieldtype": "Section Break", - "label": "Terms and Conditions", - "oldfieldtype": "Section Break", - "options": "icon-legal", + "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, + "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", + "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", + "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, + "fieldname": "supplier_address", + "fieldtype": "Link", + "in_filter": 1, + "label": "Supplier Address", + "options": "Address", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "cb_contact", - "fieldtype": "Column Break", + "fieldname": "cb_contact", + "fieldtype": "Column Break", "permlevel": 0 - }, + }, { - "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", + "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, + "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, + "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, + "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, + "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, + "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, + "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%", + "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, + "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, + "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, + "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, + "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-08-12 05:22:53.496614", - "modified_by": "Administrator", - "module": "Buying", - "name": "Purchase Order", - "owner": "Administrator", + ], + "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, + "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, + "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, + "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, + "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", + "permlevel": 1, + "read": 1, + "role": "Purchase Manager", "write": 1 } - ], - "read_only_onload": 1, - "search_fields": "status, transaction_date, supplier,grand_total", - "sort_field": "modified", + ], + "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 6c7c0c6d08..4def1db979 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/purchase_order.py @@ -238,6 +238,11 @@ def make_purchase_receipt(source_name, target_doc=None): @frappe.whitelist() def make_purchase_invoice(source_name, target_doc=None): + def postprocess(source, target): + set_missing_values(source, target) + #Get the advance paid Journal Vouchers in Purchase Invoice Advance + target.get_advances() + def update_item(obj, target, source_parent): target.amount = flt(obj.amount) - flt(obj.billed_amt) target.base_amount = target.amount * flt(source_parent.conversion_rate) @@ -263,6 +268,6 @@ def make_purchase_invoice(source_name, target_doc=None): "doctype": "Purchase Taxes and Charges", "add_if_empty": True } - }, target_doc, set_missing_values) + }, target_doc, postprocess) return doc diff --git a/erpnext/buying/doctype/purchase_order/test_records.json b/erpnext/buying/doctype/purchase_order/test_records.json index 3aaf542a32..6b89bdc3de 100644 --- a/erpnext/buying/doctype/purchase_order/test_records.json +++ b/erpnext/buying/doctype/purchase_order/test_records.json @@ -1,5 +1,6 @@ [ { + "advance_paid": 0.0, "buying_price_list": "_Test Price List", "company": "_Test Company", "conversion_rate": 1.0, @@ -31,5 +32,39 @@ "supplier": "_Test Supplier", "supplier_name": "_Test Supplier", "transaction_date": "2013-02-12" + }, + { + "advance_paid": 0.0, + "buying_price_list": "_Test Price List", + "company": "_Test Company", + "conversion_rate": 1.0, + "currency": "INR", + "doctype": "Purchase Order", + "fiscal_year": "_Test Fiscal Year 2013", + "grand_total": 5000.0, + "grand_total_import": 5000.0, + "is_subcontracted": "No", + "naming_series": "_T-Purchase Order-", + "net_total": 5000.0, + "po_details": [ + { + "base_amount": 5000.0, + "conversion_factor": 1.0, + "description": "_Test Item", + "doctype": "Purchase Order Item", + "item_code": "_Test Item", + "item_name": "_Test Item", + "parentfield": "po_details", + "qty": 10.0, + "rate": 500.0, + "schedule_date": "2013-03-01", + "stock_uom": "_Test UOM", + "uom": "_Test UOM", + "warehouse": "_Test Warehouse - _TC" + } + ], + "supplier": "_Test Supplier", + "supplier_name": "_Test Supplier", + "transaction_date": "2013-02-12" } -] \ No newline at end of file +] diff --git a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json index 741b664982..0adc981f86 100755 --- a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json +++ b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json @@ -445,7 +445,7 @@ ], "idx": 1, "istable": 1, - "modified": "2014-09-08 08:06:30.684601", + "modified": "2014-09-09 05:35:36.346557", "modified_by": "Administrator", "module": "Buying", "name": "Purchase Order Item", diff --git a/erpnext/buying/doctype/supplier/supplier.json b/erpnext/buying/doctype/supplier/supplier.json index ceaeebc13f..1d2177849f 100644 --- a/erpnext/buying/doctype/supplier/supplier.json +++ b/erpnext/buying/doctype/supplier/supplier.json @@ -186,12 +186,20 @@ ], "icon": "icon-user", "idx": 1, - "modified": "2014-08-26 04:55:32.004458", + "modified": "2014-09-10 17:53:09.286715", "modified_by": "Administrator", "module": "Buying", "name": "Supplier", "owner": "Administrator", "permissions": [ + { + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Purchase User" + }, { "amend": 0, "create": 0, @@ -201,7 +209,7 @@ "print": 1, "read": 1, "report": 1, - "role": "Purchase User", + "role": "Purchase Manager", "submit": 0, "write": 0 }, @@ -224,11 +232,27 @@ "read": 1, "role": "Material User" }, + { + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Material Manager" + }, { "apply_user_permissions": 1, "permlevel": 0, "read": 1, "role": "Accounts User" + }, + { + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts Manager" } ], "search_fields": "supplier_name,supplier_type", diff --git a/erpnext/buying/doctype/supplier/test_records.json b/erpnext/buying/doctype/supplier/test_records.json index a1d1054ff2..dfa5d46f24 100644 --- a/erpnext/buying/doctype/supplier/test_records.json +++ b/erpnext/buying/doctype/supplier/test_records.json @@ -4,5 +4,11 @@ "doctype": "Supplier", "supplier_name": "_Test Supplier", "supplier_type": "_Test Supplier Type" + }, + { + "company": "_Test Company", + "doctype": "Supplier", + "supplier_name": "_Test Supplier 1", + "supplier_type": "_Test Supplier Type" } -] \ No newline at end of file +] diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json index 3177650f4b..9f3f2fc977 100644 --- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json @@ -1,5 +1,5 @@ { - "allow_import": 1, + "allow_import": 1, "autoname": "naming_series:", "creation": "2013-05-21 16:16:45", "docstatus": 0, @@ -575,7 +575,7 @@ "icon": "icon-shopping-cart", "idx": 1, "is_submittable": 1, - "modified": "2014-08-14 02:17:26.401532", + "modified": "2014-09-09 05:35:35.369734", "modified_by": "Administrator", "module": "Buying", "name": "Supplier Quotation", diff --git a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json index 30243856ac..73362f1998 100644 --- a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json +++ b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json @@ -331,7 +331,7 @@ ], "idx": 1, "istable": 1, - "modified": "2014-09-08 08:06:30.976906", + "modified": "2014-09-09 05:35:36.623995", "modified_by": "Administrator", "module": "Buying", "name": "Supplier Quotation Item", diff --git a/erpnext/buying/report/supplier_addresses_and_contacts/supplier_addresses_and_contacts.json b/erpnext/buying/report/supplier_addresses_and_contacts/supplier_addresses_and_contacts.json index c9fd7256cb..9ae1adce8f 100644 --- a/erpnext/buying/report/supplier_addresses_and_contacts/supplier_addresses_and_contacts.json +++ b/erpnext/buying/report/supplier_addresses_and_contacts/supplier_addresses_and_contacts.json @@ -5,12 +5,12 @@ "doctype": "Report", "idx": 1, "is_standard": "Yes", - "modified": "2014-06-03 07:18:17.358554", - "modified_by": "Administrator", + "modified": "2014-09-11 08:53:17.358554", + "modified_by": "Administrator", "module": "Buying", "name": "Supplier Addresses and Contacts", "owner": "Administrator", - "query": "SELECT\n `tabSupplier`.name as \"Supplier:Link/Supplier:120\",\n\t`tabSupplier`.supplier_name as \"Supplier Name::120\",\n\t`tabSupplier`.supplier_type as \"Supplier Type:Link/Supplier Type:120\",\n\tconcat_ws(', ', \n\t\ttrim(',' from `tabAddress`.address_line1), \n\t\ttrim(',' from tabAddress.address_line2), \n\t\ttabAddress.state, tabAddress.pincode, tabAddress.country\n\t) as 'Address::180',\n concat_ws(', ', `tabContact`.first_name, `tabContact`.last_name) as 'Contact Name::180',\n\t`tabContact`.phone as \"Phone\",\n\t`tabContact`.mobile_no as \"Mobile No\",\n\t`tabContact`.email_id as \"Email Id::120\",\n\t`tabContact`.is_primary_contact as \"Is Primary Contact::120\"\nFROM\n\t`tabSupplier`\n\tleft join `tabAddress` on (\n\t\t`tabAddress`.supplier=`tabSupplier`.name\n\t)\n\tleft join `tabContact` on (\n\t\t`tabContact`.supplier=`tabSupplier`.name\n\t)\nWHERE\n\t`tabSupplier`.docstatus<2\nORDER BY\n\t`tabSupplier`.name asc", + "query": "SELECT\n `tabSupplier`.name as \"Supplier:Link/Supplier:120\",\n\t`tabSupplier`.supplier_name as \"Supplier Name::120\",\n\t`tabSupplier`.supplier_type as \"Supplier Type:Link/Supplier Type:120\",\n\tconcat_ws(', ', \n\t\ttrim(',' from `tabAddress`.address_line1), \n\t\ttrim(',' from tabAddress.address_line2), \n\t\ttabAddress.state, tabAddress.pincode, tabAddress.country\n\t) as 'Address::180',\n concat_ws(', ', `tabContact`.first_name, `tabContact`.last_name) as \"Contact Name::180\",\n\t`tabContact`.phone as \"Phone\",\n\t`tabContact`.mobile_no as \"Mobile No\",\n\t`tabContact`.email_id as \"Email Id::120\",\n\t`tabContact`.is_primary_contact as \"Is Primary Contact::120\"\nFROM\n\t`tabSupplier`\n\tleft join `tabAddress` on (\n\t\t`tabAddress`.supplier=`tabSupplier`.name\n\t)\n\tleft join `tabContact` on (\n\t\t`tabContact`.supplier=`tabSupplier`.name\n\t)\nWHERE\n\t`tabSupplier`.docstatus<2\nORDER BY\n\t`tabSupplier`.name asc", "ref_doctype": "Supplier", "report_name": "Supplier Addresses and Contacts", "report_type": "Query Report" diff --git a/erpnext/config/accounts.py b/erpnext/config/accounts.py index 646d596387..27a0725070 100644 --- a/erpnext/config/accounts.py +++ b/erpnext/config/accounts.py @@ -61,6 +61,11 @@ def get_data(): "name": "Period Closing Voucher", "description": _("Close Balance Sheet and book Profit or Loss.") }, + { + "type": "doctype", + "name": "Payment Tool", + "description": _("Create Payment Entries against Orders or Invoices.") + }, ] }, { diff --git a/erpnext/config/buying.py b/erpnext/config/buying.py index 1b9e5a23b0..f17020f2b7 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, diff --git a/erpnext/config/stock.py b/erpnext/config/stock.py index bfb4b7fd94..957abecdce 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/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 4af9f5ed8a..7fa81c9926 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -363,9 +363,10 @@ class AccountsController(TransactionBase): 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 = [] res = frappe.db.sql(""" select - t1.name as jv_no, t1.remark, t2.%s as amount, t2.name as jv_detail_no + t1.name as jv_no, t1.remark, t2.%s as amount, t2.name as jv_detail_no, t2.%s as order_no from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2 where @@ -374,18 +375,25 @@ class AccountsController(TransactionBase): and ifnull(t2.against_invoice, '') = '' and ifnull(t2.against_jv, '') = '' order by t1.posting_date""" % - (dr_or_cr, '%s'), account_head, as_dict=1) + (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) self.set(parentfield, []) for d in res: - 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 - }) + 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 + }) def validate_multiple_billing(self, ref_dt, item_ref_dn, based_on, parentfield): from erpnext.controllers.status_updater import get_tolerance_for @@ -430,6 +438,32 @@ class AccountsController(TransactionBase): return stock_items + def set_total_advance_paid(self): + if self.doctype == "Sales Order": + dr_or_cr = "credit" + against_field = "against_sales_order" + else: + dr_or_cr = "debit" + against_field = "against_purchase_order" + + advance_paid = frappe.db.sql(""" + select + sum(ifnull({dr_or_cr}, 0)) + from + `tabJournal Voucher Detail` + where + {against_field} = %s and docstatus = 1 and is_advance = "Yes" """.format(dr_or_cr=dr_or_cr, \ + against_field=against_field), self.name) + + if advance_paid: + advance_paid = flt(advance_paid[0][0], self.precision("advance_paid")) + if flt(self.grand_total) >= advance_paid: + frappe.db.set_value(self.doctype, self.name, "advance_paid", advance_paid) + else: + frappe.throw(_("Total advance ({0}) against Order {1} cannot be greater \ + than the Grand Total ({2})") + .format(advance_paid, self.name, self.grand_total)) + @property def company_abbr(self): if not hasattr(self, "_abbr"): diff --git a/erpnext/controllers/recurring_document.py b/erpnext/controllers/recurring_document.py index c7163ae3f8..bdf8b2918a 100644 --- a/erpnext/controllers/recurring_document.py +++ b/erpnext/controllers/recurring_document.py @@ -36,6 +36,9 @@ def manage_recurring_documents(doctype, next_date=None, commit=True): % (doctype, date_field, '%s', '%s'), (next_date, recurring_id)): try: ref_wrapper = frappe.get_doc(doctype, ref_document) + if hasattr(ref_wrapper, "before_recurring"): + ref_wrapper.before_recurring() + new_document_wrapper = make_new_document(ref_wrapper, date_field, next_date) send_notification(new_document_wrapper) if commit: diff --git a/erpnext/controllers/trends.py b/erpnext/controllers/trends.py index e62b661ce4..c2d5e0090c 100644 --- a/erpnext/controllers/trends.py +++ b/erpnext/controllers/trends.py @@ -16,10 +16,10 @@ def get_columns(filters, trans): # get conditions for grouping filter cond group_by_cols = group_wise_column(filters.get("group_by")) - columns = based_on_details["based_on_cols"] + period_cols + ["Total(Qty):Float:120", "Total(Amt):Currency:120"] + columns = based_on_details["based_on_cols"] + period_cols + [_("Total(Qty)") + ":Float:120", _("Total(Amt)") + ":Currency:120"] if group_by_cols: columns = based_on_details["based_on_cols"] + group_by_cols + period_cols + \ - ["Total(Qty):Float:120", "Total(Amt):Currency:120"] + [_("Total(Qty)") + ":Float:120", _("Total(Amt)") + ":Currency:120"] conditions = {"based_on_select": based_on_details["based_on_select"], "period_wise_select": period_select, "columns": columns, "group_by": based_on_details["based_on_group_by"], "grbc": group_by_cols, "trans": trans, @@ -130,8 +130,8 @@ def period_wise_columns_query(filters, trans): get_period_wise_columns(dt, filters.get("period"), pwc) query_details = get_period_wise_query(dt, trans_date, query_details) else: - pwc = [filters.get("fiscal_year") + " (Qty):Float:120", - filters.get("fiscal_year") + " (Amt):Currency:120"] + pwc = [_(filters.get("fiscal_year")) + " ("+_("Qty") + "):Float:120", + _(filters.get("fiscal_year")) + " ("+ _("Amt") + "):Currency:120"] query_details = " SUM(t2.qty), SUM(t2.base_amount)," query_details += 'SUM(t2.qty), SUM(t2.base_amount)' @@ -139,11 +139,11 @@ def period_wise_columns_query(filters, trans): def get_period_wise_columns(bet_dates, period, pwc): if period == 'Monthly': - pwc += [get_mon(bet_dates[0]) + " (Qty):Float:120", - get_mon(bet_dates[0]) + " (Amt):Currency:120"] + pwc += [_(get_mon(bet_dates[0])) + " (" + _("Qty") + "):Float:120", + _(get_mon(bet_dates[0])) + " (" + _("Amt") + "):Currency:120"] else: - pwc += [get_mon(bet_dates[0]) + "-" + get_mon(bet_dates[1]) + " (Qty):Float:120", - get_mon(bet_dates[0]) + "-" + get_mon(bet_dates[1]) + " (Amt):Currency:120"] + pwc += [_(get_mon(bet_dates[0])) + "-" + _(get_mon(bet_dates[1])) + " (" + _("Qty") + "):Float:120", + _(get_mon(bet_dates[0])) + "-" + _(get_mon(bet_dates[1])) + " (" + _("Amt") + "):Currency:120"] def get_period_wise_query(bet_dates, trans_date, query_details): query_details += """SUM(IF(t1.%(trans_date)s BETWEEN '%(sd)s' AND '%(ed)s', t2.qty, NULL)), diff --git a/erpnext/home/page/activity/activity.js b/erpnext/home/page/activity/activity.js index ac44b4d776..f50f6c89e5 100644 --- a/erpnext/home/page/activity/activity.js +++ b/erpnext/home/page/activity/activity.js @@ -20,7 +20,7 @@ frappe.pages['activity'].onload = function(wrapper) { }); list.run(); - wrapper.appframe.set_title_right("Refresh", function() { list.run(); }); + wrapper.appframe.set_title_right(__("Refresh"), function() { list.run(); }); // Build Report Button if(frappe.boot.user.can_get_report.indexOf("Feed")!=-1) { diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 166d83089b..5d500452a9 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/erpnext/hr/doctype/employee/employee.json b/erpnext/hr/doctype/employee/employee.json index 7be1c40afa..9a9631b46f 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/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py index 5d4beaf75d..fa2594b103 100644 --- a/erpnext/hr/doctype/employee/employee.py +++ b/erpnext/hr/doctype/employee/employee.py @@ -200,7 +200,7 @@ def validate_employee_role(doc, method): # called via User hook if "Employee" in [d.role for d in doc.get("user_roles")]: if not frappe.db.get_value("Employee", {"user_id": doc.name}): - frappe.msgprint("Please set User ID field in an Employee record to set Employee Role") + frappe.msgprint(_("Please set User ID field in an Employee record to set Employee Role")) doc.get("user_roles").remove(doc.get("user_roles", {"role": "Employee"})[0]) def update_user_permissions(doc, method): diff --git a/erpnext/hr/doctype/leave_application/leave_application.json b/erpnext/hr/doctype/leave_application/leave_application.json index 9818150029..9e2ad53c79 100644 --- a/erpnext/hr/doctype/leave_application/leave_application.json +++ b/erpnext/hr/doctype/leave_application/leave_application.json @@ -158,6 +158,7 @@ "reqd": 1 }, { + "allow_on_submit": 1, "fieldname": "letter_head", "fieldtype": "Link", "ignore_user_permissions": 1, @@ -183,7 +184,7 @@ "idx": 1, "is_submittable": 1, "max_attachments": 3, - "modified": "2014-08-28 03:32:38.865202", + "modified": "2014-09-09 05:35:31.531651", "modified_by": "Administrator", "module": "HR", "name": "Leave Application", diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.json b/erpnext/hr/doctype/salary_slip/salary_slip.json index b288c50cec..44607dcacd 100644 --- a/erpnext/hr/doctype/salary_slip/salary_slip.json +++ b/erpnext/hr/doctype/salary_slip/salary_slip.json @@ -72,6 +72,7 @@ "search_index": 0 }, { + "allow_on_submit": 1, "fieldname": "letter_head", "fieldtype": "Link", "ignore_user_permissions": 1, @@ -336,7 +337,7 @@ "icon": "icon-file-text", "idx": 1, "is_submittable": 1, - "modified": "2014-08-27 06:38:10.006224", + "modified": "2014-09-09 05:35:33.807228", "modified_by": "Administrator", "module": "HR", "name": "Salary Slip", diff --git a/erpnext/hr/report/employee_birthday/employee_birthday.py b/erpnext/hr/report/employee_birthday/employee_birthday.py index dfa64996f9..4ca97ce1af 100644 --- a/erpnext/hr/report/employee_birthday/employee_birthday.py +++ b/erpnext/hr/report/employee_birthday/employee_birthday.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals import frappe +from frappe import _ from frappe.utils import flt def execute(filters=None): @@ -15,9 +16,9 @@ def execute(filters=None): def get_columns(): return [ - "Employee:Link/Employee:120", "Name:Data:200", "Date of Birth:Date:100", - "Branch:Link/Branch:120", "Department:Link/Department:120", - "Designation:Link/Designation:120", "Gender::60", "Company:Link/Company:120" + _("Employee") + ":Link/Employee:120", _("Name") + ":Data:200", _("Date of Birth")+ ":Date:100", + _("Branch") + ":Link/Branch:120", _("Department") + ":Link/Department:120", + _("Designation") + ":Link/Designation:120", _("Gender") + "::60", _("Company") + ":Link/Company:120" ] def get_employees(filters): diff --git a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py index 62d819a437..4b9284804b 100644 --- a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py +++ b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py @@ -39,13 +39,13 @@ def execute(filters=None): ','.join(['%s']*len(employee_names)), employee_names, as_dict=True) columns = [ - "Fiscal Year", "Employee:Link/Employee:150", "Employee Name::200", "Department::150" + _("Fiscal Year"), _("Employee") + ":Link/Employee:150", _("Employee Name") + "::200", _("Department") +"::150" ] for leave_type in leave_types: - columns.append(leave_type + " Allocated:Float") - columns.append(leave_type + " Taken:Float") - columns.append(leave_type + " Balance:Float") + columns.append(_(leave_type) + " " + _("Allocated") + ":Float") + columns.append(_(leave_type) + " " + _("Taken") + ":Float") + columns.append(_(leave_type) + " " + _("Balance") + ":Float") data = {} for d in allocations: diff --git a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py index bf15f884dd..ee113bf246 100644 --- a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py +++ b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py @@ -45,15 +45,15 @@ def execute(filters=None): def get_columns(filters): columns = [ - "Employee:Link/Employee:120", "Employee Name::140", "Branch:Link/Branch:120", - "Department:Link/Department:120", "Designation:Link/Designation:120", - "Company:Link/Company:120" + _("Employee") + ":Link/Employee:120", _("Employee Name") + "::140", _("Branch")+ ":Link/Branch:120", + _("Department") + ":Link/Department:120", _("Designation") + ":Link/Designation:120", + _("Company") + ":Link/Company:120" ] for day in range(filters["total_days_in_month"]): columns.append(cstr(day+1) +"::20") - columns += ["Total Present:Float:80", "Total Absent:Float:80"] + columns += [_("Total Present") + ":Float:80", _("Total Absent") + ":Float:80"] return columns def get_attendance_list(conditions, filters): diff --git a/erpnext/hr/report/monthly_salary_register/monthly_salary_register.py b/erpnext/hr/report/monthly_salary_register/monthly_salary_register.py index 4fc28e5a94..537c49894e 100644 --- a/erpnext/hr/report/monthly_salary_register/monthly_salary_register.py +++ b/erpnext/hr/report/monthly_salary_register/monthly_salary_register.py @@ -36,10 +36,10 @@ def execute(filters=None): def get_columns(salary_slips): columns = [ - "Employee:Link/Employee:120", "Employee Name::140", "Branch:Link/Branch:120", - "Department:Link/Department:120", "Designation:Link/Designation:120", - "Company:Link/Company:120", "Month::80", "Leave Without pay:Float:130", - "Payment Days:Float:120" + _("Employee") + ":Link/Employee:120", _("Employee Name") + "::140", _("Branch") + ":Link/Branch:120", + _("Department") + ":Link/Department:120", _("Designation") + ":Link/Designation:120", + _("Company") + ":Link/Company:120", _("Month") + "::80", _("Leave Without Pay") + ":Float:130", + _("Payment Days") + ":Float:120" ] earning_types = frappe.db.sql_list("""select distinct e_type from `tabSalary Slip Earning` diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js index 7787ea4878..cb96478735 100644 --- a/erpnext/manufacturing/doctype/bom/bom.js +++ b/erpnext/manufacturing/doctype/bom/bom.js @@ -66,7 +66,10 @@ cur_frm.cscript.workstation = function(doc,dt,dn) { frappe.model.with_doc("Workstation", d.workstation, function(name, r) { d.hour_rate = r.docs[0].hour_rate; refresh_field("hour_rate", dn, "bom_operations"); + d.fixed_cycle_cost = r.docs[0].fixed_cycle_cost; + refresh_field("fixed_cycle_cost", dn, "bom_operations"); erpnext.bom.calculate_op_cost(doc); + erpnext.bom.calculate_fixed_cost(doc); erpnext.bom.calculate_total(doc); }); } @@ -74,6 +77,7 @@ cur_frm.cscript.workstation = function(doc,dt,dn) { cur_frm.cscript.hour_rate = function(doc, dt, dn) { erpnext.bom.calculate_op_cost(doc); + erpnext.bom.calculate_fixed_cost(doc); erpnext.bom.calculate_total(doc); } @@ -116,7 +120,6 @@ var get_bom_material_detail= function(doc, cdt, cdn) { } } - cur_frm.cscript.qty = function(doc, cdt, cdn) { erpnext.bom.calculate_rm_cost(doc); erpnext.bom.calculate_total(doc); @@ -145,6 +148,15 @@ erpnext.bom.calculate_op_cost = function(doc) { refresh_field('operating_cost'); } +erpnext.bom.calculate_fixed_cost = function(doc) { + var op = doc.bom_operations || []; + var total_fixed_cost = 0; + for(var i=0;i
- {%= doc.get_formatted("total_cost") %} + {%= doc.get_formatted("total_variable_cost") %}
diff --git a/erpnext/manufacturing/doctype/bom/bom_list.js b/erpnext/manufacturing/doctype/bom/bom_list.js index 71d54a20dc..085e2dd0ea 100644 --- a/erpnext/manufacturing/doctype/bom/bom_list.js +++ b/erpnext/manufacturing/doctype/bom/bom_list.js @@ -1,3 +1,3 @@ frappe.listview_settings['BOM'] = { - add_fields: ["is_active", "is_default", "total_cost"] + add_fields: ["is_active", "is_default", "total_variable_cost"] }; diff --git a/erpnext/manufacturing/doctype/bom/test_records.json b/erpnext/manufacturing/doctype/bom/test_records.json index efd26c243f..17c28d5d84 100644 --- a/erpnext/manufacturing/doctype/bom/test_records.json +++ b/erpnext/manufacturing/doctype/bom/test_records.json @@ -54,10 +54,20 @@ "is_default": 1, "item": "_Test FG Item", "quantity": 1.0 - }, + }, { + "bom_operations": [ + { + "operation_no": "1", + "opn_description": "_Test", + "workstation": "_Test Workstation 1", + "time_in_min": 60, + "operating_cost": 100 + } + ], "bom_materials": [ { + "operation_no": 1, "amount": 5000.0, "doctype": "BOM Item", "item_code": "_Test Item", @@ -67,6 +77,7 @@ "stock_uom": "_Test UOM" }, { + "operation_no": 1, "amount": 2000.0, "bom_no": "BOM/_Test Item Home Desktop Manufactured/001", "doctype": "BOM Item", @@ -82,6 +93,7 @@ "is_active": 1, "is_default": 1, "item": "_Test FG Item 2", - "quantity": 1.0 + "quantity": 1.0, + "with_operations": 1 } ] \ No newline at end of file diff --git a/erpnext/manufacturing/doctype/bom_operation/bom_operation.json b/erpnext/manufacturing/doctype/bom_operation/bom_operation.json index 3bf5862c19..3b1b07b5ab 100644 --- a/erpnext/manufacturing/doctype/bom_operation/bom_operation.json +++ b/erpnext/manufacturing/doctype/bom_operation/bom_operation.json @@ -1,81 +1,89 @@ { - "creation": "2013-02-22 01:27:49.000000", - "docstatus": 0, - "doctype": "DocType", + "creation": "2013-02-22 01:27:49", + "docstatus": 0, + "doctype": "DocType", "fields": [ { - "fieldname": "operation_no", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Operation No", - "oldfieldname": "operation_no", - "oldfieldtype": "Data", - "permlevel": 0, + "fieldname": "operation_no", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Operation No", + "oldfieldname": "operation_no", + "oldfieldtype": "Data", + "permlevel": 0, "reqd": 1 - }, + }, { - "fieldname": "opn_description", - "fieldtype": "Text", - "in_list_view": 1, - "label": "Operation Description", - "oldfieldname": "opn_description", - "oldfieldtype": "Text", - "permlevel": 0, + "fieldname": "opn_description", + "fieldtype": "Text", + "in_list_view": 1, + "label": "Operation Description", + "oldfieldname": "opn_description", + "oldfieldtype": "Text", + "permlevel": 0, "reqd": 1 - }, + }, { - "fieldname": "col_break1", - "fieldtype": "Column Break", + "fieldname": "col_break1", + "fieldtype": "Column Break", "permlevel": 0 - }, + }, { - "fieldname": "workstation", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Workstation", - "oldfieldname": "workstation", - "oldfieldtype": "Link", - "options": "Workstation", - "permlevel": 0, + "fieldname": "workstation", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Workstation", + "oldfieldname": "workstation", + "oldfieldtype": "Link", + "options": "Workstation", + "permlevel": 0, "reqd": 0 - }, + }, { - "fieldname": "hour_rate", - "fieldtype": "Float", - "in_list_view": 0, - "label": "Hour Rate", - "oldfieldname": "hour_rate", - "oldfieldtype": "Currency", - "permlevel": 0, + "fieldname": "hour_rate", + "fieldtype": "Float", + "in_list_view": 0, + "label": "Hour Rate", + "oldfieldname": "hour_rate", + "oldfieldtype": "Currency", + "permlevel": 0, "reqd": 0 - }, + }, { - "fieldname": "time_in_mins", - "fieldtype": "Float", - "in_list_view": 0, - "label": "Operation Time (mins)", - "oldfieldname": "time_in_mins", - "oldfieldtype": "Currency", - "permlevel": 0, + "fieldname": "time_in_mins", + "fieldtype": "Float", + "in_list_view": 0, + "label": "Operation Time (mins)", + "oldfieldname": "time_in_mins", + "oldfieldtype": "Currency", + "permlevel": 0, "reqd": 0 - }, + }, { - "allow_on_submit": 0, - "fieldname": "operating_cost", - "fieldtype": "Float", - "in_list_view": 1, - "label": "Operating Cost", - "oldfieldname": "operating_cost", - "oldfieldtype": "Currency", - "permlevel": 0, + "allow_on_submit": 0, + "fieldname": "operating_cost", + "fieldtype": "Float", + "in_list_view": 1, + "label": "Operating Cost", + "oldfieldname": "operating_cost", + "oldfieldtype": "Currency", + "permlevel": 0, "reqd": 0 + }, + { + "fieldname": "fixed_cycle_cost", + "fieldtype": "Float", + "in_list_view": 0, + "label": "Fixed Cycle Cost", + "permlevel": 0 } - ], - "idx": 1, - "istable": 1, - "modified": "2014-02-03 12:53:03.000000", - "modified_by": "Administrator", - "module": "Manufacturing", - "name": "BOM Operation", - "owner": "Administrator" -} \ No newline at end of file + ], + "idx": 1, + "istable": 1, + "modified": "2014-09-15 12:03:47.456370", + "modified_by": "Administrator", + "module": "Manufacturing", + "name": "BOM Operation", + "owner": "Administrator", + "permissions": [] +} diff --git a/erpnext/manufacturing/doctype/bom_replace_tool/bom_replace_tool.py b/erpnext/manufacturing/doctype/bom_replace_tool/bom_replace_tool.py index 63030b588b..a5b2a53792 100644 --- a/erpnext/manufacturing/doctype/bom_replace_tool/bom_replace_tool.py +++ b/erpnext/manufacturing/doctype/bom_replace_tool/bom_replace_tool.py @@ -25,7 +25,7 @@ class BOMReplaceTool(Document): frappe.throw(_("Current BOM and New BOM can not be same")) def update_new_bom(self): - current_bom_unitcost = frappe.db.sql("""select total_cost/quantity + current_bom_unitcost = frappe.db.sql("""select total_variable_cost/quantity from `tabBOM` where name = %s""", self.current_bom) current_bom_unitcost = current_bom_unitcost and flt(current_bom_unitcost[0][0]) or 0 frappe.db.sql("""update `tabBOM Item` set bom_no=%s, diff --git a/erpnext/manufacturing/doctype/production_order/production_order.js b/erpnext/manufacturing/doctype/production_order/production_order.js index a4bf14c8d7..89ef846212 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.js +++ b/erpnext/manufacturing/doctype/production_order/production_order.js @@ -123,3 +123,5 @@ cur_frm.set_query("bom_no", function(doc) { } } else msgprint(__("Please enter Production Item first")); }); + +cur_frm.add_fetch('bom_no', 'total_fixed_cost', 'total_fixed_cost'); \ No newline at end of file diff --git a/erpnext/manufacturing/doctype/production_order/production_order.json b/erpnext/manufacturing/doctype/production_order/production_order.json index f5e43b0144..3c17973f45 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.json +++ b/erpnext/manufacturing/doctype/production_order/production_order.json @@ -1,257 +1,264 @@ { - "allow_import": 1, - "autoname": "naming_series:", - "creation": "2013-01-10 16:34:16", - "docstatus": 0, - "doctype": "DocType", + "allow_import": 1, + "autoname": "naming_series:", + "creation": "2013-01-10 16:34:16", + "docstatus": 0, + "doctype": "DocType", "fields": [ { - "fieldname": "item", - "fieldtype": "Section Break", - "label": "Item", - "options": "icon-gift", + "fieldname": "item", + "fieldtype": "Section Break", + "label": "Item", + "options": "icon-gift", "permlevel": 0 - }, + }, { - "default": "PRO-", - "fieldname": "naming_series", - "fieldtype": "Select", - "label": "Series", - "options": "PRO-", - "permlevel": 0, + "default": "PRO-", + "fieldname": "naming_series", + "fieldtype": "Select", + "label": "Series", + "options": "PRO-", + "permlevel": 0, "reqd": 1 - }, + }, { - "depends_on": "eval:!doc.__islocal", - "fieldname": "status", - "fieldtype": "Select", - "in_filter": 1, - "in_list_view": 1, - "label": "Status", - "no_copy": 1, - "oldfieldname": "status", - "oldfieldtype": "Select", - "options": "\nDraft\nSubmitted\nStopped\nIn Process\nCompleted\nCancelled", - "permlevel": 0, - "read_only": 1, - "reqd": 1, + "depends_on": "eval:!doc.__islocal", + "fieldname": "status", + "fieldtype": "Select", + "in_filter": 1, + "in_list_view": 1, + "label": "Status", + "no_copy": 1, + "oldfieldname": "status", + "oldfieldtype": "Select", + "options": "\nDraft\nSubmitted\nStopped\nIn Process\nCompleted\nCancelled", + "permlevel": 0, + "read_only": 1, + "reqd": 1, "search_index": 1 - }, + }, { - "fieldname": "production_item", - "fieldtype": "Link", - "in_filter": 1, - "in_list_view": 1, - "label": "Item To Manufacture", - "oldfieldname": "production_item", - "oldfieldtype": "Link", - "options": "Item", - "permlevel": 0, - "read_only": 0, + "fieldname": "production_item", + "fieldtype": "Link", + "in_filter": 1, + "in_list_view": 1, + "label": "Item To Manufacture", + "oldfieldname": "production_item", + "oldfieldtype": "Link", + "options": "Item", + "permlevel": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "depends_on": "production_item", - "description": "Bill of Material to be considered for manufacturing", - "fieldname": "bom_no", - "fieldtype": "Link", - "in_list_view": 1, - "label": "BOM No", - "oldfieldname": "bom_no", - "oldfieldtype": "Link", - "options": "BOM", - "permlevel": 0, - "read_only": 0, + "depends_on": "production_item", + "description": "Bill of Material to be considered for manufacturing", + "fieldname": "bom_no", + "fieldtype": "Link", + "in_list_view": 1, + "label": "BOM No", + "oldfieldname": "bom_no", + "oldfieldtype": "Link", + "options": "BOM", + "permlevel": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "default": "1", - "description": "If checked, BOM for sub-assembly items will be considered for getting raw materials. Otherwise, all sub-assembly items will be treated as a raw material.", - "fieldname": "use_multi_level_bom", - "fieldtype": "Check", - "label": "Use Multi-Level BOM", + "default": "1", + "description": "If checked, BOM for sub-assembly items will be considered for getting raw materials. Otherwise, all sub-assembly items will be treated as a raw material.", + "fieldname": "use_multi_level_bom", + "fieldtype": "Check", + "label": "Use Multi-Level BOM", "permlevel": 0 - }, + }, { - "fieldname": "column_break1", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, - "read_only": 0, + "fieldname": "column_break1", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "read_only": 0, "width": "50%" - }, + }, { - "description": "Manufacture against Sales Order", - "fieldname": "sales_order", - "fieldtype": "Link", - "label": "Sales Order", - "options": "Sales Order", - "permlevel": 0, + "description": "Manufacture against Sales Order", + "fieldname": "sales_order", + "fieldtype": "Link", + "label": "Sales Order", + "options": "Sales Order", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "production_item", - "fieldname": "qty", - "fieldtype": "Float", - "in_list_view": 1, - "label": "Qty To Manufacture", - "oldfieldname": "qty", - "oldfieldtype": "Currency", - "permlevel": 0, - "read_only": 0, + "depends_on": "production_item", + "fieldname": "qty", + "fieldtype": "Float", + "in_list_view": 1, + "label": "Qty To Manufacture", + "oldfieldname": "qty", + "oldfieldtype": "Currency", + "permlevel": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "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, - "read_only": 1 - }, - { - "depends_on": "sales_order", - "fieldname": "expected_delivery_date", - "fieldtype": "Date", - "label": "Expected Delivery Date", - "permlevel": 0, - "read_only": 1 - }, - { - "fieldname": "warehouses", - "fieldtype": "Section Break", - "label": "Warehouses", - "options": "icon-building", + "depends_on": "production_item", + "fieldname": "total_fixed_cost", + "fieldtype": "Float", + "label": "Total Fixed Cost", "permlevel": 0 - }, + }, { - "depends_on": "production_item", - "description": "Manufactured quantity will be updated in this warehouse", - "fieldname": "fg_warehouse", - "fieldtype": "Link", - "in_list_view": 0, - "label": "For Warehouse", - "options": "Warehouse", - "permlevel": 0, - "read_only": 0, - "reqd": 0 - }, - { - "fieldname": "column_break_12", - "fieldtype": "Column Break", - "permlevel": 0 - }, - { - "fieldname": "wip_warehouse", - "fieldtype": "Link", - "label": "Work-in-Progress Warehouse", - "options": "Warehouse", - "permlevel": 0, - "reqd": 0 - }, - { - "fieldname": "more_info", - "fieldtype": "Section Break", - "label": "More Info", - "options": "icon-file-text", - "permlevel": 0, - "read_only": 0 - }, - { - "fieldname": "description", - "fieldtype": "Small Text", - "label": "Item Description", - "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, "read_only": 1 - }, + }, { - "fieldname": "project_name", - "fieldtype": "Link", - "in_filter": 1, - "label": "Project Name", - "oldfieldname": "project_name", - "oldfieldtype": "Link", - "options": "Project", - "permlevel": 0, + "depends_on": "sales_order", + "fieldname": "expected_delivery_date", + "fieldtype": "Date", + "label": "Expected Delivery Date", + "permlevel": 0, + "read_only": 1 + }, + { + "fieldname": "warehouses", + "fieldtype": "Section Break", + "label": "Warehouses", + "options": "icon-building", + "permlevel": 0 + }, + { + "depends_on": "production_item", + "description": "Manufactured quantity will be updated in this warehouse", + "fieldname": "fg_warehouse", + "fieldtype": "Link", + "in_list_view": 0, + "label": "For Warehouse", + "options": "Warehouse", + "permlevel": 0, + "read_only": 0, + "reqd": 0 + }, + { + "fieldname": "column_break_12", + "fieldtype": "Column Break", + "permlevel": 0 + }, + { + "fieldname": "wip_warehouse", + "fieldtype": "Link", + "label": "Work-in-Progress Warehouse", + "options": "Warehouse", + "permlevel": 0, + "reqd": 0 + }, + { + "fieldname": "more_info", + "fieldtype": "Section Break", + "label": "More Info", + "options": "icon-file-text", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "column_break2", - "fieldtype": "Column Break", - "permlevel": 0, - "read_only": 0, + "fieldname": "description", + "fieldtype": "Small Text", + "label": "Item Description", + "permlevel": 0, + "read_only": 1 + }, + { + "fieldname": "project_name", + "fieldtype": "Link", + "in_filter": 1, + "label": "Project Name", + "oldfieldname": "project_name", + "oldfieldtype": "Link", + "options": "Project", + "permlevel": 0, + "read_only": 0 + }, + { + "fieldname": "column_break2", + "fieldtype": "Column Break", + "permlevel": 0, + "read_only": 0, "width": "50%" - }, + }, { - "depends_on": "production_item", - "fieldname": "stock_uom", - "fieldtype": "Link", - "label": "Stock UOM", - "oldfieldname": "stock_uom", - "oldfieldtype": "Data", - "options": "UOM", - "permlevel": 0, + "depends_on": "production_item", + "fieldname": "stock_uom", + "fieldtype": "Link", + "label": "Stock UOM", + "oldfieldname": "stock_uom", + "oldfieldtype": "Data", + "options": "UOM", + "permlevel": 0, "read_only": 1 - }, + }, { - "fieldname": "company", - "fieldtype": "Link", - "label": "Company", - "oldfieldname": "company", - "oldfieldtype": "Link", - "options": "Company", - "permlevel": 0, - "read_only": 0, + "fieldname": "company", + "fieldtype": "Link", + "label": "Company", + "oldfieldname": "company", + "oldfieldtype": "Link", + "options": "Company", + "permlevel": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "fieldname": "amended_from", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Amended From", - "no_copy": 1, - "oldfieldname": "amended_from", - "oldfieldtype": "Data", - "options": "Production Order", - "permlevel": 0, + "fieldname": "amended_from", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Amended From", + "no_copy": 1, + "oldfieldname": "amended_from", + "oldfieldtype": "Data", + "options": "Production Order", + "permlevel": 0, "read_only": 1 } - ], - "icon": "icon-cogs", - "idx": 1, - "in_create": 0, - "is_submittable": 1, - "modified": "2014-06-23 07:55:50.092300", - "modified_by": "Administrator", - "module": "Manufacturing", - "name": "Production Order", - "owner": "Administrator", + ], + "icon": "icon-cogs", + "idx": 1, + "in_create": 0, + "is_submittable": 1, + "modified": "2014-09-15 11:45:48.591196", + "modified_by": "Administrator", + "module": "Manufacturing", + "name": "Production 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": "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 - }, + }, { - "apply_user_permissions": 1, - "permlevel": 0, - "read": 1, - "report": 1, + "apply_user_permissions": 1, + "permlevel": 0, + "read": 1, + "report": 1, "role": "Material User" } ] -} \ No newline at end of file +} diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py index 99a248bf1b..03fdf79ec7 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.py +++ b/erpnext/manufacturing/doctype/production_order/production_order.py @@ -24,6 +24,7 @@ class ProductionOrder(Document): self.validate_bom_no() self.validate_sales_order() self.validate_warehouse() + self.set_fixed_cost() from erpnext.utilities.transaction_base import validate_uom_is_integer validate_uom_is_integer(self, "stock_uom", ["qty", "produced_qty"]) @@ -55,6 +56,10 @@ class ProductionOrder(Document): for w in [self.fg_warehouse, self.wip_warehouse]: validate_warehouse_company(w, self.company) + def set_fixed_cost(self): + if self.total_fixed_cost==None: + self.total_fixed_cost = frappe.db.get_value("BOM", self.bom_no, "total_fixed_cost") + def validate_production_order_against_so(self): # already ordered qty ordered_qty_against_so = frappe.db.sql("""select sum(qty) from `tabProduction Order` @@ -156,11 +161,10 @@ def get_item_details(item): return {} res = res[0] - bom = frappe.db.sql("""select name from `tabBOM` where item=%s - and ifnull(is_default, 0)=1""", item) + bom = frappe.db.sql("""select name as bom_no,total_fixed_cost from `tabBOM` where item=%s + and ifnull(is_default, 0)=1""", item, as_dict=1) if bom: - res.bom_no = bom[0][0] - + res.update(bom[0]) return res @frappe.whitelist() diff --git a/erpnext/manufacturing/doctype/production_order/test_production_order.py b/erpnext/manufacturing/doctype/production_order/test_production_order.py index 2736be4efc..55125cf848 100644 --- a/erpnext/manufacturing/doctype/production_order/test_production_order.py +++ b/erpnext/manufacturing/doctype/production_order/test_production_order.py @@ -54,5 +54,4 @@ class TestProductionOrder(unittest.TestCase): self.assertRaises(StockOverProductionError, s.submit) - -test_records = frappe.get_test_records('Production Order') +test_records = frappe.get_test_records('Production Order') \ No newline at end of file diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py index 547ca8b4ac..f0bb9377c4 100644 --- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py +++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py @@ -153,7 +153,6 @@ class ProductionPlanningTool(Document): pi.so_pending_qty = flt(p['pending_qty']) pi.planned_qty = flt(p['pending_qty']) - def validate_data(self): self.validate_company() for d in self.get('pp_details'): diff --git a/erpnext/manufacturing/doctype/workstation/test_records.json b/erpnext/manufacturing/doctype/workstation/test_records.json new file mode 100644 index 0000000000..72123eb282 --- /dev/null +++ b/erpnext/manufacturing/doctype/workstation/test_records.json @@ -0,0 +1,10 @@ +[ + { + "doctype": "Workstation", + "name": "_Test Workstation 1", + "workstation_name": "_Test Workstation 1", + "warehouse": "_Test warehouse - _TC", + "fixed_cycle_cost": 1000, + "hour_rate":100 + } +] diff --git a/erpnext/manufacturing/doctype/workstation/test_workstation.py b/erpnext/manufacturing/doctype/workstation/test_workstation.py new file mode 100644 index 0000000000..01746ebc44 --- /dev/null +++ b/erpnext/manufacturing/doctype/workstation/test_workstation.py @@ -0,0 +1,12 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and Contributors +# See license.txt + +import frappe +import unittest + +test_dependencies = ["Warehouse"] +test_records = frappe.get_test_records('Workstation') + + +class TestWorkstation(unittest.TestCase): + pass diff --git a/erpnext/manufacturing/doctype/workstation/workstation.json b/erpnext/manufacturing/doctype/workstation/workstation.json index 278707e615..6183fa3731 100644 --- a/erpnext/manufacturing/doctype/workstation/workstation.json +++ b/erpnext/manufacturing/doctype/workstation/workstation.json @@ -1,155 +1,161 @@ { - "allow_import": 1, - "allow_rename": 1, - "autoname": "field:workstation_name", - "creation": "2013-01-10 16:34:17", - "docstatus": 0, - "doctype": "DocType", - "document_type": "Master", + "allow_import": 1, + "allow_rename": 1, + "autoname": "field:workstation_name", + "creation": "2013-01-10 16:34:17", + "docstatus": 0, + "doctype": "DocType", + "document_type": "Master", "fields": [ { - "fieldname": "workstation_name", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Workstation Name", - "oldfieldname": "workstation_name", - "oldfieldtype": "Data", - "permlevel": 0, + "fieldname": "workstation_name", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Workstation Name", + "oldfieldname": "workstation_name", + "oldfieldtype": "Data", + "permlevel": 0, "reqd": 1 - }, + }, { - "fieldname": "warehouse", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Warehouse", - "oldfieldname": "warehouse", - "oldfieldtype": "Link", - "options": "Warehouse", - "permlevel": 0, + "fieldname": "warehouse", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Warehouse", + "oldfieldname": "warehouse", + "oldfieldtype": "Link", + "options": "Warehouse", + "permlevel": 0, "reqd": 1 - }, + }, { - "fieldname": "description", - "fieldtype": "Text", - "in_list_view": 1, - "label": "Description", - "oldfieldname": "description", - "oldfieldtype": "Text", - "permlevel": 0, + "fieldname": "description", + "fieldtype": "Text", + "in_list_view": 1, + "label": "Description", + "oldfieldname": "description", + "oldfieldtype": "Text", + "permlevel": 0, "width": "300px" - }, + }, { - "fieldname": "capacity", - "fieldtype": "Data", - "hidden": 1, - "in_list_view": 1, - "label": "Capacity", - "oldfieldname": "capacity", - "oldfieldtype": "Data", - "permlevel": 0, + "fieldname": "capacity", + "fieldtype": "Data", + "hidden": 1, + "in_list_view": 1, + "label": "Capacity", + "oldfieldname": "capacity", + "oldfieldtype": "Data", + "permlevel": 0, "reqd": 0 - }, + }, { - "fieldname": "capacity_units", - "fieldtype": "Select", - "hidden": 1, - "in_list_view": 1, - "label": "Capacity Units", - "oldfieldname": "capacity_units", - "oldfieldtype": "Select", - "options": "\nUnits/Shifts\nUnits/Hour", - "permlevel": 0, + "fieldname": "capacity_units", + "fieldtype": "Select", + "hidden": 1, + "in_list_view": 1, + "label": "Capacity Units", + "oldfieldname": "capacity_units", + "oldfieldtype": "Select", + "options": "\nUnits/Shifts\nUnits/Hour", + "permlevel": 0, "reqd": 0 - }, + }, { - "fieldname": "hour_rate_labour", - "fieldtype": "Float", - "label": "Hour Rate Labour", - "oldfieldname": "hour_rate_labour", - "oldfieldtype": "Currency", - "permlevel": 0, + "fieldname": "fixed_cycle_cost", + "fieldtype": "Float", + "label": "Fixed Cycle Cost", + "permlevel": 0 + }, + { + "fieldname": "hour_rate_labour", + "fieldtype": "Float", + "label": "Hour Rate Labour", + "oldfieldname": "hour_rate_labour", + "oldfieldtype": "Currency", + "permlevel": 0, "reqd": 0 - }, + }, { - "fieldname": "over_heads", - "fieldtype": "Section Break", - "label": "Overheads", - "oldfieldtype": "Section Break", + "fieldname": "over_heads", + "fieldtype": "Section Break", + "label": "Overheads", + "oldfieldtype": "Section Break", "permlevel": 0 - }, + }, { - "description": "Electricity cost per hour", - "fieldname": "hour_rate_electricity", - "fieldtype": "Float", - "label": "Electricity Cost", - "oldfieldname": "hour_rate_electricity", - "oldfieldtype": "Currency", + "description": "Electricity cost per hour", + "fieldname": "hour_rate_electricity", + "fieldtype": "Float", + "label": "Electricity Cost", + "oldfieldname": "hour_rate_electricity", + "oldfieldtype": "Currency", "permlevel": 0 - }, + }, { - "description": "Consumable cost per hour", - "fieldname": "hour_rate_consumable", - "fieldtype": "Float", - "label": "Consumable Cost", - "oldfieldname": "hour_rate_consumable", - "oldfieldtype": "Currency", + "description": "Consumable cost per hour", + "fieldname": "hour_rate_consumable", + "fieldtype": "Float", + "label": "Consumable Cost", + "oldfieldname": "hour_rate_consumable", + "oldfieldtype": "Currency", "permlevel": 0 - }, + }, { - "description": "Rent per hour", - "fieldname": "hour_rate_rent", - "fieldtype": "Float", - "label": "Rent Cost", - "oldfieldname": "hour_rate_rent", - "oldfieldtype": "Currency", + "description": "Rent per hour", + "fieldname": "hour_rate_rent", + "fieldtype": "Float", + "label": "Rent Cost", + "oldfieldname": "hour_rate_rent", + "oldfieldtype": "Currency", "permlevel": 0 - }, + }, { - "fieldname": "overhead", - "fieldtype": "Float", - "label": "Overhead", - "oldfieldname": "overhead", - "oldfieldtype": "Currency", - "permlevel": 0, + "fieldname": "overhead", + "fieldtype": "Float", + "label": "Overhead", + "oldfieldname": "overhead", + "oldfieldtype": "Currency", + "permlevel": 0, "read_only": 1 - }, + }, { - "fieldname": "hour_rate_section_break", - "fieldtype": "Section Break", - "label": "Hour Rate", - "oldfieldtype": "Section Break", + "fieldname": "hour_rate_section_break", + "fieldtype": "Section Break", + "label": "Hour Rate", + "oldfieldtype": "Section Break", "permlevel": 0 - }, + }, { - "fieldname": "hour_rate", - "fieldtype": "Float", - "label": "Hour Rate", - "oldfieldname": "hour_rate", - "oldfieldtype": "Currency", - "permlevel": 0, + "fieldname": "hour_rate", + "fieldtype": "Float", + "label": "Hour Rate", + "oldfieldname": "hour_rate", + "oldfieldtype": "Currency", + "permlevel": 0, "read_only": 1 } - ], - "icon": "icon-wrench", - "idx": 1, - "modified": "2014-05-27 03:49:22.635046", - "modified_by": "Administrator", - "module": "Manufacturing", - "name": "Workstation", - "owner": "Administrator", + ], + "icon": "icon-wrench", + "idx": 1, + "modified": "2014-09-15 10:59:07.960814", + "modified_by": "Administrator", + "module": "Manufacturing", + "name": "Workstation", + "owner": "Administrator", "permissions": [ { - "apply_user_permissions": 1, - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Manufacturing User", - "submit": 0, + "apply_user_permissions": 1, + "create": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Manufacturing User", + "submit": 0, "write": 1 } ] -} \ No newline at end of file +} diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 9146336fd5..2f0dd2ef5e 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -80,3 +80,4 @@ 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 diff --git a/erpnext/patches/v4_2/cost_of_production_cycle.py b/erpnext/patches/v4_2/cost_of_production_cycle.py new file mode 100644 index 0000000000..26f0fcad5b --- /dev/null +++ b/erpnext/patches/v4_2/cost_of_production_cycle.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.reload_doc("manufacturing", "doctype", "bom") + frappe.db.sql("""update tabBOM set total_variable_cost = total_cost""") \ No newline at end of file diff --git a/erpnext/projects/report/daily_time_log_summary/daily_time_log_summary.py b/erpnext/projects/report/daily_time_log_summary/daily_time_log_summary.py index 185bcd9a6c..b8f746b15d 100644 --- a/erpnext/projects/report/daily_time_log_summary/daily_time_log_summary.py +++ b/erpnext/projects/report/daily_time_log_summary/daily_time_log_summary.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals import frappe +from frappe import _ from frappe.utils import flt def execute(filters=None): @@ -12,9 +13,9 @@ def execute(filters=None): filters["from_time"] = "00:00:00" filters["to_time"] = "24:00:00" - columns = ["Time Log:Link/Time Log:120", "Employee::150", "From Datetime::140", - "To Datetime::140", "Hours::70", "Activity Type::120", "Task:Link/Task:150", - "Task Subject::180", "Project:Link/Project:120", "Status::70"] + columns = [_("Time Log") + ":Link/Time Log:120", _("Employee") + "::150", _("From Datetime") + "::140", + _("To Datetime") + "::140", _("Hours") + "::70", _("Activity Type") + "::120", _("Task") + ":Link/Task:150", + _("Task Subject") + "::180", _("Project") + ":Link/Project:120", _("Status") + "::70"] user_map = get_user_map() task_map = get_task_map() 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 daed4aba61..538b7edd45 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 @@ -1,7 +1,8 @@ # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt -import frappe +import frappe +from frappe import _ def execute(filters=None): columns = get_columns() @@ -21,11 +22,11 @@ def execute(filters=None): return columns, data def get_columns(): - return ["Project Id:Link/Project:140", "Cost of Purchased Items:Currency:160", - "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"] + return [_("Project Id") + ":Link/Project:140", _("Cost of Purchased Items") + ":Currency:160", + _("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"] def get_project_details(): return frappe.db.sql(""" select name, project_name, status, company, customer, project_value, diff --git a/erpnext/public/js/purchase_trends_filters.js b/erpnext/public/js/purchase_trends_filters.js index d60b915f48..cab8bbfc24 100644 --- a/erpnext/public/js/purchase_trends_filters.js +++ b/erpnext/public/js/purchase_trends_filters.js @@ -7,21 +7,36 @@ var get_filters = function(){ "fieldname":"period", "label": __("Period"), "fieldtype": "Select", - "options": ["Monthly", "Quarterly", "Half-Yearly", "Yearly"].join("\n"), + "options": [ + { "value": "Monthly", "label": __("Monthly") }, + { "value": "Quarterly", "label": __("Quarterly") }, + { "value": "Half-Yearly", "label": __("Half-Yearly") }, + { "value": "Yearly", "label": __("Yearly") } + ], "default": "Monthly" }, { "fieldname":"based_on", "label": __("Based On"), "fieldtype": "Select", - "options": ["Item", "Item Group", "Supplier", "Supplier Type", "Project"].join("\n"), + "options": [ + { "value": "Item", "label": __("Item") }, + { "value": "Item Group", "label": __("Item Group") }, + { "value": "Supplier", "label": __("Supplier") }, + { "value": "Supplier Type", "label": __("Supplier Type") }, + { "value": "Supplier Type", "label": __("Project") } + ], "default": "Item" }, { "fieldname":"group_by", "label": __("Group By"), "fieldtype": "Select", - "options": ["", "Item", "Supplier"].join("\n"), + "options": [ + "", + { "value": "Item", "label": __("Item") }, + { "value": "Supplier", "label": __("Supplier") } + ], "default": "" }, { diff --git a/erpnext/public/js/sales_trends_filters.js b/erpnext/public/js/sales_trends_filters.js index 89c269e339..46070b4768 100644 --- a/erpnext/public/js/sales_trends_filters.js +++ b/erpnext/public/js/sales_trends_filters.js @@ -7,21 +7,37 @@ var get_filters = function(){ "fieldname":"period", "label": __("Period"), "fieldtype": "Select", - "options": ["Monthly", "Quarterly", "Half-Yearly", "Yearly"].join("\n"), + "options": [ + { "value": "Monthly", "label": __("Monthly") }, + { "value": "Quarterly", "label": __("Quarterly") }, + { "value": "Half-Yearly", "label": __("Half-Yearly") }, + { "value": "Yearly", "label": __("Yearly") } + ], "default": "Monthly" }, { "fieldname":"based_on", "label": __("Based On"), "fieldtype": "Select", - "options": ["Item", "Item Group", "Customer", "Customer Group", "Territory", "Project"].join("\n"), + "options": [ + { "value": "Item", "label": __("Item") }, + { "value": "Item Group", "label": __("Item Group") }, + { "value": "Customer", "label": __("Customer") }, + { "value": "Customer Group", "label": __("Customer Group") }, + { "value": "Territory", "label": __("Territory") }, + { "value": "Supplier Type", "label": __("Project") } + ], "default": "Item" }, { "fieldname":"group_by", "label": __("Group By"), "fieldtype": "Select", - "options": ["", "Item", "Customer"].join("\n"), + "options": [ + "", + { "value": "Item", "label": __("Item") }, + { "value": "Customer", "label": __("Customer") } + ], "default": "" }, { diff --git a/erpnext/selling/doctype/customer/customer.json b/erpnext/selling/doctype/customer/customer.json index ef71d56ad5..47286de547 100644 --- a/erpnext/selling/doctype/customer/customer.json +++ b/erpnext/selling/doctype/customer/customer.json @@ -282,7 +282,7 @@ ], "icon": "icon-user", "idx": 1, - "modified": "2014-08-07 06:57:25.248707", + "modified": "2014-09-10 16:41:07.553182", "modified_by": "Administrator", "module": "Selling", "name": "Customer", @@ -309,6 +309,14 @@ "read": 1, "role": "Sales User" }, + { + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Sales Manager" + }, { "amend": 0, "create": 1, @@ -330,6 +338,38 @@ "read": 1, "role": "Sales Master Manager", "write": 1 + }, + { + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Material User" + }, + { + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Material Manager" + }, + { + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts User" + }, + { + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts Manager" } ], "search_fields": "customer_name,customer_group,territory", diff --git a/erpnext/selling/doctype/customer/test_records.json b/erpnext/selling/doctype/customer/test_records.json index 6bac5439f5..e076f7a893 100644 --- a/erpnext/selling/doctype/customer/test_records.json +++ b/erpnext/selling/doctype/customer/test_records.json @@ -22,5 +22,13 @@ "customer_type": "Individual", "doctype": "Customer", "territory": "_Test Territory" + }, + { + "company": "_Test Company", + "customer_group": "_Test Customer Group", + "customer_name": "_Test Customer 3", + "customer_type": "Individual", + "doctype": "Customer", + "territory": "_Test Territory" } ] diff --git a/erpnext/selling/doctype/quotation/quotation.json b/erpnext/selling/doctype/quotation/quotation.json index 7972eab384..5d960e9556 100644 --- a/erpnext/selling/doctype/quotation/quotation.json +++ b/erpnext/selling/doctype/quotation/quotation.json @@ -1,5 +1,5 @@ { - "allow_import": 1, + "allow_import": 1, "autoname": "naming_series:", "creation": "2013-05-24 19:29:08", "docstatus": 0, @@ -832,7 +832,7 @@ "idx": 1, "is_submittable": 1, "max_attachments": 1, - "modified": "2014-08-12 05:04:36.157045", + "modified": "2014-09-09 05:35:33.413559", "modified_by": "Administrator", "module": "Selling", "name": "Quotation", diff --git a/erpnext/selling/doctype/quotation_item/quotation_item.json b/erpnext/selling/doctype/quotation_item/quotation_item.json index e769655e96..aa7ee6720e 100644 --- a/erpnext/selling/doctype/quotation_item/quotation_item.json +++ b/erpnext/selling/doctype/quotation_item/quotation_item.json @@ -332,7 +332,7 @@ ], "idx": 1, "istable": 1, - "modified": "2014-09-08 08:06:31.198440", + "modified": "2014-09-09 05:35:36.871532", "modified_by": "Administrator", "module": "Selling", "name": "Quotation Item", diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json index a4b00ff8b6..844e8cd2e0 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.json +++ b/erpnext/selling/doctype/sales_order/sales_order.json @@ -1,1115 +1,1122 @@ { - "allow_attach": 1, - "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", + "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", + "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", - "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": "column_break_46", - "fieldtype": "Column 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": "discount_amount", - "fieldtype": "Currency", - "label": "Discount Amount", - "options": "Company:company:default_currency", + "fieldname": "column_break_46", + "fieldtype": "Column Break", "permlevel": 0 - }, + }, { - "fieldname": "totals", - "fieldtype": "Section Break", - "label": "Totals", - "oldfieldtype": "Section Break", - "options": "icon-money", - "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, + "width": "150px" + }, + { + "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, "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": "column_break3", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "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, "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, + "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-08-28 11:22:10.959416", - "modified_by": "Administrator", - "module": "Selling", - "name": "Sales Order", - "owner": "Administrator", + ], + "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", "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 ff14f9d0c1..d2996e9574 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -326,6 +326,11 @@ def make_delivery_note(source_name, target_doc=None): @frappe.whitelist() def make_sales_invoice(source_name, target_doc=None): + def postprocess(source, target): + set_missing_values(source, target) + #Get the advance paid Journal Vouchers in Sales Invoice Advance + target.get_advances() + def set_missing_values(source, target): target.is_pos = 0 target.ignore_pricing_rule = 1 @@ -361,7 +366,18 @@ def make_sales_invoice(source_name, target_doc=None): "doctype": "Sales Team", "add_if_empty": True } - }, target_doc, set_missing_values) + }, target_doc, postprocess) + + def set_advance_vouchers(source, target): + advance_voucher_list = [] + + advance_voucher = frappe.db.sql(""" + select + t1.name as voucher_no, t1.posting_date, t1.remark, t2.account, + t2.name as voucher_detail_no, {amount_query} as payment_amount, t2.is_advance + from + `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2 + """) return doclist diff --git a/erpnext/selling/doctype/sales_order/test_records.json b/erpnext/selling/doctype/sales_order/test_records.json index 88af30c1f9..8db9915c2d 100644 --- a/erpnext/selling/doctype/sales_order/test_records.json +++ b/erpnext/selling/doctype/sales_order/test_records.json @@ -1,5 +1,6 @@ [ { + "advance_paid": 0.0, "company": "_Test Company", "conversion_rate": 1.0, "currency": "INR", diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.json b/erpnext/selling/doctype/sales_order_item/sales_order_item.json index 979b56710a..4174d05738 100644 --- a/erpnext/selling/doctype/sales_order_item/sales_order_item.json +++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.json @@ -415,7 +415,7 @@ ], "idx": 1, "istable": 1, - "modified": "2014-09-08 08:06:31.435020", + "modified": "2014-09-09 05:35:37.173841", "modified_by": "Administrator", "module": "Selling", "name": "Sales Order Item", diff --git a/erpnext/selling/page/sales_browser/sales_browser.js b/erpnext/selling/page/sales_browser/sales_browser.js index a8fd464c68..d254028865 100644 --- a/erpnext/selling/page/sales_browser/sales_browser.js +++ b/erpnext/selling/page/sales_browser/sales_browser.js @@ -8,7 +8,7 @@ pscript['onload_Sales Browser'] = function(wrapper){ wrapper.appframe.add_module_icon("Selling") - wrapper.appframe.set_title_right('Refresh', function() { + wrapper.appframe.set_title_right(__('Refresh'), function() { wrapper.make_tree(); }); @@ -44,7 +44,7 @@ pscript['onshow_Sales Browser'] = function(wrapper){ // set route var ctype = frappe.get_route()[1] || 'Territory'; - wrapper.appframe.set_title(ctype+' Tree') + wrapper.appframe.set_title(__('{0} Tree',[__(ctype)])); if(erpnext.sales_chart && erpnext.sales_chart.ctype != ctype) { wrapper.make_tree(); @@ -64,7 +64,7 @@ erpnext.SalesChart = Class.extend({ this.tree = new frappe.ui.Tree({ parent: $(parent), - label: root, + label: __(root), args: {ctype: ctype}, method: 'erpnext.selling.page.sales_browser.sales_browser.get_children', toolbar: [ @@ -112,20 +112,20 @@ erpnext.SalesChart = Class.extend({ var fields = [ {fieldtype:'Data', fieldname: 'name_field', - label:'New ' + me.ctype + ' Name', reqd:true}, - {fieldtype:'Select', fieldname:'is_group', label:'Group Node', options:'No\nYes', + label:__('New {0} Name',[__(me.ctype)]), reqd:true}, + {fieldtype:'Select', fieldname:'is_group', label:__('Group Node'), options:'No\nYes', description: __("Further nodes can be only created under 'Group' type nodes")}, - {fieldtype:'Button', fieldname:'create_new', label:'Create New' } + {fieldtype:'Button', fieldname:'create_new', label:__('Create New') } ] if(me.ctype == "Sales Person") { - fields.splice(-1, 0, {fieldtype:'Link', fieldname:'employee', label:'Employee', + fields.splice(-1, 0, {fieldtype:'Link', fieldname:'employee', label:__('Employee'), options:'Employee', description: __("Please enter Employee Id of this sales parson")}); } // the dialog var d = new frappe.ui.Dialog({ - title: __('New ') + __(me.ctype), + title: __('New {0}',[__(me.ctype)]), fields: fields }) diff --git a/erpnext/selling/page/sales_funnel/sales_funnel.js b/erpnext/selling/page/sales_funnel/sales_funnel.js index cc46c046ce..76707629cf 100644 --- a/erpnext/selling/page/sales_funnel/sales_funnel.js +++ b/erpnext/selling/page/sales_funnel/sales_funnel.js @@ -4,7 +4,7 @@ frappe.pages['sales-funnel'].onload = function(wrapper) { frappe.ui.make_app_page({ parent: wrapper, - title: 'Sales Funnel', + title: __('Sales Funnel'), single_column: true }); @@ -30,13 +30,13 @@ erpnext.SalesFunnel = Class.extend({ this.elements = { layout: $(wrapper).find(".layout-main"), - from_date: wrapper.appframe.add_date("From Date"), - to_date: wrapper.appframe.add_date("To Date"), - refresh_btn: wrapper.appframe.set_title_right("Refresh", + from_date: wrapper.appframe.add_date(__("From Date")), + to_date: wrapper.appframe.add_date(__("To Date")), + refresh_btn: wrapper.appframe.set_title_right(__("Refresh"), function() { me.get_data(); }, "icon-refresh"), }; - this.elements.no_data = $('
No Data
') + this.elements.no_data = $('
' + __("No Data") + '
') .toggle(false) .appendTo(this.elements.layout); diff --git a/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.py b/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.py index 43c4e58ecd..1ec9871b77 100644 --- a/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.py +++ b/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals import frappe +from frappe import _ from frappe.utils import getdate, cint import calendar @@ -52,13 +53,13 @@ def execute(filters=None): new[1], repeat[1], new[1] + repeat[1]]) return [ - "Year", "Month", - "New Customers:Int", - "Repeat Customers:Int", - "Total:Int", - "New Customer Revenue:Currency:150", - "Repeat Customer Revenue:Currency:150", - "Total Revenue:Currency:150" + _("Year"), _("Month"), + _("New Customers") + ":Int", + _("Repeat Customers") + ":Int", + _("Total") + ":Int", + _("New Customer Revenue") + ":Currency:150", + _("Repeat Customer Revenue") + ":Currency:150", + _("Total Revenue") + ":Currency:150" ], out diff --git a/erpnext/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.py b/erpnext/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.py index 35cdf59c50..a87c4a119f 100644 --- a/erpnext/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.py +++ b/erpnext/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.py @@ -50,14 +50,14 @@ def get_last_so_amt(customer): def get_columns(): return [ - "Customer:Link/Customer:120", - "Customer Name:Data:120", - "Territory::120", - "Customer Group::120", - "Number of Order::120", - "Total Order Value:Currency:120", - "Total Order Considered:Currency:160", - "Last Order Amount:Currency:160", - "Last Sales Order Date:Date:160", - "Days Since Last Order::160" + _("Customer") + ":Link/Customer:120", + _("Customer Name") + ":Data:120", + _("Territory") + "::120", + _("Customer Group") + "::120", + _("Number of Order") + "::120", + _("Total Order Value") + ":Currency:120", + _("Total Order Considered") + ":Currency:160", + _("Last Order Amount") + ":Currency:160", + _("Last Sales Order Date") + ":Date:160", + _("Days Since Last Order") + "::160" ] diff --git a/erpnext/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py b/erpnext/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py index b272a83d27..00b4cde0b6 100644 --- a/erpnext/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py +++ b/erpnext/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py @@ -43,21 +43,21 @@ def get_columns(filters): msgprint(_("Please specify") + ": " + label, raise_exception=True) - columns = ["Sales Person:Link/Sales Person:120", "Item Group:Link/Item Group:120"] + columns = [_("Sales Person") + ":Link/Sales Person:120", _("Item Group") + ":Link/Item Group:120"] group_months = False if filters["period"] == "Monthly" else True for from_date, to_date in get_period_date_ranges(filters["period"], filters["fiscal_year"]): - for label in ["Target (%s)", "Achieved (%s)", "Variance (%s)"]: + for label in [_("Target") + " (%s)", _("Achieved") + " (%s)", _("Variance") + " (%s)"]: if group_months: - label = label % (from_date.strftime("%b") + " - " + to_date.strftime("%b")) + label = label % (_(from_date.strftime("%b")) + " - " + _(to_date.strftime("%b"))) else: - label = label % from_date.strftime("%b") + label = label % _(from_date.strftime("%b")) columns.append(label+":Float:120") - return columns + ["Total Target:Float:120", "Total Achieved:Float:120", - "Total Variance:Float:120"] + return columns + [_("Total Target") + ":Float:120", _("Total Achieved") + ":Float:120", + _("Total Variance") + ":Float:120"] #Get sales person & item group details def get_salesperson_details(filters): 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 c7ee35fa9c..c970431bec 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", - "Contribution Amount:Currency:140"] - + + 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 diff --git a/erpnext/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.py b/erpnext/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.py index 831e6b7c5f..0ceb2d904d 100644 --- a/erpnext/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.py +++ b/erpnext/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.py @@ -43,20 +43,20 @@ def get_columns(filters): label = (" ".join(fieldname.split("_"))).title() msgprint(_("Please specify") + ": " + label, raise_exception=True) - columns = ["Territory:Link/Territory:120", "Item Group:Link/Item Group:120"] + columns = [_("Territory") + ":Link/Territory:120", _("Item Group") + ":Link/Item Group:120"] group_months = False if filters["period"] == "Monthly" else True for from_date, to_date in get_period_date_ranges(filters["period"], filters["fiscal_year"]): - for label in ["Target (%s)", "Achieved (%s)", "Variance (%s)"]: + for label in [_("Target") +" (%s)", _("Achieved") + " (%s)", _("Variance") + " (%s)"]: if group_months: - label = label % (from_date.strftime("%b") + " - " + to_date.strftime("%b")) + label = label % (_(from_date.strftime("%b")) + " - " + _(to_date.strftime("%b"))) else: - label = label % from_date.strftime("%b") + label = label % _(from_date.strftime("%b")) columns.append(label+":Float:120") - return columns + ["Total Target:Float:120", "Total Achieved:Float:120", - "Total Variance:Float:120"] + return columns + [_("Total Target") + ":Float:120", _("Total Achieved") + ":Float:120", + _("Total Variance") + ":Float:120"] #Get territory & item group details def get_territory_details(filters): diff --git a/erpnext/setup/doctype/contact_control/contact_control.js b/erpnext/setup/doctype/contact_control/contact_control.js index b053541683..0ca59fc449 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/setup/doctype/email_digest/email_digest.js b/erpnext/setup/doctype/email_digest/email_digest.js index fb08f904dd..cd5626aa2f 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 59a42cbbaf..16883bf13a 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/setup/doctype/print_heading/print_heading.json b/erpnext/setup/doctype/print_heading/print_heading.json index 313b30b3d4..c788d9ece2 100644 --- a/erpnext/setup/doctype/print_heading/print_heading.json +++ b/erpnext/setup/doctype/print_heading/print_heading.json @@ -7,6 +7,7 @@ "document_type": "Master", "fields": [ { + "allow_on_submit": 1, "fieldname": "print_heading", "fieldtype": "Data", "in_filter": 1, @@ -30,7 +31,7 @@ ], "icon": "icon-font", "idx": 1, - "modified": "2014-05-27 03:49:14.944690", + "modified": "2014-09-09 05:35:39.239327", "modified_by": "Administrator", "module": "Setup", "name": "Print Heading", diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json index 3be5f5d80f..4a957ff804 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.json +++ b/erpnext/stock/doctype/delivery_note/delivery_note.json @@ -1,5 +1,5 @@ { - "autoname": "naming_series:", + "autoname": "naming_series:", "creation": "2013-05-24 19:29:09", "docstatus": 0, "doctype": "DocType", @@ -1013,7 +1013,7 @@ "idx": 1, "in_create": 0, "is_submittable": 1, - "modified": "2014-08-12 05:23:55.104153", + "modified": "2014-09-09 05:35:30.700911", "modified_by": "Administrator", "module": "Stock", "name": "Delivery Note", diff --git a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json index d2d6af2d71..a5fe469d69 100644 --- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json +++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json @@ -426,7 +426,7 @@ ], "idx": 1, "istable": 1, - "modified": "2014-09-08 08:06:31.703783", + "modified": "2014-09-09 05:35:37.460939", "modified_by": "Administrator", "module": "Stock", "name": "Delivery Note Item", diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js index 93c1191da5..c80d19ec9c 100644 --- a/erpnext/stock/doctype/item/item.js +++ b/erpnext/stock/doctype/item/item.js @@ -47,7 +47,7 @@ cur_frm.cscript.make_dashboard = function() { } cur_frm.cscript.edit_prices_button = function() { - cur_frm.add_custom_button("Add / Edit Prices", function() { + cur_frm.add_custom_button(__("Add / Edit Prices"), function() { frappe.set_route("Report", "Item Price", {"item_code": cur_frm.doc.name}); }, "icon-money"); } diff --git a/erpnext/stock/doctype/material_request/material_request.json b/erpnext/stock/doctype/material_request/material_request.json index c60181f03c..a9ace56d11 100644 --- a/erpnext/stock/doctype/material_request/material_request.json +++ b/erpnext/stock/doctype/material_request/material_request.json @@ -1,5 +1,5 @@ { - "allow_import": 1, + "allow_import": 1, "autoname": "naming_series:", "creation": "2013-03-07 14:48:38", "docstatus": 0, @@ -235,7 +235,7 @@ "icon": "icon-ticket", "idx": 1, "is_submittable": 1, - "modified": "2014-08-11 07:11:55.802625", + "modified": "2014-09-09 05:35:31.735821", "modified_by": "Administrator", "module": "Stock", "name": "Material Request", diff --git a/erpnext/stock/doctype/material_request_item/material_request_item.json b/erpnext/stock/doctype/material_request_item/material_request_item.json index 8fc9df51b7..69f4542ab7 100644 --- a/erpnext/stock/doctype/material_request_item/material_request_item.json +++ b/erpnext/stock/doctype/material_request_item/material_request_item.json @@ -235,7 +235,7 @@ ], "idx": 1, "istable": 1, - "modified": "2014-08-14 08:37:28.991681", + "modified": "2014-09-09 05:35:37.746067", "modified_by": "Administrator", "module": "Stock", "name": "Material Request Item", diff --git a/erpnext/stock/doctype/packed_item/packed_item.json b/erpnext/stock/doctype/packed_item/packed_item.json index 33a2fb41e5..1c8de4acdb 100644 --- a/erpnext/stock/doctype/packed_item/packed_item.json +++ b/erpnext/stock/doctype/packed_item/packed_item.json @@ -151,7 +151,7 @@ ], "idx": 1, "istable": 1, - "modified": "2014-08-11 06:23:08.597647", + "modified": "2014-09-09 05:35:38.216185", "modified_by": "Administrator", "module": "Stock", "name": "Packed Item", diff --git a/erpnext/stock/doctype/packing_slip_item/packing_slip_item.json b/erpnext/stock/doctype/packing_slip_item/packing_slip_item.json index 9d5c1bb809..89f8f6ba8e 100644 --- a/erpnext/stock/doctype/packing_slip_item/packing_slip_item.json +++ b/erpnext/stock/doctype/packing_slip_item/packing_slip_item.json @@ -1,6 +1,6 @@ { "autoname": "PSD/.#######", - "creation": "2013-04-08 13:10:16.000000", + "creation": "2013-04-08 13:10:16", "docstatus": 0, "doctype": "DocType", "fields": [ @@ -70,6 +70,7 @@ "width": "100px" }, { + "allow_on_submit": 1, "fieldname": "page_break", "fieldtype": "Check", "in_list_view": 1, @@ -89,9 +90,10 @@ ], "idx": 1, "istable": 1, - "modified": "2013-12-20 19:23:23.000000", + "modified": "2014-09-09 05:35:38.604554", "modified_by": "Administrator", "module": "Stock", "name": "Packing Slip Item", - "owner": "Administrator" + "owner": "Administrator", + "permissions": [] } \ No newline at end of file diff --git a/erpnext/stock/doctype/price_list/price_list.js b/erpnext/stock/doctype/price_list/price_list.js index ea7b6dbcf0..125242faaa 100644 --- a/erpnext/stock/doctype/price_list/price_list.js +++ b/erpnext/stock/doctype/price_list/price_list.js @@ -7,7 +7,7 @@ $.extend(cur_frm.cscript, { }, refresh: function() { - cur_frm.add_custom_button("Add / Edit Prices", function() { + cur_frm.add_custom_button(__("Add / Edit Prices"), function() { frappe.route_options = { "price_list": cur_frm.doc.name }; diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json index 96b708d6c5..4b2fc3b55e 100755 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json @@ -1,5 +1,5 @@ { - "autoname": "naming_series:", + "autoname": "naming_series:", "creation": "2013-05-21 16:16:39", "docstatus": 0, "doctype": "DocType", @@ -766,7 +766,7 @@ "icon": "icon-truck", "idx": 1, "is_submittable": 1, - "modified": "2014-08-12 05:23:28.960161", + "modified": "2014-09-09 05:35:32.971576", "modified_by": "Administrator", "module": "Stock", "name": "Purchase Receipt", diff --git a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json index aff8bbd5da..da237ad3e7 100755 --- a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json +++ b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json @@ -549,7 +549,7 @@ ], "idx": 1, "istable": 1, - "modified": "2014-09-08 08:06:31.957563", + "modified": "2014-09-09 05:35:38.908372", "modified_by": "Administrator", "module": "Stock", "name": "Purchase Receipt Item", diff --git a/erpnext/stock/doctype/serial_no/serial_no.py b/erpnext/stock/doctype/serial_no/serial_no.py index b07eab74fb..14c409ba80 100644 --- a/erpnext/stock/doctype/serial_no/serial_no.py +++ b/erpnext/stock/doctype/serial_no/serial_no.py @@ -223,8 +223,8 @@ def validate_serial_no(sle, item_det): sr = frappe.get_doc("Serial No", serial_no) if sr.item_code!=sle.item_code: - frappe.throw(_("Serial No {0} does not belong to Item {1}").format(sle.item_code, - serial_no), SerialNoItemError) + frappe.throw(_("Serial No {0} does not belong to Item {1}").format(serial_no, + sle.item_code), SerialNoItemError) if sr.warehouse and sle.actual_qty > 0: frappe.throw(_("Serial No {0} has already been received").format(sr.name), diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index af6493d27f..2faa28830c 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -457,3 +457,4 @@ 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 diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.json b/erpnext/stock/doctype/stock_entry/stock_entry.json index 5e637940f6..ad4d9ddce1 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.json +++ b/erpnext/stock/doctype/stock_entry/stock_entry.json @@ -1,650 +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/Repack\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/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, "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 - }, + }, { - "fieldname": "cb1", - "fieldtype": "Column Break", - "permlevel": 0, + "depends_on": "eval:doc.purpose==\"Manufacture/Repack\"", + "fieldname": "total_fixed_cost", + "fieldtype": "Float", + "label": "Total Fixed Cost", + "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, + "fieldname": "cb1", + "fieldtype": "Column Break", + "permlevel": 0, "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, - "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, + "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: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:!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 - }, + }, { - "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, - "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, - "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, - "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, - "search_index": 0 - }, - { - "fieldname": "more_info", - "fieldtype": "Section Break", - "label": "More Info", - "oldfieldtype": "Section Break", - "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 - }, + }, { - "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, + "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 - }, + }, { - "fieldname": "col5", - "fieldtype": "Column Break", - "permlevel": 0, - "print_width": "50%", - "read_only": 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, + "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, + "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, + "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, + "search_index": 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, + "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, + "search_index": 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": 0, - "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-03 11:01:23.159584", - "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 05:35:39.352951", + "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 cda88a90bb..c3aab6acd7 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -217,6 +217,8 @@ class StockEntry(StockController): allow_negative_stock = cint(frappe.db.get_default("allow_negative_stock")) for d in self.get('mtn_details'): + d.transfer_qty = flt(d.transfer_qty) + args = frappe._dict({ "item_code": d.item_code, "warehouse": d.s_warehouse or d.t_warehouse, @@ -241,7 +243,6 @@ class StockEntry(StockController): incoming_rate = flt(self.get_incoming_rate(args), self.precision("incoming_rate", d)) if incoming_rate > 0: d.incoming_rate = incoming_rate - d.amount = flt(d.transfer_qty) * flt(d.incoming_rate) if not d.t_warehouse: raw_material_cost += flt(d.amount) @@ -256,7 +257,7 @@ class StockEntry(StockController): if d.bom_no: bom = frappe.db.get_value("BOM", d.bom_no, ["operating_cost", "quantity"], as_dict=1) operation_cost_per_unit = flt(bom.operating_cost) / flt(bom.quantity) - d.incoming_rate = operation_cost_per_unit + (raw_material_cost / flt(d.transfer_qty)) + d.incoming_rate = operation_cost_per_unit + (raw_material_cost + flt(self.total_fixed_cost)) / flt(d.transfer_qty) d.amount = flt(d.transfer_qty) * flt(d.incoming_rate) break diff --git a/erpnext/stock/doctype/stock_entry/test_records.json b/erpnext/stock/doctype/stock_entry/test_records.json index a87b635bd7..4a4ca0e65a 100644 --- a/erpnext/stock/doctype/stock_entry/test_records.json +++ b/erpnext/stock/doctype/stock_entry/test_records.json @@ -9,7 +9,7 @@ "cost_center": "_Test Cost Center - _TC", "doctype": "Stock Entry Detail", "expense_account": "Stock Adjustment - _TC", - "incoming_rate": 100, + "incoming_rate": 100, "item_code": "_Test Item", "parentfield": "mtn_details", "qty": 50.0, diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py index 0f6a33fb73..b9a6abd7b7 100644 --- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py @@ -10,6 +10,7 @@ from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_per from erpnext.stock.doctype.stock_ledger_entry.stock_ledger_entry import StockFreezeError class TestStockEntry(unittest.TestCase): + def tearDown(self): frappe.set_user("Administrator") set_perpetual_inventory(0) @@ -26,7 +27,6 @@ class TestStockEntry(unittest.TestCase): st1 = frappe.copy_doc(test_records[0]) st1.insert() st1.submit() - st2 = frappe.copy_doc(test_records[1]) st2.insert() st2.submit() @@ -821,6 +821,39 @@ class TestStockEntry(unittest.TestCase): se = frappe.copy_doc(test_records[0]).insert() self.assertRaises (StockFreezeError, se.submit) frappe.db.set_value("Stock Settings", None, "stock_frozen_upto_days", 0) + + def test_production_order(self): + bom_no = frappe.db.get_value("BOM", {"item": "_Test FG Item 2", + "is_default": 1, "docstatus": 1}) + + production_order = frappe.new_doc("Production Order") + production_order.update({ + "company": "_Test Company", + "fg_warehouse": "_Test Warehouse 1 - _TC", + "production_item": "_Test FG Item 2", + "bom_no": bom_no, + "qty": 1.0, + "stock_uom": "Nos", + "wip_warehouse": "_Test Warehouse - _TC" + }) + production_order.insert() + production_order.submit() + + self._insert_material_receipt() + + stock_entry = frappe.new_doc("Stock Entry") + stock_entry.update({ + "purpose": "Manufacture/Repack", + "production_order": production_order.name, + "bom_no": bom_no, + "fg_completed_qty": "1", + "total_fixed_cost": 1000 + }) + stock_entry.get_items() + fg_rate = [d.amount for d in stock_entry.get("mtn_details") if d.item_code=="_Test FG Item 2"][0] + self.assertEqual(fg_rate, 1200.00) + fg_rate = [d.amount for d in stock_entry.get("mtn_details") if d.item_code=="_Test Item"][0] + self.assertEqual(fg_rate, 100.00) def make_serialized_item(item_code=None, serial_no=None, target_warehouse=None): se = frappe.copy_doc(test_records[0]) diff --git a/erpnext/stock/doctype/warehouse/warehouse.json b/erpnext/stock/doctype/warehouse/warehouse.json index 0a4c244eb1..59951be927 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/stock/report/batch_wise_balance_history/batch_wise_balance_history.py b/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py index 1de86be8e0..9b94ee61e1 100644 --- a/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py +++ b/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py @@ -29,9 +29,9 @@ 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"] + ["Batch:Link/Batch:100"] + ["Opening Qty::90"] + \ - ["In Qty::80"] + ["Out Qty::80"] + ["Balance Qty::90"] + columns = [_("Item") + ":Link/Item:100"] + [_("Item Name") + "::150"] + [_("Description") + "::150"] + \ + [_("Warehouse") + ":Link/Warehouse:100"] + [_("Batch") + ":Link/Batch:100"] + [_("Opening Qty") + "::90"] + \ + [_("In Qty") + "::80"] + [_("Out Qty") + "::80"] + [_("Balance Qty") + "::90"] return columns diff --git a/erpnext/stock/report/item_prices/item_prices.py b/erpnext/stock/report/item_prices/item_prices.py index d2da54f8fa..2b413fd29b 100644 --- a/erpnext/stock/report/item_prices/item_prices.py +++ b/erpnext/stock/report/item_prices/item_prices.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals import frappe +from frappe import msgprint, _ from frappe.utils import flt def execute(filters=None): @@ -33,9 +34,9 @@ def execute(filters=None): def get_columns(filters): """return columns based on filters""" - columns = ["Item:Link/Item:100", "Item Name::150", "Description::150", "UOM:Link/UOM:80", - "Last Purchase Rate:Currency:90", "Valuation Rate:Currency:80", "Sales Price List::80", - "Purchase Price List::80", "BOM Rate:Currency:90"] + columns = [_("Item") + ":Link/Item:100", _("Item Name") + "::150", _("Description") + "::150", _("UOM") + ":Link/UOM:80", + _("Last Purchase Rate") + ":Currency:90", _("Valuation Rate") + ":Currency:80", _("Sales Price List") + "::80", + _("Purchase Price List") + "::80", _("BOM Rate") + ":Currency:90"] return columns @@ -114,7 +115,7 @@ def get_item_bom_rate(): item_bom_map = {} - for b in frappe.db.sql("""select item, (total_cost/quantity) as bom_rate + for b in frappe.db.sql("""select item, (total_variable_cost/quantity) as bom_rate from `tabBOM` where is_active=1 and is_default=1""", as_dict=1): item_bom_map.setdefault(b.item, flt(b.bom_rate)) diff --git a/erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py b/erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py index 9b4bb061a1..0ffe681b2f 100644 --- a/erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py +++ b/erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py @@ -36,10 +36,10 @@ def execute(filters=None): def get_columns(): return[ - "Item:Link/Item:120", "Item name:Data:120", "Description::160", - "Minimum Inventory Level:Float:160", "Lead Time Days:Float:120", "Consumed:Float:120", - "Delivered:Float:120", "Total Outgoing:Float:120", "Avg Daily Outgoing:Float:160", - "Reorder Level:Float:120" + _("Item") + ":Link/Item:120", _("Item Name") + ":Data:120", _("Description") + "::160", + _("Minimum Inventory Level") + ":Float:160", _("Lead Time Days") + ":Float:120", _("Consumed") + ":Float:120", + _("Delivered") + ":Float:120", _("Total Outgoing") + ":Float:120", _("Avg Daily Outgoing") + ":Float:160", + _("Reorder Level") + ":Float:120" ] def get_item_info(): diff --git a/erpnext/stock/report/stock_ageing/stock_ageing.py b/erpnext/stock/report/stock_ageing/stock_ageing.py index d8a8dc72ea..fc4786123e 100644 --- a/erpnext/stock/report/stock_ageing/stock_ageing.py +++ b/erpnext/stock/report/stock_ageing/stock_ageing.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals import frappe +from frappe import _ from frappe.utils import date_diff def execute(filters=None): @@ -35,9 +36,9 @@ def get_average_age(fifo_queue, to_date): return (age_qty / total_qty) if total_qty else 0.0 def get_columns(): - return ["Item Code:Link/Item:100", "Item Name::100", "Description::200", - "Item Group:Link/Item Group:100", "Brand:Link/Brand:100", "Average Age:Float:100", - "Earliest:Int:80", "Latest:Int:80", "UOM:Link/UOM:100"] + return [_("Item Code") + ":Link/Item:100", _("Item Name") + "::100", _("Description") + "::200", + _("Item Group") + ":Link/Item Group:100", _("Brand") + ":Link/Brand:100", _("Average Age") + ":Float:100", + _("Earliest") + ":Int:80", _("Latest") + ":Int:80", _("UOM") + ":Link/UOM:100"] def get_fifo_queue(filters): item_details = {} diff --git a/erpnext/stock/report/stock_ledger/stock_ledger.py b/erpnext/stock/report/stock_ledger/stock_ledger.py index 73a2c2a278..4c5458dbb2 100644 --- a/erpnext/stock/report/stock_ledger/stock_ledger.py +++ b/erpnext/stock/report/stock_ledger/stock_ledger.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals import frappe +from frappe import _ def execute(filters=None): columns = get_columns() @@ -26,12 +27,12 @@ def execute(filters=None): return columns, data def get_columns(): - return ["Date:Datetime:95", "Item:Link/Item:130", "Item Name::100", "Item Group:Link/Item Group:100", - "Brand:Link/Brand:100", "Description::200", "Warehouse:Link/Warehouse:100", - "Stock UOM:Link/UOM:100", "Qty:Float:50", "Balance Qty:Float:100", - "Incoming Rate:Currency:110", "Valuation Rate:Currency:110", "Balance Value:Currency:110", - "Voucher Type::110", "Voucher #::100", "Link::30", "Batch:Link/Batch:100", - "Serial #:Link/Serial No:100", "Company:Link/Company:100"] + return [_("Date") + ":Datetime:95", _("Item") + ":Link/Item:130", _("Item Name") + "::100", _("Item Group") + ":Link/Item Group:100", + _("Brand") + ":Link/Brand:100", _("Description") + "::200", _("Warehouse") + ":Link/Warehouse:100", + _("Stock UOM") + ":Link/UOM:100", _("Qty") + ":Float:50", _("Balance Qty") + ":Float:100", + _("Incoming Rate") + ":Currency:110", _("Valuation Rate") + ":Currency:110", _("Balance Value") + ":Currency:110", + _("Voucher Type") + "::110", _("Voucher #") + "::100", _("Link") + "::30", _("Batch") + ":Link/Batch:100", + _("Serial #") + ":Link/Serial No:100", _("Company") + ":Link/Company:100"] def get_stock_ledger_entries(filters): return frappe.db.sql("""select concat_ws(" ", posting_date, posting_time) as date, diff --git a/erpnext/stock/report/stock_projected_qty/stock_projected_qty.py b/erpnext/stock/report/stock_projected_qty/stock_projected_qty.py index 2a5eb5022a..ff431550ad 100644 --- a/erpnext/stock/report/stock_projected_qty/stock_projected_qty.py +++ b/erpnext/stock/report/stock_projected_qty/stock_projected_qty.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals import frappe +from frappe import _ def execute(filters=None): columns = get_columns() @@ -26,12 +27,12 @@ def execute(filters=None): return columns, data def get_columns(): - return ["Item Code:Link/Item:140", "Item Name::100", "Description::200", - "Item Group:Link/Item Group:100", "Brand:Link/Brand:100", "Warehouse:Link/Warehouse:120", - "UOM:Link/UOM:100", "Actual Qty:Float:100", "Planned Qty:Float:100", - "Requested Qty:Float:110", "Ordered Qty:Float:100", "Reserved Qty:Float:100", - "Projected Qty:Float:100", "Reorder Level:Float:100", "Reorder Qty:Float:100", - "Shortage Qty:Float:100"] + return [_("Item Code") + ":Link/Item:140", _("Item Name") + "::100", _("Description") + "::200", + _("Item Group") + ":Link/Item Group:100", _("Brand") + ":Link/Brand:100", _("Warehouse") + ":Link/Warehouse:120", + _("UOM") + ":Link/UOM:100", _("Actual Qty") + ":Float:100", _("Planned Qty") + ":Float:100", + _("Requested Qty") + ":Float:110", _("Ordered Qty") + ":Float:100", _("Reserved Qty") + ":Float:100", + _("Projected Qty") + ":Float:100", _("Reorder Level") + ":Float:100", _("Reorder Qty") + ":Float:100", + _("Shortage Qty") + ":Float:100"] def get_item_conditions(filters): conditions = [] diff --git a/erpnext/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.py b/erpnext/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.py index 22b4ec62ed..04beb6a211 100644 --- a/erpnext/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.py +++ b/erpnext/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals import frappe +from frappe import _ from frappe.utils import flt def execute(filters=None): @@ -40,12 +41,12 @@ def execute(filters=None): def get_columns(filters): """return columns based on filters""" - columns = ["Item:Link/Item:100"] + ["Item Name::100"] + \ - ["Description::150"] + ["UOM:Link/UOM:90"] + \ - ["Consumed Qty:Float:110"] + ["Consumed Amount:Currency:130"] + \ - ["Delivered Qty:Float:110"] + ["Delivered Amount:Currency:130"] + \ - ["Total Qty:Float:110"] + ["Total Amount:Currency:130"] + \ - ["Supplier(s)::250"] + columns = [_("Item") + ":Link/Item:100"] + [_("Item Name") + "::100"] + \ + [_("Description") + "::150"] + [_("UOM") + ":Link/UOM:90"] + \ + [_("Consumed Qty") + ":Float:110"] + [_("Consumed Amount") + ":Currency:130"] + \ + [_("Delivered Qty") + ":Float:110"] + [_("Delivered Amount") + ":Currency:130"] + \ + [_("Total Qty") + ":Float:110"] + [_("Total Amount") + ":Currency:130"] + \ + [_("Supplier(s)") + "::250"] return columns 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 16fe3be472..775f6f11bb 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 diff --git a/erpnext/support/doctype/support_ticket/support_ticket.js b/erpnext/support/doctype/support_ticket/support_ticket.js index d4531dc8b7..4a699a2042 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"); } diff --git a/erpnext/support/page/support_analytics/support_analytics.js b/erpnext/support/page/support_analytics/support_analytics.js index b9db1f881c..667602500a 100644 --- a/erpnext/support/page/support_analytics/support_analytics.js +++ b/erpnext/support/page/support_analytics/support_analytics.js @@ -28,7 +28,7 @@ erpnext.SupportAnalytics = frappe.views.GridReportWithPlot.extend({ filters: [ {fieldtype:"Select", label: __("Fiscal Year"), link:"Fiscal Year", - default_value: "Select Fiscal Year..."}, + default_value: __("Select Fiscal Year") + "..."}, {fieldtype:"Date", label: __("From Date")}, {fieldtype:"Label", label: __("To")}, {fieldtype:"Date", label: __("To Date")}, diff --git a/erpnext/utilities/doctype/address/address.json b/erpnext/utilities/doctype/address/address.json index 3692b91c5a..9a7c322e29 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/address_template/address_template.py b/erpnext/utilities/doctype/address_template/address_template.py index 4ac80540dd..c8d34709fe 100644 --- a/erpnext/utilities/doctype/address_template/address_template.py +++ b/erpnext/utilities/doctype/address_template/address_template.py @@ -8,16 +8,16 @@ from frappe import _ class AddressTemplate(Document): def validate(self): - defaults = frappe.db.get_values("Address Template", - {"is_default":1, "name":("!=", self.name)}) + self.defaults = frappe.db.get_values("Address Template", {"is_default":1, "name":("!=", self.name)}) if not self.is_default: - if not defaults: + if not self.defaults: self.is_default = 1 frappe.msgprint(_("Setting this Address Template as default as there is no other default")) - else: - if defaults: - for d in defaults: - frappe.db.set_value("Address Template", d[0], "is_default", 0) + + def on_update(self): + if self.is_default and self.defaults: + for d in self.defaults: + frappe.db.set_value("Address Template", d[0], "is_default", 0) def on_trash(self): if self.is_default: diff --git a/erpnext/utilities/doctype/address_template/test_address_template.py b/erpnext/utilities/doctype/address_template/test_address_template.py index 953c852d85..d4e3de0623 100644 --- a/erpnext/utilities/doctype/address_template/test_address_template.py +++ b/erpnext/utilities/doctype/address_template/test_address_template.py @@ -20,3 +20,8 @@ class TestAddressTemplate(unittest.TestCase): b.save() self.assertEqual(frappe.db.get_value("Address Template", "India", "is_default"), 0) + + def tearDown(self): + a = frappe.get_doc("Address Template", "India") + a.is_default = 1 + a.save() diff --git a/erpnext/utilities/doctype/contact/contact.json b/erpnext/utilities/doctype/contact/contact.json index c52cfdca51..caa6745661 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 +} diff --git a/setup.py b/setup.py index 5cea41c6f2..70174bd104 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()