Merge branch 'develop'

This commit is contained in:
Nabin Hait 2016-10-26 17:56:16 +05:30
commit 38c1732304
522 changed files with 106508 additions and 46384 deletions

View File

@ -2,7 +2,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
__version__ = '7.0.63' __version__ = '7.1.0'
def get_default_company(user=None): def get_default_company(user=None):
'''Get default company for user''' '''Get default company for user'''

View File

@ -10,6 +10,7 @@
"doctype": "DocType", "doctype": "DocType",
"document_type": "Other", "document_type": "Other",
"editable_grid": 1, "editable_grid": 1,
"engine": "InnoDB",
"fields": [ "fields": [
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
@ -194,6 +195,33 @@
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "1",
"fieldname": "unlink_payment_on_cancellation_of_invoice",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Unlink Payment on Cancellation of Invoice",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
} }
], ],
"hide_heading": 0, "hide_heading": 0,
@ -207,8 +235,8 @@
"issingle": 1, "issingle": 1,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-10-05 16:13:10.978208", "modified": "2016-10-20 16:12:38.595075",
"modified_by": "rohitw1991@gmail.com", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Accounts Settings", "name": "Accounts Settings",
"owner": "Administrator", "owner": "Administrator",

View File

@ -2,15 +2,6 @@
// For license information, please see license.txt // For license information, please see license.txt
frappe.ui.form.on('Asset Category', { frappe.ui.form.on('Asset Category', {
setup: function(frm) {
frm.get_field('accounts').grid.editable_fields = [
{fieldname: 'company_name', columns: 3},
{fieldname: 'fixed_asset_account', columns: 3},
{fieldname: 'accumulated_depreciation_account', columns: 2},
{fieldname: 'depreciation_expense_account', columns: 2}
];
},
onload: function(frm) { onload: function(frm) {
frm.add_fetch('company_name', 'accumulated_depreciation_account', 'accumulated_depreciation_account'); frm.add_fetch('company_name', 'accumulated_depreciation_account', 'accumulated_depreciation_account');
frm.add_fetch('company_name', 'depreciation_expense_account', 'accumulated_depreciation_account'); frm.add_fetch('company_name', 'depreciation_expense_account', 'accumulated_depreciation_account');

View File

@ -14,6 +14,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 3,
"fieldname": "company_name", "fieldname": "company_name",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -40,6 +41,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 3,
"fieldname": "fixed_asset_account", "fieldname": "fixed_asset_account",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -66,6 +68,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "accumulated_depreciation_account", "fieldname": "accumulated_depreciation_account",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -92,6 +95,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "depreciation_expense_account", "fieldname": "depreciation_expense_account",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -125,7 +129,7 @@
"issingle": 0, "issingle": 0,
"istable": 1, "istable": 1,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-07-11 03:27:58.048060", "modified": "2016-08-26 01:46:01.604335",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Asset Category Account", "name": "Asset Category Account",

View File

@ -5,13 +5,6 @@ frappe.ui.form.on("Bank Reconciliation", {
setup: function(frm) { setup: function(frm) {
frm.get_docfield("payment_entries").allow_bulk_edit = 1; frm.get_docfield("payment_entries").allow_bulk_edit = 1;
frm.add_fetch("bank_account", "account_currency", "account_currency"); frm.add_fetch("bank_account", "account_currency", "account_currency");
frm.get_field('payment_entries').grid.editable_fields = [
{fieldname: 'against_account', columns: 3},
{fieldname: 'amount', columns: 2},
{fieldname: 'cheque_number', columns: 3},
{fieldname: 'clearance_date', columns: 2}
];
}, },
onload: function(frm) { onload: function(frm) {

View File

@ -13,6 +13,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "payment_document", "fieldname": "payment_document",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -39,13 +40,14 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "payment_entry", "fieldname": "payment_entry",
"fieldtype": "Dynamic Link", "fieldtype": "Dynamic Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 0,
"label": "Payment Entry", "label": "Payment Entry",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -67,6 +69,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 3,
"fieldname": "against_account", "fieldname": "against_account",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
@ -94,6 +97,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "amount", "fieldname": "amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -121,6 +125,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_5", "fieldname": "column_break_5",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -146,6 +151,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "posting_date", "fieldname": "posting_date",
"fieldtype": "Date", "fieldtype": "Date",
"hidden": 0, "hidden": 0,
@ -172,6 +178,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 3,
"fieldname": "cheque_number", "fieldname": "cheque_number",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
@ -198,6 +205,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "cheque_date", "fieldname": "cheque_date",
"fieldtype": "Date", "fieldtype": "Date",
"hidden": 0, "hidden": 0,
@ -224,6 +232,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "clearance_date", "fieldname": "clearance_date",
"fieldtype": "Date", "fieldtype": "Date",
"hidden": 0, "hidden": 0,
@ -258,7 +267,7 @@
"istable": 1, "istable": 1,
"max_attachments": 0, "max_attachments": 0,
"menu_index": 0, "menu_index": 0,
"modified": "2016-07-11 03:27:58.139117", "modified": "2016-08-26 01:51:36.123941",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Bank Reconciliation Detail", "name": "Bank Reconciliation Detail",

View File

@ -22,5 +22,5 @@ frappe.treeview_settings["Cost Center"] = {
{fieldtype:'Data', fieldname:'cost_center_name', label:__('New Cost Center Name'), reqd:true}, {fieldtype:'Data', fieldname:'cost_center_name', label:__('New Cost Center Name'), reqd:true},
{fieldtype:'Check', fieldname:'is_group', label:__('Is Group'), {fieldtype:'Check', fieldname:'is_group', label:__('Is Group'),
description:__('Further cost centers can be made under Groups but entries can be made against non-Groups')} description:__('Further cost centers can be made under Groups but entries can be made against non-Groups')}
] ],
} }

View File

@ -44,9 +44,12 @@ class GLEntry(Document):
frappe.throw(_("{0} is required").format(_(self.meta.get_label(k)))) frappe.throw(_("{0} is required").format(_(self.meta.get_label(k))))
account_type = frappe.db.get_value("Account", self.account, "account_type") account_type = frappe.db.get_value("Account", self.account, "account_type")
if account_type in ["Receivable", "Payable"] and not (self.party_type and self.party): if not (self.party_type and self.party):
frappe.throw(_("Party Type and Party is required for Receivable / Payable account {0}").format(self.account)) if account_type == "Receivable":
frappe.throw(_("Customer is required against Receivable account {0}").format(self.account))
elif account_type == "Payable":
frappe.throw(_("Supplier is required against Payable account {0}").format(self.account))
# Zero value transaction is not allowed # Zero value transaction is not allowed
if not (flt(self.debit) or flt(self.credit)): if not (flt(self.debit) or flt(self.credit)):
frappe.throw(_("Either debit or credit amount is required for {0}").format(self.account)) frappe.throw(_("Either debit or credit amount is required for {0}").format(self.account))
@ -54,7 +57,7 @@ class GLEntry(Document):
def pl_must_have_cost_center(self): def pl_must_have_cost_center(self):
if frappe.db.get_value("Account", self.account, "report_type") == "Profit and Loss": if frappe.db.get_value("Account", self.account, "report_type") == "Profit and Loss":
if not self.cost_center and self.voucher_type != 'Period Closing Voucher': if not self.cost_center and self.voucher_type != 'Period Closing Voucher':
frappe.throw(_("Cost Center is required for 'Profit and Loss' account {0}") frappe.throw(_("Cost Center is required for 'Profit and Loss' account {0}. Please set up a default Cost Center for the Company.")
.format(self.account)) .format(self.account))
else: else:
if self.cost_center: if self.cost_center:

View File

@ -6,15 +6,6 @@ frappe.provide("erpnext.journal_entry");
frappe.ui.form.on("Journal Entry", { frappe.ui.form.on("Journal Entry", {
setup: function(frm) {
frm.get_field('accounts').grid.editable_fields = [
{fieldname: 'account', columns: 3},
{fieldname: 'party', columns: 3},
{fieldname: 'debit_in_account_currency', columns: 2},
{fieldname: 'credit_in_account_currency', columns: 2}
];
},
refresh: function(frm) { refresh: function(frm) {
erpnext.toggle_naming_series(); erpnext.toggle_naming_series();
frm.cscript.voucher_type(frm.doc); frm.cscript.voucher_type(frm.doc);
@ -268,7 +259,6 @@ cur_frm.cscript.voucher_type = function(doc, cdt, cdn) {
if(!doc.company) return; if(!doc.company) return;
var update_jv_details = function(doc, r) { var update_jv_details = function(doc, r) {
var jvdetail = frappe.model.add_child(doc, "Journal Entry Account", "accounts");
$.each(r, function(i, d) { $.each(r, function(i, d) {
var row = frappe.model.add_child(doc, "Journal Entry Account", "accounts"); var row = frappe.model.add_child(doc, "Journal Entry Account", "accounts");
row.account = d.account; row.account = d.account;
@ -276,8 +266,8 @@ cur_frm.cscript.voucher_type = function(doc, cdt, cdn) {
}); });
refresh_field("accounts"); refresh_field("accounts");
} }
if(!(doc.accounts || []).length) { if((!(doc.accounts || []).length) || ((doc.accounts || []).length==1 && !doc.accounts[0].account)) {
if(in_list(["Bank Entry", "Cash Entry"], doc.voucher_type)) { if(in_list(["Bank Entry", "Cash Entry"], doc.voucher_type)) {
return frappe.call({ return frappe.call({
type: "GET", type: "GET",

View File

@ -3,16 +3,19 @@
"allow_import": 1, "allow_import": 1,
"allow_rename": 0, "allow_rename": 0,
"autoname": "naming_series:", "autoname": "naming_series:",
"beta": 0,
"creation": "2013-03-25 10:53:52", "creation": "2013-03-25 10:53:52",
"custom": 0, "custom": 0,
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"document_type": "Document", "document_type": "Document",
"editable_grid": 0,
"fields": [ "fields": [
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "entry_type_and_date", "fieldname": "entry_type_and_date",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -38,6 +41,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "", "default": "",
"fieldname": "title", "fieldname": "title",
"fieldtype": "Data", "fieldtype": "Data",
@ -64,6 +68,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "Journal Entry", "default": "Journal Entry",
"fieldname": "voucher_type", "fieldname": "voucher_type",
"fieldtype": "Select", "fieldtype": "Select",
@ -92,6 +97,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "naming_series", "fieldname": "naming_series",
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
@ -119,6 +125,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break1", "fieldname": "column_break1",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -144,6 +151,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "posting_date", "fieldname": "posting_date",
"fieldtype": "Date", "fieldtype": "Date",
"hidden": 0, "hidden": 0,
@ -170,6 +178,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "company", "fieldname": "company",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -197,6 +206,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "2_add_edit_gl_entries", "fieldname": "2_add_edit_gl_entries",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -223,6 +233,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "accounts", "fieldname": "accounts",
"fieldtype": "Table", "fieldtype": "Table",
"hidden": 0, "hidden": 0,
@ -250,6 +261,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "section_break99", "fieldname": "section_break99",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -273,6 +285,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "", "description": "",
"fieldname": "cheque_no", "fieldname": "cheque_no",
"fieldtype": "Data", "fieldtype": "Data",
@ -300,6 +313,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "cheque_date", "fieldname": "cheque_date",
"fieldtype": "Date", "fieldtype": "Date",
"hidden": 0, "hidden": 0,
@ -326,6 +340,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "user_remark", "fieldname": "user_remark",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"hidden": 0, "hidden": 0,
@ -352,6 +367,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break99", "fieldname": "column_break99",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -375,6 +391,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "total_debit", "fieldname": "total_debit",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -402,6 +419,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "total_credit", "fieldname": "total_credit",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -429,6 +447,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "difference", "depends_on": "difference",
"fieldname": "difference", "fieldname": "difference",
"fieldtype": "Currency", "fieldtype": "Currency",
@ -457,6 +476,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "difference", "depends_on": "difference",
"fieldname": "get_balance", "fieldname": "get_balance",
"fieldtype": "Button", "fieldtype": "Button",
@ -483,6 +503,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "multi_currency", "fieldname": "multi_currency",
"fieldtype": "Check", "fieldtype": "Check",
"hidden": 0, "hidden": 0,
@ -504,10 +525,38 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "total_amount_currency",
"fieldtype": "Link",
"hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Total Amount Currency",
"length": 0,
"no_copy": 1,
"options": "Currency",
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 1,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "total_amount", "fieldname": "total_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 1, "hidden": 1,
@ -518,7 +567,7 @@
"label": "Total Amount", "label": "Total Amount",
"length": 0, "length": 0,
"no_copy": 1, "no_copy": 1,
"options": "Company:company:default_currency", "options": "total_amount_currency",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
@ -533,6 +582,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "total_amount_in_words", "fieldname": "total_amount_in_words",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
@ -557,6 +607,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"columns": 0,
"fieldname": "reference", "fieldname": "reference",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -582,6 +633,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "clearance_date", "fieldname": "clearance_date",
"fieldtype": "Date", "fieldtype": "Date",
"hidden": 0, "hidden": 0,
@ -608,6 +660,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "", "description": "",
"fieldname": "remark", "fieldname": "remark",
"fieldtype": "Small Text", "fieldtype": "Small Text",
@ -635,6 +688,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break98", "fieldname": "column_break98",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -658,6 +712,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "bill_no", "fieldname": "bill_no",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
@ -684,6 +739,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "bill_date", "fieldname": "bill_date",
"fieldtype": "Date", "fieldtype": "Date",
"hidden": 0, "hidden": 0,
@ -710,6 +766,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "due_date", "fieldname": "due_date",
"fieldtype": "Date", "fieldtype": "Date",
"hidden": 0, "hidden": 0,
@ -736,6 +793,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"columns": 0,
"depends_on": "eval:doc.voucher_type == 'Write Off Entry'", "depends_on": "eval:doc.voucher_type == 'Write Off Entry'",
"fieldname": "write_off", "fieldname": "write_off",
"fieldtype": "Section Break", "fieldtype": "Section Break",
@ -762,6 +820,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "Accounts Receivable", "default": "Accounts Receivable",
"depends_on": "eval:doc.voucher_type == 'Write Off Entry'", "depends_on": "eval:doc.voucher_type == 'Write Off Entry'",
"fieldname": "write_off_based_on", "fieldname": "write_off_based_on",
@ -789,6 +848,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.voucher_type == 'Write Off Entry'", "depends_on": "eval:doc.voucher_type == 'Write Off Entry'",
"fieldname": "get_outstanding_invoices", "fieldname": "get_outstanding_invoices",
"fieldtype": "Button", "fieldtype": "Button",
@ -815,6 +875,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_30", "fieldname": "column_break_30",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -839,6 +900,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.voucher_type == 'Write Off Entry'", "depends_on": "eval:doc.voucher_type == 'Write Off Entry'",
"fieldname": "write_off_amount", "fieldname": "write_off_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
@ -865,6 +927,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"columns": 0,
"fieldname": "printing_settings", "fieldname": "printing_settings",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -890,6 +953,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "pay_to_recd_from", "fieldname": "pay_to_recd_from",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
@ -914,6 +978,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_35", "fieldname": "column_break_35",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -938,6 +1003,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "letter_head", "fieldname": "letter_head",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -963,6 +1029,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "select_print_heading", "fieldname": "select_print_heading",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -990,6 +1057,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"columns": 0,
"fieldname": "addtional_info", "fieldname": "addtional_info",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -1016,6 +1084,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break3", "fieldname": "column_break3",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -1041,6 +1110,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "No", "default": "No",
"description": "", "description": "",
"fieldname": "is_opening", "fieldname": "is_opening",
@ -1070,6 +1140,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:inList([\"Credit Note\", \"Debit Note\"], doc.voucher_type)", "depends_on": "eval:inList([\"Credit Note\", \"Debit Note\"], doc.voucher_type)",
"fieldname": "stock_entry", "fieldname": "stock_entry",
"fieldtype": "Link", "fieldtype": "Link",
@ -1097,6 +1168,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "amended_from", "fieldname": "amended_from",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -1125,6 +1197,7 @@
"hide_toolbar": 0, "hide_toolbar": 0,
"icon": "icon-file-text", "icon": "icon-file-text",
"idx": 176, "idx": 176,
"image_view": 0,
"in_create": 0, "in_create": 0,
"in_dialog": 0, "in_dialog": 0,
"is_submittable": 1, "is_submittable": 1,
@ -1132,7 +1205,7 @@
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"menu_index": 0, "menu_index": 0,
"modified": "2016-04-06 05:33:21.851581", "modified": "2016-10-03 10:13:49.458343",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Journal Entry", "name": "Journal Entry",
@ -1148,6 +1221,7 @@
"export": 0, "export": 0,
"if_owner": 0, "if_owner": 0,
"import": 0, "import": 0,
"is_custom": 0,
"permlevel": 0, "permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
@ -1168,6 +1242,7 @@
"export": 0, "export": 0,
"if_owner": 0, "if_owner": 0,
"import": 0, "import": 0,
"is_custom": 0,
"permlevel": 0, "permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
@ -1188,6 +1263,7 @@
"export": 0, "export": 0,
"if_owner": 0, "if_owner": 0,
"import": 0, "import": 0,
"is_custom": 0,
"permlevel": 0, "permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
@ -1199,6 +1275,7 @@
"write": 0 "write": 0
} }
], ],
"quick_entry": 0,
"read_only": 0, "read_only": 0,
"read_only_onload": 1, "read_only_onload": 1,
"search_fields": "voucher_type,posting_date, due_date, cheque_no", "search_fields": "voucher_type,posting_date, due_date, cheque_no",

View File

@ -62,11 +62,13 @@ class JournalEntry(AccountsController):
def on_cancel(self): def on_cancel(self):
from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries
from erpnext.hr.doctype.salary_slip.salary_slip import unlink_ref_doc_from_salary_slip
unlink_ref_doc_from_payment_entries(self.doctype, self.name) unlink_ref_doc_from_payment_entries(self.doctype, self.name)
unlink_ref_doc_from_salary_slip(self.name)
self.make_gl_entries(1) self.make_gl_entries(1)
self.update_advance_paid() self.update_advance_paid()
self.update_expense_claim() self.update_expense_claim()
def validate_party(self): def validate_party(self):
for d in self.get("accounts"): for d in self.get("accounts"):
@ -381,6 +383,7 @@ class JournalEntry(AccountsController):
def set_total_amount(self, amt, currency): def set_total_amount(self, amt, currency):
self.total_amount = amt self.total_amount = amt
self.total_amount_currency = currency
from frappe.utils import money_in_words from frappe.utils import money_in_words
self.total_amount_in_words = money_in_words(amt, currency) self.total_amount_in_words = money_in_words(amt, currency)

View File

@ -14,6 +14,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 3,
"fieldname": "account", "fieldname": "account",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -43,6 +44,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "account_type", "fieldname": "account_type",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
@ -68,6 +70,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "balance", "fieldname": "balance",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -95,6 +98,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": ":Company", "default": ":Company",
"description": "If Income or Expense", "description": "If Income or Expense",
"fieldname": "cost_center", "fieldname": "cost_center",
@ -126,6 +130,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break1", "fieldname": "col_break1",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -149,6 +154,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "party_type", "fieldname": "party_type",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -174,6 +180,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 3,
"fieldname": "party", "fieldname": "party",
"fieldtype": "Dynamic Link", "fieldtype": "Dynamic Link",
"hidden": 0, "hidden": 0,
@ -199,6 +206,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "party_balance", "fieldname": "party_balance",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -226,6 +234,7 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"collapsible_depends_on": "", "collapsible_depends_on": "",
"columns": 0,
"depends_on": "", "depends_on": "",
"fieldname": "currency_section", "fieldname": "currency_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
@ -252,6 +261,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "account_currency", "fieldname": "account_currency",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -278,6 +288,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_10", "fieldname": "column_break_10",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -302,6 +313,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "exchange_rate", "fieldname": "exchange_rate",
"fieldtype": "Float", "fieldtype": "Float",
"hidden": 0, "hidden": 0,
@ -327,6 +339,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "sec_break1", "fieldname": "sec_break1",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -351,6 +364,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "debit_in_account_currency", "fieldname": "debit_in_account_currency",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -377,6 +391,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "debit", "fieldname": "debit",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -405,6 +420,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break2", "fieldname": "col_break2",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -428,6 +444,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "credit_in_account_currency", "fieldname": "credit_in_account_currency",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -454,6 +471,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "credit", "fieldname": "credit",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -482,6 +500,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "reference", "fieldname": "reference",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -506,6 +525,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "reference_type", "fieldname": "reference_type",
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
@ -532,6 +552,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "reference_name", "fieldname": "reference_name",
"fieldtype": "Dynamic Link", "fieldtype": "Dynamic Link",
"hidden": 0, "hidden": 0,
@ -558,6 +579,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "project", "fieldname": "project",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -584,6 +606,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break3", "fieldname": "col_break3",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -607,6 +630,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "is_advance", "fieldname": "is_advance",
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
@ -634,6 +658,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "against_account", "fieldname": "against_account",
"fieldtype": "Text", "fieldtype": "Text",
"hidden": 1, "hidden": 1,
@ -667,7 +692,7 @@
"issingle": 0, "issingle": 0,
"istable": 1, "istable": 1,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-07-11 03:28:01.575159", "modified": "2016-08-26 01:54:32.267927",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Journal Entry Account", "name": "Journal Entry Account",

View File

@ -11,13 +11,6 @@ frappe.ui.form.on('Payment Entry', {
}, },
setup: function(frm) { setup: function(frm) {
frm.get_field('references').grid.editable_fields = [
{fieldname: 'reference_doctype', columns: 2},
{fieldname: 'reference_name', columns: 2},
{fieldname: 'outstanding_amount', columns: 3},
{fieldname: 'allocated_amount', columns: 3}
];
var party_account_type = frm.doc.party_type=="Customer" ? "Receivable" : "Payable"; var party_account_type = frm.doc.party_type=="Customer" ? "Receivable" : "Payable";
frm.set_query("paid_from", function() { frm.set_query("paid_from", function() {

View File

@ -14,13 +14,14 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "reference_doctype", "fieldname": "reference_doctype",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 1,
"label": "Type", "label": "Type",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -40,6 +41,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "reference_name", "fieldname": "reference_name",
"fieldtype": "Dynamic Link", "fieldtype": "Dynamic Link",
"hidden": 0, "hidden": 0,
@ -66,6 +68,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "due_date", "fieldname": "due_date",
"fieldtype": "Date", "fieldtype": "Date",
"hidden": 0, "hidden": 0,
@ -91,6 +94,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_4", "fieldname": "column_break_4",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -115,6 +119,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "total_amount", "fieldname": "total_amount",
"fieldtype": "Float", "fieldtype": "Float",
"hidden": 0, "hidden": 0,
@ -140,6 +145,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 3,
"fieldname": "outstanding_amount", "fieldname": "outstanding_amount",
"fieldtype": "Float", "fieldtype": "Float",
"hidden": 0, "hidden": 0,
@ -165,6 +171,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 3,
"fieldname": "allocated_amount", "fieldname": "allocated_amount",
"fieldtype": "Float", "fieldtype": "Float",
"hidden": 0, "hidden": 0,
@ -190,6 +197,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "exchange_rate", "fieldname": "exchange_rate",
"fieldtype": "Float", "fieldtype": "Float",
"hidden": 0, "hidden": 0,
@ -222,7 +230,7 @@
"issingle": 0, "issingle": 0,
"istable": 1, "istable": 1,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-07-14 14:48:13.356944", "modified": "2016-08-26 01:59:04.697274",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Payment Entry Reference", "name": "Payment Entry Reference",

View File

@ -4,15 +4,6 @@
frappe.provide("erpnext.accounts"); frappe.provide("erpnext.accounts");
erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.extend({ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.extend({
setup: function() {
this.frm.get_field('payments').grid.editable_fields = [
{fieldname: 'reference_name', columns: 3},
{fieldname: 'invoice_number', columns: 3},
{fieldname: 'amount', columns: 2},
{fieldname: 'allocated_amount', columns: 2}
];
},
onload: function() { onload: function() {
var me = this var me = this
this.frm.set_query('party_type', function() { this.frm.set_query('party_type', function() {

View File

@ -14,6 +14,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "reference_type", "fieldname": "reference_type",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -39,6 +40,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 3,
"fieldname": "reference_name", "fieldname": "reference_name",
"fieldtype": "Dynamic Link", "fieldtype": "Dynamic Link",
"hidden": 0, "hidden": 0,
@ -65,13 +67,14 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "posting_date", "fieldname": "posting_date",
"fieldtype": "Date", "fieldtype": "Date",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 0,
"label": "Posting Date", "label": "Posting Date",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -89,30 +92,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"fieldname": "amount", "columns": 0,
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Amount",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "is_advance", "fieldname": "is_advance",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
@ -137,6 +117,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "reference_row", "fieldname": "reference_row",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
@ -161,6 +142,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break1", "fieldname": "col_break1",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -185,6 +167,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 3,
"fieldname": "invoice_number", "fieldname": "invoice_number",
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
@ -210,6 +193,32 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Amount",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 2,
"fieldname": "allocated_amount", "fieldname": "allocated_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -235,6 +244,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "sec_break1", "fieldname": "sec_break1",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -259,6 +269,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "remark", "fieldname": "remark",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"hidden": 0, "hidden": 0,
@ -291,7 +302,7 @@
"istable": 1, "istable": 1,
"max_attachments": 0, "max_attachments": 0,
"menu_index": 0, "menu_index": 0,
"modified": "2016-07-11 03:28:03.672936", "modified": "2016-08-26 02:08:35.879133",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Payment Reconciliation Payment", "name": "Payment Reconciliation Payment",

View File

@ -2,7 +2,7 @@
"allow_copy": 0, "allow_copy": 0,
"allow_import": 0, "allow_import": 0,
"allow_rename": 0, "allow_rename": 0,
"autoname": "PR.######", "autoname": "naming_series:",
"beta": 0, "beta": 0,
"creation": "2015-12-15 22:23:24.745065", "creation": "2015-12-15 22:23:24.745065",
"custom": 0, "custom": 0,
@ -15,6 +15,34 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "naming_series",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Series",
"length": 0,
"no_copy": 1,
"options": "PR",
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "recipient_and_message", "fieldname": "recipient_and_message",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -40,6 +68,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "", "default": "",
"fieldname": "print_format", "fieldname": "print_format",
"fieldtype": "Select", "fieldtype": "Select",
@ -67,6 +96,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "email_to", "fieldname": "email_to",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
@ -92,6 +122,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "subject", "fieldname": "subject",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
@ -117,6 +148,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_9", "fieldname": "column_break_9",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -141,6 +173,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "payment_gateway_account", "fieldname": "payment_gateway_account",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -167,6 +200,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "currency", "fieldname": "currency",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -193,6 +227,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "Amount in customer's currency", "description": "Amount in customer's currency",
"fieldname": "grand_total", "fieldname": "grand_total",
"fieldtype": "Currency", "fieldtype": "Currency",
@ -220,6 +255,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "Draft", "default": "Draft",
"fieldname": "status", "fieldname": "status",
"fieldtype": "Select", "fieldtype": "Select",
@ -247,6 +283,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.reference_doctype==\"Sales Order\"", "depends_on": "eval:doc.reference_doctype==\"Sales Order\"",
"fieldname": "make_sales_invoice", "fieldname": "make_sales_invoice",
"fieldtype": "Check", "fieldtype": "Check",
@ -273,6 +310,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "section_break_10", "fieldname": "section_break_10",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -297,6 +335,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "message", "fieldname": "message",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"hidden": 0, "hidden": 0,
@ -322,6 +361,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "message_examples", "fieldname": "message_examples",
"fieldtype": "HTML", "fieldtype": "HTML",
"hidden": 0, "hidden": 0,
@ -348,6 +388,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "mute_email", "fieldname": "mute_email",
"fieldtype": "Check", "fieldtype": "Check",
"hidden": 1, "hidden": 1,
@ -373,6 +414,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "payment_url", "fieldname": "payment_url",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
@ -399,6 +441,7 @@
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"collapsible_depends_on": "doc.payment_gateway_account", "collapsible_depends_on": "doc.payment_gateway_account",
"columns": 0,
"fieldname": "section_break_7", "fieldname": "section_break_7",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -424,6 +467,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "payment_gateway", "fieldname": "payment_gateway",
"fieldtype": "Read Only", "fieldtype": "Read Only",
"hidden": 0, "hidden": 0,
@ -450,6 +494,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "payment_account", "fieldname": "payment_account",
"fieldtype": "Read Only", "fieldtype": "Read Only",
"hidden": 0, "hidden": 0,
@ -476,6 +521,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "reference_details", "fieldname": "reference_details",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -501,6 +547,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "reference_doctype", "fieldname": "reference_doctype",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -527,6 +574,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "reference_name", "fieldname": "reference_name",
"fieldtype": "Dynamic Link", "fieldtype": "Dynamic Link",
"hidden": 0, "hidden": 0,
@ -553,6 +601,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "amended_from", "fieldname": "amended_from",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -585,7 +634,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-07-25 01:34:44.372161", "modified": "2016-09-02 04:07:15.279949",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Payment Request", "name": "Payment Request",

View File

@ -6,10 +6,11 @@ from __future__ import unicode_literals
import frappe import frappe
from frappe import _ from frappe import _
from frappe.model.document import Document from frappe.model.document import Document
from frappe.utils import flt, get_url, nowdate from frappe.utils import flt, nowdate, get_url
from erpnext.accounts.party import get_party_account from erpnext.accounts.party import get_party_account
from erpnext.accounts.utils import get_account_currency from erpnext.accounts.utils import get_account_currency
from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry, get_company_defaults from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry, get_company_defaults
from frappe.integration_broker.doctype.integration_service.integration_service import get_integration_controller
class PaymentRequest(Document): class PaymentRequest(Document):
def validate(self): def validate(self):
@ -25,7 +26,7 @@ class PaymentRequest(Document):
ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name) ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name)
if self.payment_account and ref_doc.currency != frappe.db.get_value("Account", self.payment_account, "account_currency"): if self.payment_account and ref_doc.currency != frappe.db.get_value("Account", self.payment_account, "account_currency"):
frappe.throw(_("Transaction currency must be same as Payment Gateway currency")) frappe.throw(_("Transaction currency must be same as Payment Gateway currency"))
def on_submit(self): def on_submit(self):
send_mail = True send_mail = True
self.make_communication_entry() self.make_communication_entry()
@ -35,17 +36,13 @@ class PaymentRequest(Document):
send_mail = False send_mail = False
if send_mail and not self.flags.mute_email: if send_mail and not self.flags.mute_email:
self.send_payment_request() self.set_payment_request_url()
self.send_email() self.send_email()
def on_cancel(self): def on_cancel(self):
self.check_if_payment_entry_exists()
self.set_as_cancelled() self.set_as_cancelled()
def get_payment_url(self):
""" This is blanck method to trigger hooks call from individual payment gateway app
which will return respective payment gateway"""
pass
def make_invoice(self): def make_invoice(self):
ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name) ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name)
if hasattr(ref_doc, "order_type") and getattr(ref_doc, "order_type") == "Shopping Cart": if hasattr(ref_doc, "order_type") and getattr(ref_doc, "order_type") == "Shopping Cart":
@ -54,20 +51,39 @@ class PaymentRequest(Document):
si = si.insert(ignore_permissions=True) si = si.insert(ignore_permissions=True)
si.submit() si.submit()
def send_payment_request(self): def set_payment_request_url(self):
if self.payment_account: if self.payment_account:
self.payment_url = get_url("/api/method/erpnext.accounts.doctype.payment_request.payment_request.generate_payment_request?name={0}".format(self.name)) self.payment_url = self.get_payment_url()
if self.payment_url: if self.payment_url:
self.db_set('payment_url', self.payment_url) self.db_set('payment_url', self.payment_url)
if self.payment_url or not self.payment_gateway_account: if self.payment_url or not self.payment_gateway_account:
self.db_set('status', 'Initiated') self.db_set('status', 'Initiated')
def get_payment_url(self):
data = frappe.db.get_value(self.reference_doctype, self.reference_name,
["company", "customer_name"], as_dict=1)
controller = get_integration_controller(self.payment_gateway)
controller.validate_transaction_currency(self.currency)
return controller.get_payment_url(**{
"amount": self.grand_total,
"title": data.company,
"description": self.subject,
"reference_doctype": "Payment Request",
"reference_docname": self.name,
"payer_email": self.email_to or frappe.session.user,
"payer_name": data.customer_name,
"order_id": self.name,
"currency": self.currency
})
def set_as_paid(self): def set_as_paid(self):
if frappe.session.user == "Guest": if frappe.session.user == "Guest":
frappe.set_user("Administrator") frappe.set_user("Administrator")
payment_entry = self.create_payment_entry() payment_entry = self.create_payment_entry()
self.make_invoice() self.make_invoice()
@ -141,6 +157,13 @@ class PaymentRequest(Document):
def set_as_cancelled(self): def set_as_cancelled(self):
self.db_set("status", "Cancelled") self.db_set("status", "Cancelled")
def check_if_payment_entry_exists(self):
if self.status == "Paid":
payment_entry = frappe.db.sql_list("""select parent from `tabPayment Entry Reference`
where reference_name=%s""", self.reference_name)
if payment_entry:
frappe.throw(_("Payment Entry already exists"), title=_('Error'))
def make_communication_entry(self): def make_communication_entry(self):
"""Make communication entry""" """Make communication entry"""
@ -156,7 +179,33 @@ class PaymentRequest(Document):
def get_payment_success_url(self): def get_payment_success_url(self):
return self.payment_success_url return self.payment_success_url
def on_payment_authorized(self, status=None):
if not status:
return
shopping_cart_settings = frappe.get_doc("Shopping Cart Settings")
if status in ["Authorized", "Completed"]:
redirect_to = None
self.run_method("set_as_paid")
# if shopping cart enabled and in session
if (shopping_cart_settings.enabled and hasattr(frappe.local, "session")
and frappe.local.session.user != "Guest"):
success_url = shopping_cart_settings.payment_success_url
if success_url:
redirect_to = ({
"Orders": "orders",
"Invoices": "invoices",
"My Account": "me"
}).get(success_url, "me")
else:
redirect_to = get_url("/orders/{0}".format(self.reference_name))
return redirect_to
@frappe.whitelist(allow_guest=True) @frappe.whitelist(allow_guest=True)
def make_payment_request(**args): def make_payment_request(**args):
"""Make payment request""" """Make payment request"""
@ -201,8 +250,9 @@ def make_payment_request(**args):
pr.submit() pr.submit()
if hasattr(ref_doc, "order_type") and getattr(ref_doc, "order_type") == "Shopping Cart": if hasattr(ref_doc, "order_type") and getattr(ref_doc, "order_type") == "Shopping Cart":
generate_payment_request(pr.name)
frappe.db.commit() frappe.db.commit()
frappe.local.response["type"] = "redirect"
frappe.local.response["location"] = pr.get_payment_url()
if not args.cart: if not args.cart:
return pr return pr
@ -255,10 +305,6 @@ def get_print_format_list(ref_doctype):
"print_format": print_format_list "print_format": print_format_list
} }
@frappe.whitelist(allow_guest=True)
def generate_payment_request(name):
frappe.get_doc("Payment Request", name).run_method("get_payment_url")
@frappe.whitelist(allow_guest=True) @frappe.whitelist(allow_guest=True)
def resend_payment_email(docname): def resend_payment_email(docname):
return frappe.get_doc("Payment Request", docname).send_email() return frappe.get_doc("Payment Request", docname).send_email()
@ -278,6 +324,7 @@ def make_status_as_paid(doc, method):
doc = frappe.get_doc("Payment Request", payment_request_name) doc = frappe.get_doc("Payment Request", payment_request_name)
if doc.status != "Paid": if doc.status != "Paid":
doc.db_set('status', 'Paid') doc.db_set('status', 'Paid')
frappe.db.commit()
def get_dummy_message(use_dummy_message=True): def get_dummy_message(use_dummy_message=True):
return """ return """

View File

@ -578,7 +578,8 @@ class PurchaseInvoice(BuyingController):
if not self.is_return: if not self.is_return:
from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries
unlink_ref_doc_from_payment_entries(self.doctype, self.name) if frappe.db.get_single_value('Accounts Settings', 'unlink_payment_on_cancellation_of_invoice'):
unlink_ref_doc_from_payment_entries(self.doctype, self.name)
self.update_prevdoc_status() self.update_prevdoc_status()
self.update_billing_status_for_zero_amount_refdoc("Purchase Order") self.update_billing_status_for_zero_amount_refdoc("Purchase Order")

View File

@ -6,7 +6,7 @@ from __future__ import unicode_literals
import unittest import unittest
import frappe import frappe
import frappe.model import frappe.model
from frappe.utils import cint, flt, today from frappe.utils import cint, flt, today, nowdate
import frappe.defaults import frappe.defaults
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory, \ from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory, \
test_records as pr_test_records test_records as pr_test_records
@ -17,6 +17,12 @@ test_dependencies = ["Item", "Cost Center"]
test_ignore = ["Serial No"] test_ignore = ["Serial No"]
class TestPurchaseInvoice(unittest.TestCase): class TestPurchaseInvoice(unittest.TestCase):
def setUp(self):
unlink_payment_on_cancel_of_invoice()
def tearDown(self):
unlink_payment_on_cancel_of_invoice(0)
def test_gl_entries_without_auto_accounting_for_stock(self): def test_gl_entries_without_auto_accounting_for_stock(self):
set_perpetual_inventory(0) set_perpetual_inventory(0)
self.assertTrue(not cint(frappe.defaults.get_global_default("auto_accounting_for_stock"))) self.assertTrue(not cint(frappe.defaults.get_global_default("auto_accounting_for_stock")))
@ -55,6 +61,27 @@ class TestPurchaseInvoice(unittest.TestCase):
set_perpetual_inventory(0) set_perpetual_inventory(0)
def test_payment_entry_unlink_against_purchase_invoice(self):
from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry
unlink_payment_on_cancel_of_invoice(0)
pi_doc = make_purchase_invoice()
pe = get_payment_entry("Purchase Invoice", pi_doc.name, bank_account="_Test Bank - _TC")
pe.reference_no = "1"
pe.reference_date = nowdate()
pe.paid_from_account_currency = pi_doc.currency
pe.paid_to_account_currency = pi_doc.currency
pe.source_exchange_rate = 1
pe.target_exchange_rate = 1
pe.paid_amount = pi_doc.grand_total
pe.save(ignore_permissions=True)
pe.submit()
pi_doc = frappe.get_doc('Purchase Invoice', pi_doc.name)
self.assertRaises(frappe.LinkExistsError, pi_doc.cancel)
def test_gl_entries_with_auto_accounting_for_stock_against_pr(self): def test_gl_entries_with_auto_accounting_for_stock_against_pr(self):
set_perpetual_inventory(1) set_perpetual_inventory(1)
self.assertEqual(cint(frappe.defaults.get_global_default("auto_accounting_for_stock")), 1) self.assertEqual(cint(frappe.defaults.get_global_default("auto_accounting_for_stock")), 1)
@ -411,6 +438,11 @@ class TestPurchaseInvoice(unittest.TestCase):
self.assertEquals(frappe.db.get_value("Serial No", pi.get("items")[0].rejected_serial_no, self.assertEquals(frappe.db.get_value("Serial No", pi.get("items")[0].rejected_serial_no,
"warehouse"), pi.get("items")[0].rejected_warehouse) "warehouse"), pi.get("items")[0].rejected_warehouse)
def unlink_payment_on_cancel_of_invoice(enable=1):
accounts_settings = frappe.get_doc("Accounts Settings")
accounts_settings.unlink_payment_on_cancellation_of_invoice = enable
accounts_settings.save()
def make_purchase_invoice(**args): def make_purchase_invoice(**args):
pi = frappe.new_doc("Purchase Invoice") pi = frappe.new_doc("Purchase Invoice")
args = frappe._dict(args) args = frappe._dict(args)
@ -455,4 +487,4 @@ def make_purchase_invoice(**args):
pi.submit() pi.submit()
return pi return pi
test_records = frappe.get_test_records('Purchase Invoice') test_records = frappe.get_test_records('Purchase Invoice')

View File

@ -14,6 +14,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "reference_type", "fieldname": "reference_type",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -43,6 +44,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 3,
"fieldname": "reference_name", "fieldname": "reference_name",
"fieldtype": "Dynamic Link", "fieldtype": "Dynamic Link",
"hidden": 0, "hidden": 0,
@ -69,6 +71,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 3,
"fieldname": "remarks", "fieldname": "remarks",
"fieldtype": "Text", "fieldtype": "Text",
"hidden": 0, "hidden": 0,
@ -97,6 +100,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "reference_row", "fieldname": "reference_row",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
@ -125,6 +129,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break1", "fieldname": "col_break1",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -148,6 +153,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "advance_amount", "fieldname": "advance_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -177,6 +183,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "allocated_amount", "fieldname": "allocated_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -214,7 +221,7 @@
"istable": 1, "istable": 1,
"max_attachments": 0, "max_attachments": 0,
"menu_index": 0, "menu_index": 0,
"modified": "2016-07-18 05:13:42.137419", "modified": "2016-08-26 02:30:54.407138",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Purchase Invoice Advance", "name": "Purchase Invoice Advance",

View File

@ -15,6 +15,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 3,
"fieldname": "item_code", "fieldname": "item_code",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -42,6 +43,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break1", "fieldname": "col_break1",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -65,13 +67,14 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "item_name", "fieldname": "item_name",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 0,
"label": "Item Name", "label": "Item Name",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -91,6 +94,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"columns": 0,
"fieldname": "description_section", "fieldname": "description_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -116,6 +120,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "description", "fieldname": "description",
"fieldtype": "Text Editor", "fieldtype": "Text Editor",
"hidden": 0, "hidden": 0,
@ -144,6 +149,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "image", "fieldname": "image",
"fieldtype": "Attach", "fieldtype": "Attach",
"hidden": 1, "hidden": 1,
@ -169,6 +175,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "image_view", "fieldname": "image_view",
"fieldtype": "Image", "fieldtype": "Image",
"hidden": 0, "hidden": 0,
@ -195,6 +202,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "quantity_and_rate", "fieldname": "quantity_and_rate",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -219,6 +227,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "received_qty", "fieldname": "received_qty",
"fieldtype": "Float", "fieldtype": "Float",
"hidden": 0, "hidden": 0,
@ -244,6 +253,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "qty", "fieldname": "qty",
"fieldtype": "Float", "fieldtype": "Float",
"hidden": 0, "hidden": 0,
@ -270,6 +280,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "rejected_qty", "fieldname": "rejected_qty",
"fieldtype": "Float", "fieldtype": "Float",
"hidden": 0, "hidden": 0,
@ -295,6 +306,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break2", "fieldname": "col_break2",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -318,13 +330,14 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "uom", "fieldname": "uom",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 0,
"label": "UOM", "label": "UOM",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -343,6 +356,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "conversion_factor", "fieldname": "conversion_factor",
"fieldtype": "Float", "fieldtype": "Float",
"hidden": 0, "hidden": 0,
@ -367,6 +381,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "sec_break1", "fieldname": "sec_break1",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -390,6 +405,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "price_list_rate", "fieldname": "price_list_rate",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -415,6 +431,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "price_list_rate", "depends_on": "price_list_rate",
"fieldname": "discount_percentage", "fieldname": "discount_percentage",
"fieldtype": "Percent", "fieldtype": "Percent",
@ -422,7 +439,7 @@
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 0,
"label": "Discount on Price List Rate (%)", "label": "Discount on Price List Rate (%)",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -440,6 +457,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break3", "fieldname": "col_break3",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -463,6 +481,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_price_list_rate", "fieldname": "base_price_list_rate",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -488,6 +507,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "sec_break2", "fieldname": "sec_break2",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -511,6 +531,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 3,
"fieldname": "rate", "fieldname": "rate",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -538,6 +559,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "amount", "fieldname": "amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -565,6 +587,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break4", "fieldname": "col_break4",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -588,6 +611,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_rate", "fieldname": "base_rate",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -615,6 +639,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_amount", "fieldname": "base_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -642,6 +667,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "pricing_rule", "fieldname": "pricing_rule",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -667,6 +693,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "section_break_22", "fieldname": "section_break_22",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -691,6 +718,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "net_rate", "fieldname": "net_rate",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -717,6 +745,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "net_amount", "fieldname": "net_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -743,6 +772,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_25", "fieldname": "column_break_25",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -767,6 +797,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_net_rate", "fieldname": "base_net_rate",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -793,6 +824,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_net_amount", "fieldname": "base_net_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -819,6 +851,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "warehouse_section", "fieldname": "warehouse_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -844,6 +877,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "", "default": "",
"fieldname": "warehouse", "fieldname": "warehouse",
"fieldtype": "Link", "fieldtype": "Link",
@ -871,6 +905,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "rejected_warehouse", "fieldname": "rejected_warehouse",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -897,6 +932,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "batch_no", "fieldname": "batch_no",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -923,6 +959,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_br_wh", "fieldname": "col_br_wh",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -948,6 +985,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "serial_no", "fieldname": "serial_no",
"fieldtype": "Text", "fieldtype": "Text",
"hidden": 0, "hidden": 0,
@ -973,6 +1011,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "rejected_serial_no", "fieldname": "rejected_serial_no",
"fieldtype": "Text", "fieldtype": "Text",
"hidden": 0, "hidden": 0,
@ -998,6 +1037,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "accounting", "fieldname": "accounting",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -1022,6 +1062,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "expense_account", "fieldname": "expense_account",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -1051,6 +1092,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break5", "fieldname": "col_break5",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -1074,6 +1116,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "project", "fieldname": "project",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -1099,6 +1142,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": ":Company", "default": ":Company",
"depends_on": "eval:!doc.is_fixed_asset", "depends_on": "eval:!doc.is_fixed_asset",
"fieldname": "cost_center", "fieldname": "cost_center",
@ -1130,6 +1174,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "reference", "fieldname": "reference",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -1154,6 +1199,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "brand", "fieldname": "brand",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
@ -1180,6 +1226,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "", "description": "",
"fieldname": "item_group", "fieldname": "item_group",
"fieldtype": "Link", "fieldtype": "Link",
@ -1208,6 +1255,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "Tax detail table fetched from item master as a string and stored in this field.\nUsed for Taxes and Charges", "description": "Tax detail table fetched from item master as a string and stored in this field.\nUsed for Taxes and Charges",
"fieldname": "item_tax_rate", "fieldname": "item_tax_rate",
"fieldtype": "Code", "fieldtype": "Code",
@ -1235,6 +1283,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "item_tax_amount", "fieldname": "item_tax_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 1, "hidden": 1,
@ -1262,6 +1311,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "purchase_order", "fieldname": "purchase_order",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -1289,6 +1339,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "bom", "fieldname": "bom",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -1315,6 +1366,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break6", "fieldname": "col_break6",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -1338,6 +1390,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "is_fixed_asset", "fieldname": "is_fixed_asset",
"fieldtype": "Check", "fieldtype": "Check",
"hidden": 1, "hidden": 1,
@ -1363,6 +1416,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "is_fixed_asset", "depends_on": "is_fixed_asset",
"fieldname": "asset", "fieldname": "asset",
"fieldtype": "Link", "fieldtype": "Link",
@ -1390,6 +1444,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "po_detail", "fieldname": "po_detail",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
@ -1416,6 +1471,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "purchase_receipt", "fieldname": "purchase_receipt",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -1443,6 +1499,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "page_break", "fieldname": "page_break",
"fieldtype": "Check", "fieldtype": "Check",
"hidden": 0, "hidden": 0,
@ -1467,6 +1524,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "pr_detail", "fieldname": "pr_detail",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
@ -1493,6 +1551,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "valuation_rate", "fieldname": "valuation_rate",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 1, "hidden": 1,
@ -1518,6 +1577,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "rm_supp_cost", "fieldname": "rm_supp_cost",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 1, "hidden": 1,
@ -1543,6 +1603,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "landed_cost_voucher_amount", "fieldname": "landed_cost_voucher_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -1575,7 +1636,7 @@
"issingle": 0, "issingle": 0,
"istable": 1, "istable": 1,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-07-11 03:28:04.932212", "modified": "2016-08-26 04:37:23.737537",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Purchase Invoice Item", "name": "Purchase Invoice Item",

View File

@ -8,12 +8,14 @@
"custom": 0, "custom": 0,
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"document_type": "Setup",
"editable_grid": 1, "editable_grid": 1,
"fields": [ "fields": [
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "Valuation and Total", "default": "Valuation and Total",
"fieldname": "category", "fieldname": "category",
"fieldtype": "Select", "fieldtype": "Select",
@ -42,6 +44,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "Add", "default": "Add",
"fieldname": "add_deduct_tax", "fieldname": "add_deduct_tax",
"fieldtype": "Select", "fieldtype": "Select",
@ -70,6 +73,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "charge_type", "fieldname": "charge_type",
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
@ -97,6 +101,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:[\"On Previous Row Amount\", \"On Previous Row Total\"].indexOf(doc.charge_type)!==-1", "depends_on": "eval:[\"On Previous Row Amount\", \"On Previous Row Total\"].indexOf(doc.charge_type)!==-1",
"fieldname": "row_id", "fieldname": "row_id",
"fieldtype": "Data", "fieldtype": "Data",
@ -124,6 +129,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "If checked, the tax amount will be considered as already included in the Print Rate / Print Amount", "description": "If checked, the tax amount will be considered as already included in the Print Rate / Print Amount",
"fieldname": "included_in_print_rate", "fieldname": "included_in_print_rate",
"fieldtype": "Check", "fieldtype": "Check",
@ -150,6 +156,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break1", "fieldname": "col_break1",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -173,13 +180,14 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "account_head", "fieldname": "account_head",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 1,
"label": "Account Head", "label": "Account Head",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -200,6 +208,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": ":Company", "default": ":Company",
"fieldname": "cost_center", "fieldname": "cost_center",
"fieldtype": "Link", "fieldtype": "Link",
@ -228,13 +237,14 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "description", "fieldname": "description",
"fieldtype": "Text Editor", "fieldtype": "Text Editor",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 0,
"label": "Description", "label": "Description",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -256,6 +266,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "section_break_10", "fieldname": "section_break_10",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -280,6 +291,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "rate", "fieldname": "rate",
"fieldtype": "Float", "fieldtype": "Float",
"hidden": 0, "hidden": 0,
@ -306,6 +318,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "section_break_9", "fieldname": "section_break_9",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -330,6 +343,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "tax_amount", "fieldname": "tax_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -357,6 +371,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "tax_amount_after_discount_amount", "fieldname": "tax_amount_after_discount_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -383,13 +398,14 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "total", "fieldname": "total",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 1,
"label": "Total", "label": "Total",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -410,6 +426,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_14", "fieldname": "column_break_14",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -434,6 +451,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_tax_amount", "fieldname": "base_tax_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -460,6 +478,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_total", "fieldname": "base_total",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 1, "hidden": 1,
@ -486,6 +505,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_tax_amount_after_discount_amount", "fieldname": "base_tax_amount_after_discount_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -512,6 +532,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "item_wise_tax_detail", "fieldname": "item_wise_tax_detail",
"fieldtype": "Code", "fieldtype": "Code",
"hidden": 1, "hidden": 1,
@ -538,6 +559,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "parenttype", "fieldname": "parenttype",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
@ -571,7 +593,7 @@
"issingle": 0, "issingle": 0,
"istable": 1, "istable": 1,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-07-11 03:28:06.117769", "modified": "2016-08-26 03:20:22.118330",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Purchase Taxes and Charges", "name": "Purchase Taxes and Charges",

View File

@ -0,0 +1,92 @@
{
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
"beta": 0,
"creation": "2016-07-27 17:24:24.956896",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 1,
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "company",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Company",
"length": 0,
"no_copy": 0,
"options": "Company",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"description": "Default Bank / Cash account will be automatically updated in Salary Journal Entry when this mode is selected.",
"fieldname": "default_account",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Default Account",
"length": 0,
"no_copy": 0,
"options": "Account",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2016-09-02 07:49:06.567389",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Salary Component Account",
"name_case": "",
"owner": "Administrator",
"permissions": [],
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_seen": 0
}

View File

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class SalaryComponentAccount(Document):
pass

View File

@ -20,9 +20,6 @@ def get_pos_data():
if pos_profile.get('name'): if pos_profile.get('name'):
pos_profile = frappe.get_doc('POS Profile', pos_profile.get('name')) pos_profile = frappe.get_doc('POS Profile', pos_profile.get('name'))
else:
frappe.msgprint('<a href="#List/POS Profile">'
+ _("Welcome to POS: Create your POS Profile") + '</a>');
company_data = get_company_data(doc.company) company_data = get_company_data(doc.company)
update_pos_profile_data(doc, pos_profile, company_data) update_pos_profile_data(doc, pos_profile, company_data)
@ -239,10 +236,4 @@ def save_invoice(e, si_doc, name):
si_doc.docstatus = 0 si_doc.docstatus = 0
si_doc.flags.ignore_mandatory = True si_doc.flags.ignore_mandatory = True
si_doc.insert() si_doc.insert()
make_scheduler_log(e, si_doc.name) frappe.log_error(frappe.get_traceback())
def make_scheduler_log(e, sales_invoice):
scheduler_log = frappe.new_doc('Scheduler Log')
scheduler_log.method = "erpnext.accounts.doctype.sales_invoice.pos.make_invoice"
scheduler_log.error = e
scheduler_log.save(ignore_permissions=True)

View File

@ -462,25 +462,41 @@ cur_frm.set_query("asset", "items", function(doc, cdt, cdn) {
frappe.ui.form.on('Sales Invoice', { frappe.ui.form.on('Sales Invoice', {
setup: function(frm){ setup: function(frm){
frm.fields_dict["timesheets"].grid.get_field("time_sheet").get_query = function(doc, cdt, cdn){ frm.fields_dict["timesheets"].grid.get_field("time_sheet").get_query = function(doc, cdt, cdn){
return { return{
filters: [ query: "erpnext.projects.doctype.timesheet.timesheet.get_timesheet",
["Timesheet", "status", "in", ["Submitted", "Payslip"]] filters: {'project': doc.project}
]
} }
} }
} },
})
frappe.ui.form.on('Sales Invoice Timesheet', { project: function(frm){
time_sheet: function(frm){
frm.call({ frm.call({
method: "calculate_billing_amount_from_timesheet", method: "add_timesheet_data",
doc: frm.doc, doc: frm.doc,
callback: function(r, rt) { callback: function(r, rt) {
refresh_field('total_billing_amount') refresh_field(['timesheets'])
} }
}) })
} }
}) })
cur_frm.add_fetch("time_sheet", "total_billing_amount", "billing_amount"); frappe.ui.form.on('Sales Invoice Timesheet', {
time_sheet: function(frm, cdt, cdn){
var d = locals[cdt][cdn];
frappe.call({
method: "erpnext.projects.doctype.timesheet.timesheet.get_timesheet_data",
args: {
'name': d.time_sheet,
'project': frm.doc.project || null
},
callback: function(r, rt) {
if(r.message){
data = r.message;
frappe.model.set_value(cdt, cdn, "billing_hours", data.billing_hours);
frappe.model.set_value(cdt, cdn, "billing_amount", data.billing_amount);
frappe.model.set_value(cdt, cdn, "timesheet_detail", data.timesheet_detail);
}
}
})
}
})

View File

@ -337,6 +337,34 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "project",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Project",
"length": 0,
"no_copy": 0,
"oldfieldname": "project_name",
"oldfieldtype": "Link",
"options": "Project",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
@ -2878,21 +2906,22 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"fieldname": "project", "depends_on": "",
"fieldname": "campaign",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Project", "label": "Campaign",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"oldfieldname": "project_name", "oldfieldname": "campaign",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "Project", "options": "Campaign",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 1,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
@ -2926,42 +2955,13 @@
"unique": 0, "unique": 0,
"width": "50%" "width": "50%"
}, },
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.source == 'Campaign'",
"fieldname": "campaign",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Campaign",
"length": 0,
"no_copy": 0,
"oldfieldname": "campaign",
"oldfieldtype": "Link",
"options": "Campaign",
"permlevel": 0,
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"fieldname": "source", "fieldname": "source",
"fieldtype": "Select", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
@ -2972,7 +2972,7 @@
"no_copy": 0, "no_copy": 0,
"oldfieldname": "source", "oldfieldname": "source",
"oldfieldtype": "Select", "oldfieldtype": "Select",
"options": "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign", "options": "Lead Source",
"permlevel": 0, "permlevel": 0,
"print_hide": 1, "print_hide": 1,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
@ -3867,7 +3867,7 @@
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"menu_index": 0, "menu_index": 0,
"modified": "2016-09-23 17:59:42.200474", "modified": "2016-09-24 15:54:33.104276",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Sales Invoice", "name": "Sales Invoice",

View File

@ -14,6 +14,7 @@ from erpnext.accounts.doctype.sales_invoice.pos import update_multi_mode_option
from erpnext.controllers.selling_controller import SellingController from erpnext.controllers.selling_controller import SellingController
from erpnext.accounts.utils import get_account_currency from erpnext.accounts.utils import get_account_currency
from erpnext.stock.doctype.delivery_note.delivery_note import update_billed_amount_based_on_so from erpnext.stock.doctype.delivery_note.delivery_note import update_billed_amount_based_on_so
from erpnext.projects.doctype.timesheet.timesheet import get_projectwise_timesheet_data
from erpnext.accounts.doctype.asset.depreciation \ from erpnext.accounts.doctype.asset.depreciation \
import get_disposal_account_and_cost_center, get_gl_entries_on_asset_disposal import get_disposal_account_and_cost_center, get_gl_entries_on_asset_disposal
@ -83,7 +84,8 @@ class SalesInvoice(SellingController):
self.validate_time_sheets_are_submitted() self.validate_time_sheets_are_submitted()
self.validate_multiple_billing("Delivery Note", "dn_detail", "amount", "items") self.validate_multiple_billing("Delivery Note", "dn_detail", "amount", "items")
self.update_packing_list() self.update_packing_list()
self.calculate_billing_amount_from_timesheet() self.set_billing_hours_and_amount()
self.update_timesheet_billing_for_project()
def before_save(self): def before_save(self):
set_account_for_mode_of_payment(self) set_account_for_mode_of_payment(self)
@ -134,7 +136,8 @@ class SalesInvoice(SellingController):
self.check_close_sales_order("sales_order") self.check_close_sales_order("sales_order")
from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries
unlink_ref_doc_from_payment_entries(self.doctype, self.name) if frappe.db.get_single_value('Accounts Settings', 'unlink_payment_on_cancellation_of_invoice'):
unlink_ref_doc_from_payment_entries(self.doctype, self.name)
if self.is_return: if self.is_return:
# NOTE status updating bypassed for is_return # NOTE status updating bypassed for is_return
@ -220,11 +223,21 @@ class SalesInvoice(SellingController):
for d in self.timesheets: for d in self.timesheets:
if d.time_sheet: if d.time_sheet:
timesheet = frappe.get_doc("Timesheet", d.time_sheet) timesheet = frappe.get_doc("Timesheet", d.time_sheet)
timesheet.sales_invoice = sales_invoice self.update_time_sheet_detail(timesheet, d, sales_invoice)
timesheet.calculate_total_amounts()
timesheet.calculate_percentage_billed()
timesheet.flags.ignore_validate_update_after_submit = True timesheet.flags.ignore_validate_update_after_submit = True
timesheet.set_status() timesheet.set_status()
timesheet.save() timesheet.save()
def update_time_sheet_detail(self, timesheet, args, sales_invoice):
for data in timesheet.time_logs:
if (self.project and args.timesheet_detail == data.name) or \
(not self.project and not data.sales_invoice) or \
(not sales_invoice and data.sales_invoice == self.name):
data.sales_invoice = sales_invoice
if self.project: return
def on_update(self): def on_update(self):
self.set_paid_amount() self.set_paid_amount()
@ -350,19 +363,18 @@ class SalesInvoice(SellingController):
against_acc.append(d.income_account) against_acc.append(d.income_account)
self.against_income_account = ','.join(against_acc) self.against_income_account = ','.join(against_acc)
def add_remarks(self): def add_remarks(self):
if not self.remarks: self.remarks = 'No Remarks' if not self.remarks: self.remarks = 'No Remarks'
def so_dn_required(self): def so_dn_required(self):
"""check in manage account if sales order / delivery note required or not.""" """check in manage account if sales order / delivery note required or not."""
dic = {'Sales Order':'so_required','Delivery Note':'dn_required'} dic = {'Sales Order':['so_required', 'is_pos'],'Delivery Note':['dn_required', 'update_stock']}
for i in dic: for i in dic:
if frappe.db.get_value('Selling Settings', None, dic[i]) == 'Yes': if frappe.db.get_value('Selling Settings', None, dic[i][0]) == 'Yes':
for d in self.get('items'): for d in self.get('items'):
if frappe.db.get_value('Item', d.item_code, 'is_stock_item') == 1 \ if frappe.db.get_value('Item', d.item_code, 'is_stock_item') == 1 \
and not d.get(i.lower().replace(' ','_')): and not d.get(i.lower().replace(' ','_')) and not self.get(dic[i][1]):
msgprint(_("{0} is mandatory for Item {1}").format(i,d.item_code), raise_exception=1) msgprint(_("{0} is mandatory for Item {1}").format(i,d.item_code), raise_exception=1)
@ -390,7 +402,7 @@ class SalesInvoice(SellingController):
super(SalesInvoice, self).validate_warehouse() super(SalesInvoice, self).validate_warehouse()
for d in self.get('items'): for d in self.get('items'):
if not d.warehouse: if not d.warehouse and frappe.db.get_value("Item", d.item_code, "is_stock_item"):
frappe.throw(_("Warehouse required at Row No {0}").format(d.idx)) frappe.throw(_("Warehouse required at Row No {0}").format(d.idx))
def validate_delivery_note(self): def validate_delivery_note(self):
@ -447,7 +459,35 @@ class SalesInvoice(SellingController):
else: else:
self.set('packed_items', []) self.set('packed_items', [])
def calculate_billing_amount_from_timesheet(self): def set_billing_hours_and_amount(self):
for timesheet in self.timesheets:
ts_doc = frappe.get_doc('Timesheet', timesheet.time_sheet)
if not timesheet.billing_hours and ts_doc.total_billable_hours:
timesheet.billing_hours = ts_doc.total_billable_hours
if not timesheet.billing_amount and ts_doc.total_billable_amount:
timesheet.billing_amount = ts_doc.total_billable_amount
def update_timesheet_billing_for_project(self):
if not self.timesheets and self.project:
self.add_timesheet_data()
else:
self.calculate_billing_amount_for_timesheet()
def add_timesheet_data(self):
self.set('timesheets', [])
if self.project:
for data in get_projectwise_timesheet_data(self.project):
self.append('timesheets', {
'time_sheet': data.parent,
'billing_hours': data.billing_hours,
'billing_amount': data.billing_amt,
'timesheet_detail': data.name
})
self.calculate_billing_amount_for_timesheet()
def calculate_billing_amount_for_timesheet(self):
total_billing_amount = 0.0 total_billing_amount = 0.0
for data in self.timesheets: for data in self.timesheets:
if data.billing_amount: if data.billing_amount:

View File

@ -4,8 +4,9 @@ from __future__ import unicode_literals
import frappe import frappe
import unittest, copy import unittest, copy
from frappe.utils import nowdate, add_days, flt from frappe.utils import nowdate, add_days, flt, nowdate
from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry, get_qty_after_transaction from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry, get_qty_after_transaction
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import unlink_payment_on_cancel_of_invoice
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory
from erpnext.exceptions import InvalidAccountCurrency, InvalidCurrency from erpnext.exceptions import InvalidAccountCurrency, InvalidCurrency
from erpnext.stock.doctype.serial_no.serial_no import SerialNoWarehouseError from erpnext.stock.doctype.serial_no.serial_no import SerialNoWarehouseError
@ -19,6 +20,12 @@ class TestSalesInvoice(unittest.TestCase):
w.submit() w.submit()
return w return w
def setUp(self):
unlink_payment_on_cancel_of_invoice()
def tearDown(self):
unlink_payment_on_cancel_of_invoice(0)
def test_timestamp_change(self): def test_timestamp_change(self):
w = frappe.copy_doc(test_records[0]) w = frappe.copy_doc(test_records[0])
w.docstatus = 0 w.docstatus = 0
@ -78,6 +85,28 @@ class TestSalesInvoice(unittest.TestCase):
self.assertEquals(si.base_grand_total, 1627.05) self.assertEquals(si.base_grand_total, 1627.05)
self.assertEquals(si.grand_total, 1627.05) self.assertEquals(si.grand_total, 1627.05)
def test_payment_entry_unlink_against_invoice(self):
from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry
si = frappe.copy_doc(test_records[0])
si.is_pos = 0
si.insert()
si.submit()
pe = get_payment_entry("Sales Invoice", si.name, bank_account="_Test Bank - _TC")
pe.reference_no = "1"
pe.reference_date = nowdate()
pe.paid_from_account_currency = si.currency
pe.paid_to_account_currency = si.currency
pe.source_exchange_rate = 1
pe.target_exchange_rate = 1
pe.paid_amount = si.grand_total
pe.insert()
pe.submit()
unlink_payment_on_cancel_of_invoice(0)
si = frappe.get_doc('Sales Invoice', si.name)
self.assertRaises(frappe.LinkExistsError, si.cancel)
def test_sales_invoice_calculation_export_currency(self): def test_sales_invoice_calculation_export_currency(self):
si = frappe.copy_doc(test_records[2]) si = frappe.copy_doc(test_records[2])
si.currency = "USD" si.currency = "USD"
@ -562,61 +591,7 @@ class TestSalesInvoice(unittest.TestCase):
if not frappe.db.exists("POS Profile", "_Test POS Profile"): if not frappe.db.exists("POS Profile", "_Test POS Profile"):
pos_profile.insert() pos_profile.insert()
def test_si_gl_entry_with_perpetual_inventory_and_update_stock_with_warehouse_but_no_account(self):
set_perpetual_inventory()
frappe.delete_doc("Account", "_Test Warehouse No Account - _TC")
# insert purchase receipt
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import test_records \
as pr_test_records
pr = frappe.copy_doc(pr_test_records[0])
pr.naming_series = "_T-Purchase Receipt-"
pr.get("items")[0].warehouse = "_Test Warehouse No Account - _TC"
pr.insert()
pr.submit()
si_doc = copy.deepcopy(test_records[1])
si_doc["update_stock"] = 1
# si_doc["posting_time"] = "12:05"
si_doc.get("items")[0]["warehouse"] = "_Test Warehouse No Account - _TC"
si = frappe.copy_doc(si_doc)
si.insert()
si.submit()
# check stock ledger entries
sle = frappe.db.sql("""select * from `tabStock Ledger Entry`
where voucher_type = 'Sales Invoice' and voucher_no = %s""",
si.name, as_dict=1)[0]
self.assertTrue(sle)
self.assertEquals([sle.item_code, sle.warehouse, sle.actual_qty],
["_Test Item", "_Test Warehouse No Account - _TC", -1.0])
# check gl entries
gl_entries = frappe.db.sql("""select account, debit, credit
from `tabGL Entry` where voucher_type='Sales Invoice' and voucher_no=%s
order by account asc, debit asc""", si.name, as_dict=1)
self.assertTrue(gl_entries)
expected_gl_entries = dict((d[0], d) for d in [
[si.debit_to, 630.0, 0.0],
[si_doc.get("items")[0]["income_account"], 0.0, 500.0],
[si_doc.get("taxes")[0]["account_head"], 0.0, 80.0],
[si_doc.get("taxes")[1]["account_head"], 0.0, 50.0],
])
for i, gle in enumerate(gl_entries):
self.assertEquals(expected_gl_entries[gle.account][0], gle.account)
self.assertEquals(expected_gl_entries[gle.account][1], gle.debit)
self.assertEquals(expected_gl_entries[gle.account][2], gle.credit)
si.cancel()
gle = frappe.db.sql("""select * from `tabGL Entry`
where voucher_type='Sales Invoice' and voucher_no=%s""", si.name)
self.assertFalse(gle)
set_perpetual_inventory(0)
def test_sales_invoice_gl_entry_with_perpetual_inventory_no_item_code(self): def test_sales_invoice_gl_entry_with_perpetual_inventory_no_item_code(self):
set_perpetual_inventory() set_perpetual_inventory()

View File

@ -14,6 +14,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "reference_type", "fieldname": "reference_type",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -43,6 +44,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 3,
"fieldname": "reference_name", "fieldname": "reference_name",
"fieldtype": "Dynamic Link", "fieldtype": "Dynamic Link",
"hidden": 0, "hidden": 0,
@ -69,6 +71,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 3,
"fieldname": "remarks", "fieldname": "remarks",
"fieldtype": "Text", "fieldtype": "Text",
"hidden": 0, "hidden": 0,
@ -97,6 +100,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "reference_row", "fieldname": "reference_row",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
@ -125,6 +129,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break1", "fieldname": "col_break1",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -148,6 +153,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "advance_amount", "fieldname": "advance_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -177,6 +183,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "allocated_amount", "fieldname": "allocated_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -214,7 +221,7 @@
"istable": 1, "istable": 1,
"max_attachments": 0, "max_attachments": 0,
"menu_index": 0, "menu_index": 0,
"modified": "2016-07-18 05:13:21.819598", "modified": "2016-08-26 02:36:10.718057",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Sales Invoice Advance", "name": "Sales Invoice Advance",

View File

@ -15,6 +15,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "barcode", "fieldname": "barcode",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
@ -39,6 +40,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 4,
"fieldname": "item_code", "fieldname": "item_code",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -66,6 +68,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break1", "fieldname": "col_break1",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -89,13 +92,14 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "item_name", "fieldname": "item_name",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 0,
"label": "Item Name", "label": "Item Name",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -115,6 +119,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "customer_item_code", "fieldname": "customer_item_code",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
@ -139,6 +144,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"columns": 0,
"fieldname": "section_break_6", "fieldname": "section_break_6",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -164,6 +170,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "description", "fieldname": "description",
"fieldtype": "Text Editor", "fieldtype": "Text Editor",
"hidden": 0, "hidden": 0,
@ -192,6 +199,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_8", "fieldname": "column_break_8",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -216,6 +224,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "image_view", "fieldname": "image_view",
"fieldtype": "Image", "fieldtype": "Image",
"hidden": 0, "hidden": 0,
@ -242,6 +251,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "image", "fieldname": "image",
"fieldtype": "Attach", "fieldtype": "Attach",
"hidden": 1, "hidden": 1,
@ -267,6 +277,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "quantity_and_rate", "fieldname": "quantity_and_rate",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -291,6 +302,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "qty", "fieldname": "qty",
"fieldtype": "Float", "fieldtype": "Float",
"hidden": 0, "hidden": 0,
@ -317,6 +329,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "price_list_rate", "fieldname": "price_list_rate",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -344,6 +357,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break2", "fieldname": "col_break2",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -367,13 +381,14 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "stock_uom", "fieldname": "stock_uom",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 0,
"label": "UOM", "label": "UOM",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -392,6 +407,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_price_list_rate", "fieldname": "base_price_list_rate",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -419,6 +435,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"columns": 0,
"fieldname": "discount_and_margin", "fieldname": "discount_and_margin",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -444,6 +461,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "price_list_rate", "depends_on": "price_list_rate",
"fieldname": "discount_percentage", "fieldname": "discount_percentage",
"fieldtype": "Percent", "fieldtype": "Percent",
@ -451,7 +469,7 @@
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 0,
"label": "Discount on Price List Rate (%)", "label": "Discount on Price List Rate (%)",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -471,6 +489,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_19", "fieldname": "column_break_19",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -495,6 +514,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "price_list_rate", "depends_on": "price_list_rate",
"fieldname": "margin_type", "fieldname": "margin_type",
"fieldtype": "Select", "fieldtype": "Select",
@ -522,6 +542,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.margin_type && doc.price_list_rate", "depends_on": "eval:doc.margin_type && doc.price_list_rate",
"fieldname": "margin_rate_or_amount", "fieldname": "margin_rate_or_amount",
"fieldtype": "Float", "fieldtype": "Float",
@ -548,6 +569,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.margin_type && doc.price_list_rate", "depends_on": "eval:doc.margin_type && doc.price_list_rate",
"fieldname": "total_margin", "fieldname": "total_margin",
"fieldtype": "Float", "fieldtype": "Float",
@ -574,6 +596,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "section_break1", "fieldname": "section_break1",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -597,6 +620,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "rate", "fieldname": "rate",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -624,6 +648,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "amount", "fieldname": "amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -651,6 +676,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break3", "fieldname": "col_break3",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -674,6 +700,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_rate", "fieldname": "base_rate",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -701,6 +728,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_amount", "fieldname": "base_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -728,6 +756,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "pricing_rule", "fieldname": "pricing_rule",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -753,6 +782,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "section_break_21", "fieldname": "section_break_21",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -777,6 +807,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "net_rate", "fieldname": "net_rate",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -803,6 +834,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "net_amount", "fieldname": "net_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -829,6 +861,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_24", "fieldname": "column_break_24",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -853,6 +886,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_net_rate", "fieldname": "base_net_rate",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -879,6 +913,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_net_amount", "fieldname": "base_net_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -906,6 +941,7 @@
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"collapsible_depends_on": "eval:doc.delivered_by_supplier==1", "collapsible_depends_on": "eval:doc.delivered_by_supplier==1",
"columns": 0,
"fieldname": "drop_ship", "fieldname": "drop_ship",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -931,6 +967,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "delivered_by_supplier", "fieldname": "delivered_by_supplier",
"fieldtype": "Check", "fieldtype": "Check",
"hidden": 0, "hidden": 0,
@ -956,6 +993,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"columns": 0,
"fieldname": "accounting", "fieldname": "accounting",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -980,6 +1018,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "income_account", "fieldname": "income_account",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -1009,6 +1048,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "expense_account", "fieldname": "expense_account",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -1035,6 +1075,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break4", "fieldname": "col_break4",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -1058,6 +1099,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": ":Company", "default": ":Company",
"fieldname": "cost_center", "fieldname": "cost_center",
"fieldtype": "Link", "fieldtype": "Link",
@ -1089,6 +1131,7 @@
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"collapsible_depends_on": "eval:doc.serial_no || doc.batch_no", "collapsible_depends_on": "eval:doc.serial_no || doc.batch_no",
"columns": 0,
"fieldname": "warehouse_and_reference", "fieldname": "warehouse_and_reference",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -1113,6 +1156,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "warehouse", "fieldname": "warehouse",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -1140,6 +1184,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "target_warehouse", "fieldname": "target_warehouse",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 1, "hidden": 1,
@ -1166,6 +1211,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "serial_no", "fieldname": "serial_no",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"hidden": 0, "hidden": 0,
@ -1192,6 +1238,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "batch_no", "fieldname": "batch_no",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -1217,6 +1264,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "", "description": "",
"fieldname": "item_group", "fieldname": "item_group",
"fieldtype": "Link", "fieldtype": "Link",
@ -1245,6 +1293,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "brand", "fieldname": "brand",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
@ -1271,6 +1320,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "item_tax_rate", "fieldname": "item_tax_rate",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"hidden": 1, "hidden": 1,
@ -1297,6 +1347,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break5", "fieldname": "col_break5",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -1320,6 +1371,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "actual_batch_qty", "fieldname": "actual_batch_qty",
"fieldtype": "Float", "fieldtype": "Float",
"hidden": 0, "hidden": 0,
@ -1347,6 +1399,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "actual_qty", "fieldname": "actual_qty",
"fieldtype": "Float", "fieldtype": "Float",
"hidden": 0, "hidden": 0,
@ -1373,6 +1426,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"columns": 0,
"fieldname": "edit_references", "fieldname": "edit_references",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -1398,6 +1452,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "sales_order", "fieldname": "sales_order",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -1425,6 +1480,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "so_detail", "fieldname": "so_detail",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
@ -1451,6 +1507,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_50", "fieldname": "column_break_50",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -1475,6 +1532,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "delivery_note", "fieldname": "delivery_note",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -1502,6 +1560,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "dn_detail", "fieldname": "dn_detail",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
@ -1528,6 +1587,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "delivered_qty", "fieldname": "delivered_qty",
"fieldtype": "Float", "fieldtype": "Float",
"hidden": 0, "hidden": 0,
@ -1554,6 +1614,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "is_fixed_asset", "fieldname": "is_fixed_asset",
"fieldtype": "Check", "fieldtype": "Check",
"hidden": 1, "hidden": 1,
@ -1579,6 +1640,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "asset", "fieldname": "asset",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -1605,6 +1667,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "section_break_54", "fieldname": "section_break_54",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -1629,6 +1692,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "page_break", "fieldname": "page_break",
"fieldtype": "Check", "fieldtype": "Check",
"hidden": 0, "hidden": 0,
@ -1660,7 +1724,7 @@
"issingle": 0, "issingle": 0,
"istable": 1, "istable": 1,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-07-11 03:28:07.483665", "modified": "2016-08-26 04:48:29.142409",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Sales Invoice Item", "name": "Sales Invoice Item",

View File

@ -14,6 +14,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "time_sheet", "fieldname": "time_sheet",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -40,6 +41,33 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "billing_hours",
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Billing Hours",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "billing_amount", "fieldname": "billing_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -60,6 +88,32 @@
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "timesheet_detail",
"fieldtype": "Data",
"hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Timesheet Detail",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
} }
], ],
"hide_heading": 0, "hide_heading": 0,
@ -72,7 +126,7 @@
"issingle": 0, "issingle": 0,
"istable": 1, "istable": 1,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-07-11 03:28:07.876168", "modified": "2016-09-09 14:01:04.095775",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Sales Invoice Timesheet", "name": "Sales Invoice Timesheet",

View File

@ -8,12 +8,14 @@
"custom": 0, "custom": 0,
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"document_type": "Setup",
"editable_grid": 1, "editable_grid": 1,
"fields": [ "fields": [
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "charge_type", "fieldname": "charge_type",
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
@ -41,6 +43,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:[\"On Previous Row Amount\", \"On Previous Row Total\"].indexOf(doc.charge_type)!==-1", "depends_on": "eval:[\"On Previous Row Amount\", \"On Previous Row Total\"].indexOf(doc.charge_type)!==-1",
"fieldname": "row_id", "fieldname": "row_id",
"fieldtype": "Data", "fieldtype": "Data",
@ -68,13 +71,14 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "account_head", "fieldname": "account_head",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 1,
"label": "Account Head", "label": "Account Head",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -95,6 +99,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": ":Company", "default": ":Company",
"fieldname": "cost_center", "fieldname": "cost_center",
"fieldtype": "Link", "fieldtype": "Link",
@ -123,6 +128,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break_1", "fieldname": "col_break_1",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -147,13 +153,14 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "description", "fieldname": "description",
"fieldtype": "Text Editor", "fieldtype": "Text Editor",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 0,
"label": "Description", "label": "Description",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -175,6 +182,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "If checked, the tax amount will be considered as already included in the Print Rate / Print Amount", "description": "If checked, the tax amount will be considered as already included in the Print Rate / Print Amount",
"fieldname": "included_in_print_rate", "fieldname": "included_in_print_rate",
"fieldtype": "Check", "fieldtype": "Check",
@ -202,6 +210,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "section_break_8", "fieldname": "section_break_8",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -226,6 +235,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "rate", "fieldname": "rate",
"fieldtype": "Float", "fieldtype": "Float",
"hidden": 0, "hidden": 0,
@ -252,6 +262,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "section_break_9", "fieldname": "section_break_9",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -276,6 +287,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "tax_amount", "fieldname": "tax_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -302,13 +314,14 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "total", "fieldname": "total",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 1,
"label": "Total", "label": "Total",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -328,6 +341,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "tax_amount_after_discount_amount", "fieldname": "tax_amount_after_discount_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -354,6 +368,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_13", "fieldname": "column_break_13",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -378,6 +393,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_tax_amount", "fieldname": "base_tax_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -405,6 +421,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_total", "fieldname": "base_total",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -432,6 +449,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:parent.discount_amount", "depends_on": "eval:parent.discount_amount",
"fieldname": "base_tax_amount_after_discount_amount", "fieldname": "base_tax_amount_after_discount_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
@ -458,6 +476,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "item_wise_tax_detail", "fieldname": "item_wise_tax_detail",
"fieldtype": "Code", "fieldtype": "Code",
"hidden": 1, "hidden": 1,
@ -484,6 +503,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "parenttype", "fieldname": "parenttype",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
@ -517,7 +537,7 @@
"issingle": 0, "issingle": 0,
"istable": 1, "istable": 1,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-07-11 03:28:08.283145", "modified": "2016-08-26 03:08:03.235381",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Sales Taxes and Charges", "name": "Sales Taxes and Charges",

View File

@ -4,12 +4,18 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe import _ from frappe import _
from frappe.utils import flt
from frappe.model.document import Document from frappe.model.document import Document
from erpnext.controllers.accounts_controller import validate_taxes_and_charges, validate_inclusive_tax from erpnext.controllers.accounts_controller import validate_taxes_and_charges, validate_inclusive_tax
class SalesTaxesandChargesTemplate(Document): class SalesTaxesandChargesTemplate(Document):
def validate(self): def validate(self):
valdiate_taxes_and_charges_template(self) valdiate_taxes_and_charges_template(self)
def set_missing_values(self):
for data in self.taxes:
if data.charge_type == 'On Net Total' and flt(data.rate) == 0.0:
data.rate = frappe.db.get_value('Account', data.account_head, 'tax_rate')
def valdiate_taxes_and_charges_template(doc): def valdiate_taxes_and_charges_template(doc):
# default should not be disabled # default should not be disabled

View File

@ -119,10 +119,11 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
this.list_body = this.list_dialog.body; this.list_body = this.list_dialog.body;
if(this.si_docs.length > 0){ if(this.si_docs.length > 0){
$(this.list_body).append('<div class="row list-row list-row-head pos-invoice-list">\ $(this.list_body).append('<div class="row list-row list-row-head pos-invoice-list">\
<div class="col-xs-2">Sr</div>\ <div class="col-xs-1">Sr</div>\
<div class="col-xs-4">Customer</div>\ <div class="col-xs-3">Customer</div>\
<div class="col-xs-2 text-left">Status</div>\ <div class="col-xs-2 text-left">Status</div>\
<div class="col-xs-4 text-right">Grand Total</div>\ <div class="col-xs-3 text-right">Paid Amount</div>\
<div class="col-xs-3 text-right">Grand Total</div>\
</div>') </div>')
$.each(this.si_docs, function(index, data){ $.each(this.si_docs, function(index, data){
@ -131,6 +132,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
sr: index + 1, sr: index + 1,
name: key, name: key,
customer: data[key].customer, customer: data[key].customer,
paid_amount: format_currency(data[key].paid_amount, me.frm.doc.currency),
grand_total: format_currency(data[key].grand_total, me.frm.doc.currency), grand_total: format_currency(data[key].grand_total, me.frm.doc.currency),
data: me.get_doctype_status(data[key]) data: me.get_doctype_status(data[key])
})).appendTo($(me.list_body)); })).appendTo($(me.list_body));
@ -154,12 +156,12 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
}, },
get_doctype_status: function(doc){ get_doctype_status: function(doc){
if(doc.outstanding_amount == 0){ if(doc.docstatus == 0) {
return {status: "Paid", indicator: "green"}
}else if(doc.docstatus == 0){
return {status: "Draft", indicator: "red"} return {status: "Draft", indicator: "red"}
}else if(doc.paid_amount >= 0){ }else if(doc.outstanding_amount == 0) {
return {status: "Unpaid", indicator: "orange"} return {status: "Paid", indicator: "green"}
}else {
return {status: "Submitted", indicator: "blue"}
} }
}, },
@ -244,7 +246,8 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
}) })
this.print_template = frappe.render_template("print_template", this.print_template = frappe.render_template("print_template",
{content: window.print_template, title:"POS"}) {content: window.print_template, title:"POS",
base_url: frappe.urllib.get_base_url(), print_css: frappe.boot.print_css})
}, },
setup: function(){ setup: function(){
@ -304,6 +307,15 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
}); });
this.party_field.make_input(); this.party_field.make_input();
this.set_focus()
},
set_focus: function(){
if(this.default_customer){
this.search.$input.focus();
}else{
this.party_field.$input.focus();
}
}, },
make_customer: function() { make_customer: function() {
@ -723,6 +735,26 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
}, "octicon octicon-plus").addClass("btn-primary"); }, "octicon octicon-plus").addClass("btn-primary");
}, },
print_dialog: function(){
var me = this;
msgprint = frappe.msgprint(format('<a class="btn btn-primary print_doc" \
style="margin-right: 5px;">{0}</a>\
<a class="btn btn-default new_doc">{1}</a>', [
__('Print'), __('New')
]));
$('.print_doc').click(function(){
html = frappe.render(me.print_template, me.frm.doc)
me.print_document(html)
})
$('.new_doc').click(function(){
msgprint.hide()
me.create_new();
})
},
print_document: function(html){ print_document: function(html){
var w = window.open(); var w = window.open();
w.document.write(html); w.document.write(html);
@ -735,10 +767,10 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
submit_invoice: function(){ submit_invoice: function(){
var me = this; var me = this;
frappe.confirm(__("Do you really want to submit the invoice?"), function () { this.change_status();
me.change_status(); if(this.frm.doc.docstatus == 1){
frappe.msgprint(__("Sales invoice submitted sucessfully.")) this.print_dialog()
}) }
}, },
change_status: function(){ change_status: function(){
@ -1029,7 +1061,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
validate_warehouse: function(){ validate_warehouse: function(){
if(!this.items[0].default_warehouse){ if(!this.items[0].default_warehouse){
frappe.throw(__("Deafault warehouse is required for selected item")) frappe.throw(__("Default warehouse is required for selected item"))
} }
} }
}) })

View File

@ -56,7 +56,6 @@ class ReceivablePayableReport(object):
"{range1}-{range2}".format(range1=cint(self.filters["range1"])+ 1, range2=self.filters["range2"]), "{range1}-{range2}".format(range1=cint(self.filters["range1"])+ 1, range2=self.filters["range2"]),
"{range2}-{range3}".format(range2=cint(self.filters["range2"])+ 1, range3=self.filters["range3"]), "{range2}-{range3}".format(range2=cint(self.filters["range2"])+ 1, range3=self.filters["range3"]),
"{range3}-{above}".format(range3=cint(self.filters["range3"])+ 1, above=_("Above"))): "{range3}-{above}".format(range3=cint(self.filters["range3"])+ 1, above=_("Above"))):
frappe.errprint(label)
columns.append({ columns.append({
"label": label, "label": label,
"fieldtype": "Currency", "fieldtype": "Currency",

View File

@ -8,23 +8,38 @@ from frappe.utils import flt
from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data) from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data)
def execute(filters=None): def execute(filters=None):
period_list = get_period_list(filters.fiscal_year, filters.periodicity) period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year, filters.periodicity)
asset = get_data(filters.company, "Asset", "Debit", period_list, only_current_fiscal_year=False) asset = get_data(filters.company, "Asset", "Debit", period_list, only_current_fiscal_year=False)
liability = get_data(filters.company, "Liability", "Credit", period_list, only_current_fiscal_year=False) liability = get_data(filters.company, "Liability", "Credit", period_list, only_current_fiscal_year=False)
equity = get_data(filters.company, "Equity", "Credit", period_list, only_current_fiscal_year=False) equity = get_data(filters.company, "Equity", "Credit", period_list, only_current_fiscal_year=False)
provisional_profit_loss = get_provisional_profit_loss(asset, liability, equity, provisional_profit_loss,total_credit = get_provisional_profit_loss(asset, liability, equity,
period_list, filters.company) period_list, filters.company)
message = check_opening_balance(asset, liability, equity) message,opening_balance = check_opening_balance(asset, liability, equity)
data = [] data = []
data.extend(asset or []) data.extend(asset or [])
data.extend(liability or []) data.extend(liability or [])
data.extend(equity or []) data.extend(equity or [])
if opening_balance and round(opening_balance,2) !=0:
unclosed ={
"account_name": "'" + _("Unclosed Fiscal Years Profit / Loss (Credit)") + "'",
"account": None,
"warn_if_negative": True,
"currency": frappe.db.get_value("Company", filters.company, "default_currency")
}
for period in period_list:
unclosed[period.key] = opening_balance
provisional_profit_loss[period.key] = provisional_profit_loss[period.key] - opening_balance
unclosed["total"]=opening_balance
data.append(unclosed)
if provisional_profit_loss: if provisional_profit_loss:
data.append(provisional_profit_loss) data.append(provisional_profit_loss)
if total_credit:
data.append(total_credit)
columns = get_columns(filters.periodicity, period_list, company=filters.company) columns = get_columns(filters.periodicity, period_list, company=filters.company)
@ -34,14 +49,20 @@ def execute(filters=None):
def get_provisional_profit_loss(asset, liability, equity, period_list, company): def get_provisional_profit_loss(asset, liability, equity, period_list, company):
if asset and (liability or equity): if asset and (liability or equity):
total=0 total = total_row_total=0
currency = frappe.db.get_value("Company", company, "default_currency")
provisional_profit_loss = { provisional_profit_loss = {
"account_name": "'" + _("Provisional Profit / Loss (Credit)") + "'", "account_name": "'" + _("Provisional Profit / Loss (Credit)") + "'",
"account": None, "account": None,
"warn_if_negative": True, "warn_if_negative": True,
"currency": frappe.db.get_value("Company", company, "default_currency") "currency": currency
}
total_row = {
"account_name": "'" + _("Total (Credit)") + "'",
"account": None,
"warn_if_negative": True,
"currency": currency
} }
has_value = False has_value = False
for period in period_list: for period in period_list:
@ -52,15 +73,21 @@ def get_provisional_profit_loss(asset, liability, equity, period_list, company):
effective_liability += flt(equity[-2].get(period.key)) effective_liability += flt(equity[-2].get(period.key))
provisional_profit_loss[period.key] = flt(asset[-2].get(period.key)) - effective_liability provisional_profit_loss[period.key] = flt(asset[-2].get(period.key)) - effective_liability
total_row[period.key] = effective_liability + provisional_profit_loss[period.key]
if provisional_profit_loss[period.key]: if provisional_profit_loss[period.key]:
has_value = True has_value = True
total += flt(provisional_profit_loss[period.key]) total += flt(provisional_profit_loss[period.key])
provisional_profit_loss["total"] = total provisional_profit_loss["total"] = total
total_row_total += flt(total_row[period.key])
total_row["total"] = total_row_total
if has_value: if has_value:
return provisional_profit_loss return provisional_profit_loss, total_row
return None,total_row
return None, None
def check_opening_balance(asset, liability, equity): def check_opening_balance(asset, liability, equity):
# Check if previous year balance sheet closed # Check if previous year balance sheet closed
@ -70,10 +97,11 @@ def check_opening_balance(asset, liability, equity):
if liability: if liability:
opening_balance -= flt(liability[0].get("opening_balance", 0)) opening_balance -= flt(liability[0].get("opening_balance", 0))
if equity: if equity:
opening_balance -= flt(asset[0].get("opening_balance", 0)) opening_balance -= flt(equity[0].get("opening_balance", 0))
if opening_balance: if opening_balance:
return _("Previous Financial Year is not closed") return _("Previous Financial Year is not closed"),opening_balance
return None,None
def get_chart_data(columns, asset, liability, equity): def get_chart_data(columns, asset, liability, equity):
x_intervals = ['x'] + [d.get("label") for d in columns[2:]] x_intervals = ['x'] + [d.get("label") for d in columns[2:]]
@ -101,4 +129,4 @@ def get_chart_data(columns, asset, liability, equity):
'x': 'x', 'x': 'x',
'columns': columns 'columns': columns
} }
} }

View File

@ -2,7 +2,8 @@
// For license information, please see license.txt // For license information, please see license.txt
frappe.require("assets/erpnext/js/financial_statements.js", function() { frappe.require("assets/erpnext/js/financial_statements.js", function() {
frappe.query_reports["Cash Flow"] = erpnext.financial_statements; frappe.query_reports["Cash Flow"] = $.extend({},
erpnext.financial_statements);
frappe.query_reports["Cash Flow"]["filters"].push({ frappe.query_reports["Cash Flow"]["filters"].push({
"fieldname": "accumulated_values", "fieldname": "accumulated_values",

View File

@ -6,10 +6,11 @@ import frappe
from frappe import _ from frappe import _
from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data) from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data)
from erpnext.accounts.report.profit_and_loss_statement.profit_and_loss_statement import get_net_profit_loss from erpnext.accounts.report.profit_and_loss_statement.profit_and_loss_statement import get_net_profit_loss
from erpnext.accounts.utils import get_fiscal_year
def execute(filters=None): def execute(filters=None):
period_list = get_period_list(filters.fiscal_year, filters.periodicity) period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year, filters.periodicity)
operation_accounts = { operation_accounts = {
"section_name": "Operations", "section_name": "Operations",
@ -49,9 +50,9 @@ def execute(filters=None):
# compute net profit / loss # compute net profit / loss
income = get_data(filters.company, "Income", "Credit", period_list, income = get_data(filters.company, "Income", "Credit", period_list,
accumulated_values=filters.accumulated_values, ignore_closing_entries=True) accumulated_values=filters.accumulated_values, ignore_closing_entries=True, ignore_accumulated_values_for_fy= True)
expense = get_data(filters.company, "Expense", "Debit", period_list, expense = get_data(filters.company, "Expense", "Debit", period_list,
accumulated_values=filters.accumulated_values, ignore_closing_entries=True) accumulated_values=filters.accumulated_values, ignore_closing_entries=True, ignore_accumulated_values_for_fy= True)
net_profit_loss = get_net_profit_loss(income, expense, period_list, filters.company) net_profit_loss = get_net_profit_loss(income, expense, period_list, filters.company)
@ -98,33 +99,39 @@ def execute(filters=None):
return columns, data return columns, data
def get_account_type_based_data(company, account_type, period_list, accumulated_values): def get_account_type_based_data(company, account_type, period_list, accumulated_values):
data = {} data = {}
total = 0 total = 0
for period in period_list: for period in period_list:
start_date = get_start_date(period, accumulated_values)
gl_sum = frappe.db.sql_list(""" gl_sum = frappe.db.sql_list("""
select sum(credit) - sum(debit) select sum(credit) - sum(debit)
from `tabGL Entry` from `tabGL Entry`
where company=%s and posting_date >= %s and posting_date <= %s where company=%s and posting_date >= %s and posting_date <= %s
and voucher_type != 'Period Closing Voucher' and voucher_type != 'Period Closing Voucher'
and account in ( SELECT name FROM tabAccount WHERE account_type = %s) and account in ( SELECT name FROM tabAccount WHERE account_type = %s)
""", (company, period["year_start_date"] if accumulated_values else period['from_date'], """, (company, start_date if accumulated_values else period['from_date'],
period['to_date'], account_type)) period['to_date'], account_type))
if gl_sum and gl_sum[0]: if gl_sum and gl_sum[0]:
amount = gl_sum[0] amount = gl_sum[0]
if account_type == "Depreciation": if account_type == "Depreciation":
amount *= -1 amount *= -1
else: else:
amount = 0 amount = 0
total += amount total += amount
data.setdefault(period["key"], amount) data.setdefault(period["key"], amount)
data["total"] = total data["total"] = total
return data return data
def get_start_date(period, accumulated_values):
start_date = period["year_start_date"]
if accumulated_values:
start_date = get_fiscal_year(period.to_date)[1]
return start_date
def add_total_row_account(out, data, label, period_list, currency): def add_total_row_account(out, data, label, period_list, currency):
total_row = { total_row = {

View File

@ -7,12 +7,12 @@
"doctype": "Report", "doctype": "Report",
"idx": 1, "idx": 1,
"is_standard": "Yes", "is_standard": "Yes",
"modified": "2016-05-17 08:40:18.711626", "modified": "2016-08-18 14:29:50.680329",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Delivered Items To Be Billed", "name": "Delivered Items To Be Billed",
"owner": "Administrator", "owner": "Administrator",
"query": "select\n `tabDelivery Note`.`name` as \"Delivery Note:Link/Delivery Note:120\",\n\t`tabDelivery Note`.`customer` as \"Customer:Link/Customer:120\",\n\t`tabDelivery Note`.`posting_date` as \"Date:Date\",\n\t`tabDelivery Note`.`project` as \"Project\",\n\t`tabDelivery Note Item`.`item_code` as \"Item:Link/Item:120\",\n\t(`tabDelivery Note Item`.`base_amount` - `tabDelivery Note Item`.`billed_amt`*ifnull(`tabDelivery Note`.conversion_rate, 1)) as \"Pending Amount:Currency:110\",\n\t`tabDelivery Note Item`.`item_name` as \"Item Name::150\",\n\t`tabDelivery Note Item`.`description` as \"Description::200\",\n\t`tabDelivery Note`.`company` as \"Company:Link/Company:\"\nfrom `tabDelivery Note`, `tabDelivery Note Item`\nwhere \n `tabDelivery Note`.name = `tabDelivery Note Item`.parent \n and `tabDelivery Note`.docstatus = 1 \n and `tabDelivery Note`.`status` not in (\"Stopped\", \"Closed\") \n and `tabDelivery Note Item`.amount > 0\n and `tabDelivery Note Item`.billed_amt < `tabDelivery Note Item`.amount\norder by `tabDelivery Note`.`name` desc", "query": "select\n `tabDelivery Note`.`name` as \"Delivery Note:Link/Delivery Note:120\",\n\t`tabDelivery Note`.`customer` as \"Customer:Link/Customer:120\",\n\t`tabDelivery Note`.`customer_name` as \"Customer Name::150\",\n\t`tabDelivery Note`.`posting_date` as \"Date:Date\",\n\t`tabDelivery Note`.`project` as \"Project\",\n\t`tabDelivery Note Item`.`item_code` as \"Item:Link/Item:120\",\n\t(`tabDelivery Note Item`.`base_amount` - `tabDelivery Note Item`.`billed_amt`*ifnull(`tabDelivery Note`.conversion_rate, 1)) as \"Pending Amount:Currency:110\",\n\t`tabDelivery Note Item`.`item_name` as \"Item Name::150\",\n\t`tabDelivery Note Item`.`description` as \"Description::200\",\n\t`tabDelivery Note`.`company` as \"Company:Link/Company:\"\nfrom `tabDelivery Note`, `tabDelivery Note Item`\nwhere \n `tabDelivery Note`.name = `tabDelivery Note Item`.parent \n and `tabDelivery Note`.docstatus = 1 \n and `tabDelivery Note`.`status` not in (\"Stopped\", \"Closed\") \n and `tabDelivery Note Item`.amount > 0\n and `tabDelivery Note Item`.billed_amt < `tabDelivery Note Item`.amount\norder by `tabDelivery Note`.`name` desc",
"ref_doctype": "Sales Invoice", "ref_doctype": "Sales Invoice",
"report_name": "Delivered Items To Be Billed", "report_name": "Delivered Items To Be Billed",
"report_type": "Query Report" "report_type": "Query Report"

View File

@ -3,61 +3,63 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
import math
from frappe import _ from frappe import _
from frappe.utils import (flt, getdate, get_first_day, get_last_day, from frappe.utils import (flt, getdate, get_first_day, get_last_day, date_diff,
add_months, add_days, formatdate) add_months, add_days, formatdate, cint)
def get_period_list(fiscal_year, periodicity): def get_period_list(from_fiscal_year, to_fiscal_year, periodicity):
"""Get a list of dict {"from_date": from_date, "to_date": to_date, "key": key, "label": label} """Get a list of dict {"from_date": from_date, "to_date": to_date, "key": key, "label": label}
Periodicity can be (Yearly, Quarterly, Monthly)""" Periodicity can be (Yearly, Quarterly, Monthly)"""
fy_start_end_date = frappe.db.get_value("Fiscal Year", fiscal_year, ["year_start_date", "year_end_date"]) fiscal_year = get_fiscal_year_data(from_fiscal_year, to_fiscal_year)
if not fy_start_end_date: validate_fiscal_year(fiscal_year, from_fiscal_year, to_fiscal_year)
frappe.throw(_("Fiscal Year {0} not found.").format(fiscal_year))
# start with first day, so as to avoid year to_dates like 2-April if ever they occur] # start with first day, so as to avoid year to_dates like 2-April if ever they occur]
year_start_date = get_first_day(getdate(fy_start_end_date[0])) year_start_date = getdate(fiscal_year.year_start_date)
year_end_date = getdate(fy_start_end_date[1]) year_end_date = getdate(fiscal_year.year_end_date)
if periodicity == "Yearly":
period_list = [frappe._dict({"from_date": year_start_date, "to_date": year_end_date,
"key": fiscal_year, "label": fiscal_year})]
else:
months_to_add = {
"Half-Yearly": 6,
"Quarterly": 3,
"Monthly": 1
}[periodicity]
period_list = [] months_to_add = {
"Yearly": 12,
"Half-Yearly": 6,
"Quarterly": 3,
"Monthly": 1
}[periodicity]
start_date = year_start_date period_list = []
for i in xrange(12 / months_to_add):
period = frappe._dict({ start_date = year_start_date
"from_date": start_date months = get_months(year_start_date, year_end_date)
})
to_date = add_months(start_date, months_to_add) for i in xrange(months / months_to_add):
start_date = to_date period = frappe._dict({
"from_date": start_date
if to_date == get_first_day(to_date): })
# if to_date is the first day, get the last day of previous month
to_date = add_days(to_date, -1) to_date = add_months(start_date, months_to_add)
else: start_date = to_date
# to_date should be the last day of the new to_date's month
to_date = get_last_day(to_date) if to_date == get_first_day(to_date):
# if to_date is the first day, get the last day of previous month
to_date = add_days(to_date, -1)
else:
# to_date should be the last day of the new to_date's month
to_date = get_last_day(to_date)
if to_date <= year_end_date:
# the normal case
period.to_date = to_date
else:
# if a fiscal year ends before a 12 month period
period.to_date = year_end_date
period.to_date_fiscal_year = get_date_fiscal_year(period.to_date)
period_list.append(period)
if period.to_date == year_end_date:
break
if to_date <= year_end_date:
# the normal case
period.to_date = to_date
else:
# if a fiscal year ends before a 12 month period
period.to_date = year_end_date
period_list.append(period)
if period.to_date == year_end_date:
break
# common processing # common processing
for opts in period_list: for opts in period_list:
key = opts["to_date"].strftime("%b_%Y").lower() key = opts["to_date"].strftime("%b_%Y").lower()
@ -75,6 +77,22 @@ def get_period_list(fiscal_year, periodicity):
return period_list return period_list
def get_fiscal_year_data(from_fiscal_year, to_fiscal_year):
fiscal_year = frappe.db.sql("""select min(year_start_date) as year_start_date,
max(year_end_date) as year_end_date from `tabFiscal Year` where
name between %(from_fiscal_year)s and %(to_fiscal_year)s""",
{'from_fiscal_year': from_fiscal_year, 'to_fiscal_year': to_fiscal_year}, as_dict=1)
return fiscal_year[0] if fiscal_year else {}
def validate_fiscal_year(fiscal_year, from_fiscal_year, to_fiscal_year):
if not fiscal_year.get('year_start_date') and not fiscal_year.get('year_end_date'):
frappe.throw(_("End Year cannot be before Start Year"))
def get_months(start_date, end_date):
diff = (12 * end_date.year + end_date.month) - (12 * start_date.year + start_date.month)
return diff + 1
def get_label(periodicity, from_date, to_date): def get_label(periodicity, from_date, to_date):
if periodicity=="Yearly": if periodicity=="Yearly":
if formatdate(from_date, "YYYY") == formatdate(to_date, "YYYY"): if formatdate(from_date, "YYYY") == formatdate(to_date, "YYYY"):
@ -86,8 +104,9 @@ def get_label(periodicity, from_date, to_date):
return label return label
def get_data(company, root_type, balance_must_be, period_list, def get_data(company, root_type, balance_must_be, period_list, filters=None,
accumulated_values=1, only_current_fiscal_year=True, ignore_closing_entries=False): accumulated_values=1, only_current_fiscal_year=True, ignore_closing_entries=False,
ignore_accumulated_values_for_fy=False):
accounts = get_accounts(company, root_type) accounts = get_accounts(company, root_type)
if not accounts: if not accounts:
return None return None
@ -103,10 +122,10 @@ def get_data(company, root_type, balance_must_be, period_list,
set_gl_entries_by_account(company, set_gl_entries_by_account(company,
period_list[0]["year_start_date"] if only_current_fiscal_year else None, period_list[0]["year_start_date"] if only_current_fiscal_year else None,
period_list[-1]["to_date"], period_list[-1]["to_date"],
root.lft, root.rgt, root.lft, root.rgt, filters,
gl_entries_by_account, ignore_closing_entries=ignore_closing_entries) gl_entries_by_account, ignore_closing_entries=ignore_closing_entries)
calculate_values(accounts_by_name, gl_entries_by_account, period_list, accumulated_values) calculate_values(accounts_by_name, gl_entries_by_account, period_list, accumulated_values, ignore_accumulated_values_for_fy)
accumulate_values_into_parents(accounts, accounts_by_name, period_list, accumulated_values) accumulate_values_into_parents(accounts, accounts_by_name, period_list, accumulated_values)
out = prepare_data(accounts, balance_must_be, period_list, company_currency) out = prepare_data(accounts, balance_must_be, period_list, company_currency)
out = filter_out_zero_value_rows(out, parent_children_map) out = filter_out_zero_value_rows(out, parent_children_map)
@ -116,18 +135,25 @@ def get_data(company, root_type, balance_must_be, period_list,
return out return out
def calculate_values(accounts_by_name, gl_entries_by_account, period_list, accumulated_values): def calculate_values(accounts_by_name, gl_entries_by_account, period_list, accumulated_values, ignore_accumulated_values_for_fy):
for entries in gl_entries_by_account.values(): for entries in gl_entries_by_account.values():
for entry in entries: for entry in entries:
d = accounts_by_name.get(entry.account) d = accounts_by_name.get(entry.account)
for period in period_list: for period in period_list:
# check if posting date is within the period # check if posting date is within the period
if entry.posting_date <= period.to_date: if entry.posting_date <= period.to_date:
if accumulated_values or entry.posting_date >= period.from_date: if (accumulated_values or entry.posting_date >= period.from_date) and \
(entry.fiscal_year == period.to_date_fiscal_year or not ignore_accumulated_values_for_fy):
d[period.key] = d.get(period.key, 0.0) + flt(entry.debit) - flt(entry.credit) d[period.key] = d.get(period.key, 0.0) + flt(entry.debit) - flt(entry.credit)
if entry.posting_date < period_list[0].year_start_date: if entry.posting_date < period_list[0].year_start_date:
d["opening_balance"] = d.get("opening_balance", 0.0) + flt(entry.debit) - flt(entry.credit) d["opening_balance"] = d.get("opening_balance", 0.0) + flt(entry.debit) - flt(entry.credit)
def get_date_fiscal_year(date):
from erpnext.accounts.utils import get_fiscal_year
return get_fiscal_year(date)[0]
def accumulate_values_into_parents(accounts, accounts_by_name, period_list, accumulated_values): def accumulate_values_into_parents(accounts, accounts_by_name, period_list, accumulated_values):
"""accumulate children's values in parent accounts""" """accumulate children's values in parent accounts"""
@ -261,24 +287,19 @@ def sort_root_accounts(roots):
roots.sort(compare_roots) roots.sort(compare_roots)
def set_gl_entries_by_account(company, from_date, to_date, root_lft, root_rgt, gl_entries_by_account, def set_gl_entries_by_account(company, from_date, to_date, root_lft, root_rgt, filters, gl_entries_by_account,
ignore_closing_entries=False): ignore_closing_entries=False):
"""Returns a dict like { "account": [gl entries], ... }""" """Returns a dict like { "account": [gl entries], ... }"""
additional_conditions = []
if ignore_closing_entries: additional_conditions = get_additional_conditions(from_date, ignore_closing_entries, filters)
additional_conditions.append("and ifnull(voucher_type, '')!='Period Closing Voucher'")
if from_date: gl_entries = frappe.db.sql("""select posting_date, account, debit, credit, is_opening, fiscal_year from `tabGL Entry`
additional_conditions.append("and posting_date >= %(from_date)s")
gl_entries = frappe.db.sql("""select posting_date, account, debit, credit, is_opening from `tabGL Entry`
where company=%(company)s where company=%(company)s
{additional_conditions} {additional_conditions}
and posting_date <= %(to_date)s and posting_date <= %(to_date)s
and account in (select name from `tabAccount` and account in (select name from `tabAccount`
where lft >= %(lft)s and rgt <= %(rgt)s) where lft >= %(lft)s and rgt <= %(rgt)s)
order by account, posting_date""".format(additional_conditions="\n".join(additional_conditions)), order by account, posting_date""".format(additional_conditions=additional_conditions),
{ {
"company": company, "company": company,
"from_date": from_date, "from_date": from_date,
@ -293,6 +314,22 @@ def set_gl_entries_by_account(company, from_date, to_date, root_lft, root_rgt, g
return gl_entries_by_account return gl_entries_by_account
def get_additional_conditions(from_date, ignore_closing_entries, filters):
additional_conditions = []
if ignore_closing_entries:
additional_conditions.append("ifnull(voucher_type, '')!='Period Closing Voucher'")
if from_date:
additional_conditions.append("posting_date >= %(from_date)s")
if filters:
for key in ['cost_center', 'project']:
if filters.get(key):
additional_conditions.append("%s = '%s'"%(key, filters.get(key)))
return " and {}".format(" and ".join(additional_conditions)) if additional_conditions else ""
def get_columns(periodicity, period_list, accumulated_values=1, company=None): def get_columns(periodicity, period_list, accumulated_values=1, company=None):
columns = [{ columns = [{
"fieldname": "account", "fieldname": "account",

View File

@ -33,7 +33,7 @@ frappe.query_reports["General Ledger"] = {
"fieldtype": "Link", "fieldtype": "Link",
"options": "Account", "options": "Account",
"get_query": function() { "get_query": function() {
var company = frappe.query_report.filters_by_name.company.get_value(); var company = frappe.query_report_filters_by_name.company.get_value();
return { return {
"doctype": "Account", "doctype": "Account",
"filters": { "filters": {
@ -62,8 +62,8 @@ frappe.query_reports["General Ledger"] = {
"label": __("Party"), "label": __("Party"),
"fieldtype": "Dynamic Link", "fieldtype": "Dynamic Link",
"get_options": function() { "get_options": function() {
var party_type = frappe.query_report.filters_by_name.party_type.get_value(); var party_type = frappe.query_report_filters_by_name.party_type.get_value();
var party = frappe.query_report.filters_by_name.party.get_value(); var party = frappe.query_report_filters_by_name.party.get_value();
if(party && !party_type) { if(party && !party_type) {
frappe.throw(__("Please select Party Type first")); frappe.throw(__("Please select Party Type first"));
} }

View File

@ -91,6 +91,7 @@ def get_columns(filters):
_("Voucher Type") + "::120", _("Voucher No") + ":Dynamic Link/"+_("Voucher Type")+":160", _("Voucher Type") + "::120", _("Voucher No") + ":Dynamic Link/"+_("Voucher Type")+":160",
_("Against Account") + "::120", _("Party Type") + "::80", _("Party") + "::150", _("Against Account") + "::120", _("Party Type") + "::80", _("Party") + "::150",
_("Project") + ":Link/Project:100", _("Cost Center") + ":Link/Cost Center:100", _("Project") + ":Link/Project:100", _("Cost Center") + ":Link/Cost Center:100",
_("Against Voucher Type") + "::120", _("Against Voucher") + ":Dynamic Link/"+_("Against Voucher Type")+":160",
_("Remarks") + "::400" _("Remarks") + "::400"
] ]
@ -118,6 +119,7 @@ def get_gl_entries(filters):
posting_date, account, party_type, party, posting_date, account, party_type, party,
sum(debit) as debit, sum(credit) as credit, sum(debit) as debit, sum(credit) as credit,
voucher_type, voucher_no, cost_center, project, voucher_type, voucher_no, cost_center, project,
against_voucher_type, against_voucher,
remarks, against, is_opening {select_fields} remarks, against, is_opening {select_fields}
from `tabGL Entry` from `tabGL Entry`
where company=%(company)s {conditions} where company=%(company)s {conditions}
@ -290,7 +292,7 @@ def get_result_as_list(data, filters):
row += [d.get("debit_in_account_currency"), d.get("credit_in_account_currency")] row += [d.get("debit_in_account_currency"), d.get("credit_in_account_currency")]
row += [d.get("voucher_type"), d.get("voucher_no"), d.get("against"), row += [d.get("voucher_type"), d.get("voucher_no"), d.get("against"),
d.get("party_type"), d.get("party"), d.get("project"), d.get("cost_center"), d.get("remarks") d.get("party_type"), d.get("party"), d.get("project"), d.get("cost_center"), d.get("against_voucher_type"), d.get("against_voucher"), d.get("remarks")
] ]
result.append(row) result.append(row)

View File

@ -6,6 +6,7 @@ import frappe
from frappe import _, scrub from frappe import _, scrub
from frappe.utils import flt from frappe.utils import flt
def execute(filters=None): def execute(filters=None):
if not filters: filters = frappe._dict() if not filters: filters = frappe._dict()
company_currency = frappe.db.get_value("Company", filters.company, "default_currency") company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
@ -16,7 +17,7 @@ def execute(filters=None):
source = gross_profit_data.grouped_data if filters.get("group_by") != "Invoice" else gross_profit_data.data source = gross_profit_data.grouped_data if filters.get("group_by") != "Invoice" else gross_profit_data.data
group_wise_columns = frappe._dict({ group_wise_columns = frappe._dict({
"invoice": ["parent", "customer", "posting_date","item_code", "item_name","item_group", "brand", "description", \ "invoice": ["parent", "customer", "customer_group", "posting_date","item_code", "item_name","item_group", "brand", "description", \
"warehouse", "qty", "base_rate", "buying_rate", "base_amount", "warehouse", "qty", "base_rate", "buying_rate", "base_amount",
"buying_amount", "gross_profit", "gross_profit_percent", "project"], "buying_amount", "gross_profit", "gross_profit_percent", "project"],
"item_code": ["item_code", "item_name", "brand", "description", "qty", "base_rate", "item_code": ["item_code", "item_name", "brand", "description", "qty", "base_rate",
@ -188,8 +189,8 @@ class GrossProfitGenerator(object):
# stock_ledger_entries should already be filtered by item_code and warehouse and # stock_ledger_entries should already be filtered by item_code and warehouse and
# sorted by posting_date desc, posting_time desc # sorted by posting_date desc, posting_time desc
if item_code in self.non_stock_items: if item_code in self.non_stock_items:
# average purchasing rate for non-stock items #Issue 6089-Get last purchasing rate for non-stock item
item_rate = self.get_average_buying_rate(item_code) item_rate = self.get_last_purchase_rate(item_code)
return flt(row.qty) * item_rate return flt(row.qty) * item_rate
else: else:
@ -225,6 +226,22 @@ class GrossProfitGenerator(object):
return self.average_buying_rate[item_code] return self.average_buying_rate[item_code]
def get_last_purchase_rate(self, item_code):
if self.filters.to_date:
last_purchase_rate = frappe.db.sql("""
select (a.base_rate / a.conversion_factor)
from `tabPurchase Invoice Item` a
where a.item_code = %s and a.docstatus=1
and modified <= %s
order by a.modified desc limit 1""", (item_code,self.filters.to_date))
else:
last_purchase_rate = frappe.db.sql("""
select (a.base_rate / a.conversion_factor)
from `tabPurchase Invoice Item` a
where a.item_code = %s and a.docstatus=1
order by a.modified desc limit 1""", item_code)
return flt(last_purchase_rate[0][0]) if last_purchase_rate else 0
def load_invoice_items(self): def load_invoice_items(self):
conditions = "" conditions = ""
if self.filters.company: if self.filters.company:

View File

@ -32,6 +32,8 @@ def execute(filters=None):
elif d.so_detail: elif d.so_detail:
delivery_note = ", ".join(frappe.db.sql_list("""select distinct parent delivery_note = ", ".join(frappe.db.sql_list("""select distinct parent
from `tabDelivery Note Item` where docstatus=1 and so_detail=%s""", d.so_detail)) from `tabDelivery Note Item` where docstatus=1 and so_detail=%s""", d.so_detail))
if not delivery_note and d.update_stock:
delivery_note = d.parent
row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date, d.customer, d.customer_name, row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date, d.customer, d.customer_name,
d.customer_group, d.debit_to, ", ".join(mode_of_payments.get(d.parent, [])), d.customer_group, d.debit_to, ", ".join(mode_of_payments.get(d.parent, [])),
@ -91,7 +93,7 @@ def get_items(filters):
si_item.item_code, si_item.item_name, si_item.item_group, si_item.sales_order, si_item.item_code, si_item.item_name, si_item.item_group, si_item.sales_order,
si_item.delivery_note, si_item.income_account, si_item.cost_center, si_item.qty, si_item.delivery_note, si_item.income_account, si_item.cost_center, si_item.qty,
si_item.base_net_rate, si_item.base_net_amount, si.customer_name, si_item.base_net_rate, si_item.base_net_amount, si.customer_name,
si.customer_group, si_item.so_detail si.customer_group, si_item.so_detail, si.update_stock
from `tabSales Invoice` si, `tabSales Invoice Item` si_item from `tabSales Invoice` si, `tabSales Invoice Item` si_item
where si.name = si_item.parent and si.docstatus = 1 %s where si.name = si_item.parent and si.docstatus = 1 %s
order by si.posting_date desc, si_item.item_code desc""" % conditions, filters, as_dict=1) order by si.posting_date desc, si_item.item_code desc""" % conditions, filters, as_dict=1)

View File

@ -7,12 +7,12 @@
"doctype": "Report", "doctype": "Report",
"idx": 1, "idx": 1,
"is_standard": "Yes", "is_standard": "Yes",
"modified": "2016-05-17 08:26:50.810208", "modified": "2016-08-18 14:29:50.680329",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Ordered Items To Be Billed", "name": "Ordered Items To Be Billed",
"owner": "Administrator", "owner": "Administrator",
"query": "select \n `tabSales Order`.`name` as \"Sales Order:Link/Sales Order:120\",\n `tabSales Order`.`customer` as \"Customer:Link/Customer:120\",\n `tabSales Order`.`status` as \"Status\",\n `tabSales Order`.`transaction_date` as \"Date:Date\",\n `tabSales Order`.`project` as \"Project\",\n `tabSales Order Item`.item_code as \"Item:Link/Item:120\",\n `tabSales Order Item`.base_amount as \"Amount:Currency:110\",\n (`tabSales Order Item`.billed_amt * ifnull(`tabSales Order`.conversion_rate, 1)) as \"Billed Amount:Currency:110\",\n (`tabSales Order Item`.base_amount - (`tabSales Order Item`.billed_amt * ifnull(`tabSales Order`.conversion_rate, 1))) as \"Pending Amount:Currency:120\",\n `tabSales Order Item`.item_name as \"Item Name::150\",\n `tabSales Order Item`.description as \"Description::200\",\n `tabSales Order`.`company` as \"Company:Link/Company:\"\nfrom\n `tabSales Order`, `tabSales Order Item`\nwhere\n `tabSales Order Item`.`parent` = `tabSales Order`.`name`\n and `tabSales Order`.docstatus = 1\n and `tabSales Order`.status != \"Closed\"\n and `tabSales Order Item`.amount > 0\n and `tabSales Order Item`.billed_amt < `tabSales Order Item`.amount\norder by `tabSales Order`.transaction_date asc", "query": "select \n `tabSales Order`.`name` as \"Sales Order:Link/Sales Order:120\",\n `tabSales Order`.`customer` as \"Customer:Link/Customer:120\",\n `tabSales Order`.`customer_name` as \"Customer Name:150\",\n`tabSales Order`.`status` as \"Status\",\n `tabSales Order`.`transaction_date` as \"Date:Date\",\n `tabSales Order`.`project` as \"Project\",\n `tabSales Order Item`.item_code as \"Item:Link/Item:120\",\n `tabSales Order Item`.base_amount as \"Amount:Currency:110\",\n (`tabSales Order Item`.billed_amt * ifnull(`tabSales Order`.conversion_rate, 1)) as \"Billed Amount:Currency:110\",\n (`tabSales Order Item`.base_amount - (`tabSales Order Item`.billed_amt * ifnull(`tabSales Order`.conversion_rate, 1))) as \"Pending Amount:Currency:120\",\n `tabSales Order Item`.item_name as \"Item Name::150\",\n `tabSales Order Item`.description as \"Description::200\",\n `tabSales Order`.`company` as \"Company:Link/Company:\"\nfrom\n `tabSales Order`, `tabSales Order Item`\nwhere\n `tabSales Order Item`.`parent` = `tabSales Order`.`name`\n and `tabSales Order`.docstatus = 1\n and `tabSales Order`.status != \"Closed\"\n and `tabSales Order Item`.amount > 0\n and `tabSales Order Item`.billed_amt < `tabSales Order Item`.amount\norder by `tabSales Order`.transaction_date asc",
"ref_doctype": "Sales Invoice", "ref_doctype": "Sales Invoice",
"report_name": "Ordered Items To Be Billed", "report_name": "Ordered Items To Be Billed",
"report_type": "Query Report" "report_type": "Query Report"

View File

@ -46,8 +46,8 @@ frappe.query_reports["Payment Period Based On Invoice Date"] = {
"label": __("Party"), "label": __("Party"),
"fieldtype": "Dynamic Link", "fieldtype": "Dynamic Link",
"get_options": function() { "get_options": function() {
var party_type = frappe.query_report.filters_by_name.party_type.get_value(); var party_type = frappe.query_report_filters_by_name.party_type.get_value();
var party = frappe.query_report.filters_by_name.party.get_value(); var party = frappe.query_report_filters_by_name.party.get_value();
if(party && !party_type) { if(party && !party_type) {
frappe.throw(__("Please select Party Type first")); frappe.throw(__("Please select Party Type first"));
} }

View File

@ -5,9 +5,23 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() {
frappe.query_reports["Profit and Loss Statement"] = $.extend({}, frappe.query_reports["Profit and Loss Statement"] = $.extend({},
erpnext.financial_statements); erpnext.financial_statements);
frappe.query_reports["Profit and Loss Statement"]["filters"].push({ frappe.query_reports["Profit and Loss Statement"]["filters"].push(
"fieldname": "accumulated_values", {
"label": __("Accumulated Values"), "fieldname":"cost_center",
"fieldtype": "Check" "label": __("Cost Center"),
}); "fieldtype": "Link",
"options": "Cost Center"
},
{
"fieldname":"project",
"label": __("Project"),
"fieldtype": "Link",
"options": "Project"
},
{
"fieldname": "accumulated_values",
"label": __("Accumulated Values"),
"fieldtype": "Check"
}
);
}); });

View File

@ -8,12 +8,12 @@ from frappe.utils import flt
from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data) from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data)
def execute(filters=None): def execute(filters=None):
period_list = get_period_list(filters.fiscal_year, filters.periodicity) period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year, filters.periodicity)
income = get_data(filters.company, "Income", "Credit", period_list, income = get_data(filters.company, "Income", "Credit", period_list, filters = filters,
accumulated_values=filters.accumulated_values, ignore_closing_entries=True) accumulated_values=filters.accumulated_values, ignore_closing_entries=True, ignore_accumulated_values_for_fy= True)
expense = get_data(filters.company, "Expense", "Debit", period_list, expense = get_data(filters.company, "Expense", "Debit", period_list, filters=filters,
accumulated_values=filters.accumulated_values, ignore_closing_entries=True) accumulated_values=filters.accumulated_values, ignore_closing_entries=True, ignore_accumulated_values_for_fy= True)
net_profit_loss = get_net_profit_loss(income, expense, period_list, filters.company) net_profit_loss = get_net_profit_loss(income, expense, period_list, filters.company)
@ -54,7 +54,7 @@ def get_net_profit_loss(income, expense, period_list, company):
return net_profit_loss return net_profit_loss
def get_chart_data(filters, columns, income, expense, net_profit_loss): def get_chart_data(filters, columns, income, expense, net_profit_loss):
x_intervals = ['x'] + [d.get("label") for d in columns[2:-1]] x_intervals = ['x'] + [d.get("label") for d in columns[2:]]
income_data, expense_data, net_profit = [], [], [] income_data, expense_data, net_profit = [], [], []

View File

@ -0,0 +1,106 @@
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.require("assets/erpnext/js/financial_statements.js", function() {
frappe.query_reports["Profitability Analysis"] = {
"filters": [
{
"fieldname": "company",
"label": __("Company"),
"fieldtype": "Link",
"options": "Company",
"default": frappe.defaults.get_user_default("Company"),
"reqd": 1
},
{
"fieldname": "based_on",
"label": __("Based On"),
"fieldtype": "Select",
"options": "Cost Center\nProject",
"default": "Cost Center",
"reqd": 1
},
{
"fieldname": "fiscal_year",
"label": __("Fiscal Year"),
"fieldtype": "Link",
"options": "Fiscal Year",
"default": frappe.defaults.get_user_default("fiscal_year"),
"reqd": 1,
"on_change": function(query_report) {
var fiscal_year = query_report.get_values().fiscal_year;
if (!fiscal_year) {
return;
}
frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
frappe.query_report_filters_by_name.from_date.set_input(fy.year_start_date);
frappe.query_report_filters_by_name.to_date.set_input(fy.year_end_date);
query_report.trigger_refresh();
});
}
},
{
"fieldname": "from_date",
"label": __("From Date"),
"fieldtype": "Date",
"default": frappe.defaults.get_user_default("year_start_date"),
},
{
"fieldname": "to_date",
"label": __("To Date"),
"fieldtype": "Date",
"default": frappe.defaults.get_user_default("year_end_date"),
},
{
"fieldname": "show_zero_values",
"label": __("Show zero values"),
"fieldtype": "Check"
}
],
"formatter": function(row, cell, value, columnDef, dataContext, default_formatter) {
if (columnDef.df.fieldname=="account") {
value = dataContext.account_name;
columnDef.df.link_onclick =
"frappe.query_reports['Profitability Analysis'].open_profit_and_loss_statement(" + JSON.stringify(dataContext) + ")";
columnDef.df.is_tree = true;
}
value = default_formatter(row, cell, value, columnDef, dataContext);
if (!dataContext.parent_account && dataContext.based_on != 'project') {
var $value = $(value).css("font-weight", "bold");
if (dataContext.warn_if_negative && dataContext[columnDef.df.fieldname] < 0) {
$value.addClass("text-danger");
}
value = $value.wrap("<p></p>").parent().html();
}
return value;
},
"open_profit_and_loss_statement": function(data) {
if (!data.account) return;
frappe.route_options = {
"company": frappe.query_report_filters_by_name.company.get_value(),
"from_fiscal_year": data.fiscal_year,
"to_fiscal_year": data.fiscal_year
};
if(data.based_on == 'cost_center'){
frappe.route_options["cost_center"] = data.account
} else {
frappe.route_options["project"] = data.account
}
frappe.set_route("query-report", "Profit and Loss Statement");
},
"tree": true,
"name_field": "account",
"parent_field": "parent_account",
"initial_depth": 3
}
});

View File

@ -0,0 +1,18 @@
{
"add_total_row": 0,
"apply_user_permissions": 1,
"creation": "2016-08-24 05:47:09.931202",
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"idx": 0,
"is_standard": "Yes",
"modified": "2016-08-24 05:47:09.931202",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Profitability Analysis",
"owner": "Administrator",
"ref_doctype": "GL Entry",
"report_name": "Profitability Analysis",
"report_type": "Script Report"
}

View File

@ -0,0 +1,188 @@
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt, getdate, formatdate, cstr
from erpnext.accounts.report.financial_statements import filter_accounts, filter_out_zero_value_rows
from erpnext.accounts.report.trial_balance.trial_balance import validate_filters
value_fields = ("income", "expense", "gross_profit_loss")
def execute(filters=None):
based_on = filters.based_on.replace(' ', '_').lower()
validate_filters(filters)
accounts = get_accounts_data(based_on, filters.company)
data = get_data(accounts, filters, based_on)
columns = get_columns(filters)
return columns, data
def get_accounts_data(based_on, company):
if based_on == 'cost_center':
return frappe.db.sql("""select name, parent_cost_center as parent_account, cost_center_name as account_name, lft, rgt
from `tabCost Center` where company=%s order by lft""", company, as_dict=True)
else:
return frappe.get_all('Project', fields = ["name"], filters = {'company': company})
def get_data(accounts, filters, based_on):
if not accounts:
return None
accounts, accounts_by_name, parent_children_map = filter_accounts(accounts)
gl_entries_by_account = {}
set_gl_entries_by_account(filters.company, filters.from_date,
filters.to_date, based_on, gl_entries_by_account, ignore_closing_entries=not flt(filters.with_period_closing_entry))
total_row = calculate_values(accounts, gl_entries_by_account, filters)
accumulate_values_into_parents(accounts, accounts_by_name)
data = prepare_data(accounts, filters, total_row, parent_children_map, based_on)
data = filter_out_zero_value_rows(data, parent_children_map,
show_zero_values=filters.get("show_zero_values"))
return data
def calculate_values(accounts, gl_entries_by_account, filters):
init = {
"income": 0.0,
"expense": 0.0,
"gross_profit_loss": 0.0
}
total_row = {
"cost_center": None,
"account_name": "'" + _("Total") + "'",
"warn_if_negative": True,
"income": 0.0,
"expense": 0.0,
"gross_profit_loss": 0.0
}
for d in accounts:
d.update(init.copy())
# add opening
for entry in gl_entries_by_account.get(d.name, []):
if cstr(entry.is_opening) != "Yes":
if entry.type == 'Income':
d["income"] += flt(entry.credit) - flt(entry.debit)
if entry.type == 'Expense':
d["expense"] += flt(entry.debit) - flt(entry.credit)
d["gross_profit_loss"] = d.get("income") - d.get("expense")
total_row["income"] += d["income"]
total_row["expense"] += d["expense"]
total_row["gross_profit_loss"] = total_row.get("income") - total_row.get("expense")
return total_row
def accumulate_values_into_parents(accounts, accounts_by_name):
for d in reversed(accounts):
if d.parent_account:
for key in value_fields:
accounts_by_name[d.parent_account][key] += d[key]
def prepare_data(accounts, filters, total_row, parent_children_map, based_on):
data = []
company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
for d in accounts:
has_value = False
row = {
"account_name": d.account_name or d.name,
"account": d.name,
"parent_account": d.parent_account,
"indent": d.indent,
"fiscal_year": filters.fiscal_year,
"currency": company_currency,
"based_on": based_on
}
for key in value_fields:
row[key] = flt(d.get(key, 0.0), 3)
if abs(row[key]) >= 0.005:
# ignore zero values
has_value = True
row["has_value"] = has_value
data.append(row)
data.extend([{},total_row])
return data
def get_columns(filters):
return [
{
"fieldname": "account",
"label": _(filters.based_on),
"fieldtype": "Link",
"options": filters.based_on,
"width": 300
},
{
"fieldname": "income",
"label": _("Income"),
"fieldtype": "Currency",
"options": "currency",
"width": 120
},
{
"fieldname": "expense",
"label": _("Expense"),
"fieldtype": "Currency",
"options": "currency",
"width": 120
},
{
"fieldname": "gross_profit_loss",
"label": _("Gross Profit / Loss"),
"fieldtype": "Currency",
"options": "currency",
"width": 120
},
{
"fieldname": "currency",
"label": _("Currency"),
"fieldtype": "Link",
"options": "Currency",
"hidden": 1
}
]
def set_gl_entries_by_account(company, from_date, to_date, based_on, gl_entries_by_account,
ignore_closing_entries=False):
"""Returns a dict like { "account": [gl entries], ... }"""
additional_conditions = []
if ignore_closing_entries:
additional_conditions.append("and ifnull(voucher_type, '')!='Period Closing Voucher'")
if from_date:
additional_conditions.append("and posting_date >= %(from_date)s")
gl_entries = frappe.db.sql("""select posting_date, {based_on} as based_on, debit, credit,
is_opening, (select root_type from `tabAccount` where name = account) as type
from `tabGL Entry` where company=%(company)s
{additional_conditions}
and posting_date <= %(to_date)s
and {based_on} is not null
order by {based_on}, posting_date""".format(additional_conditions="\n".join(additional_conditions), based_on= based_on),
{
"company": company,
"from_date": from_date,
"to_date": to_date
},
as_dict=True)
for entry in gl_entries:
gl_entries_by_account.setdefault(entry.based_on, []).append(entry)
return gl_entries_by_account

View File

@ -7,12 +7,12 @@
"doctype": "Report", "doctype": "Report",
"idx": 1, "idx": 1,
"is_standard": "Yes", "is_standard": "Yes",
"modified": "2016-05-17 08:28:26.093139", "modified": "2016-08-18 15:46:45.789536",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Purchase Order Items To Be Billed", "name": "Purchase Order Items To Be Billed",
"owner": "Administrator", "owner": "Administrator",
"query": "select \n `tabPurchase Order`.`name` as \"Purchase Order:Link/Purchase Order:120\",\n `tabPurchase Order`.`transaction_date` as \"Date:Date:100\",\n\t`tabPurchase Order`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Order Item`.`project` as \"Project\",\n\t`tabPurchase Order Item`.item_code as \"Item Code:Link/Item:120\",\n\t`tabPurchase Order Item`.base_amount as \"Amount:Currency:100\",\n\t(`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1)) as \"Billed Amount:Currency:100\", \n\t(`tabPurchase Order Item`.base_amount - (`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1))) as \"Amount to Bill:Currency:100\",\n\t`tabPurchase Order Item`.item_name as \"Item Name::150\",\n\t`tabPurchase Order Item`.description as \"Description::200\",\n\t`tabPurchase Order`.company as \"Company:Link/Company:\"\nfrom\n\t`tabPurchase Order`, `tabPurchase Order Item`\nwhere\n\t`tabPurchase Order Item`.`parent` = `tabPurchase Order`.`name`\n\tand `tabPurchase Order`.docstatus = 1\n\tand `tabPurchase Order`.status != \"Closed\"\n and `tabPurchase Order Item`.amount > 0\n\tand (`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1)) < `tabPurchase Order Item`.base_amount\norder by `tabPurchase Order`.transaction_date asc", "query": "select \n `tabPurchase Order`.`name` as \"Purchase Order:Link/Purchase Order:120\",\n `tabPurchase Order`.`transaction_date` as \"Date:Date:100\",\n\t`tabPurchase Order`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Order`.`supplier_name` as \"Supplier Name::150\",\n\t`tabPurchase Order Item`.`project` as \"Project\",\n\t`tabPurchase Order Item`.item_code as \"Item Code:Link/Item:120\",\n\t`tabPurchase Order Item`.base_amount as \"Amount:Currency:100\",\n\t(`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1)) as \"Billed Amount:Currency:100\", \n\t(`tabPurchase Order Item`.base_amount - (`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1))) as \"Amount to Bill:Currency:100\",\n\t`tabPurchase Order Item`.item_name as \"Item Name::150\",\n\t`tabPurchase Order Item`.description as \"Description::200\",\n\t`tabPurchase Order`.company as \"Company:Link/Company:\"\nfrom\n\t`tabPurchase Order`, `tabPurchase Order Item`\nwhere\n\t`tabPurchase Order Item`.`parent` = `tabPurchase Order`.`name`\n\tand `tabPurchase Order`.docstatus = 1\n\tand `tabPurchase Order`.status != \"Closed\"\n and `tabPurchase Order Item`.amount > 0\n\tand (`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1)) < `tabPurchase Order Item`.base_amount\norder by `tabPurchase Order`.transaction_date asc",
"ref_doctype": "Purchase Invoice", "ref_doctype": "Purchase Invoice",
"report_name": "Purchase Order Items To Be Billed", "report_name": "Purchase Order Items To Be Billed",
"report_type": "Query Report" "report_type": "Query Report"

View File

@ -7,12 +7,12 @@
"doctype": "Report", "doctype": "Report",
"idx": 1, "idx": 1,
"is_standard": "Yes", "is_standard": "Yes",
"modified": "2016-05-17 08:38:49.654749", "modified": "2016-08-18 14:32:20.965816",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Received Items To Be Billed", "name": "Received Items To Be Billed",
"owner": "Administrator", "owner": "Administrator",
"query": "select\n `tabPurchase Receipt`.`name` as \"Purchase Receipt:Link/Purchase Receipt:120\",\n `tabPurchase Receipt`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Receipt`.`posting_date` as \"Date:Date\",\n\t`tabPurchase Receipt Item`.`project` as \"Project\",\n\t`tabPurchase Receipt Item`.`item_code` as \"Item:Link/Item:120\",\n\t(`tabPurchase Receipt Item`.`base_amount` - `tabPurchase Receipt Item`.`billed_amt`*ifnull(`tabPurchase Receipt`.conversion_rate, 1)) as \"Pending Amount:Currency:110\",\n\t`tabPurchase Receipt Item`.`item_name` as \"Item Name::150\",\n\t`tabPurchase Receipt Item`.`description` as \"Description::200\",\n\t`tabPurchase Receipt`.`company` as \"Company:Link/Company:\"\nfrom `tabPurchase Receipt`, `tabPurchase Receipt Item`\nwhere\n `tabPurchase Receipt`.name = `tabPurchase Receipt Item`.parent \n and `tabPurchase Receipt`.docstatus = 1 \n and `tabPurchase Receipt`.status != \"Closed\" \n and `tabPurchase Receipt Item`.amount > 0\n and `tabPurchase Receipt Item`.billed_amt < `tabPurchase Receipt Item`.amount\norder by `tabPurchase Receipt`.`name` desc", "query": "select\n `tabPurchase Receipt`.`name` as \"Purchase Receipt:Link/Purchase Receipt:120\",\n `tabPurchase Receipt`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Receipt`.`supplier_name` as \"Supplier Name::150\",\n\t`tabPurchase Receipt`.`posting_date` as \"Date:Date\",\n\t`tabPurchase Receipt Item`.`project` as \"Project\",\n\t`tabPurchase Receipt Item`.`item_code` as \"Item:Link/Item:120\",\n\t(`tabPurchase Receipt Item`.`base_amount` - `tabPurchase Receipt Item`.`billed_amt`*ifnull(`tabPurchase Receipt`.conversion_rate, 1)) as \"Pending Amount:Currency:110\",\n\t`tabPurchase Receipt Item`.`item_name` as \"Item Name::150\",\n\t`tabPurchase Receipt Item`.`description` as \"Description::200\",\n\t`tabPurchase Receipt`.`company` as \"Company:Link/Company:\"\nfrom `tabPurchase Receipt`, `tabPurchase Receipt Item`\nwhere\n `tabPurchase Receipt`.name = `tabPurchase Receipt Item`.parent \n and `tabPurchase Receipt`.docstatus = 1 \n and `tabPurchase Receipt`.status != \"Closed\" \n and `tabPurchase Receipt Item`.amount > 0\n and `tabPurchase Receipt Item`.billed_amt < `tabPurchase Receipt Item`.amount\norder by `tabPurchase Receipt`.`name` desc",
"ref_doctype": "Purchase Invoice", "ref_doctype": "Purchase Invoice",
"report_name": "Received Items To Be Billed", "report_name": "Received Items To Be Billed",
"report_type": "Query Report" "report_type": "Query Report"

View File

@ -26,8 +26,8 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() {
} }
frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) { frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
var fy = frappe.model.get_doc("Fiscal Year", fiscal_year); var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
query_report.filters_by_name.from_date.set_input(fy.year_start_date); frappe.query_report_filters_by_name.from_date.set_input(fy.year_start_date);
query_report.filters_by_name.to_date.set_input(fy.year_end_date); frappe.query_report_filters_by_name.to_date.set_input(fy.year_end_date);
query_report.trigger_refresh(); query_report.trigger_refresh();
}); });
} }
@ -55,6 +55,11 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() {
"label": __("Show zero values"), "label": __("Show zero values"),
"fieldtype": "Check" "fieldtype": "Check"
}, },
{
"fieldname": "show_unclosed_fy_pl_balances",
"label": __("Show unclosed fiscal year's P&L balances"),
"fieldtype": "Check"
}
], ],
"formatter": erpnext.financial_statements.formatter, "formatter": erpnext.financial_statements.formatter,
"tree": true, "tree": true,

View File

@ -65,7 +65,7 @@ def get_data(filters):
gl_entries_by_account = {} gl_entries_by_account = {}
set_gl_entries_by_account(filters.company, filters.from_date, set_gl_entries_by_account(filters.company, filters.from_date,
filters.to_date, min_lft, max_rgt, gl_entries_by_account, ignore_closing_entries=not flt(filters.with_period_closing_entry)) filters.to_date, min_lft, max_rgt, filters, gl_entries_by_account, ignore_closing_entries=not flt(filters.with_period_closing_entry))
opening_balances = get_opening_balances(filters) opening_balances = get_opening_balances(filters)
@ -87,8 +87,10 @@ def get_opening_balances(filters):
def get_rootwise_opening_balances(filters, report_type): def get_rootwise_opening_balances(filters, report_type):
additional_conditions = " and posting_date >= %(year_start_date)s" \ additional_conditions = ""
if report_type == "Profit and Loss" else "" if not filters.show_unclosed_fy_pl_balances:
additional_conditions = " and posting_date >= %(year_start_date)s" \
if report_type == "Profit and Loss" else ""
if not flt(filters.with_period_closing_entry): if not flt(filters.with_period_closing_entry):
additional_conditions += " and ifnull(voucher_type, '')!='Period Closing Voucher'" additional_conditions += " and ifnull(voucher_type, '')!='Period Closing Voucher'"

View File

@ -25,8 +25,8 @@ frappe.query_reports["Trial Balance for Party"] = {
} }
frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) { frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
var fy = frappe.model.get_doc("Fiscal Year", fiscal_year); var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
query_report.filters_by_name.from_date.set_input(fy.year_start_date); frappe.query_report_filters_by_name.from_date.set_input(fy.year_start_date);
query_report.filters_by_name.to_date.set_input(fy.year_end_date); frappe.query_report_filters_by_name.to_date.set_input(fy.year_end_date);
query_report.trigger_refresh(); query_report.trigger_refresh();
}); });
} }

View File

@ -127,6 +127,83 @@ def get_balance_on(account=None, date=None, party_type=None, party=None, company
# if bal is None, return 0 # if bal is None, return 0
return flt(bal) return flt(bal)
def get_count_on(account, fieldname, date):
cond = []
if date:
cond.append("posting_date <= '%s'" % frappe.db.escape(cstr(date)))
else:
# get balance of all entries that exist
date = nowdate()
try:
year_start_date = get_fiscal_year(date, verbose=0)[1]
except FiscalYearError:
if getdate(date) > getdate(nowdate()):
# if fiscal year not found and the date is greater than today
# get fiscal year for today's date and its corresponding year start date
year_start_date = get_fiscal_year(nowdate(), verbose=1)[1]
else:
# this indicates that it is a date older than any existing fiscal year.
# hence, assuming balance as 0.0
return 0.0
if account:
acc = frappe.get_doc("Account", account)
if not frappe.flags.ignore_account_permission:
acc.check_permission("read")
# for pl accounts, get balance within a fiscal year
if acc.report_type == 'Profit and Loss':
cond.append("posting_date >= '%s' and voucher_type != 'Period Closing Voucher'" \
% year_start_date)
# different filter for group and ledger - improved performance
if acc.is_group:
cond.append("""exists (
select name from `tabAccount` ac where ac.name = gle.account
and ac.lft >= %s and ac.rgt <= %s
)""" % (acc.lft, acc.rgt))
# If group and currency same as company,
# always return balance based on debit and credit in company currency
if acc.account_currency == frappe.db.get_value("Company", acc.company, "default_currency"):
in_account_currency = False
else:
cond.append("""gle.account = "%s" """ % (frappe.db.escape(account, percent=False), ))
entries = frappe.db.sql("""
SELECT name, posting_date, account, party_type, party,debit,credit,
voucher_type, voucher_no, against_voucher_type, against_voucher
FROM `tabGL Entry` gle
WHERE {0}""".format(" and ".join(cond)), as_dict=True)
count = 0
for gle in entries:
if fieldname not in ('invoiced_amount','payables'):
count += 1
else:
dr_or_cr = "debit" if fieldname == "invoiced_amount" else "credit"
cr_or_dr = "credit" if fieldname == "invoiced_amount" else "debit"
select_fields = "ifnull(sum(credit-debit),0)" if fieldname == "invoiced_amount" else "ifnull(sum(debit-credit),0)"
if ((not gle.against_voucher) or (gle.against_voucher_type in ["Sales Order", "Purchase Order"]) or
(gle.against_voucher==gle.voucher_no and gle.get(dr_or_cr) > 0)):
payment_amount = frappe.db.sql("""
SELECT {0}
FROM `tabGL Entry` gle
WHERE docstatus < 2 and posting_date <= %(date)s and against_voucher = %(voucher_no)s
and party = %(party)s and name != %(name)s""".format(select_fields),
{"date": date, "voucher_no": gle.voucher_no, "party": gle.party, "name": gle.name})[0][0]
outstanding_amount = flt(gle.get(dr_or_cr)) - flt(gle.get(cr_or_dr)) - payment_amount
currency_precision = get_currency_precision() or 2
if abs(flt(outstanding_amount)) > 0.1/10**currency_precision:
count += 1
return count
@frappe.whitelist() @frappe.whitelist()
def add_ac(args=None): def add_ac(args=None):
if not args: if not args:
@ -570,3 +647,58 @@ def get_children():
each["balance_in_account_currency"] = flt(get_balance_on(each.get("value"))) each["balance_in_account_currency"] = flt(get_balance_on(each.get("value")))
return acc return acc
def create_payment_gateway_and_account(gateway):
create_payment_gateway(gateway)
create_payment_gateway_account(gateway)
def create_payment_gateway(gateway):
# NOTE: we don't translate Payment Gateway name because it is an internal doctype
if not frappe.db.exists("Payment Gateway", gateway):
payment_gateway = frappe.get_doc({
"doctype": "Payment Gateway",
"gateway": gateway
})
payment_gateway.insert(ignore_permissions=True)
def create_payment_gateway_account(gateway):
from erpnext.setup.setup_wizard.setup_wizard import create_bank_account
company = frappe.db.get_value("Global Defaults", None, "default_company")
if not company:
return
# NOTE: we translate Payment Gateway account name because that is going to be used by the end user
bank_account = frappe.db.get_value("Account", {"account_name": _(gateway), "company": company},
["name", 'account_currency'], as_dict=1)
if not bank_account:
# check for untranslated one
bank_account = frappe.db.get_value("Account", {"account_name": gateway, "company": company},
["name", 'account_currency'], as_dict=1)
if not bank_account:
# try creating one
bank_account = create_bank_account({"company_name": company, "bank_account": _(gateway)})
if not bank_account:
frappe.msgprint(_("Payment Gateway Account not created, please create one manually."))
return
# if payment gateway account exists, return
if frappe.db.exists("Payment Gateway Account",
{"payment_gateway": gateway, "currency": bank_account.account_currency}):
return
try:
frappe.get_doc({
"doctype": "Payment Gateway Account",
"is_default": 1,
"payment_gateway": gateway,
"payment_account": bank_account.name,
"currency": bank_account.account_currency
}).insert(ignore_permissions=True)
except frappe.DuplicateEntryError:
# already exists, due to a reinstall?
pass

View File

@ -12,14 +12,6 @@ cur_frm.email_field = "contact_email";
erpnext.buying.BuyingController = erpnext.TransactionController.extend({ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
setup: function() { setup: function() {
this._super(); this._super();
if(!in_list(["Material Request", "Request for Quotation"], this.frm.doc.doctype)){
this.frm.get_field('items').grid.editable_fields = [
{fieldname: 'item_code', columns: 3},
{fieldname: 'qty', columns: 2},
{fieldname: 'rate', columns: 3},
{fieldname: 'amount', columns: 2}
];
}
}, },
onload: function() { onload: function() {
@ -146,20 +138,15 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
}, },
qty: function(doc, cdt, cdn) { qty: function(doc, cdt, cdn) {
var item = frappe.get_doc(cdt, cdn);
if ((doc.doctype == "Purchase Receipt") || (doc.doctype == "Purchase Invoice" && doc.update_stock)) { if ((doc.doctype == "Purchase Receipt") || (doc.doctype == "Purchase Invoice" && doc.update_stock)) {
var item = frappe.get_doc(cdt, cdn);
frappe.model.round_floats_in(item, ["qty", "received_qty"]); frappe.model.round_floats_in(item, ["qty", "received_qty"]);
if(!(item.received_qty || item.rejected_qty) && item.qty) { if(!(item.received_qty || item.rejected_qty) && item.qty) {
item.received_qty = item.qty; item.received_qty = item.qty;
} }
if(item.qty > item.received_qty) { frappe.model.round_floats_in(item, ["qty", "received_qty"]);
msgprint(__("Error: {0} > {1}", [__(frappe.meta.get_label(item.doctype, "qty", item.name)), item.rejected_qty = flt(item.received_qty - item.qty, precision("rejected_qty", item));
__(frappe.meta.get_label(item.doctype, "received_qty", item.name))]))
item.qty = item.rejected_qty = 0.0;
} else {
item.rejected_qty = flt(item.received_qty - item.qty, precision("rejected_qty", item));
}
} }
this._super(doc, cdt, cdn); this._super(doc, cdt, cdn);
@ -168,26 +155,18 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
}, },
received_qty: function(doc, cdt, cdn) { received_qty: function(doc, cdt, cdn) {
var item = frappe.get_doc(cdt, cdn); this.calculate_accepted_qty(doc, cdt, cdn)
frappe.model.round_floats_in(item, ["qty", "received_qty"]);
item.qty = (item.qty < item.received_qty) ? item.qty : item.received_qty;
this.qty(doc, cdt, cdn);
}, },
rejected_qty: function(doc, cdt, cdn) { rejected_qty: function(doc, cdt, cdn) {
this.calculate_accepted_qty(doc, cdt, cdn)
},
calculate_accepted_qty: function(doc, cdt, cdn){
var item = frappe.get_doc(cdt, cdn); var item = frappe.get_doc(cdt, cdn);
frappe.model.round_floats_in(item, ["received_qty", "rejected_qty"]); frappe.model.round_floats_in(item, ["received_qty", "rejected_qty"]);
if(item.rejected_qty > item.received_qty) { item.qty = flt(item.received_qty - item.rejected_qty, precision("qty", item));
msgprint(__("Error: {0} > {1}", [__(frappe.meta.get_label(item.doctype, "rejected_qty", item.name)),
__(frappe.meta.get_label(item.doctype, "received_qty", item.name))]));
item.qty = item.rejected_qty = 0.0;
} else {
item.qty = flt(item.received_qty - item.rejected_qty, precision("qty", item));
}
this.qty(doc, cdt, cdn); this.qty(doc, cdt, cdn);
}, },
@ -204,7 +183,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
var item = frappe.get_doc(cdt, cdn); var item = frappe.get_doc(cdt, cdn);
if(item.item_code && item.warehouse) { if(item.item_code && item.warehouse) {
return this.frm.call({ return this.frm.call({
method: "erpnext.stock.get_item_details.get_projected_qty", method: "erpnext.stock.get_item_details.get_bin_details",
child: item, child: item,
args: { args: {
item_code: item.item_code, item_code: item.item_code,

View File

@ -9,11 +9,13 @@
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"document_type": "Document", "document_type": "Document",
"editable_grid": 0,
"fields": [ "fields": [
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "supplier_section", "fieldname": "supplier_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -39,6 +41,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "{supplier_name}", "default": "{supplier_name}",
"fieldname": "title", "fieldname": "title",
"fieldtype": "Data", "fieldtype": "Data",
@ -65,6 +68,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "naming_series", "fieldname": "naming_series",
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
@ -92,6 +96,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "", "description": "",
"fieldname": "supplier", "fieldname": "supplier",
"fieldtype": "Link", "fieldtype": "Link",
@ -120,6 +125,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.supplier && doc.docstatus===0 && (!(doc.items && doc.items.length) || (doc.items.length==1 && !doc.items[0].item_code))", "depends_on": "eval:doc.supplier && doc.docstatus===0 && (!(doc.items && doc.items.length) || (doc.items.length==1 && !doc.items[0].item_code))",
"fieldname": "get_items_from_open_material_requests", "fieldname": "get_items_from_open_material_requests",
"fieldtype": "Button", "fieldtype": "Button",
@ -146,6 +152,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "No", "default": "No",
"fieldname": "is_subcontracted", "fieldname": "is_subcontracted",
"fieldtype": "Select", "fieldtype": "Select",
@ -172,6 +179,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "supplier_name", "fieldname": "supplier_name",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
@ -196,6 +204,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break1", "fieldname": "column_break1",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -222,6 +231,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "Today", "default": "Today",
"fieldname": "transaction_date", "fieldname": "transaction_date",
"fieldtype": "Date", "fieldtype": "Date",
@ -249,6 +259,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "amended_from", "fieldname": "amended_from",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -276,6 +287,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "", "description": "",
"fieldname": "company", "fieldname": "company",
"fieldtype": "Link", "fieldtype": "Link",
@ -305,6 +317,7 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"collapsible_depends_on": "", "collapsible_depends_on": "",
"columns": 0,
"fieldname": "drop_ship", "fieldname": "drop_ship",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -330,6 +343,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "", "depends_on": "",
"fieldname": "customer", "fieldname": "customer",
"fieldtype": "Link", "fieldtype": "Link",
@ -357,6 +371,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "", "depends_on": "",
"fieldname": "customer_name", "fieldname": "customer_name",
"fieldtype": "Data", "fieldtype": "Data",
@ -383,6 +398,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_19", "fieldname": "column_break_19",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -407,6 +423,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "", "depends_on": "",
"fieldname": "customer_contact_person", "fieldname": "customer_contact_person",
"fieldtype": "Link", "fieldtype": "Link",
@ -434,6 +451,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "customer_contact_display", "fieldname": "customer_contact_display",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"hidden": 1, "hidden": 1,
@ -459,6 +477,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "customer_contact_mobile", "fieldname": "customer_contact_mobile",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"hidden": 1, "hidden": 1,
@ -484,6 +503,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "customer_contact_email", "fieldname": "customer_contact_email",
"fieldtype": "Code", "fieldtype": "Code",
"hidden": 1, "hidden": 1,
@ -510,6 +530,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"columns": 0,
"fieldname": "section_addresses", "fieldname": "section_addresses",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -535,6 +556,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "supplier_address", "fieldname": "supplier_address",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -560,6 +582,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "contact_person", "fieldname": "contact_person",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -585,6 +608,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "", "depends_on": "",
"fieldname": "address_display", "fieldname": "address_display",
"fieldtype": "Small Text", "fieldtype": "Small Text",
@ -610,6 +634,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "contact_display", "fieldname": "contact_display",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"hidden": 0, "hidden": 0,
@ -634,6 +659,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "contact_mobile", "fieldname": "contact_mobile",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"hidden": 0, "hidden": 0,
@ -658,6 +684,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "contact_email", "fieldname": "contact_email",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"hidden": 0, "hidden": 0,
@ -682,6 +709,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break_address", "fieldname": "col_break_address",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -706,6 +734,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "", "depends_on": "",
"fieldname": "shipping_address", "fieldname": "shipping_address",
"fieldtype": "Link", "fieldtype": "Link",
@ -733,6 +762,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "shipping_address_display", "fieldname": "shipping_address_display",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"hidden": 0, "hidden": 0,
@ -758,6 +788,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"columns": 0,
"fieldname": "currency_and_price_list", "fieldname": "currency_and_price_list",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -783,6 +814,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "currency", "fieldname": "currency",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -810,6 +842,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "", "description": "",
"fieldname": "conversion_rate", "fieldname": "conversion_rate",
"fieldtype": "Float", "fieldtype": "Float",
@ -838,6 +871,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "cb_price_list", "fieldname": "cb_price_list",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -861,6 +895,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "buying_price_list", "fieldname": "buying_price_list",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -886,6 +921,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "price_list_currency", "fieldname": "price_list_currency",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -911,6 +947,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "plc_conversion_rate", "fieldname": "plc_conversion_rate",
"fieldtype": "Float", "fieldtype": "Float",
"hidden": 0, "hidden": 0,
@ -936,6 +973,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "ignore_pricing_rule", "fieldname": "ignore_pricing_rule",
"fieldtype": "Check", "fieldtype": "Check",
"hidden": 0, "hidden": 0,
@ -960,6 +998,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "items_section", "fieldname": "items_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -986,6 +1025,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "items", "fieldname": "items",
"fieldtype": "Table", "fieldtype": "Table",
"hidden": 0, "hidden": 0,
@ -1013,6 +1053,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.docstatus===0 && (doc.items && doc.items.length)", "depends_on": "eval:doc.docstatus===0 && (doc.items && doc.items.length)",
"fieldname": "get_last_purchase_rate", "fieldname": "get_last_purchase_rate",
"fieldtype": "Button", "fieldtype": "Button",
@ -1039,6 +1080,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "sb_last_purchase", "fieldname": "sb_last_purchase",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -1062,6 +1104,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_total", "fieldname": "base_total",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -1088,6 +1131,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_net_total", "fieldname": "base_net_total",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -1115,6 +1159,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_26", "fieldname": "column_break_26",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -1138,6 +1183,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "total", "fieldname": "total",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -1164,6 +1210,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "net_total", "fieldname": "net_total",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -1191,6 +1238,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "taxes_section", "fieldname": "taxes_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -1217,6 +1265,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "", "description": "",
"fieldname": "taxes_and_charges", "fieldname": "taxes_and_charges",
"fieldtype": "Link", "fieldtype": "Link",
@ -1245,6 +1294,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "taxes", "fieldname": "taxes",
"fieldtype": "Table", "fieldtype": "Table",
"hidden": 0, "hidden": 0,
@ -1272,6 +1322,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "other_charges_calculation", "fieldname": "other_charges_calculation",
"fieldtype": "HTML", "fieldtype": "HTML",
"hidden": 0, "hidden": 0,
@ -1297,6 +1348,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "totals", "fieldname": "totals",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -1323,6 +1375,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_taxes_and_charges_added", "fieldname": "base_taxes_and_charges_added",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -1350,6 +1403,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_taxes_and_charges_deducted", "fieldname": "base_taxes_and_charges_deducted",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -1377,6 +1431,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_total_taxes_and_charges", "fieldname": "base_total_taxes_and_charges",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -1404,6 +1459,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_39", "fieldname": "column_break_39",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -1428,6 +1484,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "taxes_and_charges_added", "fieldname": "taxes_and_charges_added",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -1455,6 +1512,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "taxes_and_charges_deducted", "fieldname": "taxes_and_charges_deducted",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -1482,6 +1540,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "total_taxes_and_charges", "fieldname": "total_taxes_and_charges",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -1509,6 +1568,7 @@
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"collapsible_depends_on": "discount_amount", "collapsible_depends_on": "discount_amount",
"columns": 0,
"fieldname": "discount_section", "fieldname": "discount_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -1534,6 +1594,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "Grand Total", "default": "Grand Total",
"fieldname": "apply_discount_on", "fieldname": "apply_discount_on",
"fieldtype": "Select", "fieldtype": "Select",
@ -1561,6 +1622,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_discount_amount", "fieldname": "base_discount_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -1587,6 +1649,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_45", "fieldname": "column_break_45",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -1611,6 +1674,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "additional_discount_percentage", "fieldname": "additional_discount_percentage",
"fieldtype": "Float", "fieldtype": "Float",
"hidden": 0, "hidden": 0,
@ -1636,6 +1700,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "discount_amount", "fieldname": "discount_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -1662,6 +1727,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "totals_section", "fieldname": "totals_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -1686,6 +1752,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_grand_total", "fieldname": "base_grand_total",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -1713,6 +1780,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "In Words will be visible once you save the Purchase Order.", "description": "In Words will be visible once you save the Purchase Order.",
"fieldname": "base_in_words", "fieldname": "base_in_words",
"fieldtype": "Data", "fieldtype": "Data",
@ -1740,6 +1808,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_rounded_total", "fieldname": "base_rounded_total",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -1767,6 +1836,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break4", "fieldname": "column_break4",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -1791,6 +1861,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "grand_total", "fieldname": "grand_total",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -1818,6 +1889,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "in_words", "fieldname": "in_words",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
@ -1844,6 +1916,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "advance_paid", "fieldname": "advance_paid",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -1870,6 +1943,7 @@
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"collapsible_depends_on": "terms", "collapsible_depends_on": "terms",
"columns": 0,
"fieldname": "terms_section_break", "fieldname": "terms_section_break",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -1896,6 +1970,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "tc_name", "fieldname": "tc_name",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -1923,6 +1998,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "terms", "fieldname": "terms",
"fieldtype": "Text Editor", "fieldtype": "Text Editor",
"hidden": 0, "hidden": 0,
@ -1949,6 +2025,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"columns": 0,
"fieldname": "more_info", "fieldname": "more_info",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -1974,6 +2051,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "Draft", "default": "Draft",
"fieldname": "status", "fieldname": "status",
"fieldtype": "Select", "fieldtype": "Select",
@ -2002,6 +2080,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "ref_sq", "fieldname": "ref_sq",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
@ -2028,6 +2107,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "party_account_currency", "fieldname": "party_account_currency",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 1, "hidden": 1,
@ -2054,6 +2134,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_74", "fieldname": "column_break_74",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -2078,6 +2159,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:!doc.__islocal", "depends_on": "eval:!doc.__islocal",
"description": "", "description": "",
"fieldname": "per_received", "fieldname": "per_received",
@ -2106,6 +2188,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:!doc.__islocal", "depends_on": "eval:!doc.__islocal",
"description": "", "description": "",
"fieldname": "per_billed", "fieldname": "per_billed",
@ -2134,6 +2217,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"columns": 0,
"fieldname": "column_break5", "fieldname": "column_break5",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -2161,6 +2245,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "letter_head", "fieldname": "letter_head",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -2188,6 +2273,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "select_print_heading", "fieldname": "select_print_heading",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -2215,6 +2301,59 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_86",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"description": "",
"fieldname": "group_same_items",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Group same items",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "", "default": "",
"fieldname": "language", "fieldname": "language",
"fieldtype": "Data", "fieldtype": "Data",
@ -2243,6 +2382,7 @@
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"collapsible_depends_on": "supplied_items", "collapsible_depends_on": "supplied_items",
"columns": 0,
"description": "", "description": "",
"fieldname": "raw_material_details", "fieldname": "raw_material_details",
"fieldtype": "Section Break", "fieldtype": "Section Break",
@ -2270,6 +2410,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "supplied_items", "fieldname": "supplied_items",
"fieldtype": "Table", "fieldtype": "Table",
"hidden": 0, "hidden": 0,
@ -2298,6 +2439,7 @@
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"collapsible_depends_on": "is_recurring", "collapsible_depends_on": "is_recurring",
"columns": 0,
"fieldname": "recurring_order", "fieldname": "recurring_order",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -2323,6 +2465,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break", "fieldname": "column_break",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -2347,6 +2490,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.docstatus<2", "depends_on": "eval:doc.docstatus<2",
"description": "", "description": "",
"fieldname": "is_recurring", "fieldname": "is_recurring",
@ -2373,6 +2517,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "is_recurring", "depends_on": "is_recurring",
"description": "", "description": "",
"fieldname": "recurring_id", "fieldname": "recurring_id",
@ -2400,6 +2545,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name",
"description": "", "description": "",
"fieldname": "recurring_type", "fieldname": "recurring_type",
@ -2427,6 +2573,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name",
"description": "", "description": "",
"fieldname": "repeat_on_day_of_month", "fieldname": "repeat_on_day_of_month",
@ -2453,6 +2600,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name",
"description": "", "description": "",
"fieldname": "end_date", "fieldname": "end_date",
@ -2479,6 +2627,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name",
"fieldname": "submit_on_creation", "fieldname": "submit_on_creation",
"fieldtype": "Check", "fieldtype": "Check",
@ -2505,6 +2654,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name",
"description": "", "description": "",
"fieldname": "notify_by_email", "fieldname": "notify_by_email",
@ -2532,6 +2682,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.is_recurring && doc.notify_by_email && doc.recurring_id === doc.name", "depends_on": "eval:doc.is_recurring && doc.notify_by_email && doc.recurring_id === doc.name",
"description": "", "description": "",
"fieldname": "notification_email_address", "fieldname": "notification_email_address",
@ -2559,6 +2710,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.is_recurring && doc.notify_by_email && doc.recurring_id === doc.name", "depends_on": "eval:doc.is_recurring && doc.notify_by_email && doc.recurring_id === doc.name",
"fieldname": "recurring_print_format", "fieldname": "recurring_print_format",
"fieldtype": "Link", "fieldtype": "Link",
@ -2586,6 +2738,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break83", "fieldname": "column_break83",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -2610,6 +2763,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "is_recurring", "depends_on": "is_recurring",
"description": "", "description": "",
"fieldname": "from_date", "fieldname": "from_date",
@ -2636,6 +2790,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "is_recurring", "depends_on": "is_recurring",
"description": "", "description": "",
"fieldname": "to_date", "fieldname": "to_date",
@ -2662,6 +2817,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "is_recurring", "depends_on": "is_recurring",
"description": "", "description": "",
"fieldname": "next_date", "fieldname": "next_date",
@ -2696,7 +2852,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-07-07 11:32:05.248626", "modified": "2016-10-20 03:07:24.683178",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Purchase Order", "name": "Purchase Order",
@ -2712,6 +2868,7 @@
"export": 0, "export": 0,
"if_owner": 0, "if_owner": 0,
"import": 0, "import": 0,
"is_custom": 0,
"permlevel": 0, "permlevel": 0,
"print": 0, "print": 0,
"read": 1, "read": 1,
@ -2732,6 +2889,7 @@
"export": 0, "export": 0,
"if_owner": 0, "if_owner": 0,
"import": 0, "import": 0,
"is_custom": 0,
"permlevel": 0, "permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
@ -2752,6 +2910,7 @@
"export": 0, "export": 0,
"if_owner": 0, "if_owner": 0,
"import": 0, "import": 0,
"is_custom": 0,
"permlevel": 0, "permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
@ -2772,6 +2931,7 @@
"export": 0, "export": 0,
"if_owner": 0, "if_owner": 0,
"import": 0, "import": 0,
"is_custom": 0,
"permlevel": 1, "permlevel": 1,
"print": 0, "print": 0,
"read": 1, "read": 1,

View File

@ -155,6 +155,30 @@ class PurchaseOrder(BuyingController):
if date_diff and date_diff[0][0]: if date_diff and date_diff[0][0]:
msgprint(_("{0} {1} has been modified. Please refresh.").format(self.doctype, self.name), msgprint(_("{0} {1} has been modified. Please refresh.").format(self.doctype, self.name),
raise_exception=True) raise_exception=True)
def before_print(self):
if self.get("group_same_items"):
group_item_qty = {}
group_item_amount = {}
for item in self.items:
group_item_qty[item.item_code] = group_item_qty.get(item.item_code, 0) + item.qty
group_item_amount[item.item_code] = group_item_amount.get(item.item_code, 0) + item.amount
duplicate_list = []
for item in self.items:
if item.item_code in group_item_qty:
item.qty = group_item_qty[item.item_code]
item.amount = group_item_amount[item.item_code]
del group_item_qty[item.item_code]
else:
duplicate_list.append(item)
for item in duplicate_list:
self.remove(item)
def update_status(self, status): def update_status(self, status):
self.check_modified_date() self.check_modified_date()

View File

@ -110,6 +110,37 @@ class TestPurchaseOrder(unittest.TestCase):
po.update_status("Closed") po.update_status("Closed")
self.assertEquals(get_ordered_qty(item_code="_Test Item", warehouse="_Test Warehouse - _TC"), existing_ordered_qty) self.assertEquals(get_ordered_qty(item_code="_Test Item", warehouse="_Test Warehouse - _TC"), existing_ordered_qty)
def test_group_same_items(self):
frappe.get_doc({
"doctype": "Purchase Order",
"company": "_Test Company",
"supplier" : "_Test Supplier",
"is_subcontracted" : "No",
"currency" : frappe.db.get_value("Company", "_Test Company", "default_currency"),
"conversion_factor" : 1,
"items" : get_same_items(),
"group_same_items": 1
}).insert()
def get_same_items():
return [
{
"item_code": "_Test FG Item",
"warehouse": "_Test Warehouse - _TC",
"qty": 1,
"rate": 500,
"schedule_date": add_days(nowdate(), 1)
},
{
"item_code": "_Test FG Item",
"warehouse": "_Test Warehouse - _TC",
"qty": 4,
"rate": 500,
"schedule_date": add_days(nowdate(), 1)
}
]
def create_purchase_order(**args): def create_purchase_order(**args):
po = frappe.new_doc("Purchase Order") po = frappe.new_doc("Purchase Order")

View File

@ -15,6 +15,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 3,
"fieldname": "item_code", "fieldname": "item_code",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -42,6 +43,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "", "description": "",
"fieldname": "supplier_part_no", "fieldname": "supplier_part_no",
"fieldtype": "Data", "fieldtype": "Data",
@ -67,13 +69,14 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "item_name", "fieldname": "item_name",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 1, "in_list_view": 0,
"label": "Item Name", "label": "Item Name",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -93,6 +96,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_4", "fieldname": "column_break_4",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -114,9 +118,10 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_on_submit": 0, "allow_on_submit": 1,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "schedule_date", "fieldname": "schedule_date",
"fieldtype": "Date", "fieldtype": "Date",
"hidden": 0, "hidden": 0,
@ -139,10 +144,37 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_on_submit": 1,
"bold": 1,
"collapsible": 0,
"columns": 0,
"fieldname": "expected_delivery_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Expected Delivery Date",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"columns": 0,
"fieldname": "section_break_5", "fieldname": "section_break_5",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -168,6 +200,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "description", "fieldname": "description",
"fieldtype": "Text Editor", "fieldtype": "Text Editor",
"hidden": 0, "hidden": 0,
@ -196,6 +229,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break1", "fieldname": "col_break1",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -219,6 +253,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "image", "fieldname": "image",
"fieldtype": "Attach", "fieldtype": "Attach",
"hidden": 1, "hidden": 1,
@ -244,6 +279,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "image_view", "fieldname": "image_view",
"fieldtype": "Image", "fieldtype": "Image",
"hidden": 0, "hidden": 0,
@ -270,6 +306,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "quantity_and_rate", "fieldname": "quantity_and_rate",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -294,6 +331,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "qty", "fieldname": "qty",
"fieldtype": "Float", "fieldtype": "Float",
"hidden": 0, "hidden": 0,
@ -322,13 +360,14 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "stock_uom", "fieldname": "stock_uom",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 0,
"label": "Stock UOM", "label": "Stock UOM",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -351,6 +390,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break2", "fieldname": "col_break2",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -374,13 +414,14 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "uom", "fieldname": "uom",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 0,
"label": "UOM", "label": "UOM",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -403,6 +444,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "conversion_factor", "fieldname": "conversion_factor",
"fieldtype": "Float", "fieldtype": "Float",
"hidden": 0, "hidden": 0,
@ -431,6 +473,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "sec_break1", "fieldname": "sec_break1",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -454,6 +497,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "price_list_rate", "fieldname": "price_list_rate",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -479,6 +523,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "price_list_rate", "depends_on": "price_list_rate",
"fieldname": "discount_percentage", "fieldname": "discount_percentage",
"fieldtype": "Percent", "fieldtype": "Percent",
@ -486,7 +531,7 @@
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 0,
"label": "Discount on Price List Rate (%)", "label": "Discount on Price List Rate (%)",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -504,6 +549,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break3", "fieldname": "col_break3",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -527,6 +573,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_price_list_rate", "fieldname": "base_price_list_rate",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -552,6 +599,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "sec_break2", "fieldname": "sec_break2",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -575,6 +623,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 3,
"fieldname": "rate", "fieldname": "rate",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -582,7 +631,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 1,
"label": "Rate ", "label": "Rate",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"oldfieldname": "import_rate", "oldfieldname": "import_rate",
@ -602,6 +651,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "amount", "fieldname": "amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -629,6 +679,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break4", "fieldname": "col_break4",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -652,6 +703,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_rate", "fieldname": "base_rate",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -681,6 +733,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_amount", "fieldname": "base_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -708,6 +761,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "pricing_rule", "fieldname": "pricing_rule",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -733,6 +787,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "section_break_29", "fieldname": "section_break_29",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -757,6 +812,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "net_rate", "fieldname": "net_rate",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -783,6 +839,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "net_amount", "fieldname": "net_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -809,6 +866,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_32", "fieldname": "column_break_32",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -833,6 +891,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_net_rate", "fieldname": "base_net_rate",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -859,6 +918,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_net_amount", "fieldname": "base_net_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -885,6 +945,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "warehouse_and_reference", "fieldname": "warehouse_and_reference",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -909,6 +970,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "warehouse", "fieldname": "warehouse",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -936,6 +998,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "project", "fieldname": "project",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -961,6 +1024,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "material_request", "fieldname": "material_request",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -990,6 +1054,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "material_request_item", "fieldname": "material_request_item",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
@ -1016,6 +1081,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "sales_order", "fieldname": "sales_order",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -1042,6 +1108,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "sales_order_item", "fieldname": "sales_order_item",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
@ -1067,6 +1134,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "supplier_quotation", "fieldname": "supplier_quotation",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -1092,6 +1160,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "supplier_quotation_item", "fieldname": "supplier_quotation_item",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 1, "hidden": 1,
@ -1117,6 +1186,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "delivered_by_supplier", "fieldname": "delivered_by_supplier",
"fieldtype": "Check", "fieldtype": "Check",
"hidden": 0, "hidden": 0,
@ -1142,6 +1212,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break5", "fieldname": "col_break5",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -1165,6 +1236,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "", "description": "",
"fieldname": "item_group", "fieldname": "item_group",
"fieldtype": "Link", "fieldtype": "Link",
@ -1193,6 +1265,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "brand", "fieldname": "brand",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 1, "hidden": 1,
@ -1220,6 +1293,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "bom", "fieldname": "bom",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -1246,6 +1320,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "stock_qty", "fieldname": "stock_qty",
"fieldtype": "Float", "fieldtype": "Float",
"hidden": 0, "hidden": 0,
@ -1274,6 +1349,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "received_qty", "fieldname": "received_qty",
"fieldtype": "Float", "fieldtype": "Float",
"hidden": 0, "hidden": 0,
@ -1300,6 +1376,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "returned_qty", "depends_on": "returned_qty",
"fieldname": "returned_qty", "fieldname": "returned_qty",
"fieldtype": "Float", "fieldtype": "Float",
@ -1326,6 +1403,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "billed_amt", "fieldname": "billed_amt",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -1351,6 +1429,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "Tax detail table fetched from item master as a string and stored in this field.\nUsed for Taxes and Charges", "description": "Tax detail table fetched from item master as a string and stored in this field.\nUsed for Taxes and Charges",
"fieldname": "item_tax_rate", "fieldname": "item_tax_rate",
"fieldtype": "Code", "fieldtype": "Code",
@ -1378,6 +1457,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "page_break", "fieldname": "page_break",
"fieldtype": "Check", "fieldtype": "Check",
"hidden": 0, "hidden": 0,
@ -1411,7 +1491,7 @@
"issingle": 0, "issingle": 0,
"istable": 1, "istable": 1,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-07-11 03:28:05.251792", "modified": "2016-10-26 16:07:40.592325",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Purchase Order Item", "name": "Purchase Order Item",
@ -1423,4 +1503,4 @@
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"track_seen": 0 "track_seen": 0
} }

View File

@ -14,19 +14,6 @@ frappe.ui.form.on("Request for Quotation",{
filters: {'supplier': d.supplier} filters: {'supplier': d.supplier}
} }
} }
frm.get_field('items').grid.editable_fields = [
{fieldname: 'item_code', columns: 3},
{fieldname: 'qty', columns: 2},
{fieldname: 'schedule_date', columns: 2},
{fieldname: 'warehouse', columns: 3},
];
frm.get_field('suppliers').grid.editable_fields = [
{fieldname: 'supplier', columns: 4},
{fieldname: 'contact', columns: 3},
{fieldname: 'email_id', columns: 3}
];
}, },
onload: function(frm) { onload: function(frm) {

View File

@ -15,6 +15,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "naming_series", "fieldname": "naming_series",
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
@ -43,6 +44,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "", "description": "",
"fieldname": "company", "fieldname": "company",
"fieldtype": "Link", "fieldtype": "Link",
@ -72,6 +74,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "For individual supplier", "description": "For individual supplier",
"fieldname": "vendor", "fieldname": "vendor",
"fieldtype": "Link", "fieldtype": "Link",
@ -99,6 +102,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break1", "fieldname": "column_break1",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -126,6 +130,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "transaction_date", "fieldname": "transaction_date",
"fieldtype": "Date", "fieldtype": "Date",
"hidden": 0, "hidden": 0,
@ -153,6 +158,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "suppliers_section", "fieldname": "suppliers_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -178,6 +184,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "suppliers", "fieldname": "suppliers",
"fieldtype": "Table", "fieldtype": "Table",
"hidden": 0, "hidden": 0,
@ -204,6 +211,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "items_section", "fieldname": "items_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -231,6 +239,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "items", "fieldname": "items",
"fieldtype": "Table", "fieldtype": "Table",
"hidden": 0, "hidden": 0,
@ -259,6 +268,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "supplier_response_section", "fieldname": "supplier_response_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -284,6 +294,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "standard_reply", "fieldname": "standard_reply",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -310,6 +321,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "message_for_supplier", "fieldname": "message_for_supplier",
"fieldtype": "Text Editor", "fieldtype": "Text Editor",
"hidden": 0, "hidden": 0,
@ -336,6 +348,7 @@
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"collapsible_depends_on": "terms", "collapsible_depends_on": "terms",
"columns": 0,
"fieldname": "terms_section_break", "fieldname": "terms_section_break",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -363,6 +376,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "tc_name", "fieldname": "tc_name",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -391,6 +405,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "terms", "fieldname": "terms",
"fieldtype": "Text Editor", "fieldtype": "Text Editor",
"hidden": 0, "hidden": 0,
@ -418,6 +433,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"columns": 0,
"fieldname": "printing_settings", "fieldname": "printing_settings",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -443,6 +459,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "select_print_heading", "fieldname": "select_print_heading",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -471,6 +488,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "letter_head", "fieldname": "letter_head",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -499,6 +517,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"columns": 0,
"fieldname": "more_info", "fieldname": "more_info",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -526,6 +545,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "status", "fieldname": "status",
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
@ -554,6 +574,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "fiscal_year", "fieldname": "fiscal_year",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -582,6 +603,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break3", "fieldname": "column_break3",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -606,6 +628,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "amended_from", "fieldname": "amended_from",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -639,8 +662,8 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-08-01 08:45:39.777405", "modified": "2016-09-29 11:56:57.123429",
"modified_by": "Administrator", "modified_by": "neil@frappe.io",
"module": "Buying", "module": "Buying",
"name": "Request for Quotation", "name": "Request for Quotation",
"name_case": "", "name_case": "",
@ -726,26 +749,6 @@
"submit": 0, "submit": 0,
"write": 0 "write": 0
}, },
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Supplier",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
},
{ {
"amend": 0, "amend": 0,
"apply_user_permissions": 0, "apply_user_permissions": 0,

View File

@ -192,8 +192,6 @@ def create_supplier_quotation(doc):
if isinstance(doc, basestring): if isinstance(doc, basestring):
doc = json.loads(doc) doc = json.loads(doc)
validate_duplicate_supplier_quotation(doc)
try: try:
sq_doc = frappe.get_doc({ sq_doc = frappe.get_doc({
"doctype": "Supplier Quotation", "doctype": "Supplier Quotation",
@ -210,7 +208,7 @@ def create_supplier_quotation(doc):
frappe.msgprint(_("Supplier Quotation {0} created").format(sq_doc.name)) frappe.msgprint(_("Supplier Quotation {0} created").format(sq_doc.name))
return sq_doc.name return sq_doc.name
except Exception: except Exception:
return return None
def add_items(sq_doc, supplier, items): def add_items(sq_doc, supplier, items):
for data in items: for data in items:
@ -245,13 +243,3 @@ def get_rfq_doc(doctype, name, supplier_idx):
args = doc.get('suppliers')[cint(supplier_idx) - 1] args = doc.get('suppliers')[cint(supplier_idx) - 1]
doc.update_supplier_part_no(args) doc.update_supplier_part_no(args)
return doc return doc
@frappe.whitelist()
def validate_duplicate_supplier_quotation(args):
data = frappe.db.sql("""select sq.name as name from `tabSupplier Quotation` sq,
`tabSupplier Quotation Item` sqi where sqi.parent = sq.name and sq.supplier = %(supplier)s
and sqi.request_for_quotation = %(rfq)s and sq.docstatus < 2""",
{'supplier': args.get('supplier'), 'rfq': args.get('name')}, as_dict=True)
if data and data[0] and data[0].name:
frappe.throw(_("Already supplier quotation has created"))

View File

@ -15,6 +15,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 3,
"fieldname": "item_code", "fieldname": "item_code",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -43,6 +44,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "supplier_part_no", "fieldname": "supplier_part_no",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
@ -68,6 +70,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_3", "fieldname": "column_break_3",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -92,13 +95,14 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "item_name", "fieldname": "item_name",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 1, "in_list_view": 0,
"label": "Item Name", "label": "Item Name",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -119,6 +123,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"columns": 0,
"fieldname": "section_break_5", "fieldname": "section_break_5",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -144,6 +149,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "description", "fieldname": "description",
"fieldtype": "Text Editor", "fieldtype": "Text Editor",
"hidden": 0, "hidden": 0,
@ -173,6 +179,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break1", "fieldname": "col_break1",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -197,6 +204,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "image", "fieldname": "image",
"fieldtype": "Attach", "fieldtype": "Attach",
"hidden": 1, "hidden": 1,
@ -222,6 +230,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "image_view", "fieldname": "image_view",
"fieldtype": "Image", "fieldtype": "Image",
"hidden": 0, "hidden": 0,
@ -248,6 +257,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "quantity", "fieldname": "quantity",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -273,6 +283,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "qty", "fieldname": "qty",
"fieldtype": "Float", "fieldtype": "Float",
"hidden": 0, "hidden": 0,
@ -302,6 +313,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break2", "fieldname": "col_break2",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -326,6 +338,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"default": "Today", "default": "Today",
"fieldname": "schedule_date", "fieldname": "schedule_date",
"fieldtype": "Date", "fieldtype": "Date",
@ -333,7 +346,7 @@
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 1,
"label": "Required Date", "label": "Required Date",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -352,13 +365,14 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "uom", "fieldname": "uom",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 0,
"label": "UOM", "label": "UOM",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -382,6 +396,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "warehouse_and_reference", "fieldname": "warehouse_and_reference",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -407,6 +422,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 3,
"fieldname": "warehouse", "fieldname": "warehouse",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -435,6 +451,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "project_name", "fieldname": "project_name",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -461,6 +478,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "material_request", "fieldname": "material_request",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -487,6 +505,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break4", "fieldname": "col_break4",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -511,6 +530,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "material_request_item", "fieldname": "material_request_item",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
@ -536,6 +556,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "brand", "fieldname": "brand",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -564,6 +585,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "", "description": "",
"fieldname": "item_group", "fieldname": "item_group",
"fieldtype": "Link", "fieldtype": "Link",
@ -593,6 +615,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "page_break", "fieldname": "page_break",
"fieldtype": "Check", "fieldtype": "Check",
"hidden": 0, "hidden": 0,
@ -627,7 +650,7 @@
"issingle": 0, "issingle": 0,
"istable": 1, "istable": 1,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-07-11 03:28:06.681590", "modified": "2016-08-26 02:40:48.487168",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Request for Quotation Item", "name": "Request for Quotation Item",

View File

@ -14,6 +14,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "1", "default": "1",
"fieldname": "send_email", "fieldname": "send_email",
"fieldtype": "Check", "fieldtype": "Check",
@ -40,6 +41,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 4,
"fieldname": "supplier", "fieldname": "supplier",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -66,6 +68,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 3,
"fieldname": "contact", "fieldname": "contact",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -92,6 +95,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_3", "fieldname": "column_break_3",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -116,13 +120,14 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "supplier_name", "fieldname": "supplier_name",
"fieldtype": "Read Only", "fieldtype": "Read Only",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 0,
"label": "Supplier Name", "label": "Supplier Name",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -142,13 +147,14 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 3,
"fieldname": "email_id", "fieldname": "email_id",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 1,
"label": "Email Id", "label": "Email Id",
"length": 0, "length": 0,
"no_copy": 1, "no_copy": 1,
@ -168,6 +174,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "download_pdf", "fieldname": "download_pdf",
"fieldtype": "Button", "fieldtype": "Button",
"hidden": 0, "hidden": 0,
@ -200,7 +207,7 @@
"issingle": 0, "issingle": 0,
"istable": 1, "istable": 1,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-07-11 03:28:06.830030", "modified": "2016-08-26 02:38:45.634613",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Request for Quotation Supplier", "name": "Request for Quotation Supplier",

View File

@ -2,8 +2,18 @@
// License: GNU General Public License v3. See license.txt // License: GNU General Public License v3. See license.txt
frappe.ui.form.on("Supplier", { frappe.ui.form.on("Supplier", {
before_load: function(frm) { setup: function(frm) {
frappe.setup_language_field(frm); frm.set_query('default_price_list', { 'buying': 1});
frm.set_query('account', 'accounts', function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
return {
filters: {
'account_type': 'Payable',
'company': d.company,
"is_group": 0
}
}
});
}, },
refresh: function(frm) { refresh: function(frm) {
if(frappe.defaults.get_default("supp_master_name")!="Naming Series") { if(frappe.defaults.get_default("supp_master_name")!="Naming Series") {
@ -19,23 +29,18 @@ frappe.ui.form.on("Supplier", {
else { else {
unhide_field(['address_html','contact_html']); unhide_field(['address_html','contact_html']);
erpnext.utils.render_address_and_contact(frm); erpnext.utils.render_address_and_contact(frm);
// custom buttons
frm.add_custom_button(__('Accounting Ledger'), function() {
frappe.set_route('query-report', 'General Ledger',
{party_type:'Supplier', party:frm.doc.name});
});
frm.add_custom_button(__('Accounts Payable'), function() {
frappe.set_route('query-report', 'Accounts Payable', {supplier:frm.doc.name});
});
// indicators
erpnext.utils.set_party_dashboard_indicators(frm);
} }
}, },
}); });
cur_frm.fields_dict['default_price_list'].get_query = function(doc, cdt, cdn) {
return{
filters:{'buying': 1}
}
}
cur_frm.fields_dict['accounts'].grid.get_field('account').get_query = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
return {
filters: {
'account_type': 'Payable',
'company': d.company,
"is_group": 0
}
}
}

View File

@ -16,6 +16,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "basic_info", "fieldname": "basic_info",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -42,6 +43,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "naming_series", "fieldname": "naming_series",
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
@ -69,6 +71,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "supplier_name", "fieldname": "supplier_name",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
@ -95,6 +98,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "country", "fieldname": "country",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -121,6 +125,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "image", "fieldname": "image",
"fieldtype": "Attach Image", "fieldtype": "Attach Image",
"hidden": 1, "hidden": 1,
@ -130,7 +135,7 @@
"in_list_view": 0, "in_list_view": 0,
"label": "Image", "label": "Image",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 1,
"permlevel": 0, "permlevel": 0,
"precision": "", "precision": "",
"print_hide": 1, "print_hide": 1,
@ -146,6 +151,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "status", "fieldname": "status",
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 1, "hidden": 1,
@ -172,6 +178,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break0", "fieldname": "column_break0",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -196,6 +203,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "supplier_type", "fieldname": "supplier_type",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -223,8 +231,9 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "language", "fieldname": "language",
"fieldtype": "Select", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
@ -233,7 +242,7 @@
"label": "Print Language", "label": "Print Language",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"options": "Loading...", "options": "Language",
"permlevel": 0, "permlevel": 0,
"precision": "", "precision": "",
"print_hide": 0, "print_hide": 0,
@ -249,6 +258,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "0", "default": "0",
"fieldname": "disabled", "fieldname": "disabled",
"fieldtype": "Check", "fieldtype": "Check",
@ -275,6 +285,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"columns": 0,
"fieldname": "section_break_7", "fieldname": "section_break_7",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -300,6 +311,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "default_currency", "fieldname": "default_currency",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -325,6 +337,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_10", "fieldname": "column_break_10",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -349,6 +362,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "default_price_list", "fieldname": "default_price_list",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -374,6 +388,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"columns": 0,
"fieldname": "section_credit_limit", "fieldname": "section_credit_limit",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -399,6 +414,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "credit_days_based_on", "fieldname": "credit_days_based_on",
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
@ -425,6 +441,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.credit_days_based_on == 'Fixed Days'", "depends_on": "eval:doc.credit_days_based_on == 'Fixed Days'",
"fieldname": "credit_days", "fieldname": "credit_days",
"fieldtype": "Int", "fieldtype": "Int",
@ -450,6 +467,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:!doc.__islocal", "depends_on": "eval:!doc.__islocal",
"fieldname": "address_contacts", "fieldname": "address_contacts",
"fieldtype": "Section Break", "fieldtype": "Section Break",
@ -477,6 +495,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "address_html", "fieldname": "address_html",
"fieldtype": "HTML", "fieldtype": "HTML",
"hidden": 0, "hidden": 0,
@ -501,6 +520,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break1", "fieldname": "column_break1",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -525,6 +545,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "contact_html", "fieldname": "contact_html",
"fieldtype": "HTML", "fieldtype": "HTML",
"hidden": 0, "hidden": 0,
@ -550,6 +571,7 @@
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"collapsible_depends_on": "accounts", "collapsible_depends_on": "accounts",
"columns": 0,
"fieldname": "default_payable_accounts", "fieldname": "default_payable_accounts",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -574,6 +596,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "", "depends_on": "",
"description": "Mention if non-standard receivable account", "description": "Mention if non-standard receivable account",
"fieldname": "accounts", "fieldname": "accounts",
@ -602,6 +625,7 @@
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"collapsible_depends_on": "supplier_details", "collapsible_depends_on": "supplier_details",
"columns": 0,
"fieldname": "column_break2", "fieldname": "column_break2",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -627,6 +651,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "website", "fieldname": "website",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
@ -653,6 +678,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "Statutory info and other general information about your Supplier", "description": "Statutory info and other general information about your Supplier",
"fieldname": "supplier_details", "fieldname": "supplier_details",
"fieldtype": "Text", "fieldtype": "Text",
@ -680,6 +706,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "is_frozen", "fieldname": "is_frozen",
"fieldtype": "Check", "fieldtype": "Check",
"hidden": 0, "hidden": 0,
@ -714,7 +741,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-07-25 05:20:29.238820", "modified": "2016-09-21 18:11:03.873221",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Supplier", "name": "Supplier",

View File

@ -18,6 +18,26 @@ class Supplier(TransactionBase):
def onload(self): def onload(self):
"""Load address and contacts in `__onload`""" """Load address and contacts in `__onload`"""
load_address_and_contact(self, "supplier") load_address_and_contact(self, "supplier")
self.load_dashboard_info()
def load_dashboard_info(self):
billing_this_year = frappe.db.sql("""
select sum(credit_in_account_currency) - sum(debit_in_account_currency)
from `tabGL Entry`
where voucher_type='Purchase Invoice' and party_type = 'Supplier'
and party=%s and fiscal_year = %s""",
(self.name, frappe.db.get_default("fiscal_year")))
total_unpaid = frappe.db.sql("""select sum(outstanding_amount)
from `tabPurchase Invoice`
where supplier=%s and docstatus = 1""", self.name)
info = {}
info["billing_this_year"] = billing_this_year[0][0] if billing_this_year else 0
info["total_unpaid"] = total_unpaid[0][0] if total_unpaid else 0
self.set_onload('dashboard_info', info)
def autoname(self): def autoname(self):
supp_master_name = frappe.defaults.get_global_default('supp_master_name') supp_master_name = frappe.defaults.get_global_default('supp_master_name')

View File

@ -41,10 +41,6 @@ erpnext.buying.SupplierQuotationController = erpnext.buying.BuyingController.ext
// for backward compatibility: combine new and previous states // for backward compatibility: combine new and previous states
$.extend(cur_frm.cscript, new erpnext.buying.SupplierQuotationController({frm: cur_frm})); $.extend(cur_frm.cscript, new erpnext.buying.SupplierQuotationController({frm: cur_frm}));
cur_frm.cscript.uom = function(doc, cdt, cdn) {
// no need to trigger updation of stock uom, as this field doesn't exist in supplier quotation
}
cur_frm.fields_dict['items'].grid.get_field('project').get_query = cur_frm.fields_dict['items'].grid.get_field('project').get_query =
function(doc, cdt, cdn) { function(doc, cdt, cdn) {
return{ return{

View File

@ -15,6 +15,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "supplier_section", "fieldname": "supplier_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -40,6 +41,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "{supplier_name}", "default": "{supplier_name}",
"fieldname": "title", "fieldname": "title",
"fieldtype": "Data", "fieldtype": "Data",
@ -66,6 +68,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "naming_series", "fieldname": "naming_series",
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
@ -93,6 +96,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "", "description": "",
"fieldname": "supplier", "fieldname": "supplier",
"fieldtype": "Link", "fieldtype": "Link",
@ -121,6 +125,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "supplier_name", "fieldname": "supplier_name",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
@ -145,6 +150,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break1", "fieldname": "column_break1",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -171,6 +177,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "Today", "default": "Today",
"fieldname": "transaction_date", "fieldname": "transaction_date",
"fieldtype": "Date", "fieldtype": "Date",
@ -198,6 +205,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "amended_from", "fieldname": "amended_from",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 1, "hidden": 1,
@ -225,6 +233,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "", "description": "",
"fieldname": "company", "fieldname": "company",
"fieldtype": "Link", "fieldtype": "Link",
@ -253,6 +262,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"columns": 0,
"fieldname": "address_section", "fieldname": "address_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -278,6 +288,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "supplier_address", "fieldname": "supplier_address",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -303,6 +314,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "contact_person", "fieldname": "contact_person",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -328,6 +340,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "address_display", "fieldname": "address_display",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"hidden": 0, "hidden": 0,
@ -352,6 +365,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "contact_display", "fieldname": "contact_display",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"hidden": 0, "hidden": 0,
@ -376,6 +390,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "contact_mobile", "fieldname": "contact_mobile",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"hidden": 0, "hidden": 0,
@ -400,6 +415,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "contact_email", "fieldname": "contact_email",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
@ -425,6 +441,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"columns": 0,
"fieldname": "currency_and_price_list", "fieldname": "currency_and_price_list",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -450,6 +467,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "currency", "fieldname": "currency",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -477,6 +495,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "", "description": "",
"fieldname": "conversion_rate", "fieldname": "conversion_rate",
"fieldtype": "Float", "fieldtype": "Float",
@ -505,6 +524,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "cb_price_list", "fieldname": "cb_price_list",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -530,6 +550,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "buying_price_list", "fieldname": "buying_price_list",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -555,6 +576,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "buying_price_list", "depends_on": "buying_price_list",
"fieldname": "price_list_currency", "fieldname": "price_list_currency",
"fieldtype": "Link", "fieldtype": "Link",
@ -581,6 +603,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "buying_price_list", "depends_on": "buying_price_list",
"fieldname": "plc_conversion_rate", "fieldname": "plc_conversion_rate",
"fieldtype": "Float", "fieldtype": "Float",
@ -607,6 +630,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "ignore_pricing_rule", "fieldname": "ignore_pricing_rule",
"fieldtype": "Check", "fieldtype": "Check",
"hidden": 0, "hidden": 0,
@ -631,6 +655,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "items_section", "fieldname": "items_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -657,6 +682,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "items", "fieldname": "items",
"fieldtype": "Table", "fieldtype": "Table",
"hidden": 0, "hidden": 0,
@ -684,6 +710,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "section_break_22", "fieldname": "section_break_22",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -707,6 +734,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_total", "fieldname": "base_total",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -733,6 +761,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_net_total", "fieldname": "base_net_total",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -760,6 +789,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_24", "fieldname": "column_break_24",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -783,6 +813,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "total", "fieldname": "total",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -809,6 +840,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "net_total", "fieldname": "net_total",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -836,6 +868,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "taxes_section", "fieldname": "taxes_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -862,6 +895,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "", "description": "",
"fieldname": "taxes_and_charges", "fieldname": "taxes_and_charges",
"fieldtype": "Link", "fieldtype": "Link",
@ -890,6 +924,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "taxes", "fieldname": "taxes",
"fieldtype": "Table", "fieldtype": "Table",
"hidden": 0, "hidden": 0,
@ -917,6 +952,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "other_charges_calculation", "fieldname": "other_charges_calculation",
"fieldtype": "HTML", "fieldtype": "HTML",
"hidden": 0, "hidden": 0,
@ -942,6 +978,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "totals", "fieldname": "totals",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -968,6 +1005,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_taxes_and_charges_added", "fieldname": "base_taxes_and_charges_added",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -995,6 +1033,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_taxes_and_charges_deducted", "fieldname": "base_taxes_and_charges_deducted",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -1022,6 +1061,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_total_taxes_and_charges", "fieldname": "base_total_taxes_and_charges",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -1049,6 +1089,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_37", "fieldname": "column_break_37",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -1073,6 +1114,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "taxes_and_charges_added", "fieldname": "taxes_and_charges_added",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -1100,6 +1142,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "taxes_and_charges_deducted", "fieldname": "taxes_and_charges_deducted",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -1127,6 +1170,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "total_taxes_and_charges", "fieldname": "total_taxes_and_charges",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -1154,6 +1198,7 @@
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"collapsible_depends_on": "discount_amount", "collapsible_depends_on": "discount_amount",
"columns": 0,
"fieldname": "section_break_41", "fieldname": "section_break_41",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -1179,6 +1224,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "Grand Total", "default": "Grand Total",
"fieldname": "apply_discount_on", "fieldname": "apply_discount_on",
"fieldtype": "Select", "fieldtype": "Select",
@ -1206,6 +1252,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_discount_amount", "fieldname": "base_discount_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -1232,6 +1279,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_43", "fieldname": "column_break_43",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -1256,6 +1304,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "additional_discount_percentage", "fieldname": "additional_discount_percentage",
"fieldtype": "Float", "fieldtype": "Float",
"hidden": 0, "hidden": 0,
@ -1281,6 +1330,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "discount_amount", "fieldname": "discount_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -1307,6 +1357,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "section_break_46", "fieldname": "section_break_46",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -1331,6 +1382,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_grand_total", "fieldname": "base_grand_total",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -1358,6 +1410,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "", "description": "",
"fieldname": "base_in_words", "fieldname": "base_in_words",
"fieldtype": "Data", "fieldtype": "Data",
@ -1385,6 +1438,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_rounded_total", "fieldname": "base_rounded_total",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -1412,6 +1466,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break4", "fieldname": "column_break4",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -1436,6 +1491,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "grand_total", "fieldname": "grand_total",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -1463,6 +1519,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "in_words", "fieldname": "in_words",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
@ -1490,6 +1547,7 @@
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"collapsible_depends_on": "terms", "collapsible_depends_on": "terms",
"columns": 0,
"fieldname": "terms_section_break", "fieldname": "terms_section_break",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -1516,6 +1574,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "tc_name", "fieldname": "tc_name",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -1543,6 +1602,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "terms", "fieldname": "terms",
"fieldtype": "Text Editor", "fieldtype": "Text Editor",
"hidden": 0, "hidden": 0,
@ -1569,6 +1629,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"columns": 0,
"fieldname": "printing_settings", "fieldname": "printing_settings",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -1594,6 +1655,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "select_print_heading", "fieldname": "select_print_heading",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -1621,6 +1683,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "letter_head", "fieldname": "letter_head",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -1648,6 +1711,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "language", "fieldname": "language",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
@ -1673,6 +1737,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"columns": 0,
"fieldname": "more_info", "fieldname": "more_info",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -1699,6 +1764,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "status", "fieldname": "status",
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
@ -1726,6 +1792,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_57", "fieldname": "column_break_57",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -1749,6 +1816,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "No", "default": "No",
"fieldname": "is_subcontracted", "fieldname": "is_subcontracted",
"fieldtype": "Select", "fieldtype": "Select",
@ -1770,6 +1838,59 @@
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "reference",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Reference",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "opportunity",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Opportunity",
"length": 0,
"no_copy": 1,
"options": "Opportunity",
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
} }
], ],
"hide_heading": 0, "hide_heading": 0,
@ -1784,7 +1905,7 @@
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"menu_index": 0, "menu_index": 0,
"modified": "2016-07-08 06:48:04.162164", "modified": "2016-09-14 05:48:17.443848",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Supplier Quotation", "name": "Supplier Quotation",

View File

@ -3,6 +3,8 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe import _
from frappe.utils import flt
from frappe.model.mapper import get_mapped_doc from frappe.model.mapper import get_mapped_doc
from erpnext.controllers.buying_controller import BuyingController from erpnext.controllers.buying_controller import BuyingController
@ -53,6 +55,18 @@ class SupplierQuotation(BuyingController):
pc = frappe.get_doc('Purchase Common') pc = frappe.get_doc('Purchase Common')
pc.validate_for_items(self) pc.validate_for_items(self)
def get_list_context(context=None):
from erpnext.controllers.website_list_for_contact import get_list_context
list_context = get_list_context(context)
list_context.update({
'show_sidebar': True,
'show_search': True,
'no_breadcrumbs': True,
'title': _('Supplier Quotation'),
})
return list_context
@frappe.whitelist() @frappe.whitelist()
def make_purchase_order(source_name, target_doc=None): def make_purchase_order(source_name, target_doc=None):
def set_missing_values(source, target): def set_missing_values(source, target):
@ -62,7 +76,7 @@ def make_purchase_order(source_name, target_doc=None):
target.run_method("calculate_taxes_and_totals") target.run_method("calculate_taxes_and_totals")
def update_item(obj, target, source_parent): def update_item(obj, target, source_parent):
target.conversion_factor = 1 target.stock_qty = flt(obj.qty) * flt(obj.conversion_factor)
doclist = get_mapped_doc("Supplier Quotation", source_name, { doclist = get_mapped_doc("Supplier Quotation", source_name, {
"Supplier Quotation": { "Supplier Quotation": {
@ -76,8 +90,6 @@ def make_purchase_order(source_name, target_doc=None):
"field_map": [ "field_map": [
["name", "supplier_quotation_item"], ["name", "supplier_quotation_item"],
["parent", "supplier_quotation"], ["parent", "supplier_quotation"],
["uom", "stock_uom"],
["uom", "uom"],
["material_request", "material_request"], ["material_request", "material_request"],
["material_request_item", "material_request_item"] ["material_request_item", "material_request_item"]
], ],

View File

@ -8,12 +8,14 @@
"custom": 0, "custom": 0,
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"document_type": "Document",
"editable_grid": 1, "editable_grid": 1,
"fields": [ "fields": [
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 4,
"fieldname": "item_code", "fieldname": "item_code",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -41,6 +43,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "", "description": "",
"fieldname": "supplier_part_no", "fieldname": "supplier_part_no",
"fieldtype": "Data", "fieldtype": "Data",
@ -66,6 +69,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_3", "fieldname": "column_break_3",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -90,13 +94,14 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "item_name", "fieldname": "item_name",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 1, "in_list_view": 0,
"label": "Item Name", "label": "Item Name",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -116,6 +121,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"columns": 0,
"fieldname": "section_break_5", "fieldname": "section_break_5",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -141,6 +147,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "description", "fieldname": "description",
"fieldtype": "Text Editor", "fieldtype": "Text Editor",
"hidden": 0, "hidden": 0,
@ -169,6 +176,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break1", "fieldname": "col_break1",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -192,6 +200,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "image", "fieldname": "image",
"fieldtype": "Attach", "fieldtype": "Attach",
"hidden": 1, "hidden": 1,
@ -217,6 +226,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "image_view", "fieldname": "image_view",
"fieldtype": "Image", "fieldtype": "Image",
"hidden": 0, "hidden": 0,
@ -243,6 +253,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "quantity_and_rate", "fieldname": "quantity_and_rate",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -267,6 +278,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "qty", "fieldname": "qty",
"fieldtype": "Float", "fieldtype": "Float",
"hidden": 0, "hidden": 0,
@ -295,6 +307,34 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "stock_uom",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Stock UOM",
"length": 0,
"no_copy": 0,
"options": "UOM",
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "price_list_rate", "fieldname": "price_list_rate",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -320,6 +360,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "price_list_rate", "depends_on": "price_list_rate",
"fieldname": "discount_percentage", "fieldname": "discount_percentage",
"fieldtype": "Percent", "fieldtype": "Percent",
@ -327,7 +368,7 @@
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 0,
"label": "Discount on Price List Rate (%)", "label": "Discount on Price List Rate (%)",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -345,6 +386,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break2", "fieldname": "col_break2",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -368,13 +410,14 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "uom", "fieldname": "uom",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 0,
"label": "UOM", "label": "UOM",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -397,6 +440,33 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "conversion_factor",
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "UOM Conversion Factor",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "base_price_list_rate", "fieldname": "base_price_list_rate",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -422,6 +492,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "sec_break1", "fieldname": "sec_break1",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -445,6 +516,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "rate", "fieldname": "rate",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -472,6 +544,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 2,
"fieldname": "amount", "fieldname": "amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -499,6 +572,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break3", "fieldname": "col_break3",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -522,6 +596,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_rate", "fieldname": "base_rate",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -536,6 +611,7 @@
"oldfieldtype": "Currency", "oldfieldtype": "Currency",
"options": "Company:company:default_currency", "options": "Company:company:default_currency",
"permlevel": 0, "permlevel": 0,
"precision": "2",
"print_hide": 1, "print_hide": 1,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"print_width": "100px", "print_width": "100px",
@ -551,6 +627,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_amount", "fieldname": "base_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -578,6 +655,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "pricing_rule", "fieldname": "pricing_rule",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -603,6 +681,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "section_break_24", "fieldname": "section_break_24",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -627,6 +706,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "net_rate", "fieldname": "net_rate",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -652,6 +732,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "net_amount", "fieldname": "net_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -678,6 +759,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_27", "fieldname": "column_break_27",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -702,6 +784,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_net_rate", "fieldname": "base_net_rate",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -728,6 +811,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "base_net_amount", "fieldname": "base_net_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -754,6 +838,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "warehouse_and_reference", "fieldname": "warehouse_and_reference",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -778,6 +863,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "warehouse", "fieldname": "warehouse",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -805,6 +891,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "project", "fieldname": "project",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -830,6 +917,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "prevdoc_doctype", "fieldname": "prevdoc_doctype",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
@ -856,6 +944,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "material_request", "fieldname": "material_request",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -885,6 +974,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "request_for_quotation", "fieldname": "request_for_quotation",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -911,6 +1001,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "col_break4", "fieldname": "col_break4",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -934,6 +1025,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "material_request_item", "fieldname": "material_request_item",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
@ -960,6 +1052,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "request_for_quotation_item", "fieldname": "request_for_quotation_item",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
@ -985,6 +1078,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "brand", "fieldname": "brand",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -1012,6 +1106,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "", "description": "",
"fieldname": "item_group", "fieldname": "item_group",
"fieldtype": "Link", "fieldtype": "Link",
@ -1040,6 +1135,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "Tax detail table fetched from item master as a string and stored in this field.\nUsed for Taxes and Charges", "description": "Tax detail table fetched from item master as a string and stored in this field.\nUsed for Taxes and Charges",
"fieldname": "item_tax_rate", "fieldname": "item_tax_rate",
"fieldtype": "Code", "fieldtype": "Code",
@ -1063,10 +1159,62 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "section_break_44",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "stock_qty",
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Qty as per Stock UOM",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "page_break", "fieldname": "page_break",
"fieldtype": "Check", "fieldtype": "Check",
"hidden": 0, "hidden": 0,
@ -1100,7 +1248,7 @@
"issingle": 0, "issingle": 0,
"istable": 1, "istable": 1,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-07-11 03:28:09.043961", "modified": "2016-09-06 02:40:11.022104",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Supplier Quotation Item", "name": "Supplier Quotation Item",

View File

@ -4,12 +4,43 @@
frappe.query_reports["Quoted Item Comparison"] = { frappe.query_reports["Quoted Item Comparison"] = {
"filters": [ "filters": [
{ {
"fieldname":"supplier_quotation",
"label": __("Supplier Quotation"),
"fieldtype": "Link",
"options": "Supplier Quotation",
"default": "",
"get_query": function() {
return {
filters: {"docstatus": ["<",2]}
}
}
},{
"fieldname":"item", "fieldname":"item",
"label": __("Item"), "label": __("Item"),
"fieldtype": "Link", "fieldtype": "Link",
"options": "Item", "options": "Item",
"default": "" "default": "",
"reqd": 1,
"get_query": function() {
var quote = frappe.query_report_filters_by_name.supplier_quotation.get_value();
if (quote != "")
{
return {
query: "erpnext.buying.doctype.quality_inspection.quality_inspection.item_query",
filters: {
"from": "Supplier Quotation Item",
"parent": quote
}
}
}
else{
return{
filters: {"disabled":0}
}
}
}
} }
], ],
onload: function(report) { onload: function(report) {

View File

@ -0,0 +1,45 @@
#### Payroll
- Salary Structure based on formula
- Single Salary Structure record for multiple employees
- Make payment entry directly from Salary Slip / Process Payroll form
#### Scrap Management in Manufacturing
- Define scrap items in BOM
- Inward entry for scrap items along with finished goods
#### Reports
- Multi-year Financial Statements
- Profit and Loss Statement based on Cost Center and Project
- New report `Profitability Analysis` based on Cost Center and Project
- Unclosed previous fiscal year's account balances in Balance Sheet and Trial Balance report
#### Default Tax Template based on Country
- On new installation, added predefined tax templates based on country
#### Schools Updates
- Renamed Examination doctype to Assessment
- New Doctype
- Assessment Group
- Student Category
- Student Batch
- Guardian
- Student Admission
- Student Log
- Application portal for students
#### Other Fixes
- Show total amount in Stock Entry only for Material Issue / Receipt / Transfer purpose
- Optional settings to unlink the payment entries on cancellation of the invoice
- Validate selling price against purchase price
- Combine duplicate items while printing Purchase Order
- Project completion based on weighted average of tasks
- Show already submitted Supplier Quotations on Supplier portal
- Total and difference added for amount and qty in Stock Reconciliation
- Option to make Supplier Quotation from Opportunity
- Billing and outstanding information on Customer / Supplier dashboard
- Web Form for Job Application
- Option to make payment via Journal Entry
- Wildcard search option in POS for Customer and Item
- Optional setting for automatic allocation of payment amount against outstanding invoices in Payment Entry
- Purchase Return for rejected items

View File

@ -60,7 +60,7 @@ def get_data():
"link": "List/Lead" "link": "List/Lead"
}, },
{ {
"module_name": "Profit and Loss Statment", "module_name": "Profit and Loss Statement",
"_doctype": "Account", "_doctype": "Account",
"color": "#3498db", "color": "#3498db",
"icon": "octicon octicon-repo", "icon": "octicon octicon-repo",

View File

@ -19,7 +19,7 @@ def get_data():
}, },
{ {
"type": "report", "type": "report",
"route": "Gantt/Task", "route": "List/Task/Gantt",
"doctype": "Task", "doctype": "Task",
"name": "Gantt Chart", "name": "Gantt Chart",
"description": _("Gantt chart of all tasks.") "description": _("Gantt chart of all tasks.")

View File

@ -37,6 +37,10 @@ def get_data():
"type": "doctype", "type": "doctype",
"name": "Student Applicant" "name": "Student Applicant"
}, },
{
"type": "doctype",
"name": "Student Admission"
},
{ {
"type": "doctype", "type": "doctype",
"name": "Program Enrollment" "name": "Program Enrollment"
@ -124,6 +128,14 @@ def get_data():
"type": "doctype", "type": "doctype",
"name": "Program" "name": "Program"
}, },
{
"type": "doctype",
"name": "Student Category"
},
{
"type": "doctype",
"name": "Grading Structure"
},
{ {
"type": "doctype", "type": "doctype",
"name": "Instructor" "name": "Instructor"

View File

@ -37,7 +37,7 @@ class BuyingController(StockController):
self.validate_purchase_receipt_if_update_stock() self.validate_purchase_receipt_if_update_stock()
if self.doctype=="Purchase Receipt" or (self.doctype=="Purchase Invoice" and self.update_stock): if self.doctype=="Purchase Receipt" or (self.doctype=="Purchase Invoice" and self.update_stock):
self.validate_purchase_return() # self.validate_purchase_return()
self.validate_rejected_warehouse() self.validate_rejected_warehouse()
self.validate_accepted_rejected_qty() self.validate_accepted_rejected_qty()
@ -346,7 +346,7 @@ class BuyingController(StockController):
}) })
sl_entries.append(sle) sl_entries.append(sle)
if flt(d.rejected_qty) > 0: if flt(d.rejected_qty) != 0:
sl_entries.append(self.get_sl_entries(d, { sl_entries.append(self.get_sl_entries(d, {
"warehouse": d.rejected_warehouse, "warehouse": d.rejected_warehouse,
"actual_qty": flt(d.rejected_qty) * flt(d.conversion_factor), "actual_qty": flt(d.rejected_qty) * flt(d.conversion_factor),

View File

@ -53,13 +53,15 @@ def validate_returned_items(doc):
valid_items = frappe._dict() valid_items = frappe._dict()
select_fields = "item_code, qty" if doc.doctype=="Purchase Invoice" \ select_fields = "item_code, qty, parenttype" if doc.doctype=="Purchase Invoice" \
else "item_code, qty, serial_no, batch_no" else "item_code, qty, serial_no, batch_no, parenttype"
if doc.doctype in ['Purchase Invoice', 'Purchase Receipt']:
select_fields += ",rejected_qty, received_qty"
for d in frappe.db.sql("""select {0} from `tab{1} Item` where parent = %s""" for d in frappe.db.sql("""select {0} from `tab{1} Item` where parent = %s"""
.format(select_fields, doc.doctype), doc.return_against, as_dict=1): .format(select_fields, doc.doctype), doc.return_against, as_dict=1):
valid_items = get_ref_item_dict(valid_items, d) valid_items = get_ref_item_dict(valid_items, d)
if doc.doctype in ("Delivery Note", "Sales Invoice"): if doc.doctype in ("Delivery Note", "Sales Invoice"):
for d in frappe.db.sql("""select item_code, qty, serial_no, batch_no from `tabPacked Item` for d in frappe.db.sql("""select item_code, qty, serial_no, batch_no from `tabPacked Item`
@ -73,21 +75,15 @@ def validate_returned_items(doc):
items_returned = False items_returned = False
for d in doc.get("items"): for d in doc.get("items"):
if flt(d.qty) < 0: if flt(d.qty) < 0 or d.get('received_qty') < 0:
if d.item_code not in valid_items: if d.item_code not in valid_items:
frappe.throw(_("Row # {0}: Returned Item {1} does not exists in {2} {3}") frappe.throw(_("Row # {0}: Returned Item {1} does not exists in {2} {3}")
.format(d.idx, d.item_code, doc.doctype, doc.return_against)) .format(d.idx, d.item_code, doc.doctype, doc.return_against))
else: else:
ref = valid_items.get(d.item_code, frappe._dict()) ref = valid_items.get(d.item_code, frappe._dict())
already_returned_qty = flt(already_returned_items.get(d.item_code)) validate_quantity(doc, d, ref, valid_items, already_returned_items)
max_return_qty = flt(ref.qty) - already_returned_qty
if already_returned_qty >= ref.qty: if ref.batch_no and d.batch_no not in ref.batch_no:
frappe.throw(_("Item {0} has already been returned").format(d.item_code), StockOverReturnError)
elif abs(d.qty) > max_return_qty:
frappe.throw(_("Row # {0}: Cannot return more than {1} for Item {2}")
.format(d.idx, ref.qty, d.item_code), StockOverReturnError)
elif ref.batch_no and d.batch_no not in ref.batch_no:
frappe.throw(_("Row # {0}: Batch No must be same as {1} {2}") frappe.throw(_("Row # {0}: Batch No must be same as {1} {2}")
.format(d.idx, doc.doctype, doc.return_against)) .format(d.idx, doc.doctype, doc.return_against))
elif ref.serial_no: elif ref.serial_no:
@ -107,18 +103,45 @@ def validate_returned_items(doc):
if not items_returned: if not items_returned:
frappe.throw(_("Atleast one item should be entered with negative quantity in return document")) frappe.throw(_("Atleast one item should be entered with negative quantity in return document"))
def validate_quantity(doc, args, ref, valid_items, already_returned_items):
fields = ['qty']
if doc.doctype in ['Purchase Invoice', 'Purchase Receipt']:
fields.extend(['received_qty', 'rejected_qty'])
already_returned_data = already_returned_items.get(args.item_code) or {}
for column in fields:
return_qty = flt(already_returned_data.get(column, 0)) if len(already_returned_data) > 0 else 0
referenced_qty = ref.get(column)
max_return_qty = flt(referenced_qty) - return_qty
label = column.replace('_', ' ').title()
if flt(args.get(column)) > 0:
frappe.throw(_("{0} must be negative in return document").format(label))
elif return_qty >= referenced_qty and flt(args.get(column)) != 0:
frappe.throw(_("Item {0} has already been returned").format(args.item_code), StockOverReturnError)
elif abs(args.get(column)) > max_return_qty:
frappe.throw(_("Row # {0}: Cannot return more than {1} for Item {2}")
.format(args.idx, referenced_qty, args.item_code), StockOverReturnError)
def get_ref_item_dict(valid_items, ref_item_row): def get_ref_item_dict(valid_items, ref_item_row):
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
valid_items.setdefault(ref_item_row.item_code, frappe._dict({ valid_items.setdefault(ref_item_row.item_code, frappe._dict({
"qty": 0, "qty": 0,
"rejected_qty": 0,
"received_qty": 0,
"serial_no": [], "serial_no": [],
"batch_no": [] "batch_no": []
})) }))
item_dict = valid_items[ref_item_row.item_code] item_dict = valid_items[ref_item_row.item_code]
item_dict["qty"] += ref_item_row.qty item_dict["qty"] += ref_item_row.qty
if ref_item_row.parenttype in ['Purchase Invoice', 'Purchase Receipt']:
item_dict["received_qty"] += ref_item_row.received_qty
item_dict["rejected_qty"] += ref_item_row.rejected_qty
if ref_item_row.get("serial_no"): if ref_item_row.get("serial_no"):
item_dict["serial_no"] += get_serial_nos(ref_item_row.serial_no) item_dict["serial_no"] += get_serial_nos(ref_item_row.serial_no)
@ -128,16 +151,30 @@ def get_ref_item_dict(valid_items, ref_item_row):
return valid_items return valid_items
def get_already_returned_items(doc): def get_already_returned_items(doc):
return frappe._dict(frappe.db.sql(""" column = 'child.item_code, sum(abs(child.qty)) as qty'
select if doc.doctype in ['Purchase Invoice', 'Purchase Receipt']:
child.item_code, sum(abs(child.qty)) as qty column += ', sum(abs(child.rejected_qty)) as rejected_qty, sum(abs(child.received_qty)) as received_qty'
data = frappe.db.sql("""
select {0}
from from
`tab{0} Item` child, `tab{1}` par `tab{1} Item` child, `tab{2}` par
where where
child.parent = par.name and par.docstatus = 1 child.parent = par.name and par.docstatus = 1
and par.is_return = 1 and par.return_against = %s and child.qty < 0 and par.is_return = 1 and par.return_against = %s
group by item_code group by item_code
""".format(doc.doctype, doc.doctype), doc.return_against)) """.format(column, doc.doctype, doc.doctype), doc.return_against, as_dict=1)
items = {}
for d in data:
items.setdefault(d.item_code, frappe._dict({
"qty": d.get("qty"),
"received_qty": d.get("received_qty"),
"rejected_qty": d.get("rejected_qty")
}))
return items
def make_return_doc(doctype, source_name, target_doc=None): def make_return_doc(doctype, source_name, target_doc=None):
from frappe.model.mapper import get_mapped_doc from frappe.model.mapper import get_mapped_doc
@ -166,12 +203,18 @@ def make_return_doc(doctype, source_name, target_doc=None):
def update_item(source_doc, target_doc, source_parent): def update_item(source_doc, target_doc, source_parent):
target_doc.qty = -1* source_doc.qty target_doc.qty = -1* source_doc.qty
if doctype == "Purchase Receipt": if doctype == "Purchase Receipt":
target_doc.received_qty = -1* source_doc.qty target_doc.received_qty = -1* source_doc.received_qty
target_doc.rejected_qty = -1* source_doc.rejected_qty
target_doc.qty = -1* source_doc.qty
target_doc.purchase_order = source_doc.purchase_order target_doc.purchase_order = source_doc.purchase_order
target_doc.rejected_warehouse = source_doc.rejected_warehouse
elif doctype == "Purchase Invoice": elif doctype == "Purchase Invoice":
target_doc.received_qty = -1* source_doc.qty target_doc.received_qty = -1* source_doc.received_qty
target_doc.rejected_qty = -1* source_doc.rejected_qty
target_doc.qty = -1* source_doc.qty
target_doc.purchase_order = source_doc.purchase_order target_doc.purchase_order = source_doc.purchase_order
target_doc.purchase_receipt = source_doc.purchase_receipt target_doc.purchase_receipt = source_doc.purchase_receipt
target_doc.rejected_warehouse = source_doc.rejected_warehouse
target_doc.po_detail = source_doc.po_detail target_doc.po_detail = source_doc.po_detail
target_doc.pr_detail = source_doc.pr_detail target_doc.pr_detail = source_doc.pr_detail
elif doctype == "Delivery Note": elif doctype == "Delivery Note":

View File

@ -8,6 +8,7 @@ from erpnext.setup.utils import get_company_currency
from frappe import _, throw from frappe import _, throw
from erpnext.stock.get_item_details import get_bin_details from erpnext.stock.get_item_details import get_bin_details
from erpnext.stock.utils import get_incoming_rate from erpnext.stock.utils import get_incoming_rate
from erpnext.stock.stock_ledger import get_valuation_rate
from erpnext.controllers.stock_controller import StockController from erpnext.controllers.stock_controller import StockController
@ -32,6 +33,7 @@ class SellingController(StockController):
def validate(self): def validate(self):
super(SellingController, self).validate() super(SellingController, self).validate()
self.validate_max_discount() self.validate_max_discount()
self.validate_selling_price()
check_active_sales_items(self) check_active_sales_items(self)
def set_missing_values(self, for_validate=False): def set_missing_values(self, for_validate=False):
@ -161,6 +163,29 @@ class SellingController(StockController):
if discount and flt(d.discount_percentage) > discount: if discount and flt(d.discount_percentage) > discount:
frappe.throw(_("Maxiumm discount for Item {0} is {1}%").format(d.item_code, discount)) frappe.throw(_("Maxiumm discount for Item {0} is {1}%").format(d.item_code, discount))
def validate_selling_price(self):
if not frappe.db.get_single_value("Selling Settings", "validate_selling_price"):
return
for it in self.get("items"):
last_purchase_rate, is_stock_item = frappe.db.get_value("Item", it.name, ["last_purchase_rate", "is_stock_item"])
if flt(it.base_rate) < flt(last_purchase_rate):
throw(it.name, last_purchase_rate, "last purchase rate")
last_valuation_rate = frappe.db.sql("""
SELECT valuation_rate FROM `tabStock Ledger Entry` WHERE item_code = %s
AND warehouse = %s AND valuation_rate > 0
ORDER BY posting_date DESC, posting_time DESC, name DESC LIMIT 1
""", (it.item_code, it.warehouse))
if is_stock_item and flt(it.base_rate) < flt(last_valuation_rate):
throw_message(it.name, last_valuation_rate, "valuation rate")
def throw_message(item_name, rate, ref_rate_field):
frappe.throw(_("""Selling price for item {0} is lower than its {1}. Selling price should be atleast {2}""")
.format(item_name, ref_rate_field, rate))
def get_item_list(self): def get_item_list(self):
il = [] il = []
for d in self.get("items"): for d in self.get("items"):
@ -230,7 +255,7 @@ class SellingController(StockController):
status = frappe.db.get_value("Sales Order", d.get(ref_fieldname), "status") status = frappe.db.get_value("Sales Order", d.get(ref_fieldname), "status")
if status == "Closed": if status == "Closed":
frappe.throw(_("Sales Order {0} is {1}").format(d.get(ref_fieldname), status)) frappe.throw(_("Sales Order {0} is {1}").format(d.get(ref_fieldname), status))
def update_reserved_qty(self): def update_reserved_qty(self):
so_map = {} so_map = {}
for d in self.get("items"): for d in self.get("items"):
@ -310,7 +335,7 @@ def check_active_sales_items(obj):
item = frappe.db.sql("""select docstatus, item = frappe.db.sql("""select docstatus,
income_account from tabItem where name = %s""", income_account from tabItem where name = %s""",
d.item_code, as_dict=True)[0] d.item_code, as_dict=True)[0]
if getattr(d, "income_account", None) and not item.income_account: if getattr(d, "income_account", None) and not item.income_account:
frappe.db.set_value("Item", d.item_code, "income_account", frappe.db.set_value("Item", d.item_code, "income_account",
d.income_account) d.income_account)

View File

@ -245,8 +245,8 @@ class StatusUpdater(Document):
frappe.db.sql("""update `tab%(target_parent_dt)s` frappe.db.sql("""update `tab%(target_parent_dt)s`
set %(target_parent_field)s = round( set %(target_parent_field)s = round(
ifnull((select ifnull((select
ifnull(sum(if(%(target_ref_field)s > %(target_field)s, %(target_field)s, %(target_ref_field)s)), 0) ifnull(sum(if(%(target_ref_field)s > %(target_field)s, abs(%(target_field)s), abs(%(target_ref_field)s))), 0)
/ sum(%(target_ref_field)s) * 100 / sum(abs(%(target_ref_field)s)) * 100
from `tab%(target_dt)s` where parent="%(name)s"), 0), 2) from `tab%(target_dt)s` where parent="%(name)s"), 0), 2)
%(update_modified)s %(update_modified)s
where name='%(name)s'""" % args) where name='%(name)s'""" % args)

View File

@ -69,6 +69,10 @@ class StockController(AccountsController):
warehouse_with_no_account.append(sle.warehouse) warehouse_with_no_account.append(sle.warehouse)
if warehouse_with_no_account: if warehouse_with_no_account:
for wh in warehouse_with_no_account:
if frappe.db.get_value("Warehouse", wh, "company"):
frappe.throw(_("Warehouse {0} is not linked to any account, please create/link the corresponding (Asset) account for the warehouse.").format(wh))
msgprint(_("No accounting entries for the following warehouses") + ": \n" + msgprint(_("No accounting entries for the following warehouses") + ": \n" +
"\n".join(warehouse_with_no_account)) "\n".join(warehouse_with_no_account))
@ -276,12 +280,18 @@ def update_gl_entries_after(posting_date, posting_time, for_warehouses=None, for
def compare_existing_and_expected_gle(existing_gle, expected_gle): def compare_existing_and_expected_gle(existing_gle, expected_gle):
matched = True matched = True
for entry in expected_gle: for entry in expected_gle:
account_existed = False
for e in existing_gle: for e in existing_gle:
if entry.account==e.account and entry.against_account==e.against_account \ if entry.account == e.account:
and (not entry.cost_center or not e.cost_center or entry.cost_center==e.cost_center) \ account_existed = True
and (entry.debit != e.debit or entry.credit != e.credit): if entry.account == e.account and entry.against_account == e.against_account \
matched = False and (not entry.cost_center or not e.cost_center or entry.cost_center == e.cost_center) \
break and (entry.debit != e.debit or entry.credit != e.credit):
matched = False
break
if not account_existed:
matched = False
break
return matched return matched
def get_future_stock_vouchers(posting_date, posting_time, for_warehouses=None, for_items=None): def get_future_stock_vouchers(posting_date, posting_time, for_warehouses=None, for_items=None):

View File

@ -25,7 +25,10 @@ def get_transaction_list(doctype, txt=None, filters=None, limit_start=0, limit_p
if not filters: filters = [] if not filters: filters = []
filters.append((doctype, "docstatus", "=", 1)) if doctype == 'Supplier Quotation':
filters.append((doctype, "docstatus", "<", 2))
else:
filters.append((doctype, "docstatus", "=", 1))
if user != "Guest" and is_website_user(): if user != "Guest" and is_website_user():
parties_doctype = 'Request for Quotation Supplier' if doctype == 'Request for Quotation' else doctype parties_doctype = 'Request for Quotation Supplier' if doctype == 'Request for Quotation' else doctype
@ -112,7 +115,8 @@ def has_website_permission(doc, ptype, user, verbose=False):
return frappe.get_all(doctype, filters=[(doctype, "customer", "in", customers), return frappe.get_all(doctype, filters=[(doctype, "customer", "in", customers),
(doctype, "name", "=", doc.name)]) and True or False (doctype, "name", "=", doc.name)]) and True or False
elif suppliers: elif suppliers:
return frappe.get_all(doctype, filters=[(doctype, "suppliers", "in", suppliers), fieldname = 'suppliers' if doctype == 'Request for Quotation' else 'supplier'
return frappe.get_all(doctype, filters=[(doctype, fieldname, "in", suppliers),
(doctype, "name", "=", doc.name)]) and True or False (doctype, "name", "=", doc.name)]) and True or False
else: else:
return False return False

File diff suppressed because it is too large Load Diff

View File

@ -4,8 +4,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe import _ from frappe import _
from frappe.utils import cstr, validate_email_add, cint, comma_and, has_gravatar from frappe.utils import cstr, validate_email_add, cint, comma_and, has_gravatar, nowdate
from frappe import session
from frappe.model.mapper import get_mapped_doc from frappe.model.mapper import get_mapped_doc
from erpnext.controllers.selling_controller import SellingController from erpnext.controllers.selling_controller import SellingController
@ -34,19 +33,21 @@ class Lead(SellingController):
self.set_status() self.set_status()
self.check_email_id_is_unique() self.check_email_id_is_unique()
if self.source == 'Campaign' and not self.campaign_name and session['user'] != 'Guest':
frappe.throw(_("Campaign Name is required"))
if self.email_id: if self.email_id:
if not self.flags.ignore_email_validation: if not self.flags.ignore_email_validation:
validate_email_add(self.email_id, True) validate_email_add(self.email_id, True)
if self.email_id == self.lead_owner: if self.email_id == self.lead_owner:
# Lead Owner cannot be same as the Lead frappe.throw(_("Lead Owner cannot be same as the Lead"))
self.lead_owner = None
if self.email_id == self.contact_by:
frappe.throw(_("Next Contact By cannot be same as the Lead Email id"))
self.image = has_gravatar(self.email_id) self.image = has_gravatar(self.email_id)
if self.contact_date and self.contact_date < nowdate():
frappe.throw(_("Next Contact Date cannot be in the past"))
def on_update(self): def on_update(self):
self.add_calendar_event() self.add_calendar_event()

View File

@ -8,16 +8,47 @@ frappe.ui.form.on("Opportunity", {
customer: function(frm) { customer: function(frm) {
erpnext.utils.get_party_details(frm); erpnext.utils.get_party_details(frm);
}, },
customer_address: function(frm, cdt, cdn){
customer_address: function(frm, cdt, cdn) {
erpnext.utils.get_address_display(frm, 'customer_address', 'address_display', false); erpnext.utils.get_address_display(frm, 'customer_address', 'address_display', false);
}, },
contact_person: erpnext.utils.get_contact_details, contact_person: erpnext.utils.get_contact_details,
enquiry_from: function(frm) { enquiry_from: function(frm) {
frm.toggle_reqd("lead", frm.doc.enquiry_from==="Lead"); frm.toggle_reqd("lead", frm.doc.enquiry_from==="Lead");
frm.toggle_reqd("customer", frm.doc.enquiry_from==="Customer"); frm.toggle_reqd("customer", frm.doc.enquiry_from==="Customer");
}, },
refresh: function(frm) { refresh: function(frm) {
var doc = frm.doc;
frm.events.enquiry_from(frm); frm.events.enquiry_from(frm);
if(doc.status!=="Lost") {
if(doc.with_items){
frm.add_custom_button(__('Supplier Quotation'),
function() {
frm.trigger("make_supplier_quotation")
}, __("Make"));
frm.add_custom_button(__('Quotation'),
cur_frm.cscript.create_quotation, __("Make"));
frm.page.set_inner_btn_group_as_primary(__("Make"));
}
if(doc.status!=="Quotation") {
frm.add_custom_button(__('Lost'),
cur_frm.cscript['Declare Opportunity Lost']);
}
}
},
make_supplier_quotation: function(frm) {
frappe.model.open_mapped_doc({
method: "erpnext.crm.doctype.opportunity.opportunity.make_supplier_quotation",
frm: cur_frm
})
} }
}) })
@ -91,17 +122,6 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
}); });
} }
} }
if(doc.status!=="Lost") {
if(doc.status!=="Quotation") {
cur_frm.add_custom_button(__('Lost'),
cur_frm.cscript['Declare Opportunity Lost']);
}
cur_frm.add_custom_button(__('Quotation'),
cur_frm.cscript.create_quotation);
}
} }
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) { cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {

View File

@ -16,6 +16,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "from_section", "fieldname": "from_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -41,6 +42,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "naming_series", "fieldname": "naming_series",
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
@ -68,6 +70,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "enquiry_from", "fieldname": "enquiry_from",
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
@ -95,6 +98,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.enquiry_from===\"Customer\"", "depends_on": "eval:doc.enquiry_from===\"Customer\"",
"fieldname": "customer", "fieldname": "customer",
"fieldtype": "Link", "fieldtype": "Link",
@ -123,6 +127,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.enquiry_from===\"Lead\"", "depends_on": "eval:doc.enquiry_from===\"Lead\"",
"fieldname": "lead", "fieldname": "lead",
"fieldtype": "Link", "fieldtype": "Link",
@ -151,6 +156,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "", "depends_on": "",
"fieldname": "customer_name", "fieldname": "customer_name",
"fieldtype": "Data", "fieldtype": "Data",
@ -176,6 +182,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break0", "fieldname": "column_break0",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -201,6 +208,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "title", "fieldname": "title",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
@ -226,6 +234,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "Sales", "default": "Sales",
"fieldname": "enquiry_type", "fieldname": "enquiry_type",
"fieldtype": "Select", "fieldtype": "Select",
@ -254,6 +263,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "Open", "default": "Open",
"fieldname": "status", "fieldname": "status",
"fieldtype": "Select", "fieldtype": "Select",
@ -282,6 +292,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.status===\"Lost\"", "depends_on": "eval:doc.status===\"Lost\"",
"fieldname": "order_lost_reason", "fieldname": "order_lost_reason",
"fieldtype": "Small Text", "fieldtype": "Small Text",
@ -307,6 +318,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "mins_to_first_response", "fieldname": "mins_to_first_response",
"fieldtype": "Float", "fieldtype": "Float",
"hidden": 0, "hidden": 0,
@ -332,6 +344,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "with_items", "fieldname": "with_items",
"fieldtype": "Check", "fieldtype": "Check",
"hidden": 0, "hidden": 0,
@ -357,6 +370,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "with_items", "depends_on": "with_items",
"fieldname": "items_section", "fieldname": "items_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
@ -384,6 +398,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "", "description": "",
"fieldname": "items", "fieldname": "items",
"fieldtype": "Table", "fieldtype": "Table",
@ -413,6 +428,7 @@
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"collapsible_depends_on": "next_contact_by", "collapsible_depends_on": "next_contact_by",
"columns": 0,
"depends_on": "eval:doc.lead || doc.customer", "depends_on": "eval:doc.lead || doc.customer",
"fieldname": "contact_info", "fieldname": "contact_info",
"fieldtype": "Section Break", "fieldtype": "Section Break",
@ -439,6 +455,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.customer || doc.lead", "depends_on": "eval:doc.customer || doc.lead",
"fieldname": "customer_address", "fieldname": "customer_address",
"fieldtype": "Link", "fieldtype": "Link",
@ -465,6 +482,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "address_display", "fieldname": "address_display",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"hidden": 1, "hidden": 1,
@ -491,6 +509,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "customer", "depends_on": "customer",
"description": "", "description": "",
"fieldname": "territory", "fieldname": "territory",
@ -518,6 +537,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "customer", "depends_on": "customer",
"description": "", "description": "",
"fieldname": "customer_group", "fieldname": "customer_group",
@ -547,6 +567,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break3", "fieldname": "column_break3",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -570,6 +591,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.lead || doc.customer", "depends_on": "eval:doc.lead || doc.customer",
"fieldname": "contact_person", "fieldname": "contact_person",
"fieldtype": "Link", "fieldtype": "Link",
@ -596,6 +618,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "customer", "depends_on": "customer",
"fieldname": "contact_display", "fieldname": "contact_display",
"fieldtype": "Small Text", "fieldtype": "Small Text",
@ -621,6 +644,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.lead || doc.customer", "depends_on": "eval:doc.lead || doc.customer",
"fieldname": "contact_email", "fieldname": "contact_email",
"fieldtype": "Data", "fieldtype": "Data",
@ -646,6 +670,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.lead || doc.customer", "depends_on": "eval:doc.lead || doc.customer",
"fieldname": "contact_mobile", "fieldname": "contact_mobile",
"fieldtype": "Small Text", "fieldtype": "Small Text",
@ -672,6 +697,7 @@
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"collapsible_depends_on": "", "collapsible_depends_on": "",
"columns": 0,
"fieldname": "more_info", "fieldname": "more_info",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -698,8 +724,9 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "source", "fieldname": "source",
"fieldtype": "Select", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
@ -710,7 +737,7 @@
"no_copy": 0, "no_copy": 0,
"oldfieldname": "source", "oldfieldname": "source",
"oldfieldtype": "Select", "oldfieldtype": "Select",
"options": "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign\nWalk In", "options": "Lead Source",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
@ -725,6 +752,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "Enter name of campaign if source of enquiry is campaign", "description": "Enter name of campaign if source of enquiry is campaign",
"fieldname": "campaign", "fieldname": "campaign",
"fieldtype": "Link", "fieldtype": "Link",
@ -753,6 +781,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break1", "fieldname": "column_break1",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -778,6 +807,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "company", "fieldname": "company",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -805,6 +835,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "Today", "default": "Today",
"fieldname": "transaction_date", "fieldname": "transaction_date",
"fieldtype": "Date", "fieldtype": "Date",
@ -834,6 +865,7 @@
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
"collapsible_depends_on": "contact_by", "collapsible_depends_on": "contact_by",
"columns": 0,
"fieldname": "next_contact", "fieldname": "next_contact",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -859,6 +891,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "Your sales person who will contact the customer in future", "description": "Your sales person who will contact the customer in future",
"fieldname": "contact_by", "fieldname": "contact_by",
"fieldtype": "Link", "fieldtype": "Link",
@ -888,6 +921,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "Your sales person will get a reminder on this date to contact the customer", "description": "Your sales person will get a reminder on this date to contact the customer",
"fieldname": "contact_date", "fieldname": "contact_date",
"fieldtype": "Datetime", "fieldtype": "Datetime",
@ -915,6 +949,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break2", "fieldname": "column_break2",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@ -940,6 +975,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "to_discuss", "fieldname": "to_discuss",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"hidden": 0, "hidden": 0,
@ -966,6 +1002,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "amended_from", "fieldname": "amended_from",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -1002,7 +1039,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-07-28 15:58:06.614493", "modified": "2016-09-16 01:52:06.229882",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "CRM", "module": "CRM",
"name": "Opportunity", "name": "Opportunity",

View File

@ -231,6 +231,25 @@ def make_quotation(source_name, target_doc=None):
return doclist return doclist
@frappe.whitelist()
def make_supplier_quotation(source_name, target_doc=None):
doclist = get_mapped_doc("Opportunity", source_name, {
"Opportunity": {
"doctype": "Supplier Quotation",
"field_map": {
"name": "opportunity"
}
},
"Opportunity Item": {
"doctype": "Supplier Quotation Item",
"field_map": {
"uom": "stock_uom"
}
}
}, target_doc)
return doclist
@frappe.whitelist() @frappe.whitelist()
def set_multiple_status(names, status): def set_multiple_status(names, status):
names = json.loads(names) names = json.loads(names)

View File

@ -6,7 +6,7 @@ def get_data():
'transactions': [ 'transactions': [
{ {
'label': _('Related'), 'label': _('Related'),
'items': ['Quotation'] 'items': ['Quotation', 'Supplier Quotation']
}, },
] ]
} }

View File

@ -0,0 +1,134 @@
[
{
"doctype": "Course",
"course_name": "Communication Skiils",
"course_code": "BCA2040",
"department": "Information Technology"
},
{
"doctype": "Course",
"course_name": "Object Oriented Programing - C++",
"course_code": "BCA2030",
"department": "Information Technology"
},
{
"doctype": "Course",
"course_name": "Data Structures and Algorithm",
"course_code": "BCA2020",
"department": "Information Technology"
},
{
"doctype": "Course",
"course_name": "Operating System",
"course_code": "BCA2010",
"department": "Information Technology"
},
{
"doctype": "Course",
"course_name": "Digital Logic",
"course_code": "BCA1040",
"department": "Information Technology"
},
{
"doctype": "Course",
"course_name": "Basic Mathematics",
"course_code": "BCA1030",
"department": "Information Technology"
},
{
"doctype": "Course",
"course_name": "Programing in C",
"course_code": "BCA1020",
"department": "Information Technology"
},
{
"doctype": "Course",
"course_name": "Fundamentals of IT & Programing",
"course_code": "BCA1010",
"department": "Information Technology"
},
{
"doctype": "Course",
"course_name": "Microprocessor",
"course_code": "MCA4010",
"department": "Information Technology"
},
{
"doctype": "Course",
"course_name": "Probability and Statistics",
"course_code": "MCA4020",
"department": "Information Technology"
},
{
"doctype": "Course",
"course_name": "Programing in Java",
"course_code": "MCA4030",
"department": "Information Technology"
},
{
"doctype": "Course",
"course_name": "Communication Skills",
"course_code": "BBA 101",
"department": "Management Studies"
},
{
"doctype": "Course",
"course_name": "Organizational Behavior",
"course_code": "BBA 102",
"department": "Management Studies"
},
{
"doctype": "Course",
"course_name": "Business Environment",
"course_code": "BBA 103",
"department": "Management Studies"
},
{
"doctype": "Course",
"course_name": "Legal and Regulatory Framework",
"course_code": "BBA 301",
"department": "Management Studies"
},
{
"doctype": "Course",
"course_name": "Human Resource Management",
"course_code": "BBA 302",
"department": "Management Studies"
},
{
"doctype": "Course",
"course_name": "Advertising and Sales",
"course_code": "BBA 304",
"department": "Management Studies"
},
{
"doctype": "Course",
"course_name": "Entrepreneurship Management",
"course_code": "BBA 505",
"department": "Management Studies"
},
{
"doctype": "Course",
"course_name": "Visual Merchandising",
"course_code": "BBR 504",
"department": "Management Studies"
},
{
"doctype": "Course",
"course_name": "Warehouse Management",
"course_code": "BBR 505",
"department": "Management Studies"
},
{
"doctype": "Course",
"course_name": "Store Operations and Job Knowledge",
"course_code": "BBR 501",
"department": "Management Studies"
},
{
"doctype": "Course",
"course_name": "Management Development and Skills",
"course_code": "BBA 602",
"department": "Management Studies"
}
]

View File

@ -0,0 +1,30 @@
[
{
"doctype": "Department",
"department_name": "Information Technology"
},
{
"doctype": "Department",
"department_name": "Physics"
},
{
"doctype": "Department",
"department_name": "Chemistry"
},
{
"doctype": "Department",
"department_name": "Biology"
},
{
"doctype": "Department",
"department_name": "Commerce"
},
{
"doctype": "Department",
"department_name": "English"
},
{
"doctype": "Department",
"department_name": "Management Studies"
}
]

View File

@ -0,0 +1,128 @@
[
{
"doctype": "Instructor",
"instructor_name": "Eddie Jessup",
"naming_series": "INS/",
"department": "Information Technology"
},
{
"doctype": "Instructor",
"instructor_name": "William Dyer",
"naming_series": "INS/",
"department": "Information Technology"
},
{
"doctype": "Instructor",
"instructor_name": "Alastor Moody",
"naming_series": "INS/",
"department": "Information Technology"
},
{
"doctype": "Instructor",
"instructor_name": "Charles Xavier",
"naming_series": "INS/",
"department": "Information Technology"
},
{
"doctype": "Instructor",
"instructor_name": "Cuthbert Calculus",
"naming_series": "INS/",
"department": "Information Technology"
},
{
"doctype": "Instructor",
"instructor_name": "Reed Richards",
"naming_series": "INS/",
"department": "Information Technology"
},
{
"doctype": "Instructor",
"instructor_name": "Urban Chronotis",
"naming_series": "INS/",
"department": "Physics"
},
{
"doctype": "Instructor",
"instructor_name": "River Song",
"naming_series": "INS/",
"department": "Physics"
},
{
"doctype": "Instructor",
"instructor_name": "Yana",
"naming_series": "INS/",
"department": "Physics"
},
{
"doctype": "Instructor",
"instructor_name": "Neil Lasrado",
"naming_series": "INS/",
"department": "Information Technology"
},
{
"doctype": "Instructor",
"instructor_name": "Deepshi Garg",
"naming_series": "INS/",
"department": "Chemistry"
},
{
"doctype": "Instructor",
"instructor_name": "Shubham Saxena",
"naming_series": "INS/",
"department": "Physics"
},
{
"doctype": "Instructor",
"instructor_name": "Rushabh Mehta",
"naming_series": "INS/",
"department": "Information Technology"
},
{
"doctype": "Instructor",
"instructor_name": "Umari Syed",
"naming_series": "INS/",
"department": "Chemistry"
},
{
"doctype": "Instructor",
"instructor_name": "Aman Singh",
"naming_series": "INS/",
"department": "Physics"
},
{
"doctype": "Instructor",
"instructor_name": "Nabin",
"naming_series": "INS/",
"department": "Chemistry"
},
{
"doctype": "Instructor",
"instructor_name": "Kanchan Chauhan",
"naming_series": "INS/",
"department": "Information Technology"
},
{
"doctype": "Instructor",
"instructor_name": "Valmik Jangla",
"naming_series": "INS/",
"department": "Chemistry"
},
{
"doctype": "Instructor",
"instructor_name": "Amit Jain",
"naming_series": "INS/",
"department": "Physics"
},
{
"doctype": "Instructor",
"instructor_name": "Shreyas P",
"naming_series": "INS/",
"department": "Chemistry"
},
{
"doctype": "Instructor",
"instructor_name": "Rohit",
"naming_series": "INS/",
"department": "Information Technology"
}
]

View File

@ -0,0 +1,94 @@
[
{
"default_supplier": "Asiatic Solutions",
"default_warehouse": "Stores",
"item_code": "Books",
"item_group": "Raw Material",
"item_name": "Books"
},
{
"default_supplier": "HomeBase",
"default_warehouse": "Stores",
"item_code": "Pencil",
"item_group": "Raw Material",
"item_name": "Pencil"
},
{
"default_supplier": "New World Realty",
"default_warehouse": "Stores",
"item_code": "Tables",
"item_group": "Raw Material",
"item_name": "Tables"
},
{
"default_supplier": "Eagle Hardware",
"default_warehouse": "Stores",
"item_code": "Chair",
"item_group": "Raw Material",
"item_name": "Chair"
},
{
"default_supplier": "Asiatic Solutions",
"default_warehouse": "Stores",
"item_code": "Black Board",
"item_group": "Sub Assemblies",
"item_name": "Black Board"
},
{
"default_supplier": "HomeBase",
"default_warehouse": "Stores",
"item_code": "Chalk",
"item_group": "Raw Material",
"item_name": "Chalk"
},
{
"default_supplier": "HomeBase",
"default_warehouse": "Stores",
"item_code": "Notepad",
"item_group": "Raw Material",
"item_name": "Notepad"
},
{
"default_supplier": "Ks Merchandise",
"default_warehouse": "Stores",
"item_code": "Uniform",
"item_group": "Raw Material",
"item_name": "Uniform"
},
{
"is_stock_item": 0,
"description": "Computer",
"item_code": "Computer",
"item_name": "Computer",
"item_group": "Products"
},
{
"is_stock_item": 0,
"description": "Mobile",
"item_code": "Mobile",
"item_name": "Mobile",
"item_group": "Products"
},
{
"is_stock_item": 0,
"description": "ERP",
"item_code": "ERP",
"item_name": "ERP",
"item_group": "All Item Groups"
},
{
"is_stock_item": 0,
"description": "Autocad",
"item_code": "Autocad",
"item_name": "Autocad",
"item_group": "All Item Groups"
},
{
"default_warehouse": "Stores",
"item_code": "Service",
"item_group": "Services",
"item_name": "Service",
"has_variants": 0,
"is_stock_item": 0
}
]

View File

@ -0,0 +1,102 @@
[
{
"doctype": "Program",
"program_name": "Masters of Computer Applications",
"program_code": "MCA",
"department": "Information Technology",
"courses": [
{
"course": "Microprocessor",
"academic_term": "Semester 1"
},
{
"course": "Probability and Statistics",
"academic_term": "Semester 1"
},
{
"course": "Programing in Java",
"academic_term": "Semester 2"
}
]
},
{
"doctype": "Program",
"program_name": "Bachelor of Computer Applications",
"program_code": "BCA",
"department": "Information Technology",
"courses": [
{
"course": "Communication Skiils",
"academic_term": "Semester 3"
},
{
"course": "Object Oriented Programing - C++",
"academic_term": "Semester 3"
},
{
"course": "Basic Mathematics",
"academic_term": "Semester 2"
},
{
"course": "Data Structures and Algorithm",
"academic_term": "Semester 2"
},
{
"course": "Digital Logic",
"academic_term": "Semester 2"
},
{
"course": "Fundamentals of IT & Programing",
"academic_term": "Semester 1"
},
{
"course": "Operating System",
"academic_term": "Semester 1"
},
{
"course": "Programing in C",
"academic_term": "Semester 1"
}
]
},
{
"doctype": "Program",
"program_name": "Bachelor of Business Administration",
"program_code": "BBA",
"department": "Management Studies",
"courses": [
{
"course": "Organizational Behavior",
"academic_term": "Semester 1"
},
{
"course": "Management Development and Skills",
"academic_term": "Semester 1"
},
{
"course": "Legal and Regulatory Framework",
"academic_term": "Semester 1"
},
{
"course": "Human Resource Management",
"academic_term": "Semester 2"
},
{
"course": "Entrepreneurship Management",
"academic_term": "Semester 2"
},
{
"course": "Communication Skills",
"academic_term": "Semester 2"
},
{
"course": "Business Environment",
"academic_term": "Semester 3"
},
{
"course": "Advertising and Sales",
"academic_term": "Semester 3"
}
]
}
]

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