mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-29 18:04:46 +00:00
Merge branch 'develop' into bom_convert_uom
This commit is contained in:
@@ -13,6 +13,7 @@ before_install:
|
|||||||
|
|
||||||
install:
|
install:
|
||||||
- sudo apt-get purge -y mysql-common mysql-server mysql-client
|
- sudo apt-get purge -y mysql-common mysql-server mysql-client
|
||||||
|
- nvm install v7.10.0
|
||||||
# - wget https://raw.githubusercontent.com/frappe/bench/master/install_scripts/setup_frappe.sh
|
# - wget https://raw.githubusercontent.com/frappe/bench/master/install_scripts/setup_frappe.sh
|
||||||
# - sudo bash setup_frappe.sh --skip-setup-bench --mysql-root-password travis --bench-branch develop
|
# - sudo bash setup_frappe.sh --skip-setup-bench --mysql-root-password travis --bench-branch develop
|
||||||
- wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py
|
- wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
|
|
||||||
__version__ = '8.0.38'
|
__version__ = '8.0.45'
|
||||||
|
|
||||||
|
|
||||||
def get_default_company(user=None):
|
def get_default_company(user=None):
|
||||||
|
|||||||
@@ -2,26 +2,26 @@
|
|||||||
// License: GNU General Public License v3. See license.txt
|
// License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
|
|
||||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
cur_frm.cscript.refresh = function (doc, cdt, cdn) {
|
||||||
if(doc.__islocal) {
|
if (doc.__islocal) {
|
||||||
msgprint(__("Please create new account from Chart of Accounts."));
|
frappe.msgprint(__("Please create new account from Chart of Accounts."));
|
||||||
throw "cannot create";
|
throw "cannot create";
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.toggle_display('account_name', doc.__islocal);
|
cur_frm.toggle_display('account_name', doc.__islocal);
|
||||||
|
|
||||||
// hide fields if group
|
// hide fields if group
|
||||||
cur_frm.toggle_display(['account_type', 'tax_rate'], cint(doc.is_group)==0)
|
cur_frm.toggle_display(['account_type', 'tax_rate'], cint(doc.is_group) == 0)
|
||||||
|
|
||||||
// disable fields
|
// disable fields
|
||||||
cur_frm.toggle_enable(['account_name', 'is_group', 'company'], false);
|
cur_frm.toggle_enable(['account_name', 'is_group', 'company'], false);
|
||||||
|
|
||||||
if(cint(doc.is_group)==0) {
|
if (cint(doc.is_group) == 0) {
|
||||||
cur_frm.toggle_display('freeze_account', doc.__onload && doc.__onload.can_freeze_account);
|
cur_frm.toggle_display('freeze_account', doc.__onload && doc.__onload.can_freeze_account);
|
||||||
}
|
}
|
||||||
|
|
||||||
// read-only for root accounts
|
// read-only for root accounts
|
||||||
if(!doc.parent_account) {
|
if (!doc.parent_account) {
|
||||||
cur_frm.set_read_only();
|
cur_frm.set_read_only();
|
||||||
cur_frm.set_intro(__("This is a root account and cannot be edited."));
|
cur_frm.set_intro(__("This is a root account and cannot be edited."));
|
||||||
} else {
|
} else {
|
||||||
@@ -38,53 +38,53 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
|||||||
cur_frm.add_fetch('parent_account', 'report_type', 'report_type');
|
cur_frm.add_fetch('parent_account', 'report_type', 'report_type');
|
||||||
cur_frm.add_fetch('parent_account', 'root_type', 'root_type');
|
cur_frm.add_fetch('parent_account', 'root_type', 'root_type');
|
||||||
|
|
||||||
cur_frm.cscript.account_type = function(doc, cdt, cdn) {
|
cur_frm.cscript.account_type = function (doc, cdt, cdn) {
|
||||||
if(doc.is_group==0) {
|
if (doc.is_group == 0) {
|
||||||
cur_frm.toggle_display(['tax_rate'], doc.account_type == 'Tax');
|
cur_frm.toggle_display(['tax_rate'], doc.account_type == 'Tax');
|
||||||
cur_frm.toggle_display('warehouse', doc.account_type=='Stock');
|
cur_frm.toggle_display('warehouse', doc.account_type == 'Stock');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.add_toolbar_buttons = function(doc) {
|
cur_frm.cscript.add_toolbar_buttons = function (doc) {
|
||||||
cur_frm.add_custom_button(__('Chart of Accounts'),
|
cur_frm.add_custom_button(__('Chart of Accounts'),
|
||||||
function() { frappe.set_route("Tree", "Account"); });
|
function () { frappe.set_route("Tree", "Account"); });
|
||||||
|
|
||||||
if (doc.is_group == 1) {
|
if (doc.is_group == 1) {
|
||||||
cur_frm.add_custom_button(__('Group to Non-Group'),
|
cur_frm.add_custom_button(__('Group to Non-Group'),
|
||||||
function() { cur_frm.cscript.convert_to_ledger(); }, 'fa fa-retweet', 'btn-default');
|
function () { cur_frm.cscript.convert_to_ledger(); }, 'fa fa-retweet', 'btn-default');
|
||||||
} else if (cint(doc.is_group) == 0) {
|
} else if (cint(doc.is_group) == 0) {
|
||||||
cur_frm.add_custom_button(__('Ledger'), function() {
|
cur_frm.add_custom_button(__('Ledger'), function () {
|
||||||
frappe.route_options = {
|
frappe.route_options = {
|
||||||
"account": doc.name,
|
"account": doc.name,
|
||||||
"from_date": sys_defaults.year_start_date,
|
"from_date": frappe.sys_defaults.year_start_date,
|
||||||
"to_date": sys_defaults.year_end_date,
|
"to_date": frappe.sys_defaults.year_end_date,
|
||||||
"company": doc.company
|
"company": doc.company
|
||||||
};
|
};
|
||||||
frappe.set_route("query-report", "General Ledger");
|
frappe.set_route("query-report", "General Ledger");
|
||||||
});
|
});
|
||||||
|
|
||||||
cur_frm.add_custom_button(__('Non-Group to Group'),
|
cur_frm.add_custom_button(__('Non-Group to Group'),
|
||||||
function() { cur_frm.cscript.convert_to_group(); }, 'fa fa-retweet', 'btn-default')
|
function () { cur_frm.cscript.convert_to_group(); }, 'fa fa-retweet', 'btn-default')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.convert_to_ledger = function(doc, cdt, cdn) {
|
cur_frm.cscript.convert_to_ledger = function (doc, cdt, cdn) {
|
||||||
return $c_obj(cur_frm.doc,'convert_group_to_ledger','',function(r,rt) {
|
return $c_obj(cur_frm.doc, 'convert_group_to_ledger', '', function (r, rt) {
|
||||||
if(r.message == 1) {
|
if (r.message == 1) {
|
||||||
cur_frm.refresh();
|
cur_frm.refresh();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.convert_to_group = function(doc, cdt, cdn) {
|
cur_frm.cscript.convert_to_group = function (doc, cdt, cdn) {
|
||||||
return $c_obj(cur_frm.doc,'convert_ledger_to_group','',function(r,rt) {
|
return $c_obj(cur_frm.doc, 'convert_ledger_to_group', '', function (r, rt) {
|
||||||
if(r.message == 1) {
|
if (r.message == 1) {
|
||||||
cur_frm.refresh();
|
cur_frm.refresh();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.fields_dict['parent_account'].get_query = function(doc) {
|
cur_frm.fields_dict['parent_account'].get_query = function (doc) {
|
||||||
return {
|
return {
|
||||||
filters: {
|
filters: {
|
||||||
"is_group": 1,
|
"is_group": 1,
|
||||||
|
|||||||
@@ -72,8 +72,8 @@ frappe.treeview_settings["Account"] = {
|
|||||||
click: function(node, btn) {
|
click: function(node, btn) {
|
||||||
frappe.route_options = {
|
frappe.route_options = {
|
||||||
"account": node.label,
|
"account": node.label,
|
||||||
"from_date": sys_defaults.year_start_date,
|
"from_date": frappe.sys_defaults.year_start_date,
|
||||||
"to_date": sys_defaults.year_end_date,
|
"to_date": frappe.sys_defaults.year_end_date,
|
||||||
"company": frappe.defaults.get_default('company') ? frappe.defaults.get_default('company'): ""
|
"company": frappe.defaults.get_default('company') ? frappe.defaults.get_default('company'): ""
|
||||||
};
|
};
|
||||||
frappe.set_route("query-report", "General Ledger");
|
frappe.set_route("query-report", "General Ledger");
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ frappe.ui.form.on('Asset', {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
frm.set_query("warehouse", function() {
|
frm.set_query("warehouse", function() {
|
||||||
return {
|
return {
|
||||||
"filters": {
|
"filters": {
|
||||||
@@ -24,12 +24,12 @@ frappe.ui.form.on('Asset', {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
frappe.ui.form.trigger("Asset", "is_existing_asset");
|
frappe.ui.form.trigger("Asset", "is_existing_asset");
|
||||||
frm.toggle_display("next_depreciation_date", frm.doc.docstatus < 1);
|
frm.toggle_display("next_depreciation_date", frm.doc.docstatus < 1);
|
||||||
frm.events.make_schedules_editable(frm);
|
frm.events.make_schedules_editable(frm);
|
||||||
|
|
||||||
if (frm.doc.docstatus==1) {
|
if (frm.doc.docstatus==1) {
|
||||||
if (frm.doc.status=='Submitted' && !frm.doc.is_existing_asset && !frm.doc.purchase_invoice) {
|
if (frm.doc.status=='Submitted' && !frm.doc.is_existing_asset && !frm.doc.purchase_invoice) {
|
||||||
frm.add_custom_button("Make Purchase Invoice", function() {
|
frm.add_custom_button("Make Purchase Invoice", function() {
|
||||||
@@ -40,60 +40,60 @@ frappe.ui.form.on('Asset', {
|
|||||||
frm.add_custom_button("Transfer Asset", function() {
|
frm.add_custom_button("Transfer Asset", function() {
|
||||||
erpnext.asset.transfer_asset(frm);
|
erpnext.asset.transfer_asset(frm);
|
||||||
});
|
});
|
||||||
|
|
||||||
frm.add_custom_button("Scrap Asset", function() {
|
frm.add_custom_button("Scrap Asset", function() {
|
||||||
erpnext.asset.scrap_asset(frm);
|
erpnext.asset.scrap_asset(frm);
|
||||||
});
|
});
|
||||||
|
|
||||||
frm.add_custom_button("Sell Asset", function() {
|
frm.add_custom_button("Sell Asset", function() {
|
||||||
erpnext.asset.make_sales_invoice(frm);
|
erpnext.asset.make_sales_invoice(frm);
|
||||||
});
|
});
|
||||||
|
|
||||||
} else if (frm.doc.status=='Scrapped') {
|
} else if (frm.doc.status=='Scrapped') {
|
||||||
frm.add_custom_button("Restore Asset", function() {
|
frm.add_custom_button("Restore Asset", function() {
|
||||||
erpnext.asset.restore_asset(frm);
|
erpnext.asset.restore_asset(frm);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
frm.trigger("show_graph");
|
frm.trigger("show_graph");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
show_graph: function(frm) {
|
show_graph: function(frm) {
|
||||||
var x_intervals = ["x", frm.doc.purchase_date];
|
var x_intervals = ["x", frm.doc.purchase_date];
|
||||||
var asset_values = ["Asset Value", frm.doc.gross_purchase_amount];
|
var asset_values = ["Asset Value", frm.doc.gross_purchase_amount];
|
||||||
var last_depreciation_date = frm.doc.purchase_date;
|
var last_depreciation_date = frm.doc.purchase_date;
|
||||||
|
|
||||||
if(frm.doc.opening_accumulated_depreciation) {
|
if(frm.doc.opening_accumulated_depreciation) {
|
||||||
last_depreciation_date = frappe.datetime.add_months(frm.doc.next_depreciation_date,
|
last_depreciation_date = frappe.datetime.add_months(frm.doc.next_depreciation_date,
|
||||||
-1*frm.doc.frequency_of_depreciation);
|
-1*frm.doc.frequency_of_depreciation);
|
||||||
|
|
||||||
x_intervals.push(last_depreciation_date);
|
x_intervals.push(last_depreciation_date);
|
||||||
asset_values.push(flt(frm.doc.gross_purchase_amount) -
|
asset_values.push(flt(frm.doc.gross_purchase_amount) -
|
||||||
flt(frm.doc.opening_accumulated_depreciation));
|
flt(frm.doc.opening_accumulated_depreciation));
|
||||||
}
|
}
|
||||||
|
|
||||||
$.each(frm.doc.schedules || [], function(i, v) {
|
$.each(frm.doc.schedules || [], function(i, v) {
|
||||||
x_intervals.push(v.schedule_date);
|
x_intervals.push(v.schedule_date);
|
||||||
asset_value = flt(frm.doc.gross_purchase_amount) - flt(v.accumulated_depreciation_amount);
|
var asset_value = flt(frm.doc.gross_purchase_amount) - flt(v.accumulated_depreciation_amount);
|
||||||
if(v.journal_entry) {
|
if(v.journal_entry) {
|
||||||
last_depreciation_date = v.schedule_date;
|
last_depreciation_date = v.schedule_date;
|
||||||
asset_values.push(asset_value)
|
asset_values.push(asset_value)
|
||||||
} else {
|
} else {
|
||||||
if (in_list(["Scrapped", "Sold"], frm.doc.status)) {
|
if (in_list(["Scrapped", "Sold"], frm.doc.status)) {
|
||||||
asset_values.push(null)
|
asset_values.push(null)
|
||||||
} else {
|
} else {
|
||||||
asset_values.push(asset_value)
|
asset_values.push(asset_value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
if(in_list(["Scrapped", "Sold"], frm.doc.status)) {
|
if(in_list(["Scrapped", "Sold"], frm.doc.status)) {
|
||||||
x_intervals.push(frm.doc.disposal_date);
|
x_intervals.push(frm.doc.disposal_date);
|
||||||
asset_values.push(0);
|
asset_values.push(0);
|
||||||
last_depreciation_date = frm.doc.disposal_date;
|
last_depreciation_date = frm.doc.disposal_date;
|
||||||
}
|
}
|
||||||
|
|
||||||
frm.dashboard.setup_chart({
|
frm.dashboard.setup_chart({
|
||||||
data: {
|
data: {
|
||||||
x: 'x',
|
x: 'x',
|
||||||
@@ -117,9 +117,9 @@ frappe.ui.form.on('Asset', {
|
|||||||
padding: {bottom: 10}
|
padding: {bottom: 10}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
item_code: function(frm) {
|
item_code: function(frm) {
|
||||||
if(frm.doc.item_code) {
|
if(frm.doc.item_code) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
@@ -137,27 +137,27 @@ frappe.ui.form.on('Asset', {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
is_existing_asset: function(frm) {
|
is_existing_asset: function(frm) {
|
||||||
frm.toggle_enable("supplier", frm.doc.is_existing_asset);
|
frm.toggle_enable("supplier", frm.doc.is_existing_asset);
|
||||||
frm.toggle_reqd("next_depreciation_date", !frm.doc.is_existing_asset);
|
frm.toggle_reqd("next_depreciation_date", !frm.doc.is_existing_asset);
|
||||||
},
|
},
|
||||||
|
|
||||||
opening_accumulated_depreciation: function(frm) {
|
opening_accumulated_depreciation: function(frm) {
|
||||||
erpnext.asset.set_accululated_depreciation(frm);
|
erpnext.asset.set_accululated_depreciation(frm);
|
||||||
},
|
},
|
||||||
|
|
||||||
depreciation_method: function(frm) {
|
depreciation_method: function(frm) {
|
||||||
frm.events.make_schedules_editable(frm);
|
frm.events.make_schedules_editable(frm);
|
||||||
},
|
},
|
||||||
|
|
||||||
make_schedules_editable: function(frm) {
|
make_schedules_editable: function(frm) {
|
||||||
var is_editable = frm.doc.depreciation_method==="Manual" ? true : false;
|
var is_editable = frm.doc.depreciation_method==="Manual" ? true : false;
|
||||||
frm.toggle_enable("schedules", is_editable);
|
frm.toggle_enable("schedules", is_editable);
|
||||||
frm.fields_dict["schedules"].grid.toggle_enable("schedule_date", is_editable);
|
frm.fields_dict["schedules"].grid.toggle_enable("schedule_date", is_editable);
|
||||||
frm.fields_dict["schedules"].grid.toggle_enable("depreciation_amount", is_editable);
|
frm.fields_dict["schedules"].grid.toggle_enable("depreciation_amount", is_editable);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
frappe.ui.form.on('Depreciation Schedule', {
|
frappe.ui.form.on('Depreciation Schedule', {
|
||||||
@@ -177,7 +177,7 @@ frappe.ui.form.on('Depreciation Schedule', {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
depreciation_amount: function(frm, cdt, cdn) {
|
depreciation_amount: function(frm, cdt, cdn) {
|
||||||
erpnext.asset.set_accululated_depreciation(frm);
|
erpnext.asset.set_accululated_depreciation(frm);
|
||||||
}
|
}
|
||||||
@@ -186,11 +186,11 @@ frappe.ui.form.on('Depreciation Schedule', {
|
|||||||
|
|
||||||
erpnext.asset.set_accululated_depreciation = function(frm) {
|
erpnext.asset.set_accululated_depreciation = function(frm) {
|
||||||
if(frm.doc.depreciation_method != "Manual") return;
|
if(frm.doc.depreciation_method != "Manual") return;
|
||||||
|
|
||||||
accumulated_depreciation = flt(frm.doc.opening_accumulated_depreciation);
|
var accumulated_depreciation = flt(frm.doc.opening_accumulated_depreciation);
|
||||||
$.each(frm.doc.schedules || [], function(i, row) {
|
$.each(frm.doc.schedules || [], function(i, row) {
|
||||||
accumulated_depreciation += flt(row.depreciation_amount);
|
accumulated_depreciation += flt(row.depreciation_amount);
|
||||||
frappe.model.set_value(row.doctype, row.name,
|
frappe.model.set_value(row.doctype, row.name,
|
||||||
"accumulated_depreciation_amount", accumulated_depreciation);
|
"accumulated_depreciation_amount", accumulated_depreciation);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -260,9 +260,9 @@ erpnext.asset.transfer_asset = function(frm) {
|
|||||||
title: __("Transfer Asset"),
|
title: __("Transfer Asset"),
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
"label": __("Target Warehouse"),
|
"label": __("Target Warehouse"),
|
||||||
"fieldname": "target_warehouse",
|
"fieldname": "target_warehouse",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"options": "Warehouse",
|
"options": "Warehouse",
|
||||||
"get_query": function () {
|
"get_query": function () {
|
||||||
return {
|
return {
|
||||||
@@ -271,13 +271,13 @@ erpnext.asset.transfer_asset = function(frm) {
|
|||||||
["Warehouse", "is_group", "=", 0]
|
["Warehouse", "is_group", "=", 0]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": __("Date"),
|
"label": __("Date"),
|
||||||
"fieldname": "transfer_date",
|
"fieldname": "transfer_date",
|
||||||
"fieldtype": "Datetime",
|
"fieldtype": "Datetime",
|
||||||
"reqd": 1,
|
"reqd": 1,
|
||||||
"default": frappe.datetime.now_datetime()
|
"default": frappe.datetime.now_datetime()
|
||||||
}
|
}
|
||||||
@@ -285,7 +285,7 @@ erpnext.asset.transfer_asset = function(frm) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
dialog.set_primary_action(__("Transfer"), function() {
|
dialog.set_primary_action(__("Transfer"), function() {
|
||||||
args = dialog.get_values();
|
var args = dialog.get_values();
|
||||||
if(!args) return;
|
if(!args) return;
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
return frappe.call({
|
return frappe.call({
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ class Asset(Document):
|
|||||||
self.validate_asset_values()
|
self.validate_asset_values()
|
||||||
self.make_depreciation_schedule()
|
self.make_depreciation_schedule()
|
||||||
self.set_accumulated_depreciation()
|
self.set_accumulated_depreciation()
|
||||||
self.validate_expected_value_after_useful_life()
|
if self.get("schedules"):
|
||||||
|
self.validate_expected_value_after_useful_life()
|
||||||
# Validate depreciation related accounts
|
# Validate depreciation related accounts
|
||||||
get_depreciation_accounts(self)
|
get_depreciation_accounts(self)
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
frappe.listview_settings['Asset'] = {
|
frappe.listview_settings['Asset'] = {
|
||||||
add_fields: ['image']
|
add_fields: ['image']
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
frappe.ui.form.on('Asset Movement', {
|
frappe.ui.form.on('Asset Movement', {
|
||||||
onload: function(frm) {
|
onload: function(frm) {
|
||||||
frm.add_fetch("asset", "warehouse", "source_warehouse");
|
frm.add_fetch("asset", "warehouse", "source_warehouse");
|
||||||
|
|
||||||
frm.set_query("target_warehouse", function() {
|
frm.set_query("target_warehouse", function() {
|
||||||
return {
|
return {
|
||||||
filters: [
|
filters: [
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ frappe.ui.form.on('Bank Guarantee', {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
start_date: function(frm) {
|
start_date: function(frm) {
|
||||||
end_date = frappe.datetime.add_days(cur_frm.doc.start_date, cur_frm.doc.validity - 1);
|
var end_date = frappe.datetime.add_days(cur_frm.doc.start_date, cur_frm.doc.validity - 1);
|
||||||
cur_frm.set_value("end_date", end_date);
|
cur_frm.set_value("end_date", end_date);
|
||||||
},
|
},
|
||||||
validity: function(frm) {
|
validity: function(frm) {
|
||||||
end_date = frappe.datetime.add_days(cur_frm.doc.start_date, cur_frm.doc.validity - 1);
|
var end_date = frappe.datetime.add_days(cur_frm.doc.start_date, cur_frm.doc.validity - 1);
|
||||||
cur_frm.set_value("end_date", end_date);
|
cur_frm.set_value("end_date", end_date);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -43,7 +43,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
|||||||
|
|
||||||
cur_frm.cscript.parent_cost_center = function(doc, cdt, cdn) {
|
cur_frm.cscript.parent_cost_center = function(doc, cdt, cdn) {
|
||||||
if(!doc.company){
|
if(!doc.company){
|
||||||
msgprint(__('Please enter company name first'));
|
frappe.msgprint(__('Please enter company name first'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ $.extend(cur_frm.cscript, {
|
|||||||
this.frm.toggle_enable('year_start_date', doc.__islocal)
|
this.frm.toggle_enable('year_start_date', doc.__islocal)
|
||||||
this.frm.toggle_enable('year_end_date', doc.__islocal)
|
this.frm.toggle_enable('year_end_date', doc.__islocal)
|
||||||
|
|
||||||
if (!doc.__islocal && (doc.name != sys_defaults.fiscal_year)) {
|
if (!doc.__islocal && (doc.name != frappe.sys_defaults.fiscal_year)) {
|
||||||
this.frm.add_custom_button(__("Default"),
|
this.frm.add_custom_button(__("Default"),
|
||||||
this.frm.cscript.set_as_default, "fa fa-star");
|
this.frm.cscript.set_as_default, "fa fa-star");
|
||||||
this.frm.set_intro(__("To set this Fiscal Year as Default, click on 'Set as Default'"));
|
this.frm.set_intro(__("To set this Fiscal Year as Default, click on 'Set as Default'"));
|
||||||
@@ -30,7 +30,7 @@ $.extend(cur_frm.cscript, {
|
|||||||
year_start_date: function(doc, dt, dn) {
|
year_start_date: function(doc, dt, dn) {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
year_end_date =
|
var year_end_date =
|
||||||
frappe.datetime.add_days(frappe.datetime.add_months(this.frm.doc.year_start_date, 12), -1);
|
frappe.datetime.add_days(frappe.datetime.add_months(this.frm.doc.year_start_date, 12), -1);
|
||||||
this.frm.set_value("year_end_date", year_end_date);
|
this.frm.set_value("year_end_date", year_end_date);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -62,11 +62,10 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({
|
|||||||
if(this.frm.doc.__islocal && this.frm.doc.company) {
|
if(this.frm.doc.__islocal && this.frm.doc.company) {
|
||||||
frappe.model.set_default_values(this.frm.doc);
|
frappe.model.set_default_values(this.frm.doc);
|
||||||
$.each(this.frm.doc.accounts || [], function(i, jvd) {
|
$.each(this.frm.doc.accounts || [], function(i, jvd) {
|
||||||
frappe.model.set_default_values(jvd);
|
frappe.model.set_default_values(jvd);
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
if(!this.frm.doc.amended_from) this.frm.doc.posting_date = this.frm.posting_date || get_today();
|
if(!this.frm.doc.amended_from) this.frm.doc.posting_date = this.frm.posting_date || frappe.datetime.get_today();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -124,7 +123,7 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({
|
|||||||
// account filter
|
// account filter
|
||||||
frappe.model.validate_missing(jvd, "account");
|
frappe.model.validate_missing(jvd, "account");
|
||||||
|
|
||||||
party_account_field = jvd.reference_type==="Sales Invoice" ? "debit_to": "credit_to";
|
var party_account_field = jvd.reference_type==="Sales Invoice" ? "debit_to": "credit_to";
|
||||||
out.filters.push([jvd.reference_type, party_account_field, "=", jvd.account]);
|
out.filters.push([jvd.reference_type, party_account_field, "=", jvd.account]);
|
||||||
} else {
|
} else {
|
||||||
// party_type and party mandatory
|
// party_type and party mandatory
|
||||||
@@ -243,7 +242,7 @@ cur_frm.cscript.update_totals = function(doc) {
|
|||||||
cur_frm.cscript.get_balance = function(doc,dt,dn) {
|
cur_frm.cscript.get_balance = function(doc,dt,dn) {
|
||||||
cur_frm.cscript.update_totals(doc);
|
cur_frm.cscript.update_totals(doc);
|
||||||
return $c_obj(cur_frm.doc, 'get_balance', '', function(r, rt){
|
return $c_obj(cur_frm.doc, 'get_balance', '', function(r, rt){
|
||||||
cur_frm.refresh();
|
cur_frm.refresh();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
"editable_grid": 0,
|
"editable_grid": 0,
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -42,6 +43,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 1,
|
"allow_on_submit": 1,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -72,6 +74,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -104,6 +107,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -135,6 +139,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -164,6 +169,7 @@
|
|||||||
"width": "50%"
|
"width": "50%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -194,6 +200,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -225,6 +232,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -255,6 +263,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -286,6 +295,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -313,6 +323,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -344,6 +355,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -374,6 +386,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -404,6 +417,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -431,6 +445,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -462,6 +477,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -493,6 +509,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -525,6 +542,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -555,6 +573,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -584,6 +603,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -614,6 +634,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 1,
|
"bold": 1,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -643,6 +664,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -671,6 +693,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 1,
|
"collapsible": 1,
|
||||||
@@ -700,6 +723,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -730,6 +754,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -761,6 +786,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -788,6 +814,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -818,6 +845,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -848,6 +876,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -878,6 +907,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 1,
|
"collapsible": 1,
|
||||||
@@ -908,6 +938,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -939,6 +970,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -969,6 +1001,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -997,6 +1030,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -1027,6 +1061,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 1,
|
"collapsible": 1,
|
||||||
@@ -1056,6 +1091,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 1,
|
"allow_on_submit": 1,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -1084,6 +1120,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -1112,6 +1149,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 1,
|
"allow_on_submit": 1,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -1141,6 +1179,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 1,
|
"allow_on_submit": 1,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -1172,6 +1211,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 1,
|
"collapsible": 1,
|
||||||
@@ -1202,6 +1242,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -1231,6 +1272,7 @@
|
|||||||
"width": "50%"
|
"width": "50%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -1264,11 +1306,12 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
"depends_on": "eval:inList([\"Credit Note\", \"Debit Note\"], doc.voucher_type)",
|
"depends_on": "eval:in_list([\"Credit Note\", \"Debit Note\"], doc.voucher_type)",
|
||||||
"fieldname": "stock_entry",
|
"fieldname": "stock_entry",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@@ -1295,6 +1338,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -1338,7 +1382,7 @@
|
|||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"menu_index": 0,
|
"menu_index": 0,
|
||||||
"modified": "2017-04-10 12:07:44.599804",
|
"modified": "2017-06-07 18:13:25.808427",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Journal Entry",
|
"name": "Journal Entry",
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
// License: GNU General Public License v3. See license.txt
|
// License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
cur_frm.cscript.onload = function(doc,cdt,cdn){
|
cur_frm.cscript.onload = function(doc,cdt,cdn){
|
||||||
if(doc.__islocal){
|
if(doc.__islocal){
|
||||||
var callback1 = function(r,rt){
|
var callback1 = function(r,rt){
|
||||||
refresh_field('percentages');
|
refresh_field('percentages');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $c('runserverobj',args={'method':'get_months', 'docs':doc}, callback1);
|
return $c('runserverobj', {'method':'get_months', 'docs':doc}, callback1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.refresh = function(doc,cdt,cdn){
|
cur_frm.cscript.refresh = function(doc,cdt,cdn){
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ frappe.ui.form.on('Payment Entry', {
|
|||||||
frm.set_query("paid_to", function() {
|
frm.set_query("paid_to", function() {
|
||||||
var party_account_type = frm.doc.party_type=="Customer" ? "Receivable" : "Payable";
|
var party_account_type = frm.doc.party_type=="Customer" ? "Receivable" : "Payable";
|
||||||
var account_types = in_list(["Receive", "Internal Transfer"], frm.doc.payment_type) ?
|
var account_types = in_list(["Receive", "Internal Transfer"], frm.doc.payment_type) ?
|
||||||
["Bank", "Cash"] : party_account_type;
|
["Bank", "Cash"] : party_account_type;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
filters: {
|
filters: {
|
||||||
@@ -182,8 +182,8 @@ frappe.ui.form.on('Payment Entry', {
|
|||||||
if(frm.doc.payment_type == "Internal Transfer") {
|
if(frm.doc.payment_type == "Internal Transfer") {
|
||||||
$.each(["party", "party_balance", "paid_from", "paid_to",
|
$.each(["party", "party_balance", "paid_from", "paid_to",
|
||||||
"references", "total_allocated_amount"], function(i, field) {
|
"references", "total_allocated_amount"], function(i, field) {
|
||||||
frm.set_value(field, null);
|
frm.set_value(field, null);
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
if(!frm.doc.party)
|
if(!frm.doc.party)
|
||||||
frm.set_value("party_type", frm.doc.payment_type=="Receive" ? "Customer" : "Supplier");
|
frm.set_value("party_type", frm.doc.payment_type=="Receive" ? "Customer" : "Supplier");
|
||||||
@@ -200,9 +200,10 @@ frappe.ui.form.on('Payment Entry', {
|
|||||||
$.each(["party", "party_balance", "paid_from", "paid_to",
|
$.each(["party", "party_balance", "paid_from", "paid_to",
|
||||||
"paid_from_account_currency", "paid_from_account_balance",
|
"paid_from_account_currency", "paid_from_account_balance",
|
||||||
"paid_to_account_currency", "paid_to_account_balance",
|
"paid_to_account_currency", "paid_to_account_balance",
|
||||||
"references", "total_allocated_amount"], function(i, field) {
|
"references", "total_allocated_amount"],
|
||||||
|
function(i, field) {
|
||||||
frm.set_value(field, null);
|
frm.set_value(field, null);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -487,13 +488,17 @@ frappe.ui.form.on('Payment Entry', {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if((frm.doc.payment_type=="Receive" && frm.doc.party_type=="Customer") ||
|
if(
|
||||||
(frm.doc.payment_type=="Pay" && frm.doc.party_type=="Supplier")) {
|
(frm.doc.payment_type=="Receive" && frm.doc.party_type=="Customer") ||
|
||||||
if(total_positive_outstanding > total_negative_outstanding)
|
(frm.doc.payment_type=="Pay" && frm.doc.party_type=="Supplier")
|
||||||
frm.set_value("paid_amount",
|
) {
|
||||||
total_positive_outstanding - total_negative_outstanding);
|
if(total_positive_outstanding > total_negative_outstanding)
|
||||||
} else if (total_negative_outstanding &&
|
frm.set_value("paid_amount",
|
||||||
(total_positive_outstanding < total_negative_outstanding)) {
|
total_positive_outstanding - total_negative_outstanding);
|
||||||
|
} else if (
|
||||||
|
total_negative_outstanding &&
|
||||||
|
total_positive_outstanding < total_negative_outstanding
|
||||||
|
) {
|
||||||
frm.set_value("received_amount",
|
frm.set_value("received_amount",
|
||||||
total_negative_outstanding - total_positive_outstanding);
|
total_negative_outstanding - total_positive_outstanding);
|
||||||
}
|
}
|
||||||
@@ -561,9 +566,11 @@ frappe.ui.form.on('Payment Entry', {
|
|||||||
row.allocated_amount = 0 //If allocate payment amount checkbox is unchecked, set zero to allocate amount
|
row.allocated_amount = 0 //If allocate payment amount checkbox is unchecked, set zero to allocate amount
|
||||||
if(frm.doc.allocate_payment_amount){
|
if(frm.doc.allocate_payment_amount){
|
||||||
if(row.outstanding_amount > 0 && allocated_positive_outstanding > 0) {
|
if(row.outstanding_amount > 0 && allocated_positive_outstanding > 0) {
|
||||||
if(row.outstanding_amount >= allocated_positive_outstanding)
|
if(row.outstanding_amount >= allocated_positive_outstanding) {
|
||||||
row.allocated_amount = allocated_positive_outstanding;
|
row.allocated_amount = allocated_positive_outstanding;
|
||||||
else row.allocated_amount = row.outstanding_amount;
|
} else {
|
||||||
|
row.allocated_amount = row.outstanding_amount;
|
||||||
|
}
|
||||||
|
|
||||||
allocated_positive_outstanding -= flt(row.allocated_amount);
|
allocated_positive_outstanding -= flt(row.allocated_amount);
|
||||||
} else if (row.outstanding_amount < 0 && allocated_negative_outstanding) {
|
} else if (row.outstanding_amount < 0 && allocated_negative_outstanding) {
|
||||||
@@ -581,7 +588,8 @@ frappe.ui.form.on('Payment Entry', {
|
|||||||
},
|
},
|
||||||
|
|
||||||
set_total_allocated_amount: function(frm) {
|
set_total_allocated_amount: function(frm) {
|
||||||
var total_allocated_amount = base_total_allocated_amount = 0.0;
|
var total_allocated_amount = 0.0;
|
||||||
|
var base_total_allocated_amount = 0.0;
|
||||||
$.each(frm.doc.references || [], function(i, row) {
|
$.each(frm.doc.references || [], function(i, row) {
|
||||||
if (row.allocated_amount) {
|
if (row.allocated_amount) {
|
||||||
total_allocated_amount += flt(row.allocated_amount);
|
total_allocated_amount += flt(row.allocated_amount);
|
||||||
@@ -653,19 +661,21 @@ frappe.ui.form.on('Payment Entry', {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(frm.doc.party_type=="Customer"
|
if(frm.doc.party_type=="Customer" &&
|
||||||
&& !in_list(["Sales Order", "Sales Invoice", "Journal Entry"], row.reference_doctype)) {
|
!in_list(["Sales Order", "Sales Invoice", "Journal Entry"], row.reference_doctype)
|
||||||
frappe.model.set_value(row.doctype, row.name, "reference_doctype", null);
|
) {
|
||||||
frappe.msgprint(__("Row #{0}: Reference Document Type must be one of Sales Order, Sales Invoice or Journal Entry", [row.idx]));
|
frappe.model.set_value(row.doctype, row.name, "reference_doctype", null);
|
||||||
return false;
|
frappe.msgprint(__("Row #{0}: Reference Document Type must be one of Sales Order, Sales Invoice or Journal Entry", [row.idx]));
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(frm.doc.party_type=="Supplier" && !in_list(["Purchase Order",
|
if(frm.doc.party_type=="Supplier" &&
|
||||||
"Purchase Invoice", "Journal Entry"], row.reference_doctype)) {
|
!in_list(["Purchase Order", "Purchase Invoice", "Journal Entry"], row.reference_doctype)
|
||||||
frappe.model.set_value(row.doctype, row.name, "against_voucher_type", null);
|
) {
|
||||||
frappe.msgprint(__("Row #{0}: Reference Document Type must be one of Purchase Order, Purchase Invoice or Journal Entry", [row.idx]));
|
frappe.model.set_value(row.doctype, row.name, "against_voucher_type", null);
|
||||||
return false;
|
frappe.msgprint(__("Row #{0}: Reference Document Type must be one of Purchase Order, Purchase Invoice or Journal Entry", [row.idx]));
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (row) {
|
if (row) {
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ class PaymentEntry(AccountsController):
|
|||||||
self.validate_transaction_reference()
|
self.validate_transaction_reference()
|
||||||
self.set_title()
|
self.set_title()
|
||||||
self.set_remarks()
|
self.set_remarks()
|
||||||
|
self.validate_duplicate_entry()
|
||||||
|
self.validate_allocated_amount()
|
||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
self.setup_party_account_field()
|
self.setup_party_account_field()
|
||||||
@@ -61,7 +63,22 @@ class PaymentEntry(AccountsController):
|
|||||||
self.make_gl_entries(cancel=1)
|
self.make_gl_entries(cancel=1)
|
||||||
self.update_advance_paid()
|
self.update_advance_paid()
|
||||||
self.delink_advance_entry_references()
|
self.delink_advance_entry_references()
|
||||||
|
|
||||||
|
def validate_duplicate_entry(self):
|
||||||
|
reference_names = []
|
||||||
|
for d in self.get("references"):
|
||||||
|
if (d.reference_doctype, d.reference_name) in reference_names:
|
||||||
|
frappe.throw(_("Row #{0}: Duplicate entry in References {1} {2}").format(d.idx, d.reference_doctype, d.reference_name))
|
||||||
|
reference_names.append((d.reference_doctype, d.reference_name))
|
||||||
|
|
||||||
|
|
||||||
|
def validate_allocated_amount(self):
|
||||||
|
for d in self.get("references"):
|
||||||
|
if (flt(d.allocated_amount))> 0:
|
||||||
|
if flt(d.allocated_amount) > flt(d.outstanding_amount):
|
||||||
|
frappe.throw(_("Row #{0}: Allocated Amount cannot be greater than outstanding amount.").format(d.idx))
|
||||||
|
|
||||||
|
|
||||||
def delink_advance_entry_references(self):
|
def delink_advance_entry_references(self):
|
||||||
for reference in self.references:
|
for reference in self.references:
|
||||||
if reference.reference_doctype in ("Sales Invoice", "Purchase Invoice"):
|
if reference.reference_doctype in ("Sales Invoice", "Purchase Invoice"):
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext
|
|||||||
|
|
||||||
this.frm.set_query('receivable_payable_account', function() {
|
this.frm.set_query('receivable_payable_account', function() {
|
||||||
if(!me.frm.doc.company || !me.frm.doc.party_type) {
|
if(!me.frm.doc.company || !me.frm.doc.party_type) {
|
||||||
msgprint(__("Please select Company and Party Type first"));
|
frappe.msgprint(__("Please select Company and Party Type first"));
|
||||||
} else {
|
} else {
|
||||||
return{
|
return{
|
||||||
filters: {
|
filters: {
|
||||||
@@ -29,7 +29,7 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext
|
|||||||
|
|
||||||
this.frm.set_query('bank_cash_account', function() {
|
this.frm.set_query('bank_cash_account', function() {
|
||||||
if(!me.frm.doc.company) {
|
if(!me.frm.doc.company) {
|
||||||
msgprint(__("Please select Company first"));
|
frappe.msgprint(__("Please select Company first"));
|
||||||
} else {
|
} else {
|
||||||
return{
|
return{
|
||||||
filters:[
|
filters:[
|
||||||
@@ -96,10 +96,11 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext
|
|||||||
},
|
},
|
||||||
|
|
||||||
set_invoice_options: function() {
|
set_invoice_options: function() {
|
||||||
|
var me = this;
|
||||||
var invoices = [];
|
var invoices = [];
|
||||||
|
|
||||||
$.each(me.frm.doc.invoices || [], function(i, row) {
|
$.each(me.frm.doc.invoices || [], function(i, row) {
|
||||||
if (row.invoice_number && !inList(invoices, row.invoice_number))
|
if (row.invoice_number && !in_list(invoices, row.invoice_number))
|
||||||
invoices.push(row.invoice_type + " | " + row.invoice_number);
|
invoices.push(row.invoice_type + " | " + row.invoice_number);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -108,7 +109,7 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext
|
|||||||
me.frm.doc.name).options = "\n" + invoices.join("\n");
|
me.frm.doc.name).options = "\n" + invoices.join("\n");
|
||||||
|
|
||||||
$.each(me.frm.doc.payments || [], function(i, p) {
|
$.each(me.frm.doc.payments || [], function(i, p) {
|
||||||
if(!inList(invoices, cstr(p.invoice_number))) p.invoice_number = null;
|
if(!in_list(invoices, cstr(p.invoice_number))) p.invoice_number = null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
frappe.ui.form.on('Period Closing Voucher', {
|
frappe.ui.form.on('Period Closing Voucher', {
|
||||||
onload: function(frm) {
|
onload: function(frm) {
|
||||||
if (!frm.doc.transaction_date) frm.doc.transaction_date = dateutil.obj_to_str(new Date());
|
if (!frm.doc.transaction_date) frm.doc.transaction_date = frappe.datetime.obj_to_str(new Date());
|
||||||
},
|
},
|
||||||
|
|
||||||
setup: function(frm) {
|
setup: function(frm) {
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ cur_frm.fields_dict['income_account'].get_query = function(doc,cdt,cdn) {
|
|||||||
'company': doc.company,
|
'company': doc.company,
|
||||||
'account_type': "Income Account"
|
'account_type': "Income Account"
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
// Cost Center
|
// Cost Center
|
||||||
@@ -47,8 +47,8 @@ cur_frm.fields_dict['cost_center'].get_query = function(doc,cdt,cdn) {
|
|||||||
'company': doc.company,
|
'company': doc.company,
|
||||||
'is_group': 0
|
'is_group': 0
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
// Expense Account
|
// Expense Account
|
||||||
@@ -60,8 +60,8 @@ cur_frm.fields_dict["expense_account"].get_query = function(doc) {
|
|||||||
"company": doc.company,
|
"company": doc.company,
|
||||||
"is_group": 0
|
"is_group": 0
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
// ------------------ Get Print Heading ------------------------------------
|
// ------------------ Get Print Heading ------------------------------------
|
||||||
cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) {
|
cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) {
|
||||||
@@ -69,13 +69,13 @@ cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn)
|
|||||||
filters:[
|
filters:[
|
||||||
['Print Heading', 'docstatus', '!=', 2]
|
['Print Heading', 'docstatus', '!=', 2]
|
||||||
]
|
]
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
cur_frm.fields_dict.user.get_query = function(doc,cdt,cdn) {
|
cur_frm.fields_dict.user.get_query = function(doc,cdt,cdn) {
|
||||||
return{ query:"frappe.core.doctype.user.user.user_query"}
|
return{ query:"frappe.core.doctype.user.user.user_query"};
|
||||||
}
|
};
|
||||||
|
|
||||||
cur_frm.fields_dict.write_off_account.get_query = function(doc) {
|
cur_frm.fields_dict.write_off_account.get_query = function(doc) {
|
||||||
return{
|
return{
|
||||||
@@ -84,16 +84,16 @@ cur_frm.fields_dict.write_off_account.get_query = function(doc) {
|
|||||||
'is_group': 0,
|
'is_group': 0,
|
||||||
'company': doc.company
|
'company': doc.company
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
// Write off cost center
|
// Write off cost center
|
||||||
//-----------------------
|
// -----------------------
|
||||||
cur_frm.fields_dict.write_off_cost_center.get_query = function(doc) {
|
cur_frm.fields_dict.write_off_cost_center.get_query = function(doc) {
|
||||||
return{
|
return{
|
||||||
filters:{
|
filters:{
|
||||||
'is_group': 0,
|
'is_group': 0,
|
||||||
'company': doc.company
|
'company': doc.company
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -2,63 +2,65 @@
|
|||||||
// License: GNU General Public License v3. See license.txt
|
// License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
frappe.ui.form.on("Pricing Rule", "refresh", function(frm) {
|
frappe.ui.form.on("Pricing Rule", "refresh", function(frm) {
|
||||||
var help_content = ['<table class="table table-bordered" style="background-color: #f9f9f9;">',
|
var help_content =
|
||||||
'<tr><td>',
|
`<table class="table table-bordered" style="background-color: #f9f9f9;">
|
||||||
'<h4><i class="fa fa-hand-right"></i> ',
|
<tr><td>
|
||||||
__('Notes'),
|
<h4>
|
||||||
':</h4>',
|
<i class="fa fa-hand-right"></i>
|
||||||
'<ul>',
|
${__('Notes')}
|
||||||
'<li>',
|
</h4>
|
||||||
__("Pricing Rule is made to overwrite Price List / define discount percentage, based on some criteria."),
|
<ul>
|
||||||
'</li>',
|
<li>
|
||||||
'<li>',
|
${__("Pricing Rule is made to overwrite Price List / define discount percentage, based on some criteria.")}
|
||||||
__("If selected Pricing Rule is made for 'Price', it will overwrite Price List. Pricing Rule price is the final price, so no further discount should be applied. Hence, in transactions like Sales Order, Purchase Order etc, it will be fetched in 'Rate' field, rather than 'Price List Rate' field."),
|
</li>
|
||||||
'</li>',
|
<li>
|
||||||
'<li>',
|
${__("If selected Pricing Rule is made for 'Price', it will overwrite Price List. Pricing Rule price is the final price, so no further discount should be applied. Hence, in transactions like Sales Order, Purchase Order etc, it will be fetched in 'Rate' field, rather than 'Price List Rate' field.")}
|
||||||
__('Discount Percentage can be applied either against a Price List or for all Price List.'),
|
</li>
|
||||||
'</li>',
|
<li>
|
||||||
'<li>',
|
${__('Discount Percentage can be applied either against a Price List or for all Price List.')}
|
||||||
__('To not apply Pricing Rule in a particular transaction, all applicable Pricing Rules should be disabled.'),
|
</li>
|
||||||
'</li>',
|
<li>
|
||||||
'</ul>',
|
${__('To not apply Pricing Rule in a particular transaction, all applicable Pricing Rules should be disabled.')}
|
||||||
'</td></tr>',
|
</li>
|
||||||
'<tr><td>',
|
</ul>
|
||||||
'<h4><i class="fa fa-question-sign"></i> ',
|
</td></tr>
|
||||||
__('How Pricing Rule is applied?'),
|
<tr><td>
|
||||||
'</h4>',
|
<h4><i class="fa fa-question-sign"></i>
|
||||||
'<ol>',
|
${__('How Pricing Rule is applied?')}
|
||||||
'<li>',
|
</h4>
|
||||||
__("Pricing Rule is first selected based on 'Apply On' field, which can be Item, Item Group or Brand."),
|
<ol>
|
||||||
'</li>',
|
<li>
|
||||||
'<li>',
|
${__("Pricing Rule is first selected based on 'Apply On' field, which can be Item, Item Group or Brand.")}
|
||||||
__("Then Pricing Rules are filtered out based on Customer, Customer Group, Territory, Supplier, Supplier Type, Campaign, Sales Partner etc."),
|
</li>
|
||||||
'</li>',
|
<li>
|
||||||
'<li>',
|
${__("Then Pricing Rules are filtered out based on Customer, Customer Group, Territory, Supplier, Supplier Type, Campaign, Sales Partner etc.")}
|
||||||
__('Pricing Rules are further filtered based on quantity.'),
|
</li>
|
||||||
'</li>',
|
<li>
|
||||||
'<li>',
|
${__('Pricing Rules are further filtered based on quantity.')}
|
||||||
__('If two or more Pricing Rules are found based on the above conditions, Priority is applied. Priority is a number between 0 to 20 while default value is zero (blank). Higher number means it will take precedence if there are multiple Pricing Rules with same conditions.'),
|
</li>
|
||||||
'</li>',
|
<li>
|
||||||
'<li>',
|
${__('If two or more Pricing Rules are found based on the above conditions, Priority is applied. Priority is a number between 0 to 20 while default value is zero (blank). Higher number means it will take precedence if there are multiple Pricing Rules with same conditions.')}
|
||||||
__('Even if there are multiple Pricing Rules with highest priority, then following internal priorities are applied:'),
|
</li>
|
||||||
'<ul>',
|
<li>
|
||||||
'<li>',
|
${__('Even if there are multiple Pricing Rules with highest priority, then following internal priorities are applied:')}
|
||||||
__('Item Code > Item Group > Brand'),
|
<ul>
|
||||||
'</li>',
|
<li>
|
||||||
'<li>',
|
${__('Item Code > Item Group > Brand')}
|
||||||
__('Customer > Customer Group > Territory'),
|
</li>
|
||||||
'</li>',
|
<li>
|
||||||
'<li>',
|
${__('Customer > Customer Group > Territory')}
|
||||||
__('Supplier > Supplier Type'),
|
</li>
|
||||||
'</li>',
|
<li>
|
||||||
'</ul>',
|
${__('Supplier > Supplier Type')}
|
||||||
'</li>',
|
</li>
|
||||||
'<li>',
|
</ul>
|
||||||
__('If multiple Pricing Rules continue to prevail, users are asked to set Priority manually to resolve conflict.'),
|
</li>
|
||||||
'</li>',
|
<li>
|
||||||
'</ol>',
|
${__('If multiple Pricing Rules continue to prevail, users are asked to set Priority manually to resolve conflict.')}
|
||||||
'</td></tr>',
|
</li>
|
||||||
'</table>'].join("\n");
|
</ol>
|
||||||
|
</td></tr>
|
||||||
|
</table>`;
|
||||||
|
|
||||||
set_field_options("pricing_rule_help", help_content);
|
set_field_options("pricing_rule_help", help_content);
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
|
|||||||
},
|
},
|
||||||
get_query_filters: {
|
get_query_filters: {
|
||||||
docstatus: 1,
|
docstatus: 1,
|
||||||
status: ["!=", "Closed"],
|
status: ["not in", ["Closed", "Completed"]],
|
||||||
company: me.frm.doc.company,
|
company: me.frm.doc.company,
|
||||||
is_return: 0
|
is_return: 0
|
||||||
}
|
}
|
||||||
@@ -101,8 +101,8 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
|
|||||||
account: this.frm.doc.credit_to,
|
account: this.frm.doc.credit_to,
|
||||||
price_list: this.frm.doc.buying_price_list,
|
price_list: this.frm.doc.buying_price_list,
|
||||||
}, function() {
|
}, function() {
|
||||||
me.apply_pricing_rule();
|
me.apply_pricing_rule();
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
credit_to: function() {
|
credit_to: function() {
|
||||||
@@ -130,7 +130,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
|
|||||||
if(cint(this.frm.doc.is_paid)) {
|
if(cint(this.frm.doc.is_paid)) {
|
||||||
if(!this.frm.doc.company) {
|
if(!this.frm.doc.company) {
|
||||||
this.frm.set_value("is_paid", 0)
|
this.frm.set_value("is_paid", 0)
|
||||||
msgprint(__("Please specify Company to proceed"));
|
frappe.msgprint(__("Please specify Company to proceed"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.calculate_outstanding_amount();
|
this.calculate_outstanding_amount();
|
||||||
@@ -195,19 +195,19 @@ cur_frm.script_manager.make(erpnext.accounts.PurchaseInvoice);
|
|||||||
// Hide Fields
|
// Hide Fields
|
||||||
// ------------
|
// ------------
|
||||||
function hide_fields(doc) {
|
function hide_fields(doc) {
|
||||||
parent_fields = ['due_date', 'is_opening', 'advances_section', 'from_date', 'to_date'];
|
var parent_fields = ['due_date', 'is_opening', 'advances_section', 'from_date', 'to_date'];
|
||||||
|
|
||||||
if(cint(doc.is_paid) == 1) {
|
if(cint(doc.is_paid) == 1) {
|
||||||
hide_field(parent_fields);
|
hide_field(parent_fields);
|
||||||
} else {
|
} else {
|
||||||
for (i in parent_fields) {
|
for (var i in parent_fields) {
|
||||||
var docfield = frappe.meta.docfield_map[doc.doctype][parent_fields[i]];
|
var docfield = frappe.meta.docfield_map[doc.doctype][parent_fields[i]];
|
||||||
if(!docfield.hidden) unhide_field(parent_fields[i]);
|
if(!docfield.hidden) unhide_field(parent_fields[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
item_fields_stock = ['warehouse_section', 'received_qty', 'rejected_qty'];
|
var item_fields_stock = ['warehouse_section', 'received_qty', 'rejected_qty'];
|
||||||
|
|
||||||
cur_frm.fields_dict['items'].grid.set_column_disp(item_fields_stock,
|
cur_frm.fields_dict['items'].grid.set_column_disp(item_fields_stock,
|
||||||
(cint(doc.update_stock)==1 || cint(doc.is_return)==1 ? true : false));
|
(cint(doc.update_stock)==1 || cint(doc.is_return)==1 ? true : false));
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ frappe.ui.form.on("Purchase Taxes and Charges", "add_deduct_tax", function(doc,
|
|||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
|
|
||||||
if(!d.category && d.add_deduct_tax) {
|
if(!d.category && d.add_deduct_tax) {
|
||||||
msgprint(__("Please select Category first"));
|
frappe.msgprint(__("Please select Category first"));
|
||||||
d.add_deduct_tax = '';
|
d.add_deduct_tax = '';
|
||||||
}
|
}
|
||||||
else if(d.category != 'Total' && d.add_deduct_tax == 'Deduct') {
|
else if(d.category != 'Total' && d.add_deduct_tax == 'Deduct') {
|
||||||
msgprint(__("Cannot deduct when category is for 'Valuation' or 'Valuation and Total'"));
|
frappe.msgprint(__("Cannot deduct when category is for 'Valuation' or 'Valuation and Total'"));
|
||||||
d.add_deduct_tax = '';
|
d.add_deduct_tax = '';
|
||||||
}
|
}
|
||||||
refresh_field('add_deduct_tax', d.name, 'taxes');
|
refresh_field('add_deduct_tax', d.name, 'taxes');
|
||||||
@@ -23,7 +23,7 @@ frappe.ui.form.on("Purchase Taxes and Charges", "category", function(doc, cdt, c
|
|||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
|
|
||||||
if (d.category != 'Total' && d.add_deduct_tax == 'Deduct') {
|
if (d.category != 'Total' && d.add_deduct_tax == 'Deduct') {
|
||||||
msgprint(__("Cannot deduct when category is for 'Valuation' or 'Vaulation and Total'"));
|
frappe.msgprint(__("Cannot deduct when category is for 'Valuation' or 'Vaulation and Total'"));
|
||||||
d.add_deduct_tax = '';
|
d.add_deduct_tax = '';
|
||||||
}
|
}
|
||||||
refresh_field('add_deduct_tax', d.name, 'taxes');
|
refresh_field('add_deduct_tax', d.name, 'taxes');
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ def get_pos_data():
|
|||||||
'item_groups': get_item_groups(pos_profile),
|
'item_groups': get_item_groups(pos_profile),
|
||||||
'customers': customers,
|
'customers': customers,
|
||||||
'address': get_customers_address(customers),
|
'address': get_customers_address(customers),
|
||||||
|
'contacts': get_contacts(customers),
|
||||||
'serial_no_data': get_serial_no_data(pos_profile, doc.company),
|
'serial_no_data': get_serial_no_data(pos_profile, doc.company),
|
||||||
'batch_no_data': get_batch_no_data(),
|
'batch_no_data': get_batch_no_data(),
|
||||||
'tax_data': get_item_tax_data(),
|
'tax_data': get_item_tax_data(),
|
||||||
@@ -160,7 +161,7 @@ def get_item_groups(pos_profile):
|
|||||||
item_group_dict[data.name] = [data.lft, data.rgt]
|
item_group_dict[data.name] = [data.lft, data.rgt]
|
||||||
return item_group_dict
|
return item_group_dict
|
||||||
|
|
||||||
def get_customers_list(pos_profile):
|
def get_customers_list(pos_profile={}):
|
||||||
cond = "1=1"
|
cond = "1=1"
|
||||||
customer_groups = []
|
customer_groups = []
|
||||||
if pos_profile.get('customer_groups'):
|
if pos_profile.get('customer_groups'):
|
||||||
@@ -170,7 +171,7 @@ def get_customers_list(pos_profile):
|
|||||||
cond = "customer_group in (%s)"%(', '.join(['%s']*len(customer_groups)))
|
cond = "customer_group in (%s)"%(', '.join(['%s']*len(customer_groups)))
|
||||||
|
|
||||||
return frappe.db.sql(""" select name, customer_name, customer_group,
|
return frappe.db.sql(""" select name, customer_name, customer_group,
|
||||||
territory from tabCustomer where disabled = 0
|
territory, customer_pos_id from tabCustomer where disabled = 0
|
||||||
and {cond}""".format(cond=cond), tuple(customer_groups), as_dict=1) or {}
|
and {cond}""".format(cond=cond), tuple(customer_groups), as_dict=1) or {}
|
||||||
|
|
||||||
def get_customers_address(customers):
|
def get_customers_address(customers):
|
||||||
@@ -183,13 +184,29 @@ def get_customers_address(customers):
|
|||||||
email_id, phone, fax, pincode from `tabAddress` where is_primary_address =1 and name in
|
email_id, phone, fax, pincode from `tabAddress` where is_primary_address =1 and name in
|
||||||
(select parent from `tabDynamic Link` where link_doctype = 'Customer' and link_name = %s
|
(select parent from `tabDynamic Link` where link_doctype = 'Customer' and link_name = %s
|
||||||
and parenttype = 'Address')""", data.name, as_dict=1)
|
and parenttype = 'Address')""", data.name, as_dict=1)
|
||||||
if address:
|
address_data = {}
|
||||||
address_data = address[0]
|
if address: address_data = address[0]
|
||||||
address_data.update({'full_name': data.customer_name})
|
|
||||||
customer_address[data.name] = address_data
|
address_data.update({'full_name': data.customer_name, 'customer_pos_id': data.customer_pos_id})
|
||||||
|
customer_address[data.name] = address_data
|
||||||
|
|
||||||
return customer_address
|
return customer_address
|
||||||
|
|
||||||
|
def get_contacts(customers):
|
||||||
|
customer_contact = {}
|
||||||
|
if isinstance(customers, basestring):
|
||||||
|
customers = [frappe._dict({'name': customers})]
|
||||||
|
|
||||||
|
for data in customers:
|
||||||
|
contact = frappe.db.sql(""" select email_id, phone from `tabContact`
|
||||||
|
where is_primary_contact =1 and name in
|
||||||
|
(select parent from `tabDynamic Link` where link_doctype = 'Customer' and link_name = %s
|
||||||
|
and parenttype = 'Contact')""", data.name, as_dict=1)
|
||||||
|
if contact:
|
||||||
|
customer_contact[data.name] = contact[0]
|
||||||
|
|
||||||
|
return customer_contact
|
||||||
|
|
||||||
def get_child_nodes(group_type, root):
|
def get_child_nodes(group_type, root):
|
||||||
lft, rgt = frappe.db.get_value(group_type, root, ["lft", "rgt"])
|
lft, rgt = frappe.db.get_value(group_type, root, ["lft", "rgt"])
|
||||||
return frappe.db.sql(""" Select name, lft, rgt from `tab{tab}` where
|
return frappe.db.sql(""" Select name, lft, rgt from `tab{tab}` where
|
||||||
@@ -294,7 +311,7 @@ def make_invoice(doc_list={}, email_queue_list={}, customers_list={}):
|
|||||||
if isinstance(customers_list, basestring):
|
if isinstance(customers_list, basestring):
|
||||||
customers_list = json.loads(customers_list)
|
customers_list = json.loads(customers_list)
|
||||||
|
|
||||||
customers = make_customer_and_address(customers_list)
|
customers_list = make_customer_and_address(customers_list)
|
||||||
name_list = []
|
name_list = []
|
||||||
for docs in doc_list:
|
for docs in doc_list:
|
||||||
for name, doc in docs.items():
|
for name, doc in docs.items():
|
||||||
@@ -303,6 +320,7 @@ def make_invoice(doc_list={}, email_queue_list={}, customers_list={}):
|
|||||||
si_doc = frappe.new_doc('Sales Invoice')
|
si_doc = frappe.new_doc('Sales Invoice')
|
||||||
si_doc.offline_pos_name = name
|
si_doc.offline_pos_name = name
|
||||||
si_doc.update(doc)
|
si_doc.update(doc)
|
||||||
|
si_doc.customer = get_customer_id(doc)
|
||||||
si_doc.due_date = doc.get('posting_date')
|
si_doc.due_date = doc.get('posting_date')
|
||||||
submit_invoice(si_doc, name, doc)
|
submit_invoice(si_doc, name, doc)
|
||||||
name_list.append(name)
|
name_list.append(name)
|
||||||
@@ -310,30 +328,54 @@ def make_invoice(doc_list={}, email_queue_list={}, customers_list={}):
|
|||||||
name_list.append(name)
|
name_list.append(name)
|
||||||
|
|
||||||
email_queue = make_email_queue(email_queue_list)
|
email_queue = make_email_queue(email_queue_list)
|
||||||
|
customers = get_customers_list()
|
||||||
return {
|
return {
|
||||||
'invoice': name_list,
|
'invoice': name_list,
|
||||||
'email_queue': email_queue,
|
'email_queue': email_queue,
|
||||||
'customers': customers
|
'customers': customers_list,
|
||||||
|
'synced_customers_list': customers,
|
||||||
|
'synced_address': get_customers_address(customers),
|
||||||
|
'synced_contacts': get_contacts(customers)
|
||||||
}
|
}
|
||||||
|
|
||||||
def validate_records(doc):
|
def validate_records(doc):
|
||||||
validate_item(doc)
|
validate_item(doc)
|
||||||
|
|
||||||
def make_customer_and_address(customers):
|
def get_customer_id(doc, customer=None):
|
||||||
customer_list = []
|
cust_id = None
|
||||||
for name, data in customers.items():
|
if doc.get('customer_pos_id'):
|
||||||
if not frappe.db.exists('Customer', name):
|
cust_id = frappe.db.get_value('Customer',
|
||||||
name = add_customer(name)
|
{'customer_pos_id': doc.get('customer_pos_id')}, 'name')
|
||||||
data = json.loads(data)
|
|
||||||
make_contact(data, name)
|
|
||||||
make_address(data, name)
|
|
||||||
customer_list.append(name)
|
|
||||||
frappe.db.commit()
|
|
||||||
return customer_list
|
|
||||||
|
|
||||||
def add_customer(name):
|
if not cust_id:
|
||||||
|
customer = customer or doc.get('customer')
|
||||||
|
if frappe.db.exists('Customer', customer):
|
||||||
|
cust_id = customer
|
||||||
|
else:
|
||||||
|
cust_id = add_customer(doc)
|
||||||
|
|
||||||
|
return cust_id
|
||||||
|
|
||||||
|
def make_customer_and_address(customers):
|
||||||
|
customers_list = []
|
||||||
|
for customer, data in customers.items():
|
||||||
|
data = json.loads(data)
|
||||||
|
cust_id = get_customer_id(data, customer)
|
||||||
|
if not cust_id:
|
||||||
|
cust_id = add_customer(data)
|
||||||
|
else:
|
||||||
|
frappe.db.set_value("Customer", cust_id, "customer_name", data.get('full_name'))
|
||||||
|
|
||||||
|
make_contact(data, cust_id)
|
||||||
|
make_address(data, cust_id)
|
||||||
|
customers_list.append(customer)
|
||||||
|
frappe.db.commit()
|
||||||
|
return customers_list
|
||||||
|
|
||||||
|
def add_customer(data):
|
||||||
customer_doc = frappe.new_doc('Customer')
|
customer_doc = frappe.new_doc('Customer')
|
||||||
customer_doc.customer_name = name
|
customer_doc.customer_name = data.get('full_name') or data.get('customer')
|
||||||
|
customer_doc.customer_pos_id = data.get('customer_pos_id')
|
||||||
customer_doc.customer_type = 'Company'
|
customer_doc.customer_type = 'Company'
|
||||||
customer_doc.customer_group = frappe.db.get_single_value('Selling Settings', 'customer_group')
|
customer_doc.customer_group = frappe.db.get_single_value('Selling Settings', 'customer_group')
|
||||||
customer_doc.territory = frappe.db.get_single_value('Selling Settings', 'territory')
|
customer_doc.territory = frappe.db.get_single_value('Selling Settings', 'territory')
|
||||||
@@ -348,6 +390,7 @@ def make_contact(args,customer):
|
|||||||
{'link_doctype': 'Customer', 'link_name': customer, 'parenttype': 'Contact'}, 'parent')
|
{'link_doctype': 'Customer', 'link_name': customer, 'parenttype': 'Contact'}, 'parent')
|
||||||
|
|
||||||
args = {
|
args = {
|
||||||
|
'first_name': args.get('full_name'),
|
||||||
'email_id': args.get('email_id'),
|
'email_id': args.get('email_id'),
|
||||||
'phone': args.get('phone')
|
'phone': args.get('phone')
|
||||||
}
|
}
|
||||||
@@ -357,8 +400,8 @@ def make_contact(args,customer):
|
|||||||
doc = frappe.get_doc('Contact', name)
|
doc = frappe.get_doc('Contact', name)
|
||||||
|
|
||||||
doc.update(args)
|
doc.update(args)
|
||||||
|
doc.is_primary_contact = 1
|
||||||
if not name:
|
if not name:
|
||||||
doc.first_name = customer
|
|
||||||
doc.append('links',{
|
doc.append('links',{
|
||||||
'link_doctype': 'Customer',
|
'link_doctype': 'Customer',
|
||||||
'link_name': customer
|
'link_name': customer
|
||||||
|
|||||||
@@ -175,8 +175,8 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
|||||||
account: this.frm.doc.debit_to,
|
account: this.frm.doc.debit_to,
|
||||||
price_list: this.frm.doc.selling_price_list,
|
price_list: this.frm.doc.selling_price_list,
|
||||||
}, function() {
|
}, function() {
|
||||||
me.apply_pricing_rule();
|
me.apply_pricing_rule();
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
debit_to: function() {
|
debit_to: function() {
|
||||||
@@ -267,7 +267,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
|||||||
if(this.frm.doc.is_pos) {
|
if(this.frm.doc.is_pos) {
|
||||||
if(!this.frm.doc.company) {
|
if(!this.frm.doc.company) {
|
||||||
this.frm.set_value("is_pos", 0);
|
this.frm.set_value("is_pos", 0);
|
||||||
msgprint(__("Please specify Company to proceed"));
|
frappe.msgprint(__("Please specify Company to proceed"));
|
||||||
} else {
|
} else {
|
||||||
var me = this;
|
var me = this;
|
||||||
return this.frm.call({
|
return this.frm.call({
|
||||||
@@ -299,6 +299,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
|||||||
this.calculate_write_off_amount()
|
this.calculate_write_off_amount()
|
||||||
}else {
|
}else {
|
||||||
this.frm.set_value("change_amount", 0.0)
|
this.frm.set_value("change_amount", 0.0)
|
||||||
|
this.frm.set_value("base_change_amount", 0.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.frm.refresh_fields();
|
this.frm.refresh_fields();
|
||||||
@@ -311,19 +312,19 @@ $.extend(cur_frm.cscript, new erpnext.accounts.SalesInvoiceController({frm: cur_
|
|||||||
// Hide Fields
|
// Hide Fields
|
||||||
// ------------
|
// ------------
|
||||||
cur_frm.cscript.hide_fields = function(doc) {
|
cur_frm.cscript.hide_fields = function(doc) {
|
||||||
parent_fields = ['project', 'due_date', 'is_opening', 'source', 'total_advance', 'get_advances',
|
var parent_fields = ['project', 'due_date', 'is_opening', 'source', 'total_advance', 'get_advances',
|
||||||
'advances', 'sales_partner', 'commission_rate', 'total_commission', 'advances', 'from_date', 'to_date'];
|
'advances', 'sales_partner', 'commission_rate', 'total_commission', 'advances', 'from_date', 'to_date'];
|
||||||
|
|
||||||
if(cint(doc.is_pos) == 1) {
|
if(cint(doc.is_pos) == 1) {
|
||||||
hide_field(parent_fields);
|
hide_field(parent_fields);
|
||||||
} else {
|
} else {
|
||||||
for (i in parent_fields) {
|
for (var i in parent_fields) {
|
||||||
var docfield = frappe.meta.docfield_map[doc.doctype][parent_fields[i]];
|
var docfield = frappe.meta.docfield_map[doc.doctype][parent_fields[i]];
|
||||||
if(!docfield.hidden) unhide_field(parent_fields[i]);
|
if(!docfield.hidden) unhide_field(parent_fields[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
item_fields_stock = ['batch_no', 'actual_batch_qty', 'actual_qty', 'expense_account',
|
var item_fields_stock = ['batch_no', 'actual_batch_qty', 'actual_qty', 'expense_account',
|
||||||
'warehouse', 'expense_account', 'quality_inspection']
|
'warehouse', 'expense_account', 'quality_inspection']
|
||||||
cur_frm.fields_dict['items'].grid.set_column_disp(item_fields_stock,
|
cur_frm.fields_dict['items'].grid.set_column_disp(item_fields_stock,
|
||||||
(cint(doc.update_stock)==1 || cint(doc.is_return)==1 ? true : false));
|
(cint(doc.update_stock)==1 || cint(doc.is_return)==1 ? true : false));
|
||||||
@@ -400,7 +401,7 @@ cur_frm.set_query("income_account", "items", function(doc) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// expense account
|
// expense account
|
||||||
if (sys_defaults.auto_accounting_for_stock) {
|
if (frappe.sys_defaults.auto_accounting_for_stock) {
|
||||||
cur_frm.fields_dict['items'].grid.get_field('expense_account').get_query = function(doc) {
|
cur_frm.fields_dict['items'].grid.get_field('expense_account').get_query = function(doc) {
|
||||||
return {
|
return {
|
||||||
filters: {
|
filters: {
|
||||||
@@ -442,11 +443,12 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if(cur_frm.doc.is_pos) {
|
if(cur_frm.doc.is_pos) {
|
||||||
cur_frm.msgbox = frappe.msgprint(format('<a class="btn btn-primary" \
|
cur_frm.msgbox = frappe.msgprint(
|
||||||
onclick="cur_frm.print_preview.printit(true)" style="margin-right: 5px;">{0}</a>\
|
`<a class="btn btn-primary" onclick="cur_frm.print_preview.printit(true)" style="margin-right: 5px;">
|
||||||
<a class="btn btn-default" href="javascript:frappe.new_doc(cur_frm.doctype);">{1}</a>', [
|
${__('Print')}</a>
|
||||||
__('Print'), __('New')
|
<a class="btn btn-default" href="javascript:frappe.new_doc(cur_frm.doctype);">
|
||||||
]));
|
${__('New')}</a>`
|
||||||
|
);
|
||||||
|
|
||||||
} else if(cint(frappe.boot.notification_settings.sales_invoice)) {
|
} else if(cint(frappe.boot.notification_settings.sales_invoice)) {
|
||||||
cur_frm.email_doc(frappe.boot.notification_settings.sales_invoice_message);
|
cur_frm.email_doc(frappe.boot.notification_settings.sales_invoice_message);
|
||||||
|
|||||||
@@ -247,7 +247,6 @@ class SalesInvoice(SellingController):
|
|||||||
(not self.project and not data.sales_invoice) or \
|
(not self.project and not data.sales_invoice) or \
|
||||||
(not sales_invoice and data.sales_invoice == self.name):
|
(not sales_invoice and data.sales_invoice == self.name):
|
||||||
data.sales_invoice = sales_invoice
|
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()
|
||||||
@@ -487,13 +486,14 @@ class SalesInvoice(SellingController):
|
|||||||
self.set('packed_items', [])
|
self.set('packed_items', [])
|
||||||
|
|
||||||
def set_billing_hours_and_amount(self):
|
def set_billing_hours_and_amount(self):
|
||||||
for timesheet in self.timesheets:
|
if not self.project:
|
||||||
ts_doc = frappe.get_doc('Timesheet', timesheet.time_sheet)
|
for timesheet in self.timesheets:
|
||||||
if not timesheet.billing_hours and ts_doc.total_billable_hours:
|
ts_doc = frappe.get_doc('Timesheet', timesheet.time_sheet)
|
||||||
timesheet.billing_hours = ts_doc.total_billable_hours
|
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:
|
if not timesheet.billing_amount and ts_doc.total_billable_amount:
|
||||||
timesheet.billing_amount = ts_doc.total_billable_amount
|
timesheet.billing_amount = ts_doc.total_billable_amount
|
||||||
|
|
||||||
def update_timesheet_billing_for_project(self):
|
def update_timesheet_billing_for_project(self):
|
||||||
if not self.timesheets and self.project:
|
if not self.timesheets and self.project:
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ frappe.pages['pos'].refresh = function (wrapper) {
|
|||||||
erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||||
init: function (wrapper) {
|
init: function (wrapper) {
|
||||||
this.page_len = 20;
|
this.page_len = 20;
|
||||||
|
this.freeze = false;
|
||||||
this.page = wrapper.page;
|
this.page = wrapper.page;
|
||||||
this.wrapper = $(wrapper).find('.page-content');
|
this.wrapper = $(wrapper).find('.page-content');
|
||||||
this.set_indicator();
|
this.set_indicator();
|
||||||
@@ -72,6 +73,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
onload: function () {
|
onload: function () {
|
||||||
var me = this;
|
var me = this;
|
||||||
this.get_data_from_server(function () {
|
this.get_data_from_server(function () {
|
||||||
|
me.make_control();
|
||||||
me.create_new();
|
me.create_new();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -96,7 +98,6 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
this.page.add_menu_item(__("Sync Master Data"), function () {
|
this.page.add_menu_item(__("Sync Master Data"), function () {
|
||||||
me.get_data_from_server(function () {
|
me.get_data_from_server(function () {
|
||||||
me.load_data(false);
|
me.load_data(false);
|
||||||
me.make_customer();
|
|
||||||
me.make_item_list();
|
me.make_item_list();
|
||||||
me.set_missing_values();
|
me.set_missing_values();
|
||||||
})
|
})
|
||||||
@@ -113,7 +114,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
|
|
||||||
email_prompt: function() {
|
email_prompt: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
fields = [{label:__("To"), fieldtype:"Data", reqd: 0, fieldname:"recipients",length:524288},
|
var fields = [{label:__("To"), fieldtype:"Data", reqd: 0, fieldname:"recipients",length:524288},
|
||||||
{fieldtype: "Section Break", collapsible: 1, label: "CC & Standard Reply"},
|
{fieldtype: "Section Break", collapsible: 1, label: "CC & Standard Reply"},
|
||||||
{fieldtype: "Section Break"},
|
{fieldtype: "Section Break"},
|
||||||
{label:__("Subject"), fieldtype:"Data", reqd: 1,
|
{label:__("Subject"), fieldtype:"Data", reqd: 1,
|
||||||
@@ -311,6 +312,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
this.serial_no_data = r.message.serial_no_data;
|
this.serial_no_data = r.message.serial_no_data;
|
||||||
this.batch_no_data = r.message.batch_no_data;
|
this.batch_no_data = r.message.batch_no_data;
|
||||||
this.tax_data = r.message.tax_data;
|
this.tax_data = r.message.tax_data;
|
||||||
|
this.contacts = r.message.contacts;
|
||||||
this.address = r.message.address || {};
|
this.address = r.message.address || {};
|
||||||
this.price_list_data = r.message.price_list_data;
|
this.price_list_data = r.message.price_list_data;
|
||||||
this.bin_data = r.message.bin_data;
|
this.bin_data = r.message.bin_data;
|
||||||
@@ -320,7 +322,6 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
this.default_customer = r.message.default_customer || null;
|
this.default_customer = r.message.default_customer || null;
|
||||||
this.print_settings = locals[":Print Settings"]["Print Settings"];
|
this.print_settings = locals[":Print Settings"]["Print Settings"];
|
||||||
this.letter_head = (this.pos_profile_data.length > 0) ? frappe.boot.letter_heads[this.pos_profile_data[letter_head]] : {};
|
this.letter_head = (this.pos_profile_data.length > 0) ? frappe.boot.letter_heads[this.pos_profile_data[letter_head]] : {};
|
||||||
this.make_control()
|
|
||||||
},
|
},
|
||||||
|
|
||||||
save_previous_entry: function () {
|
save_previous_entry: function () {
|
||||||
@@ -403,6 +404,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
this.frm = {}
|
this.frm = {}
|
||||||
this.frm.doc = this.doc
|
this.frm.doc = this.doc
|
||||||
this.set_transaction_defaults("Customer");
|
this.set_transaction_defaults("Customer");
|
||||||
|
this.frm.doc["allow_user_to_edit_rate"] = this.pos_profile_data["allow_user_to_edit_rate"] ? true : false,
|
||||||
this.wrapper.html(frappe.render_template("pos", this.frm.doc));
|
this.wrapper.html(frappe.render_template("pos", this.frm.doc));
|
||||||
this.make_search();
|
this.make_search();
|
||||||
this.make_customer();
|
this.make_customer();
|
||||||
@@ -602,7 +604,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
var html = "";
|
var html = "";
|
||||||
if(this.si_docs.length) {
|
if(this.si_docs.length) {
|
||||||
this.si_docs.forEach(function (data, i) {
|
this.si_docs.forEach(function (data, i) {
|
||||||
for (key in data) {
|
for (var key in data) {
|
||||||
html += frappe.render_template("pos_invoice_list", {
|
html += frappe.render_template("pos_invoice_list", {
|
||||||
sr: i + 1,
|
sr: i + 1,
|
||||||
name: key,
|
name: key,
|
||||||
@@ -707,15 +709,28 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
autoFirst: true,
|
autoFirst: true,
|
||||||
list: [],
|
list: [],
|
||||||
filter: function (item, input) {
|
filter: function (item, input) {
|
||||||
var value = item.value.toLowerCase();
|
if (item.value.includes('is_action')) {
|
||||||
if (value.indexOf('is_action') !== -1 ||
|
|
||||||
value.indexOf(input) !== -1) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input = input.toLowerCase();
|
||||||
|
item = this.get_item(item.value);
|
||||||
|
var searchtext =
|
||||||
|
Object.keys(item)
|
||||||
|
.filter(key => ['customer_name', 'customer_group', 'value', 'label', 'email_id', 'phone'].includes(key))
|
||||||
|
.map(key => item[key])
|
||||||
|
.join(" ")
|
||||||
|
.toLowerCase();
|
||||||
|
|
||||||
|
return searchtext.includes(input)
|
||||||
},
|
},
|
||||||
item: function (item, input) {
|
item: function (item, input) {
|
||||||
var d = item;
|
var d = this.get_item(item.value);
|
||||||
var html = "<span>" + __(d.label || d.value) + "</span>";
|
var html = "<span>" + __(d.label || d.value) + "</span>";
|
||||||
|
if(d.customer_name) {
|
||||||
|
html += '<br><span class="text-muted ellipsis">' + __(d.customer_name) + '</span>';
|
||||||
|
}
|
||||||
|
|
||||||
return $('<li></li>')
|
return $('<li></li>')
|
||||||
.data('item.autocomplete', d)
|
.data('item.autocomplete', d)
|
||||||
.html('<a><p>' + html + '</p></a>')
|
.html('<a><p>' + html + '</p></a>')
|
||||||
@@ -723,28 +738,12 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.customers_mapper = this.customers.map(function (c) {
|
this.prepare_customer_mapper()
|
||||||
return {
|
|
||||||
label: c.name,
|
|
||||||
value: c.name,
|
|
||||||
customer_group: c.customer_group,
|
|
||||||
territory: c.territory
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.customers_mapper.push({
|
|
||||||
label: "<span class='text-primary link-option'>"
|
|
||||||
+ "<i class='fa fa-plus' style='margin-right: 5px;'></i> "
|
|
||||||
+ __("Create a new Customer")
|
|
||||||
+ "</span>",
|
|
||||||
value: 'is_action',
|
|
||||||
action: me.add_customer
|
|
||||||
});
|
|
||||||
this.autocomplete_customers();
|
this.autocomplete_customers();
|
||||||
|
|
||||||
this.party_field.$input
|
this.party_field.$input
|
||||||
.on('input', function (e) {
|
.on('input', function (e) {
|
||||||
me.party_field.awesomeplete.list = this.customers_mapper;
|
me.party_field.awesomeplete.list = me.customers_mapper;
|
||||||
})
|
})
|
||||||
.on('awesomplete-select', function (e) {
|
.on('awesomplete-select', function (e) {
|
||||||
var customer = me.party_field.awesomeplete
|
var customer = me.party_field.awesomeplete
|
||||||
@@ -784,6 +783,32 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
prepare_customer_mapper: function() {
|
||||||
|
var me = this;
|
||||||
|
|
||||||
|
this.customers_mapper = this.customers.map(function (c) {
|
||||||
|
contact = me.contacts[c.name];
|
||||||
|
return {
|
||||||
|
label: c.name,
|
||||||
|
value: c.name,
|
||||||
|
customer_name: c.customer_name,
|
||||||
|
customer_group: c.customer_group,
|
||||||
|
territory: c.territory,
|
||||||
|
phone: contact ? contact["phone"] : '',
|
||||||
|
email_id: contact ? contact["email_id"] : ''
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.customers_mapper.push({
|
||||||
|
label: "<span class='text-primary link-option'>"
|
||||||
|
+ "<i class='fa fa-plus' style='margin-right: 5px;'></i> "
|
||||||
|
+ __("Create a new Customer")
|
||||||
|
+ "</span>",
|
||||||
|
value: 'is_action',
|
||||||
|
action: me.add_customer
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
autocomplete_customers: function() {
|
autocomplete_customers: function() {
|
||||||
this.party_field.awesomeplete.list = this.customers_mapper;
|
this.party_field.awesomeplete.list = this.customers_mapper;
|
||||||
},
|
},
|
||||||
@@ -871,10 +896,15 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
"label": __("ZIP Code"),
|
"label": __("ZIP Code"),
|
||||||
"fieldname": "pincode",
|
"fieldname": "pincode",
|
||||||
"fieldtype": "Data"
|
"fieldtype": "Data"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": __("Customer POS Id"),
|
||||||
|
"fieldname": "customer_pos_id",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"hidden": 1
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
this.customer_doc.show()
|
this.customer_doc.show()
|
||||||
this.render_address_data()
|
this.render_address_data()
|
||||||
|
|
||||||
@@ -887,12 +917,19 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
|
|
||||||
render_address_data: function() {
|
render_address_data: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
this.address_data = this.address[this.frm.doc.customer];
|
this.address_data = this.address[this.frm.doc.customer] || {};
|
||||||
this.customer_doc.set_values(this.address_data)
|
if(!this.address_data.email_id || !this.address_data.phone) {
|
||||||
|
this.address_data = this.contacts[this.frm.doc.customer];
|
||||||
|
}
|
||||||
|
|
||||||
|
this.customer_doc.set_values(this.address_data)
|
||||||
if(!this.customer_doc.fields_dict.full_name.$input.val()) {
|
if(!this.customer_doc.fields_dict.full_name.$input.val()) {
|
||||||
this.customer_doc.set_value("full_name", this.frm.doc.customer)
|
this.customer_doc.set_value("full_name", this.frm.doc.customer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!this.customer_doc.fields_dict.customer_pos_id.value) {
|
||||||
|
this.customer_doc.set_value("customer_pos_id", $.now())
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
get_address_from_localstorage: function() {
|
get_address_from_localstorage: function() {
|
||||||
@@ -902,6 +939,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
|
|
||||||
make_offline_customer: function(new_customer) {
|
make_offline_customer: function(new_customer) {
|
||||||
this.frm.doc.customer = this.frm.doc.customer || this.customer_doc.get_values().full_name;
|
this.frm.doc.customer = this.frm.doc.customer || this.customer_doc.get_values().full_name;
|
||||||
|
this.frm.doc.customer_pos_id = this.customer_doc.fields_dict.customer_pos_id.value;
|
||||||
this.customer_details = this.get_customers_details();
|
this.customer_details = this.get_customers_details();
|
||||||
this.customer_details[this.frm.doc.customer] = this.get_prompt_details();
|
this.customer_details[this.frm.doc.customer] = this.get_prompt_details();
|
||||||
this.party_field.$input.val(this.frm.doc.customer);
|
this.party_field.$input.val(this.frm.doc.customer);
|
||||||
@@ -923,12 +961,13 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.address[this.frm.doc.customer] = this.customer_doc.get_values();
|
this.address[this.frm.doc.customer] = JSON.parse(this.get_prompt_details())
|
||||||
},
|
},
|
||||||
|
|
||||||
get_prompt_details: function() {
|
get_prompt_details: function() {
|
||||||
this.prompt_details = this.customer_doc.get_values();
|
this.prompt_details = this.customer_doc.get_values();
|
||||||
this.prompt_details['country'] = this.pos_profile_data.country;
|
this.prompt_details['country'] = this.pos_profile_data.country;
|
||||||
|
this.prompt_details['customer_pos_id'] = this.customer_doc.fields_dict.customer_pos_id.value;
|
||||||
return JSON.stringify(this.prompt_details)
|
return JSON.stringify(this.prompt_details)
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -942,30 +981,10 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
this.numeric_keypad.show();
|
this.numeric_keypad.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
get_customers: function (key) {
|
|
||||||
var me = this;
|
|
||||||
key = key.toLowerCase().trim()
|
|
||||||
var re = new RegExp('%', 'g');
|
|
||||||
var reg = new RegExp(key.replace(re, '\\w*\\s*[a-zA-Z0-9]*'))
|
|
||||||
|
|
||||||
if (key) {
|
|
||||||
return $.grep(this.customers, function (data) {
|
|
||||||
if (reg.test(data.name.toLowerCase())
|
|
||||||
|| reg.test(data.customer_name.toLowerCase())
|
|
||||||
|| (data.customer_group && reg.test(data.customer_group.toLowerCase()))) {
|
|
||||||
return data
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
customers = this.customers.sort(function (a, b) { return a.idx < b.idx })
|
|
||||||
return customers.slice(0, 20)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
make_item_list: function () {
|
make_item_list: function () {
|
||||||
var me = this;
|
var me = this;
|
||||||
if (!this.price_list) {
|
if (!this.price_list) {
|
||||||
msgprint(__("Price List not found or disabled"));
|
frappe.msgprint(__("Price List not found or disabled"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1180,6 +1199,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
this.child_doc = this.get_child_item(this.item_code);
|
this.child_doc = this.get_child_item(this.item_code);
|
||||||
$(this.wrapper).find('.selected-item').empty();
|
$(this.wrapper).find('.selected-item').empty();
|
||||||
if(this.child_doc.length) {
|
if(this.child_doc.length) {
|
||||||
|
this.child_doc[0]["allow_user_to_edit_rate"] = this.pos_profile_data["allow_user_to_edit_rate"] ? true : false,
|
||||||
this.selected_row = $(frappe.render_template("pos_selected_item", this.child_doc[0]))
|
this.selected_row = $(frappe.render_template("pos_selected_item", this.child_doc[0]))
|
||||||
$(this.wrapper).find('.selected-item').html(this.selected_row)
|
$(this.wrapper).find('.selected-item').html(this.selected_row)
|
||||||
}
|
}
|
||||||
@@ -1232,7 +1252,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
|
|
||||||
remove_zero_qty_item: function () {
|
remove_zero_qty_item: function () {
|
||||||
var me = this;
|
var me = this;
|
||||||
idx = 0
|
var idx = 0;
|
||||||
this.items = []
|
this.items = []
|
||||||
$.each(this.frm.doc["items"] || [], function (i, d) {
|
$.each(this.frm.doc["items"] || [], function (i, d) {
|
||||||
if (!in_list(me.remove_item, d.idx)) {
|
if (!in_list(me.remove_item, d.idx)) {
|
||||||
@@ -1250,7 +1270,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
|
|
||||||
this.wrapper.find('input.discount-percentage').on("change", function () {
|
this.wrapper.find('input.discount-percentage').on("change", function () {
|
||||||
me.frm.doc.additional_discount_percentage = flt($(this).val(), precision("additional_discount_percentage"));
|
me.frm.doc.additional_discount_percentage = flt($(this).val(), precision("additional_discount_percentage"));
|
||||||
total = me.frm.doc.grand_total
|
var total = me.frm.doc.grand_total
|
||||||
|
|
||||||
if (me.frm.doc.apply_discount_on == 'Net Total') {
|
if (me.frm.doc.apply_discount_on == 'Net Total') {
|
||||||
total = me.frm.doc.net_total
|
total = me.frm.doc.net_total
|
||||||
@@ -1388,7 +1408,6 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
actual_qty: me.actual_qty_dict[d.item_code] || 0.0,
|
actual_qty: me.actual_qty_dict[d.item_code] || 0.0,
|
||||||
projected_qty: d.projected_qty,
|
projected_qty: d.projected_qty,
|
||||||
rate: format_currency(d.rate, me.frm.doc.currency),
|
rate: format_currency(d.rate, me.frm.doc.currency),
|
||||||
enabled: me.pos_profile_data["allow_user_to_edit_rate"] ? true : false,
|
|
||||||
amount: format_currency(d.amount, me.frm.doc.currency),
|
amount: format_currency(d.amount, me.frm.doc.currency),
|
||||||
selected_class: (me.item_code == d.item_code) ? "active" : ""
|
selected_class: (me.item_code == d.item_code) ? "active" : ""
|
||||||
})).appendTo($items);
|
})).appendTo($items);
|
||||||
@@ -1442,7 +1461,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
|
|
||||||
if (this.frm.doc.docstatus == 1) {
|
if (this.frm.doc.docstatus == 1) {
|
||||||
this.page.set_secondary_action(__("Print"), function () {
|
this.page.set_secondary_action(__("Print"), function () {
|
||||||
html = frappe.render(me.print_template_data, me.frm.doc)
|
var html = frappe.render(me.print_template_data, me.frm.doc)
|
||||||
me.print_document(html)
|
me.print_document(html)
|
||||||
})
|
})
|
||||||
this.page.add_menu_item(__("Email"), function () {
|
this.page.add_menu_item(__("Email"), function () {
|
||||||
@@ -1465,19 +1484,18 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
print_dialog: function () {
|
print_dialog: function () {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
this.msgprint = frappe.msgprint(format('<a class="btn btn-primary print_doc" \
|
this.frappe.msgprint = frappe.msgprint(
|
||||||
style="margin-right: 5px;">{0}</a>\
|
`<a class="btn btn-primary print_doc"
|
||||||
<a class="btn btn-default new_doc">{1}</a>', [
|
style="margin-right: 5px;">${__('Print')}</a>
|
||||||
__('Print'), __('New')
|
<a class="btn btn-default new_doc">${__('New')}</a>`);
|
||||||
]));
|
|
||||||
|
|
||||||
$('.print_doc').click(function () {
|
$('.print_doc').click(function () {
|
||||||
html = frappe.render(me.print_template_data, me.frm.doc)
|
var html = frappe.render(me.print_template_data, me.frm.doc)
|
||||||
me.print_document(html)
|
me.print_document(html)
|
||||||
})
|
})
|
||||||
|
|
||||||
$('.new_doc').click(function () {
|
$('.new_doc').click(function () {
|
||||||
me.msgprint.hide()
|
me.frappe.msgprint.hide()
|
||||||
me.make_new_cart()
|
me.make_new_cart()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -1506,9 +1524,9 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
|
|
||||||
//Remove the sold serial no from the cache
|
//Remove the sold serial no from the cache
|
||||||
$.each(this.frm.doc.items, function(index, data) {
|
$.each(this.frm.doc.items, function(index, data) {
|
||||||
sn = data.serial_no.split('\n')
|
var sn = data.serial_no.split('\n')
|
||||||
if(sn.length) {
|
if(sn.length) {
|
||||||
serial_no_list = me.serial_no_data[data.item_code]
|
var serial_no_list = me.serial_no_data[data.item_code]
|
||||||
if(serial_no_list) {
|
if(serial_no_list) {
|
||||||
$.each(sn, function(i, serial_no) {
|
$.each(sn, function(i, serial_no) {
|
||||||
if(in_list(Object.keys(serial_no_list), serial_no)) {
|
if(in_list(Object.keys(serial_no_list), serial_no)) {
|
||||||
@@ -1531,7 +1549,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
|
|
||||||
toggle_input_field: function () {
|
toggle_input_field: function () {
|
||||||
var pointer_events = 'inherit'
|
var pointer_events = 'inherit'
|
||||||
disabled = this.frm.doc.docstatus == 1 ? true: false;
|
var disabled = this.frm.doc.docstatus == 1 ? true: false;
|
||||||
$(this.wrapper).find('input').attr("disabled", disabled);
|
$(this.wrapper).find('input').attr("disabled", disabled);
|
||||||
$(this.wrapper).find('select').attr("disabled", disabled);
|
$(this.wrapper).find('select').attr("disabled", disabled);
|
||||||
$(this.wrapper).find('input').attr("disabled", disabled);
|
$(this.wrapper).find('input').attr("disabled", disabled);
|
||||||
@@ -1571,7 +1589,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
var me = this;
|
var me = this;
|
||||||
this.si_docs = this.get_doc_from_localstorage();
|
this.si_docs = this.get_doc_from_localstorage();
|
||||||
$.each(this.si_docs, function (index, data) {
|
$.each(this.si_docs, function (index, data) {
|
||||||
for (key in data) {
|
for (var key in data) {
|
||||||
if (key == me.name) {
|
if (key == me.name) {
|
||||||
me.si_docs[index][key] = me.frm.doc;
|
me.si_docs[index][key] = me.frm.doc;
|
||||||
me.update_localstorage();
|
me.update_localstorage();
|
||||||
@@ -1608,8 +1626,11 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
this.si_docs = this.get_submitted_invoice() || [];
|
this.si_docs = this.get_submitted_invoice() || [];
|
||||||
this.email_queue_list = this.get_email_queue() || {};
|
this.email_queue_list = this.get_email_queue() || {};
|
||||||
this.customers_list = this.get_customers_details() || {};
|
this.customers_list = this.get_customers_details() || {};
|
||||||
|
if(this.customer_doc) {
|
||||||
|
this.freeze = this.customer_doc.display
|
||||||
|
}
|
||||||
|
|
||||||
if (this.si_docs.length || this.email_queue_list || this.customers_list) {
|
if ((this.si_docs.length || this.email_queue_list || this.customers_list) && !this.freeze) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "erpnext.accounts.doctype.sales_invoice.pos.make_invoice",
|
method: "erpnext.accounts.doctype.sales_invoice.pos.make_invoice",
|
||||||
args: {
|
args: {
|
||||||
@@ -1619,12 +1640,17 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
},
|
},
|
||||||
callback: function (r) {
|
callback: function (r) {
|
||||||
if (r.message) {
|
if (r.message) {
|
||||||
|
me.customers = r.message.synced_customers_list;
|
||||||
|
me.address = r.message.synced_address;
|
||||||
|
me.contacts = r.message.synced_contacts;
|
||||||
me.removed_items = r.message.invoice;
|
me.removed_items = r.message.invoice;
|
||||||
me.removed_email = r.message.email_queue
|
me.removed_email = r.message.email_queue
|
||||||
me.removed_customers = r.message.customers
|
me.removed_customers = r.message.customers
|
||||||
me.remove_doc_from_localstorage();
|
me.remove_doc_from_localstorage();
|
||||||
me.remove_email_queue_from_localstorage();
|
me.remove_email_queue_from_localstorage();
|
||||||
me.remove_customer_from_localstorage();
|
me.remove_customer_from_localstorage();
|
||||||
|
me.prepare_customer_mapper()
|
||||||
|
me.autocomplete_customers()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -1634,10 +1660,10 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
get_submitted_invoice: function () {
|
get_submitted_invoice: function () {
|
||||||
var invoices = [];
|
var invoices = [];
|
||||||
var index = 1;
|
var index = 1;
|
||||||
docs = this.get_doc_from_localstorage();
|
var docs = this.get_doc_from_localstorage();
|
||||||
if (docs) {
|
if (docs) {
|
||||||
invoices = $.map(docs, function (data) {
|
invoices = $.map(docs, function (data) {
|
||||||
for (key in data) {
|
for (var key in data) {
|
||||||
if (data[key].docstatus == 1 && index < 50) {
|
if (data[key].docstatus == 1 && index < 50) {
|
||||||
index++
|
index++
|
||||||
data[key].docstatus = 0;
|
data[key].docstatus = 0;
|
||||||
@@ -1656,7 +1682,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
this.new_si_docs = [];
|
this.new_si_docs = [];
|
||||||
if (this.removed_items) {
|
if (this.removed_items) {
|
||||||
$.each(this.si_docs, function (index, data) {
|
$.each(this.si_docs, function (index, data) {
|
||||||
for (key in data) {
|
for (var key in data) {
|
||||||
if (!in_list(me.removed_items, key)) {
|
if (!in_list(me.removed_items, key)) {
|
||||||
me.new_si_docs.push(data);
|
me.new_si_docs.push(data);
|
||||||
}
|
}
|
||||||
@@ -1715,8 +1741,9 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
|
|
||||||
validate_serial_no: function () {
|
validate_serial_no: function () {
|
||||||
var me = this;
|
var me = this;
|
||||||
var item_code = serial_no = '';
|
var item_code = ''
|
||||||
for (key in this.item_serial_no) {
|
var serial_no = '';
|
||||||
|
for (var key in this.item_serial_no) {
|
||||||
item_code = key;
|
item_code = key;
|
||||||
serial_no = me.item_serial_no[key][0];
|
serial_no = me.item_serial_no[key][0];
|
||||||
}
|
}
|
||||||
@@ -1763,20 +1790,24 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
mandatory_batch_no: function () {
|
mandatory_batch_no: function () {
|
||||||
var me = this;
|
var me = this;
|
||||||
if (this.items[0].has_batch_no && !this.item_batch_no[this.items[0].item_code]) {
|
if (this.items[0].has_batch_no && !this.item_batch_no[this.items[0].item_code]) {
|
||||||
frappe.prompt([
|
frappe.prompt([{
|
||||||
{'fieldname': 'batch', 'fieldtype': 'Select', 'label': __('Batch No'), 'reqd': 1, 'options':this.batch_no_data[this.items[0].item_code]}
|
'fieldname': 'batch',
|
||||||
],
|
'fieldtype': 'Select',
|
||||||
function(values){
|
'label': __('Batch No'),
|
||||||
me.item_batch_no[me.items[0].item_code] = values.batch;
|
'reqd': 1,
|
||||||
},
|
'options': this.batch_no_data[this.items[0].item_code]
|
||||||
__('Select Batch No'))
|
}],
|
||||||
}
|
function(values){
|
||||||
|
me.item_batch_no[me.items[0].item_code] = values.batch;
|
||||||
|
},
|
||||||
|
__('Select Batch No'))
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
apply_pricing_rule: function () {
|
apply_pricing_rule: function () {
|
||||||
var me = this;
|
var me = this;
|
||||||
$.each(this.frm.doc["items"], function (n, item) {
|
$.each(this.frm.doc["items"], function (n, item) {
|
||||||
pricing_rule = me.get_pricing_rule(item)
|
var pricing_rule = me.get_pricing_rule(item)
|
||||||
me.validate_pricing_rule(pricing_rule)
|
me.validate_pricing_rule(pricing_rule)
|
||||||
if (pricing_rule.length) {
|
if (pricing_rule.length) {
|
||||||
item.pricing_rule = pricing_rule[0].name;
|
item.pricing_rule = pricing_rule[0].name;
|
||||||
@@ -1836,7 +1867,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
|
|
||||||
validate_condition: function (data) {
|
validate_condition: function (data) {
|
||||||
//This method check condition based on applicable for
|
//This method check condition based on applicable for
|
||||||
condition = this.get_mapper_for_pricing_rule(data)[data.applicable_for]
|
var condition = this.get_mapper_for_pricing_rule(data)[data.applicable_for]
|
||||||
if (in_list(condition[1], condition[0])) {
|
if (in_list(condition[1], condition[0])) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@@ -1869,7 +1900,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
count = 0
|
var count = 0
|
||||||
$.each(priority_list, function (index, value) {
|
$.each(priority_list, function (index, value) {
|
||||||
if (value == priority) {
|
if (value == priority) {
|
||||||
count++
|
count++
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import datetime
|
|||||||
from frappe import _, msgprint, scrub
|
from frappe import _, msgprint, scrub
|
||||||
from frappe.defaults import get_user_permissions
|
from frappe.defaults import get_user_permissions
|
||||||
from frappe.utils import add_days, getdate, formatdate, get_first_day, date_diff, \
|
from frappe.utils import add_days, getdate, formatdate, get_first_day, date_diff, \
|
||||||
add_years, get_timestamp, nowdate
|
add_years, get_timestamp, nowdate, flt
|
||||||
from frappe.geo.doctype.address.address import get_address_display, get_default_address
|
from frappe.geo.doctype.address.address import get_address_display, get_default_address
|
||||||
from frappe.email.doctype.contact.contact import get_contact_details, get_default_contact
|
from frappe.email.doctype.contact.contact import get_contact_details, get_default_contact
|
||||||
from erpnext.exceptions import PartyFrozen, InvalidCurrency, PartyDisabled, InvalidAccountCurrency
|
from erpnext.exceptions import PartyFrozen, InvalidCurrency, PartyDisabled, InvalidAccountCurrency
|
||||||
@@ -366,8 +366,10 @@ def get_timeline_data(doctype, name):
|
|||||||
|
|
||||||
def get_dashboard_info(party_type, party):
|
def get_dashboard_info(party_type, party):
|
||||||
current_fiscal_year = get_fiscal_year(nowdate(), as_dict=True)
|
current_fiscal_year = get_fiscal_year(nowdate(), as_dict=True)
|
||||||
party_account_currency = get_party_account_currency(party_type, party, frappe.db.get_default("company"))
|
company = frappe.db.get_default("company") or frappe.get_all("Company")[0].name
|
||||||
company_default_currency = get_default_currency()
|
party_account_currency = get_party_account_currency(party_type, party, company)
|
||||||
|
company_default_currency = get_default_currency() \
|
||||||
|
or frappe.db.get_value('Company', company, 'default_currency')
|
||||||
|
|
||||||
if party_account_currency==company_default_currency:
|
if party_account_currency==company_default_currency:
|
||||||
total_field = "base_grand_total"
|
total_field = "base_grand_total"
|
||||||
@@ -389,10 +391,10 @@ def get_dashboard_info(party_type, party):
|
|||||||
where party_type = %s and party=%s""", (party_type, party))
|
where party_type = %s and party=%s""", (party_type, party))
|
||||||
|
|
||||||
info = {}
|
info = {}
|
||||||
info["billing_this_year"] = billing_this_year[0][0] if billing_this_year else 0
|
info["billing_this_year"] = flt(billing_this_year[0][0]) if billing_this_year else 0
|
||||||
info["currency"] = party_account_currency
|
info["currency"] = party_account_currency
|
||||||
info["total_unpaid"] = total_unpaid[0][0] if total_unpaid else 0
|
info["total_unpaid"] = flt(total_unpaid[0][0]) if total_unpaid else 0
|
||||||
if party_type == "Supplier":
|
if party_type == "Supplier":
|
||||||
info["total_unpaid"] = -1 * info["total_unpaid"]
|
info["total_unpaid"] = -1 * info["total_unpaid"]
|
||||||
|
|
||||||
return info
|
return info
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"doctype": "Print Format",
|
"doctype": "Print Format",
|
||||||
"font": "Default",
|
"font": "Default",
|
||||||
"html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ company }}<br>\n\t{{ __(\"POS No : \") }} {{ offline_pos_name }}<br>\n</p>\n<p>\n\t<b>{{ __(\"Date\") }}:</b> {{ dateutil.global_date_format(posting_date) }}<br>\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"50%\">{{ __(\"Item\") }}</b></th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ __(\"Qty\") }}</th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ __(\"Amount\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{% for item in items %}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_name }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ format_number(item.qty, null,precision(\"difference\")) }}<br>@ {{ format_currency(item.rate, currency) }}</td>\n\t\t\t<td class=\"text-right\">{{ format_currency(item.amount, currency) }}</td>\n\t\t</tr>\n\t\t{% endfor %}\n\t</tbody>\n</table>\n\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ __(\"Net Total\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(total, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% for row in taxes %}\n\t\t{% if not row.included_in_print_rate %}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ row.description }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(row.tax_amount, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% endif %}\n\t\t{% endfor %}\n\t\t{% if discount_amount %}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t{{ __(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(discount_amount, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% endif %}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ __(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(grand_total, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ __(\"Paid Amount\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(paid_amount, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t</tbody>\n</table>\n\n\n<hr>\n<p>{{ terms }}</p>\n<p class=\"text-center\">{{ __(\"Thank you, please visit again.\") }}</p>",
|
"html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ company }}<br>\n\t{{ __(\"POS No : \") }} {{ offline_pos_name }}<br>\n</p>\n<p>\n\t<b>{{ __(\"Customer\") }}:</b> {{ customer }}<br>\n</p>\n\n<p>\n\t<b>{{ __(\"Date\") }}:</b> {{ dateutil.global_date_format(posting_date) }}<br>\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"50%\">{{ __(\"Item\") }}</b></th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ __(\"Qty\") }}</th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ __(\"Amount\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{% for item in items %}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_name }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ format_number(item.qty, null,precision(\"difference\")) }}<br>@ {{ format_currency(item.rate, currency) }}</td>\n\t\t\t<td class=\"text-right\">{{ format_currency(item.amount, currency) }}</td>\n\t\t</tr>\n\t\t{% endfor %}\n\t</tbody>\n</table>\n\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ __(\"Net Total\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(total, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% for row in taxes %}\n\t\t{% if not row.included_in_print_rate %}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ row.description }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(row.tax_amount, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% endif %}\n\t\t{% endfor %}\n\t\t{% if discount_amount %}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t{{ __(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(discount_amount, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% endif %}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ __(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(grand_total, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ __(\"Paid Amount\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(paid_amount, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t</tbody>\n</table>\n\n\n<hr>\n<p>{{ terms }}</p>\n<p class=\"text-center\">{{ __(\"Thank you, please visit again.\") }}</p>",
|
||||||
"idx": 0,
|
"idx": 0,
|
||||||
"line_breaks": 0,
|
"line_breaks": 0,
|
||||||
"modified": "2017-04-19 13:28:05.129504",
|
"modified": "2017-05-19 14:36:04.740728",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Point of Sale",
|
"name": "Point of Sale",
|
||||||
|
|||||||
@@ -20,13 +20,13 @@ frappe.query_reports["Accounts Payable"] = {
|
|||||||
"fieldname":"report_date",
|
"fieldname":"report_date",
|
||||||
"label": __("As on Date"),
|
"label": __("As on Date"),
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"default": get_today()
|
"default": frappe.datetime.get_today()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname":"ageing_based_on",
|
"fieldname":"ageing_based_on",
|
||||||
"label": __("Ageing Based On"),
|
"label": __("Ageing Based On"),
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"options": 'Posting Date' + NEWLINE + 'Due Date',
|
"options": 'Posting Date\nDue Date',
|
||||||
"default": "Posting Date"
|
"default": "Posting Date"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,13 +20,13 @@ frappe.query_reports["Accounts Payable Summary"] = {
|
|||||||
"fieldname":"report_date",
|
"fieldname":"report_date",
|
||||||
"label": __("Date"),
|
"label": __("Date"),
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"default": get_today()
|
"default": frappe.datetime.get_today()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname":"ageing_based_on",
|
"fieldname":"ageing_based_on",
|
||||||
"label": __("Ageing Based On"),
|
"label": __("Ageing Based On"),
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"options": 'Posting Date' + NEWLINE + 'Due Date',
|
"options": 'Posting Date\nDue Date',
|
||||||
"default": "Posting Date"
|
"default": "Posting Date"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ frappe.query_reports["Accounts Receivable"] = {
|
|||||||
"fieldname":"credit_days_based_on",
|
"fieldname":"credit_days_based_on",
|
||||||
"label": __("Credit Days Based On"),
|
"label": __("Credit Days Based On"),
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"options": "" + NEWLINE + "Fixed Days" + NEWLINE + "Last Day of the Next Month"
|
"options": "\nFixed Days\nLast Day of the Next Month"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldtype": "Break",
|
"fieldtype": "Break",
|
||||||
@@ -35,13 +35,13 @@ frappe.query_reports["Accounts Receivable"] = {
|
|||||||
"fieldname":"report_date",
|
"fieldname":"report_date",
|
||||||
"label": __("As on Date"),
|
"label": __("As on Date"),
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"default": get_today()
|
"default": frappe.datetime.get_today()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname":"ageing_based_on",
|
"fieldname":"ageing_based_on",
|
||||||
"label": __("Ageing Based On"),
|
"label": __("Ageing Based On"),
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"options": 'Posting Date' + NEWLINE + 'Due Date',
|
"options": 'Posting Date\nDue Date',
|
||||||
"default": "Posting Date"
|
"default": "Posting Date"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,7 +33,9 @@ class ReceivablePayableReport(object):
|
|||||||
if args.get("party_type") == "Supplier":
|
if args.get("party_type") == "Supplier":
|
||||||
columns += [_("Bill No") + "::80", _("Bill Date") + ":Date:80"]
|
columns += [_("Bill No") + "::80", _("Bill Date") + ":Date:80"]
|
||||||
|
|
||||||
for label in ("Invoiced Amount", "Paid Amount", "Outstanding Amount"):
|
credit_or_debit_note = "Credit Note" if args.get("party_type") == "Customer" else "Debit Note"
|
||||||
|
|
||||||
|
for label in ("Invoiced Amount", "Paid Amount", credit_or_debit_note, "Outstanding Amount"):
|
||||||
columns.append({
|
columns.append({
|
||||||
"label": label,
|
"label": label,
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
@@ -95,13 +97,14 @@ class ReceivablePayableReport(object):
|
|||||||
self.filters["company"] = frappe.db.get_single_value('Global Defaults', 'default_company')
|
self.filters["company"] = frappe.db.get_single_value('Global Defaults', 'default_company')
|
||||||
|
|
||||||
company_currency = frappe.db.get_value("Company", self.filters.get("company"), "default_currency")
|
company_currency = frappe.db.get_value("Company", self.filters.get("company"), "default_currency")
|
||||||
|
|
||||||
|
return_entries = self.get_return_entries(args.get("party_type"))
|
||||||
|
|
||||||
data = []
|
data = []
|
||||||
for gle in self.get_entries_till(self.filters.report_date, args.get("party_type")):
|
for gle in self.get_entries_till(self.filters.report_date, args.get("party_type")):
|
||||||
if self.is_receivable_or_payable(gle, dr_or_cr, future_vouchers):
|
if self.is_receivable_or_payable(gle, dr_or_cr, future_vouchers):
|
||||||
outstanding_amount = flt(self.get_outstanding_amount(gle,
|
outstanding_amount, credit_note_amount = self.get_outstanding_amount(gle,
|
||||||
self.filters.report_date, dr_or_cr), currency_precision)
|
self.filters.report_date, dr_or_cr, return_entries, currency_precision)
|
||||||
|
|
||||||
if abs(outstanding_amount) > 0.1/10**currency_precision:
|
if abs(outstanding_amount) > 0.1/10**currency_precision:
|
||||||
row = [gle.posting_date, gle.party]
|
row = [gle.posting_date, gle.party]
|
||||||
|
|
||||||
@@ -123,8 +126,8 @@ class ReceivablePayableReport(object):
|
|||||||
|
|
||||||
# invoiced and paid amounts
|
# invoiced and paid amounts
|
||||||
invoiced_amount = gle.get(dr_or_cr) if (gle.get(dr_or_cr) > 0) else 0
|
invoiced_amount = gle.get(dr_or_cr) if (gle.get(dr_or_cr) > 0) else 0
|
||||||
paid_amt = invoiced_amount - outstanding_amount
|
paid_amt = invoiced_amount - outstanding_amount - credit_note_amount
|
||||||
row += [invoiced_amount, paid_amt, outstanding_amount]
|
row += [invoiced_amount, paid_amt, credit_note_amount, outstanding_amount]
|
||||||
|
|
||||||
# ageing data
|
# ageing data
|
||||||
entry_date = due_date if self.filters.ageing_based_on == "Due Date" else gle.posting_date
|
entry_date = due_date if self.filters.ageing_based_on == "Due Date" else gle.posting_date
|
||||||
@@ -132,7 +135,8 @@ class ReceivablePayableReport(object):
|
|||||||
cint(self.filters.range3), self.age_as_on, entry_date, outstanding_amount)
|
cint(self.filters.range3), self.age_as_on, entry_date, outstanding_amount)
|
||||||
|
|
||||||
# issue 6371-Ageing buckets should not have amounts if due date is not reached
|
# issue 6371-Ageing buckets should not have amounts if due date is not reached
|
||||||
if self.filters.ageing_based_on == "Due Date" and getdate(due_date) > getdate(self.filters.report_date):
|
if self.filters.ageing_based_on == "Due Date" \
|
||||||
|
and getdate(due_date) > getdate(self.filters.report_date):
|
||||||
row[-1]=row[-2]=row[-3]=row[-4]=0
|
row[-1]=row[-2]=row[-3]=row[-4]=0
|
||||||
|
|
||||||
if self.filters.get(scrub(args.get("party_type"))):
|
if self.filters.get(scrub(args.get("party_type"))):
|
||||||
@@ -175,14 +179,28 @@ class ReceivablePayableReport(object):
|
|||||||
# entries adjusted with future vouchers
|
# entries adjusted with future vouchers
|
||||||
((gle.against_voucher_type, gle.against_voucher) in future_vouchers)
|
((gle.against_voucher_type, gle.against_voucher) in future_vouchers)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def get_return_entries(self, party_type):
|
||||||
|
doctype = "Sales Invoice" if party_type=="Customer" else "Purchase Invoice"
|
||||||
|
return [d.name for d in frappe.get_all(doctype, filters={"is_return": 1, "docstatus": 1})]
|
||||||
|
|
||||||
def get_outstanding_amount(self, gle, report_date, dr_or_cr):
|
def get_outstanding_amount(self, gle, report_date, dr_or_cr, return_entries, currency_precision):
|
||||||
payment_amount = 0.0
|
payment_amount, credit_note_amount = 0.0, 0.0
|
||||||
|
reverse_dr_or_cr = "credit" if dr_or_cr=="debit" else "debit"
|
||||||
|
|
||||||
for e in self.get_gl_entries_for(gle.party, gle.party_type, gle.voucher_type, gle.voucher_no):
|
for e in self.get_gl_entries_for(gle.party, gle.party_type, gle.voucher_type, gle.voucher_no):
|
||||||
if getdate(e.posting_date) <= report_date and e.name!=gle.name:
|
if getdate(e.posting_date) <= report_date and e.name!=gle.name:
|
||||||
payment_amount += (flt(e.credit if gle.party_type == "Customer" else e.debit) - flt(e.get(dr_or_cr)))
|
amount = flt(e.get(reverse_dr_or_cr)) - flt(e.get(dr_or_cr))
|
||||||
|
if e.voucher_no not in return_entries:
|
||||||
return flt(gle.get(dr_or_cr)) - flt(gle.credit if gle.party_type == "Customer" else gle.debit) - payment_amount
|
payment_amount += amount
|
||||||
|
else:
|
||||||
|
credit_note_amount += amount
|
||||||
|
|
||||||
|
outstanding_amount = flt((flt(gle.get(dr_or_cr)) - flt(gle.get(reverse_dr_or_cr)) \
|
||||||
|
- payment_amount - credit_note_amount), currency_precision)
|
||||||
|
credit_note_amount = flt(credit_note_amount, currency_precision)
|
||||||
|
|
||||||
|
return outstanding_amount, credit_note_amount
|
||||||
|
|
||||||
def get_party_name(self, party_type, party_name):
|
def get_party_name(self, party_type, party_name):
|
||||||
return self.get_party_map(party_type).get(party_name, {}).get("customer_name" if party_type == "Customer" else "supplier_name") or ""
|
return self.get_party_map(party_type).get(party_name, {}).get("customer_name" if party_type == "Customer" else "supplier_name") or ""
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ frappe.query_reports["Accounts Receivable Summary"] = {
|
|||||||
"fieldname":"credit_days_based_on",
|
"fieldname":"credit_days_based_on",
|
||||||
"label": __("Credit Days Based On"),
|
"label": __("Credit Days Based On"),
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"options": "" + NEWLINE + "Fixed Days" + NEWLINE + "Last Day of the Next Month"
|
"options": "\nFixed Days\nLast Day of the Next Month"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldtype": "Break",
|
"fieldtype": "Break",
|
||||||
@@ -35,13 +35,13 @@ frappe.query_reports["Accounts Receivable Summary"] = {
|
|||||||
"fieldname":"report_date",
|
"fieldname":"report_date",
|
||||||
"label": __("Date"),
|
"label": __("Date"),
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"default": get_today()
|
"default": frappe.datetime.get_today()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname":"ageing_based_on",
|
"fieldname":"ageing_based_on",
|
||||||
"label": __("Ageing Based On"),
|
"label": __("Ageing Based On"),
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"options": 'Posting Date' + NEWLINE + 'Due Date',
|
"options": 'Posting Date\nDue Date',
|
||||||
"default": "Posting Date"
|
"default": "Posting Date"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -70,7 +70,7 @@ frappe.query_reports["Accounts Receivable Summary"] = {
|
|||||||
onload: function(report) {
|
onload: function(report) {
|
||||||
report.page.add_inner_button(__("Accounts Receivable"), function() {
|
report.page.add_inner_button(__("Accounts Receivable"), function() {
|
||||||
var filters = report.get_values();
|
var filters = report.get_values();
|
||||||
frappe.set_route('query-report', 'Accounts Receivable', {company: filters.company});
|
frappe.set_route('query-report', 'Accounts Receivable', { company: filters.company });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ frappe.query_reports["Bank Clearance Summary"] = {
|
|||||||
"fieldname":"to_date",
|
"fieldname":"to_date",
|
||||||
"label": __("To Date"),
|
"label": __("To Date"),
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"default": get_today()
|
"default": frappe.datetime.get_today()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname":"account",
|
"fieldname":"account",
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ frappe.query_reports["Bank Reconciliation Statement"] = {
|
|||||||
"fieldname":"report_date",
|
"fieldname":"report_date",
|
||||||
"label": __("Date"),
|
"label": __("Date"),
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"default": get_today(),
|
"default": frappe.datetime.get_today(),
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ frappe.query_reports["Budget Variance Report"] = {
|
|||||||
label: __("Fiscal Year"),
|
label: __("Fiscal Year"),
|
||||||
fieldtype: "Link",
|
fieldtype: "Link",
|
||||||
options: "Fiscal Year",
|
options: "Fiscal Year",
|
||||||
default: sys_defaults.fiscal_year,
|
default: frappe.sys_defaults.fiscal_year,
|
||||||
reqd: 1
|
reqd: 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ frappe.query_reports["Item-wise Purchase Register"] = {
|
|||||||
"fieldname":"to_date",
|
"fieldname":"to_date",
|
||||||
"label": __("To Date"),
|
"label": __("To Date"),
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"default": get_today()
|
"default": frappe.datetime.get_today()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "item_code",
|
"fieldname": "item_code",
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ frappe.query_reports["Item-wise Sales Register"] = frappe.query_reports["Sales R
|
|||||||
"fieldname":"to_date",
|
"fieldname":"to_date",
|
||||||
"label": __("To Date"),
|
"label": __("To Date"),
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"default": get_today()
|
"default": frappe.datetime.get_today()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname":"customer",
|
"fieldname":"customer",
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ frappe.query_reports["Payment Period Based On Invoice Date"] = {
|
|||||||
fieldname:"to_date",
|
fieldname:"to_date",
|
||||||
label: __("To Date"),
|
label: __("To Date"),
|
||||||
fieldtype: "Date",
|
fieldtype: "Date",
|
||||||
default: get_today()
|
default: frappe.datetime.get_today()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldname:"payment_type",
|
fieldname:"payment_type",
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
|
|
||||||
frappe.require("assets/erpnext/js/purchase_trends_filters.js", function() {
|
frappe.require("assets/erpnext/js/purchase_trends_filters.js", function() {
|
||||||
frappe.query_reports["Purchase Invoice Trends"] = {
|
frappe.query_reports["Purchase Invoice Trends"] = {
|
||||||
filters: get_filters()
|
filters: erpnext.get_purchase_trends_filters()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -14,7 +14,7 @@ frappe.query_reports["Purchase Register"] = {
|
|||||||
"fieldname":"to_date",
|
"fieldname":"to_date",
|
||||||
"label": __("To Date"),
|
"label": __("To Date"),
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"default": get_today()
|
"default": frappe.datetime.get_today()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname":"supplier",
|
"fieldname":"supplier",
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
|
|
||||||
frappe.require("assets/erpnext/js/sales_trends_filters.js", function() {
|
frappe.require("assets/erpnext/js/sales_trends_filters.js", function() {
|
||||||
frappe.query_reports["Sales Invoice Trends"] = {
|
frappe.query_reports["Sales Invoice Trends"] = {
|
||||||
filters: get_filters()
|
filters: erpnext.get_sales_trends_filters()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -14,7 +14,7 @@ frappe.query_reports["Sales Register"] = {
|
|||||||
"fieldname":"to_date",
|
"fieldname":"to_date",
|
||||||
"label": __("To Date"),
|
"label": __("To Date"),
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"default": get_today()
|
"default": frappe.datetime.get_today()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname":"customer",
|
"fieldname":"customer",
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
|
|||||||
|
|
||||||
if(is_drop_ship && doc.status!="Delivered"){
|
if(is_drop_ship && doc.status!="Delivered"){
|
||||||
cur_frm.add_custom_button(__('Delivered'),
|
cur_frm.add_custom_button(__('Delivered'),
|
||||||
this.delivered_by_supplier, __("Status"));
|
this.delivered_by_supplier, __("Status"));
|
||||||
|
|
||||||
cur_frm.page.set_inner_btn_group_as_primary(__("Status"));
|
cur_frm.page.set_inner_btn_group_as_primary(__("Status"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,34 +1,34 @@
|
|||||||
frappe.listview_settings['Purchase Order'] = {
|
frappe.listview_settings['Purchase Order'] = {
|
||||||
add_fields: ["base_grand_total", "company", "currency", "supplier",
|
add_fields: ["base_grand_total", "company", "currency", "supplier",
|
||||||
"supplier_name", "per_received", "per_billed", "status"],
|
"supplier_name", "per_received", "per_billed", "status"],
|
||||||
get_indicator: function(doc) {
|
get_indicator: function (doc) {
|
||||||
if(doc.status==="Closed"){
|
if (doc.status === "Closed") {
|
||||||
return [__("Closed"), "green", "status,=,Closed"];
|
return [__("Closed"), "green", "status,=,Closed"];
|
||||||
} else if (doc.status==="Delivered") {
|
} else if (doc.status === "Delivered") {
|
||||||
return [__("Delivered"), "green", "status,=,Closed"];
|
return [__("Delivered"), "green", "status,=,Closed"];
|
||||||
}else if(flt(doc.per_received, 2) < 100 && doc.status!=="Closed") {
|
} else if (flt(doc.per_received, 2) < 100 && doc.status !== "Closed") {
|
||||||
if(flt(doc.per_billed, 2) < 100) {
|
if (flt(doc.per_billed, 2) < 100) {
|
||||||
return [__("To Receive and Bill"), "orange",
|
return [__("To Receive and Bill"), "orange",
|
||||||
"per_received,<,100|per_billed,<,100|status,!=,Closed"];
|
"per_received,<,100|per_billed,<,100|status,!=,Closed"];
|
||||||
} else {
|
} else {
|
||||||
return [__("To Receive"), "orange",
|
return [__("To Receive"), "orange",
|
||||||
"per_received,<,100|per_billed,=,100|status,!=,Closed"];
|
"per_received,<,100|per_billed,=,100|status,!=,Closed"];
|
||||||
}
|
}
|
||||||
} else if(flt(doc.per_received, 2) == 100 && flt(doc.per_billed, 2) < 100 && doc.status!=="Closed") {
|
} else if (flt(doc.per_received, 2) == 100 && flt(doc.per_billed, 2) < 100 && doc.status !== "Closed") {
|
||||||
return [__("To Bill"), "orange", "per_received,=,100|per_billed,<,100|status,!=,Closed"];
|
return [__("To Bill"), "orange", "per_received,=,100|per_billed,<,100|status,!=,Closed"];
|
||||||
} else if(flt(doc.per_received, 2) == 100 && flt(doc.per_billed, 2) == 100 && doc.status!=="Closed") {
|
} else if (flt(doc.per_received, 2) == 100 && flt(doc.per_billed, 2) == 100 && doc.status !== "Closed") {
|
||||||
return [__("Completed"), "green", "per_received,=,100|per_billed,=,100|status,!=,Closed"];
|
return [__("Completed"), "green", "per_received,=,100|per_billed,=,100|status,!=,Closed"];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onload: function(listview) {
|
onload: function (listview) {
|
||||||
var method = "erpnext.buying.doctype.purchase_order.purchase_order.close_or_unclose_purchase_orders";
|
var method = "erpnext.buying.doctype.purchase_order.purchase_order.close_or_unclose_purchase_orders";
|
||||||
|
|
||||||
listview.page.add_menu_item(__("Close"), function() {
|
listview.page.add_menu_item(__("Close"), function () {
|
||||||
listview.call_for_selected_items(method, {"status": "Closed"});
|
listview.call_for_selected_items(method, { "status": "Closed" });
|
||||||
});
|
});
|
||||||
|
|
||||||
listview.page.add_menu_item(__("Re-open"), function() {
|
listview.page.add_menu_item(__("Re-open"), function () {
|
||||||
listview.call_for_selected_items(method, {"status": "Submitted"});
|
listview.call_for_selected_items(method, { "status": "Submitted" });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -56,17 +56,17 @@ frappe.ui.form.on("Request for Quotation",{
|
|||||||
var dialog = new frappe.ui.Dialog({
|
var dialog = new frappe.ui.Dialog({
|
||||||
title: __("For Supplier"),
|
title: __("For Supplier"),
|
||||||
fields: [
|
fields: [
|
||||||
{"fieldtype": "Select", "label": __("Supplier"),
|
{ "fieldtype": "Select", "label": __("Supplier"),
|
||||||
"fieldname": "supplier", "options":"Supplier",
|
"fieldname": "supplier",
|
||||||
"options": $.map(doc.suppliers,
|
"options": doc.suppliers.map(d => d.supplier),
|
||||||
function(d) { return d.supplier }), "reqd": 1 },
|
"reqd": 1 },
|
||||||
{"fieldtype": "Button", "label": __("Make Supplier Quotation"),
|
{ "fieldtype": "Button", "label": __("Make Supplier Quotation"),
|
||||||
"fieldname": "make_supplier_quotation", "cssClass": "btn-primary"},
|
"fieldname": "make_supplier_quotation", "cssClass": "btn-primary" },
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
dialog.fields_dict.make_supplier_quotation.$input.click(function() {
|
dialog.fields_dict.make_supplier_quotation.$input.click(function() {
|
||||||
args = dialog.get_values();
|
var args = dialog.get_values();
|
||||||
if(!args) return;
|
if(!args) return;
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
return frappe.call({
|
return frappe.call({
|
||||||
@@ -117,7 +117,7 @@ frappe.ui.form.on("Request for Quotation Supplier",{
|
|||||||
+"&supplier_idx="+encodeURIComponent(child.idx)
|
+"&supplier_idx="+encodeURIComponent(child.idx)
|
||||||
+"&no_letterhead=0"));
|
+"&no_letterhead=0"));
|
||||||
if(!w) {
|
if(!w) {
|
||||||
msgprint(__("Please enable pop-ups")); return;
|
frappe.msgprint(__("Please enable pop-ups")); return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -144,44 +144,44 @@ erpnext.buying.RequestforQuotationController = erpnext.buying.BuyingController.e
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}, __("Get items from"));
|
}, __("Get items from"));
|
||||||
// Get items from open Material Requests based on supplier
|
// Get items from open Material Requests based on supplier
|
||||||
this.frm.add_custom_button(__('Possible Supplier'), function() {
|
this.frm.add_custom_button(__('Possible Supplier'), function() {
|
||||||
// Create a dialog window for the user to pick their supplier
|
// Create a dialog window for the user to pick their supplier
|
||||||
var d = new frappe.ui.Dialog({
|
var d = new frappe.ui.Dialog({
|
||||||
title: __('Select Possible Supplier'),
|
title: __('Select Possible Supplier'),
|
||||||
fields: [
|
fields: [
|
||||||
{fieldname: 'supplier', fieldtype:'Link', options:'Supplier', label:'Supplier', reqd:1},
|
{fieldname: 'supplier', fieldtype:'Link', options:'Supplier', label:'Supplier', reqd:1},
|
||||||
{fieldname: 'ok_button', fieldtype:'Button', label:'Get Items from Material Requests'},
|
{fieldname: 'ok_button', fieldtype:'Button', label:'Get Items from Material Requests'},
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
// On the user clicking the ok button
|
// On the user clicking the ok button
|
||||||
d.fields_dict.ok_button.input.onclick = function() {
|
d.fields_dict.ok_button.input.onclick = function() {
|
||||||
var btn = d.fields_dict.ok_button.input;
|
var btn = d.fields_dict.ok_button.input;
|
||||||
var v = d.get_values();
|
var v = d.get_values();
|
||||||
if(v) {
|
if(v) {
|
||||||
$(btn).set_working();
|
$(btn).set_working();
|
||||||
|
|
||||||
erpnext.utils.map_current_doc({
|
erpnext.utils.map_current_doc({
|
||||||
method: "erpnext.buying.doctype.request_for_quotation.request_for_quotation.get_item_from_material_requests_based_on_supplier",
|
method: "erpnext.buying.doctype.request_for_quotation.request_for_quotation.get_item_from_material_requests_based_on_supplier",
|
||||||
source_name: v.supplier,
|
source_name: v.supplier,
|
||||||
target: me.frm,
|
target: me.frm,
|
||||||
setters: {
|
setters: {
|
||||||
company: me.frm.doc.company
|
company: me.frm.doc.company
|
||||||
},
|
},
|
||||||
get_query_filters: {
|
get_query_filters: {
|
||||||
material_request_type: "Purchase",
|
material_request_type: "Purchase",
|
||||||
docstatus: 1,
|
docstatus: 1,
|
||||||
status: ["!=", "Stopped"],
|
status: ["!=", "Stopped"],
|
||||||
per_ordered: ["<", 99.99]
|
per_ordered: ["<", 99.99]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$(btn).done_working();
|
$(btn).done_working();
|
||||||
d.hide();
|
d.hide();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
d.show();
|
}
|
||||||
}, __("Get items from"));
|
d.show();
|
||||||
|
}, __("Get items from"));
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
// 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", {
|
||||||
setup: function(frm) {
|
setup: function (frm) {
|
||||||
frm.set_query('default_price_list', { 'buying': 1});
|
frm.set_query('default_price_list', { 'buying': 1 });
|
||||||
frm.set_query('account', 'accounts', function(doc, cdt, cdn) {
|
frm.set_query('account', 'accounts', function (doc, cdt, cdn) {
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
return {
|
return {
|
||||||
filters: {
|
filters: {
|
||||||
'account_type': 'Payable',
|
'account_type': 'Payable',
|
||||||
@@ -15,30 +15,30 @@ frappe.ui.form.on("Supplier", {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
refresh: function(frm) {
|
refresh: function (frm) {
|
||||||
frappe.dynamic_link = {doc: frm.doc, fieldname: 'name', doctype: 'Supplier'}
|
frappe.dynamic_link = { doc: frm.doc, fieldname: 'name', doctype: 'Supplier' }
|
||||||
|
|
||||||
if(frappe.defaults.get_default("supp_master_name")!="Naming Series") {
|
if (frappe.defaults.get_default("supp_master_name") != "Naming Series") {
|
||||||
frm.toggle_display("naming_series", false);
|
frm.toggle_display("naming_series", false);
|
||||||
} else {
|
} else {
|
||||||
erpnext.toggle_naming_series();
|
erpnext.toggle_naming_series();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(frm.doc.__islocal){
|
if (frm.doc.__islocal) {
|
||||||
hide_field(['address_html','contact_html']);
|
hide_field(['address_html', 'contact_html']);
|
||||||
frappe.geo.clear_address_and_contact(frm);
|
frappe.geo.clear_address_and_contact(frm);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
unhide_field(['address_html','contact_html']);
|
unhide_field(['address_html', 'contact_html']);
|
||||||
frappe.geo.render_address_and_contact(frm);
|
frappe.geo.render_address_and_contact(frm);
|
||||||
|
|
||||||
// custom buttons
|
// custom buttons
|
||||||
frm.add_custom_button(__('Accounting Ledger'), function() {
|
frm.add_custom_button(__('Accounting Ledger'), function () {
|
||||||
frappe.set_route('query-report', 'General Ledger',
|
frappe.set_route('query-report', 'General Ledger',
|
||||||
{party_type:'Supplier', party:frm.doc.name});
|
{ party_type: 'Supplier', party: frm.doc.name });
|
||||||
});
|
});
|
||||||
frm.add_custom_button(__('Accounts Payable'), function() {
|
frm.add_custom_button(__('Accounts Payable'), function () {
|
||||||
frappe.set_route('query-report', 'Accounts Payable', {supplier:frm.doc.name});
|
frappe.set_route('query-report', 'Accounts Payable', { supplier: frm.doc.name });
|
||||||
});
|
});
|
||||||
|
|
||||||
// indicators
|
// indicators
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
{% include 'erpnext/public/js/controllers/buying.js' %};
|
{% include 'erpnext/public/js/controllers/buying.js' %};
|
||||||
|
|
||||||
frappe.ui.form.on('Suppier Quotation', {
|
frappe.ui.form.on('Suppier Quotation', {
|
||||||
setup: function() {
|
setup: function(frm) {
|
||||||
frm.custom_make_buttons = {
|
frm.custom_make_buttons = {
|
||||||
'Purchase Order': 'Purchase Order'
|
'Purchase Order': 'Purchase Order'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ frappe.pages['purchase-analytics'].on_page_load = function(wrapper) {
|
|||||||
|
|
||||||
new erpnext.PurchaseAnalytics(wrapper);
|
new erpnext.PurchaseAnalytics(wrapper);
|
||||||
|
|
||||||
|
|
||||||
frappe.breadcrumbs.add("Buying");
|
frappe.breadcrumbs.add("Buying");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -18,7 +17,6 @@ erpnext.PurchaseAnalytics = frappe.views.TreeGridReport.extend({
|
|||||||
init: function(wrapper) {
|
init: function(wrapper) {
|
||||||
this._super({
|
this._super({
|
||||||
title: __("Purchase Analytics"),
|
title: __("Purchase Analytics"),
|
||||||
page: wrapper,
|
|
||||||
parent: $(wrapper).find('.layout-main'),
|
parent: $(wrapper).find('.layout-main'),
|
||||||
page: wrapper.page,
|
page: wrapper.page,
|
||||||
doctypes: ["Item", "Item Group", "Supplier", "Supplier Type", "Company", "Fiscal Year",
|
doctypes: ["Item", "Item Group", "Supplier", "Supplier Type", "Company", "Fiscal Year",
|
||||||
@@ -193,13 +191,13 @@ erpnext.PurchaseAnalytics = frappe.views.TreeGridReport.extend({
|
|||||||
},
|
},
|
||||||
prepare_balances: function() {
|
prepare_balances: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
var from_date = dateutil.str_to_obj(this.from_date);
|
var from_date = frappe.datetime.str_to_obj(this.from_date);
|
||||||
var to_date = dateutil.str_to_obj(this.to_date);
|
var to_date = frappe.datetime.str_to_obj(this.to_date);
|
||||||
var is_val = this.value_or_qty == 'Value';
|
var is_val = this.value_or_qty == 'Value';
|
||||||
|
|
||||||
$.each(this.tl[this.based_on], function(i, tl) {
|
$.each(this.tl[this.based_on], function(i, tl) {
|
||||||
if (me.is_default('company') ? true : tl.company === me.company) {
|
if (me.is_default('company') ? true : tl.company === me.company) {
|
||||||
var posting_date = dateutil.str_to_obj(tl.posting_date);
|
var posting_date = frappe.datetime.str_to_obj(tl.posting_date);
|
||||||
if (posting_date >= from_date && posting_date <= to_date) {
|
if (posting_date >= from_date && posting_date <= to_date) {
|
||||||
var item = me.item_by_name[tl[me.tree_grid.item_key]] ||
|
var item = me.item_by_name[tl[me.tree_grid.item_key]] ||
|
||||||
me.item_by_name['Not Set'];
|
me.item_by_name['Not Set'];
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
|
|
||||||
frappe.require("assets/erpnext/js/purchase_trends_filters.js", function() {
|
frappe.require("assets/erpnext/js/purchase_trends_filters.js", function() {
|
||||||
frappe.query_reports["Purchase Order Trends"] = {
|
frappe.query_reports["Purchase Order Trends"] = {
|
||||||
filters: get_filters()
|
filters: erpnext.get_purchase_trends_filters()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -3,30 +3,26 @@
|
|||||||
|
|
||||||
frappe.query_reports["Quoted Item Comparison"] = {
|
frappe.query_reports["Quoted Item Comparison"] = {
|
||||||
"filters": [
|
"filters": [
|
||||||
{
|
{
|
||||||
"fieldname":"supplier_quotation",
|
"fieldname": "supplier_quotation",
|
||||||
"label": __("Supplier Quotation"),
|
"label": __("Supplier Quotation"),
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"options": "Supplier Quotation",
|
"options": "Supplier Quotation",
|
||||||
"default": "",
|
"default": "",
|
||||||
"get_query": function() {
|
"get_query": function () {
|
||||||
return {
|
return { filters: { "docstatus": ["<", 2] } }
|
||||||
filters: {"docstatus": ["<",2]}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
},{
|
"fieldname": "item",
|
||||||
"fieldname":"item",
|
"label": __("Item"),
|
||||||
"label": __("Item"),
|
"fieldtype": "Link",
|
||||||
"fieldtype": "Link",
|
"options": "Item",
|
||||||
"options": "Item",
|
"default": "",
|
||||||
"default": "",
|
"reqd": 1,
|
||||||
"reqd": 1,
|
"get_query": function () {
|
||||||
"get_query": function() {
|
|
||||||
var quote = frappe.query_report_filters_by_name.supplier_quotation.get_value();
|
var quote = frappe.query_report_filters_by_name.supplier_quotation.get_value();
|
||||||
if (quote != "")
|
if (quote != "") {
|
||||||
{
|
|
||||||
return {
|
return {
|
||||||
query: "erpnext.buying.doctype.quality_inspection.quality_inspection.item_query",
|
query: "erpnext.buying.doctype.quality_inspection.quality_inspection.item_query",
|
||||||
filters: {
|
filters: {
|
||||||
@@ -35,79 +31,74 @@ frappe.query_reports["Quoted Item Comparison"] = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
return{
|
return {
|
||||||
filters: {"disabled":0}
|
filters: { "disabled": 0 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
onload: function(report) {
|
onload: function (report) {
|
||||||
//Create a button for setting the default supplier
|
// Create a button for setting the default supplier
|
||||||
report.page.add_inner_button(__("Select Default Supplier"), function() {
|
report.page.add_inner_button(__("Select Default Supplier"), function () {
|
||||||
|
|
||||||
var reporter = frappe.query_reports["Quoted Item Comparison"];
|
var reporter = frappe.query_reports["Quoted Item Comparison"];
|
||||||
|
|
||||||
//Always make a new one so that the latest values get updated
|
//Always make a new one so that the latest values get updated
|
||||||
reporter.make_default_supplier_dialog(report);
|
reporter.make_default_supplier_dialog(report);
|
||||||
report.dialog.show();
|
report.dialog.show();
|
||||||
setTimeout(function() { report.dialog.input.focus(); }, 1000);
|
setTimeout(function () { report.dialog.input.focus(); }, 1000);
|
||||||
|
|
||||||
}, 'Tools');
|
}, 'Tools');
|
||||||
|
|
||||||
},
|
},
|
||||||
"make_default_supplier_dialog": function (report) {
|
"make_default_supplier_dialog": function (report) {
|
||||||
//Get the name of the item to change
|
// Get the name of the item to change
|
||||||
var filters = report.get_values();
|
var filters = report.get_values();
|
||||||
var item_code = filters.item;
|
var item_code = filters.item;
|
||||||
|
|
||||||
//Get a list of the suppliers (with a blank as well) for the user to select
|
// Get a list of the suppliers (with a blank as well) for the user to select
|
||||||
var select_options = "";
|
var select_options = "";
|
||||||
for (let supplier of report.data)
|
for (let supplier of report.data) {
|
||||||
{
|
select_options += supplier.supplier_name + '\n'
|
||||||
select_options += supplier.supplier_name+ '\n'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Create a dialog window for the user to pick their supplier
|
// Create a dialog window for the user to pick their supplier
|
||||||
var d = new frappe.ui.Dialog({
|
var d = new frappe.ui.Dialog({
|
||||||
title: __('Select Default Supplier'),
|
title: __('Select Default Supplier'),
|
||||||
fields: [
|
fields: [
|
||||||
{fieldname: 'supplier', fieldtype:'Select', label:'Supplier', reqd:1,options:select_options},
|
{ fieldname: 'supplier', fieldtype: 'Select', label: 'Supplier', reqd: 1, options: select_options },
|
||||||
{fieldname: 'ok_button', fieldtype:'Button', label:'Set Default Supplier'},
|
{ fieldname: 'ok_button', fieldtype: 'Button', label: 'Set Default Supplier' },
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
//On the user clicking the ok button
|
// On the user clicking the ok button
|
||||||
d.fields_dict.ok_button.input.onclick = function() {
|
d.fields_dict.ok_button.input.onclick = function () {
|
||||||
var btn = d.fields_dict.ok_button.input;
|
var btn = d.fields_dict.ok_button.input;
|
||||||
var v = report.dialog.get_values();
|
var v = report.dialog.get_values();
|
||||||
if(v) {
|
if (v) {
|
||||||
$(btn).set_working();
|
$(btn).set_working();
|
||||||
|
|
||||||
//Set the default_supplier field of the appropriate Item to the selected supplier
|
// Set the default_supplier field of the appropriate Item to the selected supplier
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "frappe.client.set_value",
|
method: "frappe.client.set_value",
|
||||||
args: {
|
args: {
|
||||||
doctype: "Item",
|
doctype: "Item",
|
||||||
name: item_code,
|
name: item_code,
|
||||||
fieldname: "default_supplier",
|
fieldname: "default_supplier",
|
||||||
value: v.supplier,
|
value: v.supplier,
|
||||||
},
|
},
|
||||||
callback: function (r){
|
callback: function (r) {
|
||||||
$(btn).done_working();
|
$(btn).done_working();
|
||||||
msgprint("Successfully Set Supplier");
|
frappe.msgprint("Successfully Set Supplier");
|
||||||
report.dialog.hide();
|
report.dialog.hide();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
report.dialog = d;
|
report.dialog = d;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ def get_data():
|
|||||||
"type": "report",
|
"type": "report",
|
||||||
"is_query_report": True,
|
"is_query_report": True,
|
||||||
"name": "Addresses And Contacts",
|
"name": "Addresses And Contacts",
|
||||||
"label": "Sales Partner Addresses And Contacts",
|
"label": _("Sales Partner Addresses And Contacts"),
|
||||||
"doctype": "Address",
|
"doctype": "Address",
|
||||||
"route_options": {
|
"route_options": {
|
||||||
"party_type": "Sales Partner"
|
"party_type": "Sales Partner"
|
||||||
@@ -226,7 +226,7 @@ def get_data():
|
|||||||
"type": "report",
|
"type": "report",
|
||||||
"is_query_report": True,
|
"is_query_report": True,
|
||||||
"name": "Addresses And Contacts",
|
"name": "Addresses And Contacts",
|
||||||
"label": "Customer Addresses And Contacts",
|
"label": _("Customer Addresses And Contacts"),
|
||||||
"doctype": "Address",
|
"doctype": "Address",
|
||||||
"route_options": {
|
"route_options": {
|
||||||
"party_type": "Customer"
|
"party_type": "Customer"
|
||||||
|
|||||||
@@ -144,7 +144,8 @@ def get_ref_item_dict(valid_items, ref_item_row):
|
|||||||
}))
|
}))
|
||||||
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
|
||||||
item_dict["rate"] = ref_item_row.get("rate", 0)
|
if ref_item_row.get("rate", 0) > item_dict["rate"]:
|
||||||
|
item_dict["rate"] = ref_item_row.get("rate", 0)
|
||||||
|
|
||||||
if ref_item_row.parenttype in ['Purchase Invoice', 'Purchase Receipt']:
|
if ref_item_row.parenttype in ['Purchase Invoice', 'Purchase Receipt']:
|
||||||
item_dict["received_qty"] += ref_item_row.received_qty
|
item_dict["received_qty"] += ref_item_row.received_qty
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ status_map = {
|
|||||||
["Converted", "has_customer"],
|
["Converted", "has_customer"],
|
||||||
],
|
],
|
||||||
"Opportunity": [
|
"Opportunity": [
|
||||||
["Quotation", "has_active_quotation"],
|
|
||||||
["Converted", "has_ordered_quotation"],
|
|
||||||
["Lost", "eval:self.status=='Lost'"],
|
["Lost", "eval:self.status=='Lost'"],
|
||||||
["Lost", "has_lost_quotation"],
|
["Lost", "has_lost_quotation"],
|
||||||
|
["Quotation", "has_active_quotation"],
|
||||||
|
["Converted", "has_ordered_quotation"],
|
||||||
["Closed", "eval:self.status=='Closed'"]
|
["Closed", "eval:self.status=='Closed'"]
|
||||||
],
|
],
|
||||||
"Quotation": [
|
"Quotation": [
|
||||||
@@ -85,6 +85,16 @@ status_map = {
|
|||||||
["Completed", "eval:self.per_billed == 100 and self.docstatus == 1"],
|
["Completed", "eval:self.per_billed == 100 and self.docstatus == 1"],
|
||||||
["Cancelled", "eval:self.docstatus==2"],
|
["Cancelled", "eval:self.docstatus==2"],
|
||||||
["Closed", "eval:self.status=='Closed'"],
|
["Closed", "eval:self.status=='Closed'"],
|
||||||
|
],
|
||||||
|
"Material Request": [
|
||||||
|
["Draft", None],
|
||||||
|
["Stopped", "eval:self.status == 'Stopped'"],
|
||||||
|
["Cancelled", "eval:self.docstatus == 2"],
|
||||||
|
["Pending", "eval:self.status != 'Stopped' and self.per_ordered == 0 and self.docstatus == 1"],
|
||||||
|
["Partially Ordered", "eval:self.status != 'Stopped' and self.per_ordered < 100 and self.per_ordered > 0 and self.docstatus == 1"],
|
||||||
|
["Ordered", "eval:self.status != 'Stopped' and self.per_ordered == 100 and self.docstatus == 1 and self.material_request_type == 'Purchase'"],
|
||||||
|
["Transferred", "eval:self.status != 'Stopped' and self.per_ordered == 100 and self.docstatus == 1 and self.material_request_type == 'Material Transfer'"],
|
||||||
|
["Issued", "eval:self.status != 'Stopped' and self.per_ordered == 100 and self.docstatus == 1 and self.material_request_type == 'Material Issue'"]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +137,8 @@ class StatusUpdater(Document):
|
|||||||
self.status = s[0]
|
self.status = s[0]
|
||||||
break
|
break
|
||||||
|
|
||||||
if self.status != _status and self.status not in ("Submitted", "Cancelled"):
|
if self.status != _status and self.status not in ("Cancelled", "Partially Ordered",
|
||||||
|
"Ordered", "Issued", "Transferred"):
|
||||||
self.add_comment("Label", _(self.status))
|
self.add_comment("Label", _(self.status))
|
||||||
|
|
||||||
if update:
|
if update:
|
||||||
|
|||||||
@@ -440,16 +440,16 @@ class calculate_taxes_and_totals(object):
|
|||||||
self.doc.conversion_rate, self.doc.precision("grand_total")) - self.doc.total_advance
|
self.doc.conversion_rate, self.doc.precision("grand_total")) - self.doc.total_advance
|
||||||
- flt(self.doc.base_write_off_amount), self.doc.precision("grand_total"))
|
- flt(self.doc.base_write_off_amount), self.doc.precision("grand_total"))
|
||||||
|
|
||||||
if self.doc.doctype == "Sales Invoice":
|
if self.doc.doctype == "Sales Invoice":
|
||||||
self.doc.round_floats_in(self.doc, ["paid_amount"])
|
self.doc.round_floats_in(self.doc, ["paid_amount"])
|
||||||
paid_amount = self.doc.paid_amount \
|
|
||||||
if self.doc.party_account_currency == self.doc.currency else self.doc.base_paid_amount
|
|
||||||
|
|
||||||
change_amount = self.doc.change_amount \
|
|
||||||
if self.doc.party_account_currency == self.doc.currency else self.doc.base_change_amount
|
|
||||||
|
|
||||||
self.calculate_write_off_amount()
|
self.calculate_write_off_amount()
|
||||||
self.calculate_change_amount()
|
self.calculate_change_amount()
|
||||||
|
|
||||||
|
paid_amount = self.doc.paid_amount \
|
||||||
|
if self.doc.party_account_currency == self.doc.currency else self.doc.base_paid_amount
|
||||||
|
|
||||||
|
change_amount = self.doc.change_amount \
|
||||||
|
if self.doc.party_account_currency == self.doc.currency else self.doc.base_change_amount
|
||||||
|
|
||||||
self.doc.outstanding_amount = flt(total_amount_to_pay - flt(paid_amount) +
|
self.doc.outstanding_amount = flt(total_amount_to_pay - flt(paid_amount) +
|
||||||
flt(change_amount), self.doc.precision("outstanding_amount"))
|
flt(change_amount), self.doc.precision("outstanding_amount"))
|
||||||
@@ -462,7 +462,8 @@ class calculate_taxes_and_totals(object):
|
|||||||
|
|
||||||
if self.doc.is_pos:
|
if self.doc.is_pos:
|
||||||
for payment in self.doc.get('payments'):
|
for payment in self.doc.get('payments'):
|
||||||
payment.base_amount = flt(payment.amount * self.doc.conversion_rate)
|
payment.amount = flt(payment.amount)
|
||||||
|
payment.base_amount = payment.amount * flt(self.doc.conversion_rate)
|
||||||
paid_amount += payment.amount
|
paid_amount += payment.amount
|
||||||
base_paid_amount += payment.base_amount
|
base_paid_amount += payment.base_amount
|
||||||
elif not self.doc.is_return:
|
elif not self.doc.is_return:
|
||||||
@@ -474,7 +475,9 @@ class calculate_taxes_and_totals(object):
|
|||||||
def calculate_change_amount(self):
|
def calculate_change_amount(self):
|
||||||
self.doc.change_amount = 0.0
|
self.doc.change_amount = 0.0
|
||||||
self.doc.base_change_amount = 0.0
|
self.doc.base_change_amount = 0.0
|
||||||
if self.doc.paid_amount > self.doc.grand_total:
|
if self.doc.paid_amount > self.doc.grand_total and not self.doc.is_return \
|
||||||
|
and any([d.type == "Cash" for d in self.doc.payments]):
|
||||||
|
|
||||||
self.doc.change_amount = flt(self.doc.paid_amount - self.doc.grand_total +
|
self.doc.change_amount = flt(self.doc.paid_amount - self.doc.grand_total +
|
||||||
self.doc.write_off_amount, self.doc.precision("change_amount"))
|
self.doc.write_off_amount, self.doc.precision("change_amount"))
|
||||||
|
|
||||||
|
|||||||
@@ -7,34 +7,35 @@ cur_frm.email_field = "email_id";
|
|||||||
erpnext.LeadController = frappe.ui.form.Controller.extend({
|
erpnext.LeadController = frappe.ui.form.Controller.extend({
|
||||||
setup: function() {
|
setup: function() {
|
||||||
this.frm.fields_dict.customer.get_query = function(doc, cdt, cdn) {
|
this.frm.fields_dict.customer.get_query = function(doc, cdt, cdn) {
|
||||||
return { query: "erpnext.controllers.queries.customer_query" } }
|
return { query: "erpnext.controllers.queries.customer_query" } }
|
||||||
},
|
},
|
||||||
|
|
||||||
onload: function() {
|
onload: function() {
|
||||||
if(cur_frm.fields_dict.lead_owner.df.options.match(/^User/)) {
|
if(cur_frm.fields_dict.lead_owner.df.options.match(/^User/)) {
|
||||||
cur_frm.fields_dict.lead_owner.get_query = function(doc, cdt, cdn) {
|
cur_frm.fields_dict.lead_owner.get_query = function(doc, cdt, cdn) {
|
||||||
return { query:"frappe.core.doctype.user.user.user_query" } }
|
return { query: "frappe.core.doctype.user.user.user_query" }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cur_frm.fields_dict.contact_by.df.options.match(/^User/)) {
|
if(cur_frm.fields_dict.contact_by.df.options.match(/^User/)) {
|
||||||
cur_frm.fields_dict.contact_by.get_query = function(doc, cdt, cdn) {
|
cur_frm.fields_dict.contact_by.get_query = function(doc, cdt, cdn) {
|
||||||
return { query:"frappe.core.doctype.user.user.user_query" } }
|
return { query: "frappe.core.doctype.user.user.user_query" } }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
refresh: function() {
|
refresh: function() {
|
||||||
var doc = this.frm.doc;
|
var doc = this.frm.doc;
|
||||||
erpnext.toggle_naming_series();
|
erpnext.toggle_naming_series();
|
||||||
frappe.dynamic_link = {doc: this.frm.doc, fieldname: 'name', doctype: 'Lead'}
|
frappe.dynamic_link = {doc: doc, fieldname: 'name', doctype: 'Lead'}
|
||||||
|
|
||||||
if(!this.frm.doc.__islocal && this.frm.doc.__onload && !this.frm.doc.__onload.is_customer) {
|
if(!doc.__islocal && doc.__onload && !doc.__onload.is_customer) {
|
||||||
this.frm.add_custom_button(__("Customer"), this.create_customer, __("Make"));
|
this.frm.add_custom_button(__("Customer"), this.create_customer, __("Make"));
|
||||||
this.frm.add_custom_button(__("Opportunity"), this.create_opportunity, __("Make"));
|
this.frm.add_custom_button(__("Opportunity"), this.create_opportunity, __("Make"));
|
||||||
this.frm.add_custom_button(__("Quotation"), this.make_quotation, __("Make"));
|
this.frm.add_custom_button(__("Quotation"), this.make_quotation, __("Make"));
|
||||||
cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
|
cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!this.frm.doc.__islocal) {
|
if(!doc.__islocal) {
|
||||||
frappe.geo.render_address_and_contact(cur_frm);
|
frappe.geo.render_address_and_contact(cur_frm);
|
||||||
} else {
|
} else {
|
||||||
frappe.geo.clear_address_and_contact(cur_frm);
|
frappe.geo.clear_address_and_contact(cur_frm);
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ frappe.ui.form.on("Opportunity", {
|
|||||||
var doc = frm.doc;
|
var doc = frm.doc;
|
||||||
frm.events.enquiry_from(frm);
|
frm.events.enquiry_from(frm);
|
||||||
frm.trigger('set_contact_link');
|
frm.trigger('set_contact_link');
|
||||||
|
erpnext.toggle_naming_series();
|
||||||
|
|
||||||
if(!doc.__islocal && doc.status!=="Lost") {
|
if(!doc.__islocal && doc.status!=="Lost") {
|
||||||
if(doc.with_items){
|
if(doc.with_items){
|
||||||
@@ -54,6 +55,20 @@ frappe.ui.form.on("Opportunity", {
|
|||||||
cur_frm.cscript['Declare Opportunity Lost']);
|
cur_frm.cscript['Declare Opportunity Lost']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!frm.doc.__islocal && frm.perm[0].write && frm.doc.docstatus==0) {
|
||||||
|
if(frm.doc.status==="Open") {
|
||||||
|
frm.add_custom_button(__("Close"), function() {
|
||||||
|
frm.set_value("status", "Closed");
|
||||||
|
frm.save();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
frm.add_custom_button(__("Reopen"), function() {
|
||||||
|
frm.set_value("status", "Open");
|
||||||
|
frm.save();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
set_contact_link: function(frm) {
|
set_contact_link: function(frm) {
|
||||||
@@ -107,7 +122,8 @@ erpnext.crm.Opportunity = frappe.ui.form.Controller.extend({
|
|||||||
|
|
||||||
$.each([["lead", "lead"],
|
$.each([["lead", "lead"],
|
||||||
["customer", "customer"],
|
["customer", "customer"],
|
||||||
["contact_person", "contact_query"]], function(i, opts) {
|
["contact_person", "contact_query"]],
|
||||||
|
function(i, opts) {
|
||||||
me.frm.set_query(opts[0], erpnext.queries[opts[1]]);
|
me.frm.set_query(opts[0], erpnext.queries[opts[1]]);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -122,25 +138,6 @@ erpnext.crm.Opportunity = frappe.ui.form.Controller.extend({
|
|||||||
|
|
||||||
$.extend(cur_frm.cscript, new erpnext.crm.Opportunity({frm: cur_frm}));
|
$.extend(cur_frm.cscript, new erpnext.crm.Opportunity({frm: cur_frm}));
|
||||||
|
|
||||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
|
||||||
erpnext.toggle_naming_series();
|
|
||||||
|
|
||||||
var frm = cur_frm;
|
|
||||||
if(!doc.__islocal && frm.perm[0].write && doc.docstatus==0) {
|
|
||||||
if(frm.doc.status==="Open") {
|
|
||||||
frm.add_custom_button(__("Close"), function() {
|
|
||||||
frm.set_value("status", "Closed");
|
|
||||||
frm.save();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
frm.add_custom_button(__("Reopen"), function() {
|
|
||||||
frm.set_value("status", "Open");
|
|
||||||
frm.save();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
|
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
|
||||||
if(doc.enquiry_from == 'Lead' && doc.lead)
|
if(doc.enquiry_from == 'Lead' && doc.lead)
|
||||||
cur_frm.cscript.lead(doc, cdt, cdn);
|
cur_frm.cscript.lead(doc, cdt, cdn);
|
||||||
@@ -157,7 +154,7 @@ cur_frm.cscript.item_code = function(doc, cdt, cdn) {
|
|||||||
$.each(r.message, function(k, v) {
|
$.each(r.message, function(k, v) {
|
||||||
frappe.model.set_value(cdt, cdn, k, v);
|
frappe.model.set_value(cdt, cdn, k, v);
|
||||||
});
|
});
|
||||||
refresh_field('image_view', d.name, 'items');
|
refresh_field('image_view', d.name, 'items');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -184,7 +181,7 @@ cur_frm.cscript['Declare Opportunity Lost'] = function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
dialog.fields_dict.update.$input.click(function() {
|
dialog.fields_dict.update.$input.click(function() {
|
||||||
args = dialog.get_values();
|
var args = dialog.get_values();
|
||||||
if(!args) return;
|
if(!args) return;
|
||||||
return cur_frm.call({
|
return cur_frm.call({
|
||||||
doc: cur_frm.doc,
|
doc: cur_frm.doc,
|
||||||
@@ -192,7 +189,7 @@ cur_frm.cscript['Declare Opportunity Lost'] = function() {
|
|||||||
args: args.reason,
|
args: args.reason,
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
if(r.exc) {
|
if(r.exc) {
|
||||||
msgprint(__("There were errors."));
|
frappe.msgprint(__("There were errors."));
|
||||||
} else {
|
} else {
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
cur_frm.refresh();
|
cur_frm.refresh();
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ class Opportunity(TransactionBase):
|
|||||||
if not self.enquiry_from:
|
if not self.enquiry_from:
|
||||||
frappe.throw(_("Opportunity From field is mandatory"))
|
frappe.throw(_("Opportunity From field is mandatory"))
|
||||||
|
|
||||||
self.set_status()
|
|
||||||
self.validate_item_details()
|
self.validate_item_details()
|
||||||
self.validate_uom_is_integer("uom", "qty")
|
self.validate_uom_is_integer("uom", "qty")
|
||||||
self.validate_lead_cust()
|
self.validate_lead_cust()
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
// For license information, please see license.txt
|
// For license information, please see license.txt
|
||||||
frappe.query_reports["Campaign Efficiency"] = {
|
frappe.query_reports["Campaign Efficiency"] = {
|
||||||
"filters": [
|
"filters": [
|
||||||
{
|
{
|
||||||
"fieldname": "from_date",
|
"fieldname": "from_date",
|
||||||
"label": __("From Date"),
|
"label": __("From Date"),
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"default": frappe.defaults.get_user_default("year_start_date"),
|
"default": frappe.defaults.get_user_default("year_start_date"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "to_date",
|
"fieldname": "to_date",
|
||||||
"label": __("To Date"),
|
"label": __("To Date"),
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"default": frappe.defaults.get_user_default("year_end_date"),
|
"default": frappe.defaults.get_user_default("year_end_date"),
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2,40 +2,40 @@
|
|||||||
// For license information, please see license.txt
|
// For license information, please see license.txt
|
||||||
|
|
||||||
frappe.query_reports["Minutes to First Response for Opportunity"] = {
|
frappe.query_reports["Minutes to First Response for Opportunity"] = {
|
||||||
"filters": [
|
"filters": [
|
||||||
{
|
{
|
||||||
"fieldname":"from_date",
|
"fieldname": "from_date",
|
||||||
"label": __("From Date"),
|
"label": __("From Date"),
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
'reqd': 1,
|
'reqd': 1,
|
||||||
"default": frappe.datetime.add_days(frappe.datetime.nowdate(), -30)
|
"default": frappe.datetime.add_days(frappe.datetime.nowdate(), -30)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname":"to_date",
|
"fieldname": "to_date",
|
||||||
"label": __("To Date"),
|
"label": __("To Date"),
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
'reqd': 1,
|
'reqd': 1,
|
||||||
"default":frappe.datetime.nowdate()
|
"default": frappe.datetime.nowdate()
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
get_chart_data: function(columns, result) {
|
get_chart_data: function (columns, result) {
|
||||||
return {
|
return {
|
||||||
data: {
|
data: {
|
||||||
x: 'Date',
|
x: 'Date',
|
||||||
columns: [
|
columns: [
|
||||||
['Date'].concat($.map(result, function(d) { return d[0]; })),
|
['Date'].concat($.map(result, function (d) { return d[0]; })),
|
||||||
['Mins to first response'].concat($.map(result, function(d) { return d[1]; }))
|
['Mins to first response'].concat($.map(result, function (d) { return d[1]; }))
|
||||||
]
|
]
|
||||||
// rows: [['Date', 'Mins to first response']].concat(result)
|
// rows: [['Date', 'Mins to first response']].concat(result)
|
||||||
},
|
},
|
||||||
axis: {
|
axis: {
|
||||||
x: {
|
x: {
|
||||||
type: 'timeseries',
|
type: 'timeseries',
|
||||||
tick: {
|
tick: {
|
||||||
format: frappe.ui.py_date_format
|
format: frappe.ui.py_date_format
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
chart_type: 'line',
|
chart_type: 'line',
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
18
erpnext/demo/data/assessment_criteria.json
Normal file
18
erpnext/demo/data/assessment_criteria.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"doctype": "Assessment Criteria",
|
||||||
|
"assessment_criteria": "Aptitude"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doctype": "Assessment Criteria",
|
||||||
|
"assessment_criteria": "Application"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doctype": "Assessment Criteria",
|
||||||
|
"assessment_criteria": "Understanding"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doctype": "Assessment Criteria",
|
||||||
|
"assessment_criteria": "Knowledge"
|
||||||
|
}
|
||||||
|
]
|
||||||
17
erpnext/demo/data/grading_scale.json
Normal file
17
erpnext/demo/data/grading_scale.json
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"doctype": "Grading Scale",
|
||||||
|
"grading_scale_name": "Standard Grading",
|
||||||
|
"description": "Standard Grading Scale",
|
||||||
|
"intervals": [
|
||||||
|
{"threshold": 100.0, "grade_code": "A", "grade_description": "Excellent"},
|
||||||
|
{"threshold": 89.9, "grade_code": "B+", "grade_description": "Close to Excellence"},
|
||||||
|
{"threshold": 80.0, "grade_code": "B", "grade_description": "Good"},
|
||||||
|
{"threshold": 69.9, "grade_code": "C+", "grade_description": "Almost Good"},
|
||||||
|
{"threshold": 60.0, "grade_code": "C", "grade_description": "Average"},
|
||||||
|
{"threshold": 50.0, "grade_code": "D+", "grade_description": "Have to Work"},
|
||||||
|
{"threshold": 40.0, "grade_code": "D", "grade_description": "Not met Baseline Expectations"},
|
||||||
|
{"threshold": 0.0, "grade_code": "F", "grade_description": "Have to work a lot"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -57,6 +57,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"is_stock_item": 0,
|
"is_stock_item": 0,
|
||||||
|
"default_warehouse": "Stores",
|
||||||
"description": "Computer",
|
"description": "Computer",
|
||||||
"item_code": "Computer",
|
"item_code": "Computer",
|
||||||
"item_name": "Computer",
|
"item_name": "Computer",
|
||||||
@@ -64,6 +65,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"is_stock_item": 0,
|
"is_stock_item": 0,
|
||||||
|
"default_warehouse": "Stores",
|
||||||
"description": "Mobile",
|
"description": "Mobile",
|
||||||
"item_code": "Mobile",
|
"item_code": "Mobile",
|
||||||
"item_name": "Mobile",
|
"item_name": "Mobile",
|
||||||
@@ -71,6 +73,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"is_stock_item": 0,
|
"is_stock_item": 0,
|
||||||
|
"default_warehouse": "Stores",
|
||||||
"description": "ERP",
|
"description": "ERP",
|
||||||
"item_code": "ERP",
|
"item_code": "ERP",
|
||||||
"item_name": "ERP",
|
"item_name": "ERP",
|
||||||
@@ -78,12 +81,14 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"is_stock_item": 0,
|
"is_stock_item": 0,
|
||||||
|
"default_warehouse": "Stores",
|
||||||
"description": "Autocad",
|
"description": "Autocad",
|
||||||
"item_code": "Autocad",
|
"item_code": "Autocad",
|
||||||
"item_name": "Autocad",
|
"item_name": "Autocad",
|
||||||
"item_group": "All Item Groups"
|
"item_group": "All Item Groups"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"default_warehouse": "Stores",
|
||||||
"default_warehouse": "Stores",
|
"default_warehouse": "Stores",
|
||||||
"item_code": "Service",
|
"item_code": "Service",
|
||||||
"item_group": "Services",
|
"item_group": "Services",
|
||||||
|
|||||||
@@ -1,102 +1,46 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"doctype": "Program",
|
"doctype": "Program",
|
||||||
|
"name": "MCA",
|
||||||
"program_name": "Masters of Computer Applications",
|
"program_name": "Masters of Computer Applications",
|
||||||
"program_code": "MCA",
|
"program_code": "MCA",
|
||||||
"department": "Information Technology",
|
"department": "Information Technology",
|
||||||
"courses": [
|
"courses": [
|
||||||
{
|
{ "course": "MCA4010" },
|
||||||
"course": "Microprocessor",
|
{ "course": "MCA4020" },
|
||||||
"academic_term": "Semester 1"
|
{ "course": "MCA4030" }
|
||||||
},
|
|
||||||
{
|
|
||||||
"course": "Probability and Statistics",
|
|
||||||
"academic_term": "Semester 1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"course": "Programing in Java",
|
|
||||||
"academic_term": "Semester 2"
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "Program",
|
"doctype": "Program",
|
||||||
|
"name": "BCA",
|
||||||
"program_name": "Bachelor of Computer Applications",
|
"program_name": "Bachelor of Computer Applications",
|
||||||
"program_code": "BCA",
|
"program_code": "BCA",
|
||||||
"department": "Information Technology",
|
"department": "Information Technology",
|
||||||
"courses": [
|
"courses": [
|
||||||
{
|
{ "course": "BCA2030" },
|
||||||
"course": "Communication Skiils",
|
{ "course": "BCA1030" },
|
||||||
"academic_term": "Semester 3"
|
{ "course": "BCA2020" },
|
||||||
},
|
{ "course": "BCA1040" },
|
||||||
{
|
{ "course": "BCA1010" },
|
||||||
"course": "Object Oriented Programing - C++",
|
{ "course": "BCA2010" },
|
||||||
"academic_term": "Semester 3"
|
{ "course": "BCA1020" }
|
||||||
},
|
|
||||||
{
|
|
||||||
"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",
|
"doctype": "Program",
|
||||||
|
"name": "BBA",
|
||||||
"program_name": "Bachelor of Business Administration",
|
"program_name": "Bachelor of Business Administration",
|
||||||
"program_code": "BBA",
|
"program_code": "BBA",
|
||||||
"department": "Management Studies",
|
"department": "Management Studies",
|
||||||
"courses": [
|
"courses": [
|
||||||
{
|
{ "course": "BBA 101" },
|
||||||
"course": "Organizational Behavior",
|
{ "course": "BBA 102" },
|
||||||
"academic_term": "Semester 1"
|
{ "course": "BBA 103" },
|
||||||
},
|
{ "course": "BBA 301" },
|
||||||
{
|
{ "course": "BBA 302" },
|
||||||
"course": "Management Development and Skills",
|
{ "course": "BBA 304" },
|
||||||
"academic_term": "Semester 1"
|
{ "course": "BBA 505" }
|
||||||
},
|
|
||||||
{
|
|
||||||
"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"
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
10
erpnext/demo/data/student_batch_name.json
Normal file
10
erpnext/demo/data/student_batch_name.json
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"doctype": "Student Batch Name",
|
||||||
|
"batch_name": "Section-A"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doctype": "Student Batch Name",
|
||||||
|
"batch_name": "Section-B"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -35,6 +35,7 @@ def make(domain='Manufacturing'):
|
|||||||
frappe.destroy()
|
frappe.destroy()
|
||||||
frappe.init(site)
|
frappe.init(site)
|
||||||
frappe.connect()
|
frappe.connect()
|
||||||
|
|
||||||
simulate(domain)
|
simulate(domain)
|
||||||
|
|
||||||
def simulate(domain='Manufacturing'):
|
def simulate(domain='Manufacturing'):
|
||||||
@@ -73,7 +74,7 @@ def simulate(domain='Manufacturing'):
|
|||||||
stock.work()
|
stock.work()
|
||||||
accounts.work()
|
accounts.work()
|
||||||
projects.run_projects(current_date)
|
projects.run_projects(current_date)
|
||||||
#run_messages()
|
# run_messages()
|
||||||
|
|
||||||
if domain=='Manufacturing':
|
if domain=='Manufacturing':
|
||||||
sales.work()
|
sales.work()
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ def setup_data():
|
|||||||
make_student_group()
|
make_student_group()
|
||||||
make_fees_category()
|
make_fees_category()
|
||||||
make_fees_structure()
|
make_fees_structure()
|
||||||
|
make_assessment_groups()
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
frappe.clear_cache()
|
frappe.clear_cache()
|
||||||
|
|
||||||
@@ -24,6 +25,9 @@ def make_masters():
|
|||||||
import_json("Instructor")
|
import_json("Instructor")
|
||||||
import_json("Course")
|
import_json("Course")
|
||||||
import_json("Program")
|
import_json("Program")
|
||||||
|
import_json("Student Batch Name")
|
||||||
|
import_json("Assessment Criteria")
|
||||||
|
import_json("Grading Scale")
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
|
|
||||||
def setup_item():
|
def setup_item():
|
||||||
@@ -81,13 +85,24 @@ def make_student_applicants():
|
|||||||
count+=1
|
count+=1
|
||||||
|
|
||||||
def make_student_group():
|
def make_student_group():
|
||||||
for d in frappe.db.get_list("Academic Term"):
|
for term in frappe.db.get_list("Academic Term"):
|
||||||
sg_tool = frappe.new_doc("Student Group Creation Tool")
|
for program in frappe.db.get_list("Program"):
|
||||||
sg_tool.academic_year = "2016-17"
|
sg_tool = frappe.new_doc("Student Group Creation Tool")
|
||||||
sg_tool.academic_term = d.name
|
sg_tool.academic_year = "2017-18"
|
||||||
sg_tool.courses = sg_tool.get_courses()
|
sg_tool.academic_term = term.name
|
||||||
sg_tool.create_student_groups()
|
sg_tool.program = program.name
|
||||||
frappe.db.commit()
|
for d in sg_tool.get_courses():
|
||||||
|
d = frappe._dict(d)
|
||||||
|
student_group = frappe.new_doc("Student Group")
|
||||||
|
student_group.student_group_name = d.student_group_name
|
||||||
|
student_group.group_based_on = d.group_based_on
|
||||||
|
student_group.program = program.name
|
||||||
|
student_group.course = d.course
|
||||||
|
student_group.batch = d.batch
|
||||||
|
student_group.academic_term = term.name
|
||||||
|
student_group.academic_year = "2017-18"
|
||||||
|
student_group.save()
|
||||||
|
frappe.db.commit()
|
||||||
|
|
||||||
def make_fees_category():
|
def make_fees_category():
|
||||||
fee_type = ["Tuition Fee", "Hostel Fee", "Logistics Fee",
|
fee_type = ["Tuition Fee", "Hostel Fee", "Logistics Fee",
|
||||||
@@ -111,7 +126,7 @@ def make_fees_category():
|
|||||||
def make_fees_structure():
|
def make_fees_structure():
|
||||||
for d in frappe.db.get_list("Program"):
|
for d in frappe.db.get_list("Program"):
|
||||||
program = frappe.get_doc("Program", d.name)
|
program = frappe.get_doc("Program", d.name)
|
||||||
for academic_term in ["Semester 1", "Semester 2", "Semester 3"]:
|
for academic_term in ["2017-18 (Semester 1)", "2017-18 (Semester 2)", "2017-18 (Semester 3)"]:
|
||||||
fee_structure = frappe.new_doc("Fee Structure")
|
fee_structure = frappe.new_doc("Fee Structure")
|
||||||
fee_structure.program = d.name
|
fee_structure.program = d.name
|
||||||
fee_structure.academic_term = random.choice(frappe.db.get_list("Academic Term")).name
|
fee_structure.academic_term = random.choice(frappe.db.get_list("Academic Term")).name
|
||||||
@@ -123,6 +138,27 @@ def make_fees_structure():
|
|||||||
program.save()
|
program.save()
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
|
|
||||||
|
def make_assessment_groups():
|
||||||
|
for year in frappe.db.get_list("Academic Year"):
|
||||||
|
ag = frappe.new_doc('Assessment Group')
|
||||||
|
ag.assessment_group_name = year.name
|
||||||
|
ag.parent_assessment_group = "All Assessment Groups"
|
||||||
|
ag.is_group = 1
|
||||||
|
ag.insert()
|
||||||
|
for term in frappe.db.get_list("Academic Term", filters = {"academic_year": year.name}):
|
||||||
|
ag1 = frappe.new_doc('Assessment Group')
|
||||||
|
ag1.assessment_group_name = term.name
|
||||||
|
ag1.parent_assessment_group = ag.name
|
||||||
|
ag1.is_group = 1
|
||||||
|
ag1.insert()
|
||||||
|
for assessment_group in ['Term I', 'Term II']:
|
||||||
|
ag2 = frappe.new_doc('Assessment Group')
|
||||||
|
ag2.assessment_group_name = ag1.name + " " + assessment_group
|
||||||
|
ag2.parent_assessment_group = ag1.name
|
||||||
|
ag2.insert()
|
||||||
|
frappe.db.commit()
|
||||||
|
|
||||||
|
|
||||||
def get_json_path(doctype):
|
def get_json_path(doctype):
|
||||||
return frappe.get_app_path('erpnext', 'demo', 'data', frappe.scrub(doctype) + '.json')
|
return frappe.get_app_path('erpnext', 'demo', 'data', frappe.scrub(doctype) + '.json')
|
||||||
|
|
||||||
|
|||||||
@@ -8,30 +8,22 @@ import random
|
|||||||
from frappe.utils import cstr
|
from frappe.utils import cstr
|
||||||
from frappe.utils.make_random import get_random
|
from frappe.utils.make_random import get_random
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from erpnext.schools.api import get_student_group_students, make_attendance_records, enroll_student, get_fee_schedule, collect_fees
|
from erpnext.schools.api import get_student_group_students, make_attendance_records, enroll_student, \
|
||||||
|
get_fee_schedule, collect_fees, get_course
|
||||||
|
from erpnext.schools.doctype.program_enrollment.program_enrollment import get_program_courses
|
||||||
|
from erpnext.schools.doctype.student_group.student_group import get_students
|
||||||
|
|
||||||
def work():
|
def work():
|
||||||
frappe.set_user(frappe.db.get_global('demo_schools_user'))
|
frappe.set_user(frappe.db.get_global('demo_schools_user'))
|
||||||
for d in xrange(20):
|
for d in xrange(20):
|
||||||
approve_random_student_applicant()
|
approve_random_student_applicant()
|
||||||
enroll_random_student(frappe.flags.current_date)
|
enroll_random_student(frappe.flags.current_date)
|
||||||
if frappe.flags.current_date.weekday()== 0:
|
# if frappe.flags.current_date.weekday()== 0:
|
||||||
make_course_schedule(frappe.flags.current_date, frappe.utils.add_days(frappe.flags.current_date, 5))
|
# make_course_schedule(frappe.flags.current_date, frappe.utils.add_days(frappe.flags.current_date, 5))
|
||||||
mark_student_attendance(frappe.flags.current_date)
|
mark_student_attendance(frappe.flags.current_date)
|
||||||
|
# make_assessment_plan()
|
||||||
make_fees()
|
make_fees()
|
||||||
|
|
||||||
def mark_student_attendance(current_date):
|
|
||||||
status = ["Present", "Absent"]
|
|
||||||
for d in frappe.db.get_list("Course Schedule", filters={"schedule_date": current_date}, fields=("name", "student_group")):
|
|
||||||
students = get_student_group_students(d.student_group)
|
|
||||||
for stud in students:
|
|
||||||
make_attendance_records(stud.student, stud.student_name, d.name, status[weighted_choice([9,4])])
|
|
||||||
|
|
||||||
def make_fees():
|
|
||||||
for d in range(1,10):
|
|
||||||
random_fee = get_random("Fees", {"paid_amount": 0})
|
|
||||||
collect_fees(random_fee, frappe.db.get_value("Fees", random_fee, "outstanding_amount"))
|
|
||||||
|
|
||||||
def approve_random_student_applicant():
|
def approve_random_student_applicant():
|
||||||
random_student = get_random("Student Applicant", {"application_status": "Applied"})
|
random_student = get_random("Student Applicant", {"application_status": "Applied"})
|
||||||
if random_student:
|
if random_student:
|
||||||
@@ -39,31 +31,59 @@ def approve_random_student_applicant():
|
|||||||
frappe.db.set_value("Student Applicant", random_student, "application_status", status[weighted_choice([9,3])])
|
frappe.db.set_value("Student Applicant", random_student, "application_status", status[weighted_choice([9,3])])
|
||||||
|
|
||||||
def enroll_random_student(current_date):
|
def enroll_random_student(current_date):
|
||||||
|
batch = ["Section-A", "Section-B"]
|
||||||
random_student = get_random("Student Applicant", {"application_status": "Approved"})
|
random_student = get_random("Student Applicant", {"application_status": "Approved"})
|
||||||
if random_student:
|
if random_student:
|
||||||
enrollment = enroll_student(random_student)
|
enrollment = enroll_student(random_student)
|
||||||
enrollment.academic_year = get_random("Academic Year")
|
enrollment.academic_year = get_random("Academic Year")
|
||||||
enrollment.enrollment_date = current_date
|
enrollment.enrollment_date = current_date
|
||||||
|
enrollment.student_batch_name = batch[weighted_choice([9,3])]
|
||||||
fee_schedule = get_fee_schedule(enrollment.program)
|
fee_schedule = get_fee_schedule(enrollment.program)
|
||||||
for fee in fee_schedule:
|
for fee in fee_schedule:
|
||||||
enrollment.append("fees", fee)
|
enrollment.append("fees", fee)
|
||||||
|
enrolled_courses = get_course(enrollment.program)
|
||||||
|
for course in enrolled_courses:
|
||||||
|
enrollment.append("courses", course)
|
||||||
enrollment.submit()
|
enrollment.submit()
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
assign_student_group(enrollment.student, enrollment.program)
|
assign_student_group(enrollment.student, enrollment.student_name, enrollment.program,
|
||||||
|
enrolled_courses, enrollment.student_batch_name)
|
||||||
|
|
||||||
def assign_student_group(student, program):
|
def assign_student_group(student, student_name, program, courses, batch):
|
||||||
courses = []
|
course_list = [d["course"] for d in courses]
|
||||||
for d in frappe.get_list("Program Course", fields=("course"), filters={"parent": program }):
|
for d in frappe.get_list("Student Group", fields=("name"), filters={"program": program, "course":("in", course_list)}):
|
||||||
courses.append(d.course)
|
student_group = frappe.get_doc("Student Group", d.name)
|
||||||
|
student_group.append("students", {"student": student, "student_name": student_name,
|
||||||
|
"group_roll_number":len(student_group.students)+1, "active":1})
|
||||||
|
student_group.save()
|
||||||
|
student_batch = frappe.get_list("Student Group", fields=("name"), filters={"program": program, "group_based_on":"Batch", "batch":batch})[0]
|
||||||
|
student_batch_doc = frappe.get_doc("Student Group", student_batch.name)
|
||||||
|
student_batch_doc.append("students", {"student": student, "student_name": student_name,
|
||||||
|
"group_roll_number":len(student_batch_doc.students)+1, "active":1})
|
||||||
|
student_batch_doc.save()
|
||||||
|
frappe.db.commit()
|
||||||
|
|
||||||
for d in xrange(3):
|
def mark_student_attendance(current_date):
|
||||||
course = random.choice(courses)
|
status = ["Present", "Absent"]
|
||||||
random_sg = get_random("Student Group", {"course": course})
|
for d in frappe.db.get_list("Student Group", filters={"group_based_on": "Batch"}):
|
||||||
if random_sg:
|
students = get_student_group_students(d.name)
|
||||||
student_group = frappe.get_doc("Student Group", random_sg)
|
for stud in students:
|
||||||
student_group.append("students", {"student": student})
|
make_attendance_records(stud.student, stud.student_name, status[weighted_choice([9,4])], None, d.name, current_date)
|
||||||
student_group.save()
|
|
||||||
courses.remove(course)
|
def make_fees():
|
||||||
|
for d in range(1,10):
|
||||||
|
random_fee = get_random("Fees", {"paid_amount": 0})
|
||||||
|
collect_fees(random_fee, frappe.db.get_value("Fees", random_fee, "outstanding_amount"))
|
||||||
|
|
||||||
|
def make_assessment_plan(date):
|
||||||
|
for d in range(1,4):
|
||||||
|
random_group = get_random("Student Group", {"group_based_on": "Course"}, True)
|
||||||
|
doc = frappe.new_doc("Assessment Plan")
|
||||||
|
doc.student_group = random_group.name
|
||||||
|
doc.course = random_group.course
|
||||||
|
doc.assessment_group = get_random("Assessment Group", {"is_group": 0, "parent": "2017-18 (Semester 2)"})
|
||||||
|
doc.grading_scale = get_random("Grading Scale")
|
||||||
|
doc.maximum_assessment_score = 100
|
||||||
|
|
||||||
def make_course_schedule(start_date, end_date):
|
def make_course_schedule(start_date, end_date):
|
||||||
for d in frappe.db.get_list("Student Group"):
|
for d in frappe.db.get_list("Student Group"):
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ In ERPNext, your accounting operations consists of 3 main transactions:
|
|||||||
|
|
||||||
* Sales Invoice: The bills that you raise to your Customers for the products or services you provide.
|
* Sales Invoice: The bills that you raise to your Customers for the products or services you provide.
|
||||||
* Purchase Invoice: Bills that your Suppliers give you for their products or services.
|
* Purchase Invoice: Bills that your Suppliers give you for their products or services.
|
||||||
* Journal Entrys: For accounting entries, like payments, credit and other types.
|
* Journal Entries: For accounting entries, like payments, credit and other types.
|
||||||
|
|
||||||
### Topics
|
### Topics
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
### Bank Reconciliation Statement
|
### Bank Reconciliation Statement
|
||||||
|
|
||||||
If you are receiving payments or making payments via cheques, the bank statements will not accurately match the dates of your entry, this is because the bank usually takes time to “clear” these payments. Also you may have
|
If you are receiving payments or making payments via cheques, the bank statements will not accurately match the dates of your entry, this is because the bank usually takes time to “clear” these payments. Also you may have
|
||||||
mailed a cheque to your Supplier and it may be a few days before it is received and deposited by the Supplier. In ERPNext you can synchronise your bank statements and your Journal Entrys using the “Bank Reconciliation”
|
mailed a cheque to your Supplier and it may be a few days before it is received and deposited by the Supplier. In ERPNext you can synchronise your bank statements and your Journal Entries using the “Bank Reconciliation”
|
||||||
tool.
|
tool.
|
||||||
|
|
||||||
The Bank Reconciliation Report provide the difference between the bank balance shown in an organisation's bank statement, as provided by the ban against amount shown in the companies Chart of Accounts.
|
The Bank Reconciliation Report provide the difference between the bank balance shown in an organisation's bank statement, as provided by the ban against amount shown in the companies Chart of Accounts.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
###Payment Tool
|
###Payment Tool
|
||||||
The Payment Tool Feature allows non-accounting personnel to generate Journal Entrys by populating relevant fields in the Journal Entry with account and payment details.
|
The Payment Tool Feature allows non-accounting personnel to generate Journal Entries by populating relevant fields in the Journal Entry with account and payment details.
|
||||||
|
|
||||||
To go to Payment Tool, click on Accounts > Tools > Payment Tool.
|
To go to Payment Tool, click on Accounts > Tools > Payment Tool.
|
||||||
|
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ them by product line or business group (e.g., online sales, retail sales, etc.).
|
|||||||
|
|
||||||
A document that contains General Ledger (GL) entries and the sum of Debits and
|
A document that contains General Ledger (GL) entries and the sum of Debits and
|
||||||
Credits of those entries is the same. In ERPNext you can update Payments,
|
Credits of those entries is the same. In ERPNext you can update Payments,
|
||||||
Returns, etc., using Journal Entrys.
|
Returns, etc., using Journal Entries.
|
||||||
|
|
||||||
> Accounts > Journal Entry
|
> Accounts > Journal Entry
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ create a “Packing List” table for you based on the sub-Items in that Item.
|
|||||||
If your Items are serialized, then for Product Bundle type of Items, you will have
|
If your Items are serialized, then for Product Bundle type of Items, you will have
|
||||||
to update the Serial Number in the “Packing List” table.
|
to update the Serial Number in the “Packing List” table.
|
||||||
|
|
||||||
### Packing Items in to Cases, for Container Shipment
|
### Packing Items into Cases, for Container Shipment
|
||||||
|
|
||||||
If you are doing container shipment or by weight, then you can use the Packing
|
If you are doing container shipment or by weight, then you can use the Packing
|
||||||
Slip to breakup your Delivery Note into smaller units. To make a Packing Slip
|
Slip to breakup your Delivery Note into smaller units. To make a Packing Slip
|
||||||
|
|||||||
@@ -178,7 +178,8 @@ scheduler_events = {
|
|||||||
"erpnext.hr.doctype.employee.employee.send_birthday_reminders",
|
"erpnext.hr.doctype.employee.employee.send_birthday_reminders",
|
||||||
"erpnext.projects.doctype.task.task.set_tasks_as_overdue",
|
"erpnext.projects.doctype.task.task.set_tasks_as_overdue",
|
||||||
"erpnext.accounts.doctype.asset.depreciation.post_depreciation_entries",
|
"erpnext.accounts.doctype.asset.depreciation.post_depreciation_entries",
|
||||||
'erpnext.hr.doctype.daily_work_summary_settings.daily_work_summary_settings.send_summary'
|
"erpnext.hr.doctype.daily_work_summary_settings.daily_work_summary_settings.send_summary",
|
||||||
|
"erpnext.stock.doctype.serial_no.serial_no.update_maintenance_status"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,11 +46,11 @@ cur_frm.cscript.score = function(doc,cdt,cdn){
|
|||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
if (d.score){
|
if (d.score){
|
||||||
if (flt(d.score) > 5) {
|
if (flt(d.score) > 5) {
|
||||||
msgprint(__("Score must be less than or equal to 5"));
|
frappe.msgprint(__("Score must be less than or equal to 5"));
|
||||||
d.score = 0;
|
d.score = 0;
|
||||||
refresh_field('score', d.name, 'goals');
|
refresh_field('score', d.name, 'goals');
|
||||||
}
|
}
|
||||||
total = flt(d.per_weightage*d.score)/100;
|
var total = flt(d.per_weightage*d.score)/100;
|
||||||
d.score_earned = total.toPrecision(2);
|
d.score_earned = total.toPrecision(2);
|
||||||
refresh_field('score_earned', d.name, 'goals');
|
refresh_field('score_earned', d.name, 'goals');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ cur_frm.add_fetch('employee', 'company', 'company');
|
|||||||
cur_frm.add_fetch('employee', 'employee_name', 'employee_name');
|
cur_frm.add_fetch('employee', 'employee_name', 'employee_name');
|
||||||
|
|
||||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||||
if(doc.__islocal) cur_frm.set_value("attendance_date", get_today());
|
if(doc.__islocal) cur_frm.set_value("attendance_date", frappe.datetime.get_today());
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) {
|
cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ frappe.ui.form.on("Employee Attendance Tool", {
|
|||||||
|
|
||||||
onload: function(frm) {
|
onload: function(frm) {
|
||||||
frm.doc.department = frm.doc.branch = frm.doc.company = "All";
|
frm.doc.department = frm.doc.branch = frm.doc.company = "All";
|
||||||
frm.set_value("date", get_today());
|
frm.set_value("date", frappe.datetime.get_today());
|
||||||
erpnext.employee_attendance_tool.load_employees(frm);
|
erpnext.employee_attendance_tool.load_employees(frm);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
// For license information, please see license.txt
|
// For license information, please see license.txt
|
||||||
|
|
||||||
frappe.ui.form.on('Employee Loan', {
|
frappe.ui.form.on('Employee Loan', {
|
||||||
onload: function(frm) {
|
onload: function (frm) {
|
||||||
frm.set_query("employee_loan_application", function() {
|
frm.set_query("employee_loan_application", function () {
|
||||||
return {
|
return {
|
||||||
"filters": {
|
"filters": {
|
||||||
"employee": frm.doc.employee,
|
"employee": frm.doc.employee,
|
||||||
@@ -12,19 +12,19 @@ frappe.ui.form.on('Employee Loan', {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
frm.set_query("interest_income_account", function() {
|
frm.set_query("interest_income_account", function () {
|
||||||
return {
|
return {
|
||||||
"filters": {
|
"filters": {
|
||||||
"company": frm.doc.company,
|
"company": frm.doc.company,
|
||||||
"root_type": "Income",
|
"root_type": "Income",
|
||||||
"is_group": 0
|
"is_group": 0
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
$.each(["payment_account", "employee_loan_account"], function(i, field) {
|
$.each(["payment_account", "employee_loan_account"], function (i, field) {
|
||||||
frm.set_query(field, function() {
|
frm.set_query(field, function () {
|
||||||
return {
|
return {
|
||||||
"filters": {
|
"filters": {
|
||||||
"company": frm.doc.company,
|
"company": frm.doc.company,
|
||||||
@@ -36,16 +36,16 @@ frappe.ui.form.on('Employee Loan', {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
refresh: function(frm) {
|
refresh: function (frm) {
|
||||||
if (frm.doc.docstatus == 1 && (frm.doc.status == "Sanctioned" || frm.doc.status == "Partially Disbursed")) {
|
if (frm.doc.docstatus == 1 && (frm.doc.status == "Sanctioned" || frm.doc.status == "Partially Disbursed")) {
|
||||||
frm.add_custom_button(__('Make Disbursement Entry'), function() {
|
frm.add_custom_button(__('Make Disbursement Entry'), function () {
|
||||||
frm.trigger("make_jv");
|
frm.trigger("make_jv");
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
frm.trigger("toggle_fields");
|
frm.trigger("toggle_fields");
|
||||||
},
|
},
|
||||||
|
|
||||||
make_jv: function(frm) {
|
make_jv: function (frm) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
args: {
|
args: {
|
||||||
"employee_loan": frm.doc.name,
|
"employee_loan": frm.doc.name,
|
||||||
@@ -56,36 +56,36 @@ frappe.ui.form.on('Employee Loan', {
|
|||||||
"payment_account": frm.doc.payment_account
|
"payment_account": frm.doc.payment_account
|
||||||
},
|
},
|
||||||
method: "erpnext.hr.doctype.employee_loan.employee_loan.make_jv_entry",
|
method: "erpnext.hr.doctype.employee_loan.employee_loan.make_jv_entry",
|
||||||
callback: function(r) {
|
callback: function (r) {
|
||||||
if (r.message)
|
if (r.message)
|
||||||
var doc = frappe.model.sync(r.message)[0];
|
var doc = frappe.model.sync(r.message)[0];
|
||||||
frappe.set_route("Form", doc.doctype, doc.name);
|
frappe.set_route("Form", doc.doctype, doc.name);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
mode_of_payment: function(frm) {
|
mode_of_payment: function (frm) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.get_bank_cash_account",
|
method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.get_bank_cash_account",
|
||||||
args: {
|
args: {
|
||||||
"mode_of_payment": frm.doc.mode_of_payment,
|
"mode_of_payment": frm.doc.mode_of_payment,
|
||||||
"company": frm.doc.company
|
"company": frm.doc.company
|
||||||
},
|
},
|
||||||
callback: function(r, rt) {
|
callback: function (r, rt) {
|
||||||
if(r.message) {
|
if (r.message) {
|
||||||
frm.set_value("payment_account", r.message.account);
|
frm.set_value("payment_account", r.message.account);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
employee_loan_application: function(frm) {
|
employee_loan_application: function (frm) {
|
||||||
return frappe.call({
|
return frappe.call({
|
||||||
method: "erpnext.hr.doctype.employee_loan.employee_loan.get_employee_loan_application",
|
method: "erpnext.hr.doctype.employee_loan.employee_loan.get_employee_loan_application",
|
||||||
args: {
|
args: {
|
||||||
"employee_loan_application": frm.doc.employee_loan_application
|
"employee_loan_application": frm.doc.employee_loan_application
|
||||||
},
|
},
|
||||||
callback: function(r){
|
callback: function (r) {
|
||||||
if(!r.exc && r.message) {
|
if (!r.exc && r.message) {
|
||||||
frm.set_value("loan_type", r.message.loan_type);
|
frm.set_value("loan_type", r.message.loan_type);
|
||||||
frm.set_value("loan_amount", r.message.loan_amount);
|
frm.set_value("loan_amount", r.message.loan_amount);
|
||||||
frm.set_value("repayment_method", r.message.repayment_method);
|
frm.set_value("repayment_method", r.message.repayment_method);
|
||||||
@@ -97,12 +97,12 @@ frappe.ui.form.on('Employee Loan', {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
repayment_method: function(frm) {
|
repayment_method: function (frm) {
|
||||||
frm.trigger("toggle_fields")
|
frm.trigger("toggle_fields")
|
||||||
},
|
},
|
||||||
|
|
||||||
toggle_fields: function(frm) {
|
toggle_fields: function (frm) {
|
||||||
frm.toggle_enable("monthly_repayment_amount", frm.doc.repayment_method=="Repay Fixed Amount per Period")
|
frm.toggle_enable("monthly_repayment_amount", frm.doc.repayment_method == "Repay Fixed Amount per Period")
|
||||||
frm.toggle_enable("repayment_periods", frm.doc.repayment_method=="Repay Over Number of Periods")
|
frm.toggle_enable("repayment_periods", frm.doc.repayment_method == "Repay Over Number of Periods")
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ cur_frm.cscript.onload = function(doc,cdt,cdn) {
|
|||||||
cur_frm.set_value("approval_status", "Draft")
|
cur_frm.set_value("approval_status", "Draft")
|
||||||
|
|
||||||
if (doc.__islocal) {
|
if (doc.__islocal) {
|
||||||
cur_frm.set_value("posting_date", dateutil.get_today());
|
cur_frm.set_value("posting_date", frappe.datetime.get_today());
|
||||||
if(doc.amended_from)
|
if(doc.amended_from)
|
||||||
cur_frm.set_value("approval_status", "Draft");
|
cur_frm.set_value("approval_status", "Draft");
|
||||||
cur_frm.cscript.clear_sanctioned(doc);
|
cur_frm.cscript.clear_sanctioned(doc);
|
||||||
@@ -81,15 +81,15 @@ cur_frm.cscript.clear_sanctioned = function(doc) {
|
|||||||
refresh_many(['sanctioned_amount', 'total_sanctioned_amount']);
|
refresh_many(['sanctioned_amount', 'total_sanctioned_amount']);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.refresh = function(doc,cdt,cdn){
|
cur_frm.cscript.refresh = function(doc,cdt,cdn) {
|
||||||
cur_frm.cscript.set_help(doc);
|
cur_frm.cscript.set_help(doc);
|
||||||
|
|
||||||
if(!doc.__islocal) {
|
if(!doc.__islocal) {
|
||||||
cur_frm.toggle_enable("exp_approver", doc.approval_status=="Draft");
|
cur_frm.toggle_enable("exp_approver", doc.approval_status=="Draft");
|
||||||
cur_frm.toggle_enable("approval_status", (doc.exp_approver==user && doc.docstatus==0));
|
cur_frm.toggle_enable("approval_status", (doc.exp_approver==frappe.session.user && doc.docstatus==0));
|
||||||
|
|
||||||
if (doc.docstatus==0 && doc.exp_approver==user && doc.approval_status=="Approved")
|
if (doc.docstatus==0 && doc.exp_approver==frappe.session.user && doc.approval_status=="Approved")
|
||||||
cur_frm.savesubmit();
|
cur_frm.savesubmit();
|
||||||
|
|
||||||
if (doc.docstatus===1 && doc.approval_status=="Approved") {
|
if (doc.docstatus===1 && doc.approval_status=="Approved") {
|
||||||
if (cint(doc.total_amount_reimbursed) < cint(doc.total_sanctioned_amount) && frappe.model.can_create("Journal Entry")) {
|
if (cint(doc.total_amount_reimbursed) < cint(doc.total_sanctioned_amount) && frappe.model.can_create("Journal Entry")) {
|
||||||
@@ -97,6 +97,8 @@ cur_frm.cscript.refresh = function(doc,cdt,cdn){
|
|||||||
cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
|
cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
|
// no idea how `me` works here
|
||||||
if (cint(doc.total_amount_reimbursed) > 0 && frappe.model.can_read("Journal Entry")) {
|
if (cint(doc.total_amount_reimbursed) > 0 && frappe.model.can_read("Journal Entry")) {
|
||||||
cur_frm.add_custom_button(__('Bank Entries'), function() {
|
cur_frm.add_custom_button(__('Bank Entries'), function() {
|
||||||
frappe.route_options = {
|
frappe.route_options = {
|
||||||
@@ -107,17 +109,18 @@ cur_frm.cscript.refresh = function(doc,cdt,cdn){
|
|||||||
frappe.set_route("List", "Journal Entry");
|
frappe.set_route("List", "Journal Entry");
|
||||||
}, __("View"));
|
}, __("View"));
|
||||||
}
|
}
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.set_help = function(doc) {
|
cur_frm.cscript.set_help = function(doc) {
|
||||||
cur_frm.set_intro("");
|
cur_frm.set_intro("");
|
||||||
if(doc.__islocal && !in_list(roles, "HR User")) {
|
if(doc.__islocal && !in_list(frappe.user_roles, "HR User")) {
|
||||||
cur_frm.set_intro(__("Fill the form and save it"))
|
cur_frm.set_intro(__("Fill the form and save it"))
|
||||||
} else {
|
} else {
|
||||||
if(doc.docstatus==0 && doc.approval_status=="Draft") {
|
if(doc.docstatus==0 && doc.approval_status=="Draft") {
|
||||||
if(user==doc.exp_approver) {
|
if(frappe.session.user==doc.exp_approver) {
|
||||||
cur_frm.set_intro(__("You are the Expense Approver for this record. Please Update the 'Status' and Save"));
|
cur_frm.set_intro(__("You are the Expense Approver for this record. Please Update the 'Status' and Save"));
|
||||||
} else {
|
} else {
|
||||||
cur_frm.set_intro(__("Expense Claim is pending approval. Only the Expense Approver can update status."));
|
cur_frm.set_intro(__("Expense Claim is pending approval. Only the Expense Approver can update status."));
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ from erpnext.accounts.party import get_party_account
|
|||||||
from erpnext.accounts.general_ledger import make_gl_entries
|
from erpnext.accounts.general_ledger import make_gl_entries
|
||||||
from erpnext.accounts.doctype.sales_invoice.sales_invoice import get_bank_cash_account
|
from erpnext.accounts.doctype.sales_invoice.sales_invoice import get_bank_cash_account
|
||||||
from erpnext.controllers.accounts_controller import AccountsController
|
from erpnext.controllers.accounts_controller import AccountsController
|
||||||
|
from frappe.utils.csvutils import getlink
|
||||||
|
|
||||||
class InvalidExpenseApproverError(frappe.ValidationError): pass
|
class InvalidExpenseApproverError(frappe.ValidationError): pass
|
||||||
|
|
||||||
@@ -146,7 +147,7 @@ class ExpenseClaim(AccountsController):
|
|||||||
frappe.throw(_("Cost center is required to book an expense claim"))
|
frappe.throw(_("Cost center is required to book an expense claim"))
|
||||||
|
|
||||||
if not self.payable_account:
|
if not self.payable_account:
|
||||||
frappe.throw(_("Please set default payable account in the employee {0}").format(self.employee))
|
frappe.throw(_("Please set default payable account for the company {0}").format(getlink("Company",self.company)))
|
||||||
|
|
||||||
if self.is_paid:
|
if self.is_paid:
|
||||||
if not self.mode_of_payment:
|
if not self.mode_of_payment:
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ class JobApplicant(Document):
|
|||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.check_email_id_is_unique()
|
self.check_email_id_is_unique()
|
||||||
validate_email_add(self.email_id, True)
|
if self.email_id:
|
||||||
|
validate_email_add(self.email_id, True)
|
||||||
|
|
||||||
if not self.applicant_name and self.email_id:
|
if not self.applicant_name and self.email_id:
|
||||||
guess = self.email_id.split('@')[0]
|
guess = self.email_id.split('@')[0]
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ cur_frm.add_fetch('employee','employee_name','employee_name');
|
|||||||
|
|
||||||
frappe.ui.form.on("Leave Allocation", {
|
frappe.ui.form.on("Leave Allocation", {
|
||||||
onload: function(frm) {
|
onload: function(frm) {
|
||||||
if(!frm.doc.from_date) frm.set_value("from_date", get_today());
|
if(!frm.doc.from_date) frm.set_value("from_date", frappe.datetime.get_today());
|
||||||
|
|
||||||
frm.set_query("employee", function() {
|
frm.set_query("employee", function() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ cur_frm.add_fetch('employee','company','company');
|
|||||||
frappe.ui.form.on("Leave Application", {
|
frappe.ui.form.on("Leave Application", {
|
||||||
onload: function(frm) {
|
onload: function(frm) {
|
||||||
if (!frm.doc.posting_date) {
|
if (!frm.doc.posting_date) {
|
||||||
frm.set_value("posting_date", get_today());
|
frm.set_value("posting_date", frappe.datetime.get_today());
|
||||||
}
|
}
|
||||||
|
|
||||||
frm.set_query("leave_approver", function() {
|
frm.set_query("leave_approver", function() {
|
||||||
@@ -76,9 +76,9 @@ frappe.ui.form.on("Leave Application", {
|
|||||||
frm.set_value('half_day_date', '');
|
frm.set_value('half_day_date', '');
|
||||||
var half_day_datepicker = frm.fields_dict.half_day_date.datepicker;
|
var half_day_datepicker = frm.fields_dict.half_day_date.datepicker;
|
||||||
half_day_datepicker.update({
|
half_day_datepicker.update({
|
||||||
minDate: frappe.datetime.str_to_obj(frm.doc.from_date),
|
minDate: frappe.datetime.str_to_obj(frm.doc.from_date),
|
||||||
maxDate: frappe.datetime.str_to_obj(frm.doc.to_date)
|
maxDate: frappe.datetime.str_to_obj(frm.doc.to_date)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
get_leave_balance: function(frm) {
|
get_leave_balance: function(frm) {
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||||
// License: GNU General Public License v3. See license.txt
|
// License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
cur_frm.cscript.onload = function(doc, dt, dn){
|
cur_frm.cscript.onload = function (doc, dt, dn) {
|
||||||
if(!doc.posting_date)
|
if (!doc.posting_date)
|
||||||
set_multiple(dt, dn, {posting_date: get_today()});
|
set_multiple(dt, dn, { posting_date: frappe.datetime.get_today() });
|
||||||
if(!doc.leave_transaction_type)
|
if (!doc.leave_transaction_type)
|
||||||
set_multiple(dt, dn, {leave_transaction_type: 'Allocation'});
|
set_multiple(dt, dn, { leave_transaction_type: 'Allocation' });
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.to_date = function(doc, cdt, cdn) {
|
cur_frm.cscript.to_date = function (doc, cdt, cdn) {
|
||||||
return $c('runserverobj', args={'method':'to_date_validation','docs':doc},
|
return $c('runserverobj', { 'method': 'to_date_validation', 'docs': doc },
|
||||||
function(r, rt) {
|
function (r, rt) {
|
||||||
var doc = locals[cdt][cdn];
|
var doc = locals[cdt][cdn];
|
||||||
if (r.message) {
|
if (r.message) {
|
||||||
msgprint(__("To date cannot be before from date"));
|
frappe.msgprint(__("To date cannot be before from date"));
|
||||||
doc.to_date = '';
|
doc.to_date = '';
|
||||||
refresh_field('to_date');
|
refresh_field('to_date');
|
||||||
}
|
}
|
||||||
@@ -21,11 +21,11 @@ cur_frm.cscript.to_date = function(doc, cdt, cdn) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.allocation_type = function (doc, cdt, cdn){
|
cur_frm.cscript.allocation_type = function (doc, cdt, cdn) {
|
||||||
doc.no_of_days = '';
|
doc.no_of_days = '';
|
||||||
refresh_field('no_of_days');
|
refresh_field('no_of_days');
|
||||||
}
|
}
|
||||||
|
|
||||||
frappe.ui.form.on("Leave Control Panel", "refresh", function(frm) {
|
frappe.ui.form.on("Leave Control Panel", "refresh", function (frm) {
|
||||||
frm.disable_save();
|
frm.disable_save();
|
||||||
});
|
});
|
||||||
@@ -4,16 +4,18 @@
|
|||||||
frappe.provide("erpnext.offer_letter");
|
frappe.provide("erpnext.offer_letter");
|
||||||
|
|
||||||
frappe.ui.form.on("Offer Letter", {
|
frappe.ui.form.on("Offer Letter", {
|
||||||
select_terms: function(frm) {
|
select_terms: function (frm) {
|
||||||
frappe.model.get_value("Terms and Conditions", frm.doc.select_terms, "terms", function(value) {
|
erpnext.utils.get_terms(frm.doc.select_terms, frm.doc, function (r) {
|
||||||
frm.set_value("terms", value.terms);
|
if (!r.exc) {
|
||||||
|
frm.set_value("terms", r.message);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
refresh:function(frm){
|
refresh: function (frm) {
|
||||||
if((!frm.doc.__islocal) && (frm.doc.status=='Accepted') && (frm.doc.docstatus===1)){
|
if ((!frm.doc.__islocal) && (frm.doc.status == 'Accepted') && (frm.doc.docstatus === 1)) {
|
||||||
frm.add_custom_button(__('Make Employee'),
|
frm.add_custom_button(__('Make Employee'),
|
||||||
function() {
|
function () {
|
||||||
erpnext.offer_letter.make_employee(frm)
|
erpnext.offer_letter.make_employee(frm)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -22,7 +24,7 @@ frappe.ui.form.on("Offer Letter", {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
erpnext.offer_letter.make_employee = function(frm) {
|
erpnext.offer_letter.make_employee = function (frm) {
|
||||||
frappe.model.open_mapped_doc({
|
frappe.model.open_mapped_doc({
|
||||||
method: "erpnext.hr.doctype.offer_letter.offer_letter.make_employee",
|
method: "erpnext.hr.doctype.offer_letter.offer_letter.make_employee",
|
||||||
frm: frm
|
frm: frm
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// License: GNU General Public License v3. See license.txt
|
// License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
frappe.ui.form.on("Process Payroll", {
|
frappe.ui.form.on("Process Payroll", {
|
||||||
onload: function(frm) {
|
onload: function (frm) {
|
||||||
frm.doc.posting_date = frappe.datetime.nowdate();
|
frm.doc.posting_date = frappe.datetime.nowdate();
|
||||||
frm.doc.start_date = '';
|
frm.doc.start_date = '';
|
||||||
frm.doc.end_date = '';
|
frm.doc.end_date = '';
|
||||||
@@ -10,8 +10,8 @@ frappe.ui.form.on("Process Payroll", {
|
|||||||
frm.toggle_reqd(['payroll_frequency'], !frm.doc.salary_slip_based_on_timesheet);
|
frm.toggle_reqd(['payroll_frequency'], !frm.doc.salary_slip_based_on_timesheet);
|
||||||
},
|
},
|
||||||
|
|
||||||
setup: function(frm) {
|
setup: function (frm) {
|
||||||
frm.set_query("payment_account", function() {
|
frm.set_query("payment_account", function () {
|
||||||
var account_types = ["Bank", "Cash"];
|
var account_types = ["Bank", "Cash"];
|
||||||
return {
|
return {
|
||||||
filters: {
|
filters: {
|
||||||
@@ -21,57 +21,57 @@ frappe.ui.form.on("Process Payroll", {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
frm.set_query("cost_center", function() {
|
frm.set_query("cost_center", function () {
|
||||||
return {
|
return {
|
||||||
filters: {
|
filters: {
|
||||||
"is_group": 0,
|
"is_group": 0,
|
||||||
company: frm.doc.company
|
company: frm.doc.company
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}),
|
||||||
}),
|
frm.set_query("project", function () {
|
||||||
frm.set_query("project", function() {
|
return {
|
||||||
return {
|
filters: {
|
||||||
filters: {
|
company: frm.doc.company
|
||||||
company: frm.doc.company
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
refresh: function(frm) {
|
refresh: function (frm) {
|
||||||
frm.disable_save();
|
frm.disable_save();
|
||||||
},
|
},
|
||||||
|
|
||||||
payroll_frequency: function(frm) {
|
payroll_frequency: function (frm) {
|
||||||
frm.trigger("set_start_end_dates");
|
frm.trigger("set_start_end_dates");
|
||||||
},
|
},
|
||||||
|
|
||||||
start_date: function(frm) {
|
start_date: function (frm) {
|
||||||
frm.trigger("set_start_end_dates");
|
frm.trigger("set_start_end_dates");
|
||||||
},
|
},
|
||||||
|
|
||||||
end_date: function(frm) {
|
end_date: function (frm) {
|
||||||
frm.trigger("set_start_end_dates");
|
frm.trigger("set_start_end_dates");
|
||||||
},
|
},
|
||||||
|
|
||||||
salary_slip_based_on_timesheet: function(frm) {
|
salary_slip_based_on_timesheet: function (frm) {
|
||||||
frm.toggle_reqd(['payroll_frequency'], !frm.doc.salary_slip_based_on_timesheet);
|
frm.toggle_reqd(['payroll_frequency'], !frm.doc.salary_slip_based_on_timesheet);
|
||||||
},
|
},
|
||||||
|
|
||||||
payment_account: function(frm) {
|
payment_account: function (frm) {
|
||||||
frm.toggle_display(['make_bank_entry'], (frm.doc.payment_account!="" && frm.doc.payment_account!="undefined"));
|
frm.toggle_display(['make_bank_entry'], (frm.doc.payment_account != "" && frm.doc.payment_account != "undefined"));
|
||||||
},
|
},
|
||||||
|
|
||||||
set_start_end_dates: function(frm) {
|
set_start_end_dates: function (frm) {
|
||||||
if (!frm.doc.salary_slip_based_on_timesheet){
|
if (!frm.doc.salary_slip_based_on_timesheet) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method:'erpnext.hr.doctype.process_payroll.process_payroll.get_start_end_dates',
|
method: 'erpnext.hr.doctype.process_payroll.process_payroll.get_start_end_dates',
|
||||||
args:{
|
args: {
|
||||||
payroll_frequency: frm.doc.payroll_frequency,
|
payroll_frequency: frm.doc.payroll_frequency,
|
||||||
start_date: frm.doc.start_date || frm.doc.posting_date
|
start_date: frm.doc.start_date || frm.doc.posting_date
|
||||||
},
|
},
|
||||||
callback: function(r){
|
callback: function (r) {
|
||||||
if (r.message){
|
if (r.message) {
|
||||||
frm.set_value('start_date', r.message.start_date);
|
frm.set_value('start_date', r.message.start_date);
|
||||||
frm.set_value('end_date', r.message.end_date);
|
frm.set_value('end_date', r.message.end_date);
|
||||||
}
|
}
|
||||||
@@ -81,60 +81,60 @@ frappe.ui.form.on("Process Payroll", {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
cur_frm.cscript.display_activity_log = function(msg) {
|
cur_frm.cscript.display_activity_log = function (msg) {
|
||||||
if(!cur_frm.ss_html)
|
if (!cur_frm.ss_html)
|
||||||
cur_frm.ss_html = $a(cur_frm.fields_dict['activity_log'].wrapper,'div');
|
cur_frm.ss_html = $a(cur_frm.fields_dict['activity_log'].wrapper, 'div');
|
||||||
if(msg) {
|
if (msg) {
|
||||||
cur_frm.ss_html.innerHTML =
|
cur_frm.ss_html.innerHTML =
|
||||||
'<div class="padding"><h4>'+__("Activity Log:")+'</h4>'+msg+'</div>';
|
'<div class="padding"><h4>' + __("Activity Log:") + '</h4>' + msg + '</div>';
|
||||||
} else {
|
} else {
|
||||||
cur_frm.ss_html.innerHTML = "";
|
cur_frm.ss_html.innerHTML = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Create salary slip
|
// Create salary slip
|
||||||
//-----------------------
|
// -----------------------
|
||||||
cur_frm.cscript.create_salary_slip = function(doc, cdt, cdn) {
|
cur_frm.cscript.create_salary_slip = function (doc, cdt, cdn) {
|
||||||
cur_frm.cscript.display_activity_log("");
|
cur_frm.cscript.display_activity_log("");
|
||||||
var callback = function(r, rt){
|
var callback = function (r, rt) {
|
||||||
if (r.message)
|
if (r.message)
|
||||||
cur_frm.cscript.display_activity_log(r.message);
|
cur_frm.cscript.display_activity_log(r.message);
|
||||||
}
|
}
|
||||||
return $c('runserverobj', args={'method':'create_salary_slips','docs':doc},callback);
|
return $c('runserverobj', { 'method': 'create_salary_slips', 'docs': doc }, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.submit_salary_slip = function(doc, cdt, cdn) {
|
cur_frm.cscript.submit_salary_slip = function (doc, cdt, cdn) {
|
||||||
cur_frm.cscript.display_activity_log("");
|
cur_frm.cscript.display_activity_log("");
|
||||||
|
|
||||||
frappe.confirm(__("Do you really want to Submit all Salary Slip from {0} to {1}", [doc.start_date, doc.end_date]), function() {
|
frappe.confirm(__("Do you really want to Submit all Salary Slip from {0} to {1}", [doc.start_date, doc.end_date]), function () {
|
||||||
// clear all in locals
|
// clear all in locals
|
||||||
if(locals["Salary Slip"]) {
|
if (locals["Salary Slip"]) {
|
||||||
$.each(locals["Salary Slip"], function(name, d) {
|
$.each(locals["Salary Slip"], function (name, d) {
|
||||||
frappe.model.remove_from_locals("Salary Slip", name);
|
frappe.model.remove_from_locals("Salary Slip", name);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var callback = function(r, rt){
|
var callback = function (r, rt) {
|
||||||
if (r.message)
|
if (r.message)
|
||||||
cur_frm.cscript.display_activity_log(r.message);
|
cur_frm.cscript.display_activity_log(r.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $c('runserverobj', args={'method':'submit_salary_slips','docs':doc},callback);
|
return $c('runserverobj', { 'method': 'submit_salary_slips', 'docs': doc }, callback);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.make_bank_entry = function(doc, cdt, cdn){
|
cur_frm.cscript.make_bank_entry = function (doc, cdt, cdn) {
|
||||||
if(doc.company && doc.start_date && doc.end_date){
|
if (doc.company && doc.start_date && doc.end_date) {
|
||||||
return frappe.call({
|
return frappe.call({
|
||||||
doc: cur_frm.doc,
|
doc: cur_frm.doc,
|
||||||
method: "make_payment_entry",
|
method: "make_payment_entry",
|
||||||
callback: function(r) {
|
callback: function (r) {
|
||||||
if (r.message)
|
if (r.message)
|
||||||
var doc = frappe.model.sync(r.message)[0];
|
var doc = frappe.model.sync(r.message)[0];
|
||||||
frappe.set_route("Form", doc.doctype, doc.name);
|
frappe.set_route("Form", doc.doctype, doc.name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
msgprint(__("Company, From Date and To Date is mandatory"));
|
frappe.msgprint(__("Company, From Date and To Date is mandatory"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -39,7 +39,7 @@ frappe.ui.form.on("Salary Slip", {
|
|||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
frm.trigger("toggle_fields")
|
frm.trigger("toggle_fields")
|
||||||
frm.trigger("toggle_reqd_fields")
|
frm.trigger("toggle_reqd_fields")
|
||||||
salary_detail_fields = ['formula', 'abbr', 'statistical_component']
|
var salary_detail_fields = ['formula', 'abbr', 'statistical_component']
|
||||||
cur_frm.fields_dict['earnings'].grid.set_column_disp(salary_detail_fields,false);
|
cur_frm.fields_dict['earnings'].grid.set_column_disp(salary_detail_fields,false);
|
||||||
cur_frm.fields_dict['deductions'].grid.set_column_disp(salary_detail_fields,false);
|
cur_frm.fields_dict['deductions'].grid.set_column_disp(salary_detail_fields,false);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class SalarySlip(TransactionBase):
|
|||||||
frappe.throw(_("Name error: {0}".format(err)))
|
frappe.throw(_("Name error: {0}".format(err)))
|
||||||
except SyntaxError as err:
|
except SyntaxError as err:
|
||||||
frappe.throw(_("Syntax error in formula or condition: {0}".format(err)))
|
frappe.throw(_("Syntax error in formula or condition: {0}".format(err)))
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
frappe.throw(_("Error in formula or condition: {0}".format(e)))
|
frappe.throw(_("Error in formula or condition: {0}".format(e)))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@@ -330,11 +330,18 @@ class SalarySlip(TransactionBase):
|
|||||||
frappe.throw(_("Please set the Date Of Joining for employee {0}").format(frappe.bold(self.employee_name)))
|
frappe.throw(_("Please set the Date Of Joining for employee {0}").format(frappe.bold(self.employee_name)))
|
||||||
|
|
||||||
for d in self.get(component_type):
|
for d in self.get(component_type):
|
||||||
if self.salary_structure and ((cint(d.depends_on_lwp) == 1 and not self.salary_slip_based_on_timesheet) or\
|
if (self.salary_structure and
|
||||||
getdate(self.start_date) < joining_date or getdate(self.end_date) > relieving_date):
|
cint(d.depends_on_lwp) and
|
||||||
|
(not
|
||||||
|
self.salary_slip_based_on_timesheet or
|
||||||
|
getdate(self.start_date) < joining_date or
|
||||||
|
getdate(self.end_date) > relieving_date
|
||||||
|
)):
|
||||||
|
|
||||||
d.amount = rounded((flt(d.default_amount) * flt(self.payment_days)
|
d.amount = rounded(
|
||||||
/ cint(self.total_working_days)), self.precision("amount", component_type))
|
(flt(d.default_amount) * flt(self.payment_days)
|
||||||
|
/ cint(self.total_working_days)), self.precision("amount", component_type)
|
||||||
|
)
|
||||||
elif not self.payment_days and not self.salary_slip_based_on_timesheet:
|
elif not self.payment_days and not self.salary_slip_based_on_timesheet:
|
||||||
d.amount = 0
|
d.amount = 0
|
||||||
elif not d.amount:
|
elif not d.amount:
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ cur_frm.add_fetch('company', 'default_letter_head', 'letter_head');
|
|||||||
|
|
||||||
|
|
||||||
cur_frm.cscript.onload = function(doc, dt, dn){
|
cur_frm.cscript.onload = function(doc, dt, dn){
|
||||||
e_tbl = doc.earnings || [];
|
var e_tbl = doc.earnings || [];
|
||||||
d_tbl = doc.deductions || [];
|
var d_tbl = doc.deductions || [];
|
||||||
if (e_tbl.length == 0 && d_tbl.length == 0)
|
if (e_tbl.length == 0 && d_tbl.length == 0)
|
||||||
return function(r, rt) { refresh_many(['earnings', 'deductions']);};
|
return function(r, rt) { refresh_many(['earnings', 'deductions']);};
|
||||||
}
|
}
|
||||||
@@ -16,7 +16,7 @@ cur_frm.cscript.onload = function(doc, dt, dn){
|
|||||||
frappe.ui.form.on('Salary Structure', {
|
frappe.ui.form.on('Salary Structure', {
|
||||||
onload: function(frm) {
|
onload: function(frm) {
|
||||||
frm.toggle_reqd(['payroll_frequency'], !frm.doc.salary_slip_based_on_timesheet),
|
frm.toggle_reqd(['payroll_frequency'], !frm.doc.salary_slip_based_on_timesheet),
|
||||||
|
|
||||||
frm.set_query("salary_component", "earnings", function() {
|
frm.set_query("salary_component", "earnings", function() {
|
||||||
return {
|
return {
|
||||||
filters: {
|
filters: {
|
||||||
@@ -40,19 +40,19 @@ frappe.ui.form.on('Salary Structure', {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
frm.trigger("toggle_fields");
|
frm.trigger("toggle_fields");
|
||||||
frm.fields_dict['earnings'].grid.set_column_disp("default_amount", false);
|
frm.fields_dict['earnings'].grid.set_column_disp("default_amount", false);
|
||||||
frm.fields_dict['deductions'].grid.set_column_disp("default_amount", false);
|
frm.fields_dict['deductions'].grid.set_column_disp("default_amount", false);
|
||||||
|
|
||||||
frm.add_custom_button(__("Preview Salary Slip"),
|
frm.add_custom_button(__("Preview Salary Slip"),
|
||||||
function() { frm.trigger('preview_salary_slip'); }, "fa fa-sitemap", "btn-default");
|
function() { frm.trigger('preview_salary_slip'); }, "fa fa-sitemap", "btn-default");
|
||||||
|
|
||||||
frm.add_custom_button(__("Add Employees"),function () {
|
frm.add_custom_button(__("Add Employees"),function () {
|
||||||
frm.trigger('add_employees')
|
frm.trigger('add_employees')
|
||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
add_employees:function (frm) {
|
add_employees:function (frm) {
|
||||||
@@ -108,21 +108,24 @@ frappe.ui.form.on('Salary Structure', {
|
|||||||
salary_slip_based_on_timesheet: function(frm) {
|
salary_slip_based_on_timesheet: function(frm) {
|
||||||
frm.trigger("toggle_fields")
|
frm.trigger("toggle_fields")
|
||||||
},
|
},
|
||||||
|
|
||||||
preview_salary_slip: function(frm) {
|
preview_salary_slip: function(frm) {
|
||||||
var d = new frappe.ui.Dialog({
|
var d = new frappe.ui.Dialog({
|
||||||
title: __("Preview Salary Slip"),
|
title: __("Preview Salary Slip"),
|
||||||
fields: [
|
fields: [
|
||||||
{"fieldname":"employee", "fieldtype":"Select", "label":__("Employee"),
|
{ "fieldname":"employee", "fieldtype":"Select", "label":__("Employee"),
|
||||||
options: $.map(frm.doc.employees, function(d) { return d.employee }), reqd: 1, label:"Employee"},
|
options: $.map(frm.doc.employees, function(d) { return d.employee }), reqd: 1 },
|
||||||
{fieldname:"fetch", "label":__("Show Salary Slip"), "fieldtype":"Button"}
|
{ fieldname:"fetch", "label":__("Show Salary Slip"), "fieldtype":"Button"}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
d.get_input("fetch").on("click", function() {
|
d.get_input("fetch").on("click", function() {
|
||||||
var values = d.get_values();
|
var values = d.get_values();
|
||||||
if(!values) return;
|
if(!values) return;
|
||||||
frm.doc.salary_slip_based_on_timesheet?print_format="Salary Slip based on Timesheet":print_format="Salary Slip Standard";
|
var print_format;
|
||||||
|
frm.doc.salary_slip_based_on_timesheet ?
|
||||||
|
print_format="Salary Slip based on Timesheet" :
|
||||||
|
print_format="Salary Slip Standard";
|
||||||
|
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "erpnext.hr.doctype.salary_structure.salary_structure.make_salary_slip",
|
method: "erpnext.hr.doctype.salary_structure.salary_structure.make_salary_slip",
|
||||||
args: {
|
args: {
|
||||||
@@ -140,7 +143,7 @@ frappe.ui.form.on('Salary Structure', {
|
|||||||
});
|
});
|
||||||
d.show();
|
d.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
toggle_fields: function(frm) {
|
toggle_fields: function(frm) {
|
||||||
frm.toggle_display(['salary_component', 'hour_rate'], frm.doc.salary_slip_based_on_timesheet);
|
frm.toggle_display(['salary_component', 'hour_rate'], frm.doc.salary_slip_based_on_timesheet);
|
||||||
frm.toggle_reqd(['salary_component', 'hour_rate'], frm.doc.salary_slip_based_on_timesheet);
|
frm.toggle_reqd(['salary_component', 'hour_rate'], frm.doc.salary_slip_based_on_timesheet);
|
||||||
@@ -184,11 +187,11 @@ frappe.ui.form.on('Salary Detail', {
|
|||||||
amount: function(frm) {
|
amount: function(frm) {
|
||||||
calculate_totals(frm.doc);
|
calculate_totals(frm.doc);
|
||||||
},
|
},
|
||||||
|
|
||||||
earnings_remove: function(frm) {
|
earnings_remove: function(frm) {
|
||||||
calculate_totals(frm.doc);
|
calculate_totals(frm.doc);
|
||||||
},
|
},
|
||||||
|
|
||||||
deductions_remove: function(frm) {
|
deductions_remove: function(frm) {
|
||||||
calculate_totals(frm.doc);
|
calculate_totals(frm.doc);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"allow_copy": 0,
|
"allow_copy": 0,
|
||||||
|
"allow_guest_to_view": 0,
|
||||||
"allow_import": 1,
|
"allow_import": 1,
|
||||||
"allow_rename": 1,
|
"allow_rename": 1,
|
||||||
"autoname": "field:event_name",
|
"autoname": "field:event_name",
|
||||||
@@ -12,6 +13,7 @@
|
|||||||
"editable_grid": 1,
|
"editable_grid": 1,
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -27,7 +29,7 @@
|
|||||||
"in_standard_filter": 0,
|
"in_standard_filter": 0,
|
||||||
"label": "Event Name",
|
"label": "Event Name",
|
||||||
"length": 0,
|
"length": 0,
|
||||||
"no_copy": 0,
|
"no_copy": 1,
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"precision": "",
|
"precision": "",
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
@@ -41,6 +43,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 1,
|
"allow_on_submit": 1,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -71,6 +74,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -99,6 +103,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -129,6 +134,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -157,6 +163,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -186,6 +193,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -216,6 +224,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -244,6 +253,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -274,6 +284,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -303,6 +314,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -331,6 +343,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -361,6 +374,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -390,6 +404,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -418,6 +433,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -447,6 +463,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -476,6 +493,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -504,6 +522,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -533,6 +552,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -562,6 +582,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -592,6 +613,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 1,
|
"allow_on_submit": 1,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -622,6 +644,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@@ -651,17 +674,17 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"has_web_view": 0,
|
||||||
"hide_heading": 0,
|
"hide_heading": 0,
|
||||||
"hide_toolbar": 0,
|
"hide_toolbar": 0,
|
||||||
"idx": 0,
|
"idx": 0,
|
||||||
"image_view": 0,
|
"image_view": 0,
|
||||||
"in_create": 0,
|
"in_create": 0,
|
||||||
"in_dialog": 0,
|
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2017-02-17 16:51:35.141403",
|
"modified": "2017-05-29 06:13:38.411039",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Training Event",
|
"name": "Training Event",
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ class TrainingResult(Document):
|
|||||||
|
|
||||||
def send_result(self):
|
def send_result(self):
|
||||||
for emp in self.employees:
|
for emp in self.employees:
|
||||||
message = "Thank You for attending {0}. You grade is {1}".format(self.training_event, emp.grade)
|
message = "Thank You for attending {0}.".format(self.training_event)
|
||||||
|
if emp.grade:
|
||||||
|
message = message + "Your grade: {0}".format(emp.grade)
|
||||||
frappe.sendmail(frappe.db.get_value("Employee", emp.employee, "company_email"), \
|
frappe.sendmail(frappe.db.get_value("Employee", emp.employee, "company_email"), \
|
||||||
subject=_("{0} Results".format(self.training_event)), \
|
subject=_("{0} Results".format(self.training_event)), \
|
||||||
content=message)
|
content=message)
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ frappe.provide("erpnext.hr");
|
|||||||
|
|
||||||
erpnext.hr.AttendanceControlPanel = frappe.ui.form.Controller.extend({
|
erpnext.hr.AttendanceControlPanel = frappe.ui.form.Controller.extend({
|
||||||
onload: function() {
|
onload: function() {
|
||||||
this.frm.set_value("att_fr_date", get_today());
|
this.frm.set_value("att_fr_date", frappe.datetime.get_today());
|
||||||
this.frm.set_value("att_to_date", get_today());
|
this.frm.set_value("att_to_date", frappe.datetime.get_today());
|
||||||
},
|
},
|
||||||
|
|
||||||
refresh: function() {
|
refresh: function() {
|
||||||
@@ -18,7 +18,7 @@ erpnext.hr.AttendanceControlPanel = frappe.ui.form.Controller.extend({
|
|||||||
|
|
||||||
get_template:function() {
|
get_template:function() {
|
||||||
if(!this.frm.doc.att_fr_date || !this.frm.doc.att_to_date) {
|
if(!this.frm.doc.att_fr_date || !this.frm.doc.att_to_date) {
|
||||||
msgprint(__("Attendance From Date and Attendance To Date is mandatory"));
|
frappe.msgprint(__("Attendance From Date and Attendance To Date is mandatory"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
window.location.href = repl(frappe.request.url +
|
window.location.href = repl(frappe.request.url +
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
frappe.ui.form.on("Vehicle Log", {
|
frappe.ui.form.on("Vehicle Log", {
|
||||||
refresh: function(frm,cdt,cdn) {
|
refresh: function(frm,cdt,cdn) {
|
||||||
vehicle_log=frappe.model.get_doc(cdt,cdn);
|
var vehicle_log=frappe.model.get_doc(cdt,cdn);
|
||||||
if (vehicle_log.license_plate) {
|
if (vehicle_log.license_plate) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "erpnext.hr.doctype.vehicle_log.vehicle_log.get_make_model",
|
method: "erpnext.hr.doctype.vehicle_log.vehicle_log.get_make_model",
|
||||||
@@ -26,16 +26,16 @@ frappe.ui.form.on("Vehicle Log", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
expense_claim: function(frm){
|
expense_claim: function(frm){
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "erpnext.hr.doctype.vehicle_log.vehicle_log.make_expense_claim",
|
method: "erpnext.hr.doctype.vehicle_log.vehicle_log.make_expense_claim",
|
||||||
args:{
|
args:{
|
||||||
docname: frm.doc.name
|
docname: frm.doc.name
|
||||||
},
|
},
|
||||||
callback: function(r){
|
callback: function(r){
|
||||||
var doc = frappe.model.sync(r.message);
|
var doc = frappe.model.sync(r.message);
|
||||||
frappe.set_route('Form', 'Expense Claim', r.message.name);
|
frappe.set_route('Form', 'Expense Claim', r.message.name);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -54,17 +54,18 @@ frappe.team_updates = {
|
|||||||
data.avatar = frappe.avatar(data.sender);
|
data.avatar = frappe.avatar(data.sender);
|
||||||
data.when = comment_when(data.creation);
|
data.when = comment_when(data.creation);
|
||||||
|
|
||||||
var date = dateutil.str_to_obj(data.creation);
|
var date = frappe.datetime.str_to_obj(data.creation);
|
||||||
var last = me.last_feed_date;
|
var last = me.last_feed_date;
|
||||||
|
|
||||||
if((last && dateutil.obj_to_str(last) != dateutil.obj_to_str(date)) || (!last)) {
|
if((last && frappe.datetime.obj_to_str(last) != frappe.datetime.obj_to_str(date)) || (!last)) {
|
||||||
var diff = dateutil.get_day_diff(dateutil.get_today(), dateutil.obj_to_str(date));
|
var diff = frappe.datetime.get_day_diff(frappe.datetime.get_today(), frappe.datetime.obj_to_str(date));
|
||||||
|
var pdate;
|
||||||
if(diff < 1) {
|
if(diff < 1) {
|
||||||
pdate = 'Today';
|
pdate = 'Today';
|
||||||
} else if(diff < 2) {
|
} else if(diff < 2) {
|
||||||
pdate = 'Yesterday';
|
pdate = 'Yesterday';
|
||||||
} else {
|
} else {
|
||||||
pdate = dateutil.global_date_format(date);
|
pdate = frappe.datetime.global_date_format(date);
|
||||||
}
|
}
|
||||||
data.date_sep = pdate;
|
data.date_sep = pdate;
|
||||||
data.date_class = pdate=='Today' ? "date-indicator blue" : "date-indicator";
|
data.date_class = pdate=='Today' ? "date-indicator blue" : "date-indicator";
|
||||||
|
|||||||
@@ -25,11 +25,10 @@ def get_columns():
|
|||||||
]
|
]
|
||||||
|
|
||||||
def get_employees(filters):
|
def get_employees(filters):
|
||||||
holiday_filter = {"holiday_date": (">=", filters.from_date),
|
holiday_filter = [["holiday_date", ">=", filters.from_date], ["holiday_date", "<=", filters.to_date]]
|
||||||
"holiday_date": ("<=", filters.to_date)}
|
|
||||||
if filters.holiday_list:
|
if filters.holiday_list:
|
||||||
holiday_filter["parent"] = filters.holiday_list
|
holiday_filter.append(["parent", "=", filters.holiday_list])
|
||||||
|
|
||||||
holidays = frappe.get_all("Holiday", fields=["holiday_date", "description"],
|
holidays = frappe.get_all("Holiday", fields=["holiday_date", "description"],
|
||||||
filters=holiday_filter)
|
filters=holiday_filter)
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ frappe.query_reports["Salary Register"] = {
|
|||||||
"fieldname":"date_range",
|
"fieldname":"date_range",
|
||||||
"label": __("Date Range"),
|
"label": __("Date Range"),
|
||||||
"fieldtype": "DateRange",
|
"fieldtype": "DateRange",
|
||||||
"default": [frappe.datetime.add_months(get_today(),-1), frappe.datetime.get_today()],
|
"default": [frappe.datetime.add_months(frappe.datetime.get_today(),-1), frappe.datetime.get_today()],
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ erpnext.maintenance.MaintenanceSchedule = frappe.ui.form.Controller.extend({
|
|||||||
|
|
||||||
if (item.start_date && item.end_date && item.periodicity) {
|
if (item.start_date && item.end_date && item.periodicity) {
|
||||||
if(item.start_date > item.end_date) {
|
if(item.start_date > item.end_date) {
|
||||||
msgprint(__("Row {0}:Start Date must be before End Date", [item.idx]));
|
frappe.msgprint(__("Row {0}:Start Date must be before End Date", [item.idx]));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ cur_frm.cscript.onload = function(doc, dt, dn) {
|
|||||||
if(!doc.status) set_multiple(dt,dn,{status:'Draft'});
|
if(!doc.status) set_multiple(dt,dn,{status:'Draft'});
|
||||||
|
|
||||||
if(doc.__islocal){
|
if(doc.__islocal){
|
||||||
set_multiple(dt,dn,{transaction_date:get_today()});
|
set_multiple(dt,dn,{transaction_date: frappe.datetime.get_today()});
|
||||||
}
|
}
|
||||||
|
|
||||||
// set add fetch for item_code's item_name and description
|
// set add fetch for item_code's item_name and description
|
||||||
@@ -108,12 +108,12 @@ cur_frm.cscript.onload = function(doc, dt, dn) {
|
|||||||
|
|
||||||
cur_frm.cscript.generate_schedule = function(doc, cdt, cdn) {
|
cur_frm.cscript.generate_schedule = function(doc, cdt, cdn) {
|
||||||
if (!doc.__islocal) {
|
if (!doc.__islocal) {
|
||||||
return $c('runserverobj', args={'method':'generate_schedule', 'docs':doc},
|
return $c('runserverobj', {'method':'generate_schedule', 'docs':doc},
|
||||||
function(r, rt) {
|
function(r, rt) {
|
||||||
refresh_field('schedules');
|
refresh_field('schedules');
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
msgprint(__("Please save the document before generating maintenance schedule"));
|
frappe.msgprint(__("Please save the document before generating maintenance schedule"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,8 +66,7 @@ class MaintenanceSchedule(TransactionBase):
|
|||||||
parent=%s""", (d.sales_person, d.item_code, self.name), as_dict=1)
|
parent=%s""", (d.sales_person, d.item_code, self.name), as_dict=1)
|
||||||
|
|
||||||
for key in scheduled_date:
|
for key in scheduled_date:
|
||||||
description = frappe._("Reference: %s, Item Code: %s and Customer: %s") % \
|
description =frappe._("Reference: {0}, Item Code: {1} and Customer: {2}").format(self.name, d.item_code, self.customer)
|
||||||
(self.name, d.item_code, self.customer)
|
|
||||||
frappe.get_doc({
|
frappe.get_doc({
|
||||||
"doctype": "Event",
|
"doctype": "Event",
|
||||||
"owner": email_map.get(d.sales_person, self.owner),
|
"owner": email_map.get(d.sales_person, self.owner),
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
// License: GNU General Public License v3. See license.txt
|
// License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
frappe.provide("erpnext.maintenance");
|
frappe.provide("erpnext.maintenance");
|
||||||
me.frm.set_query('contact_person', erpnext.queries.contact_query);
|
|
||||||
|
|
||||||
|
|
||||||
frappe.ui.form.on('Maintenance Visit', {
|
frappe.ui.form.on('Maintenance Visit', {
|
||||||
setup: function(frm) {
|
setup: function(frm) {
|
||||||
@@ -85,7 +83,7 @@ $.extend(cur_frm.cscript, new erpnext.maintenance.MaintenanceVisit({frm: cur_frm
|
|||||||
|
|
||||||
cur_frm.cscript.onload = function(doc, dt, dn) {
|
cur_frm.cscript.onload = function(doc, dt, dn) {
|
||||||
if(!doc.status) set_multiple(dt,dn,{status:'Draft'});
|
if(!doc.status) set_multiple(dt,dn,{status:'Draft'});
|
||||||
if(doc.__islocal) set_multiple(dt,dn,{mntc_date:get_today()});
|
if(doc.__islocal) set_multiple(dt,dn,{mntc_date: frappe.datetime.get_today()});
|
||||||
|
|
||||||
// set add fetch for item_code's item_name and description
|
// set add fetch for item_code's item_name and description
|
||||||
cur_frm.add_fetch('item_code', 'item_name', 'item_name');
|
cur_frm.add_fetch('item_code', 'item_name', 'item_name');
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ erpnext.bom.BomController = erpnext.TransactionController.extend({
|
|||||||
|
|
||||||
item_code: function(doc, cdt, cdn){
|
item_code: function(doc, cdt, cdn){
|
||||||
var scrap_items = false;
|
var scrap_items = false;
|
||||||
child = locals[cdt][cdn];
|
var child = locals[cdt][cdn];
|
||||||
if(child.doctype == 'BOM Scrap Item') {
|
if(child.doctype == 'BOM Scrap Item') {
|
||||||
scrap_items = true;
|
scrap_items = true;
|
||||||
}
|
}
|
||||||
@@ -141,12 +141,12 @@ cur_frm.cscript.rate = function(doc, cdt, cdn) {
|
|||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
var scrap_items = false;
|
var scrap_items = false;
|
||||||
|
|
||||||
if(child.doctype == 'BOM Scrap Item') {
|
if(cdt == 'BOM Scrap Item') {
|
||||||
scrap_items = true;
|
scrap_items = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d.bom_no) {
|
if (d.bom_no) {
|
||||||
msgprint(__("You can not change rate if BOM mentioned agianst any item"));
|
frappe.msgprint(__("You can not change rate if BOM mentioned agianst any item"));
|
||||||
get_bom_material_detail(doc, cdt, cdn, scrap_items);
|
get_bom_material_detail(doc, cdt, cdn, scrap_items);
|
||||||
} else {
|
} else {
|
||||||
erpnext.bom.calculate_rm_cost(doc);
|
erpnext.bom.calculate_rm_cost(doc);
|
||||||
@@ -168,8 +168,8 @@ erpnext.bom.calculate_op_cost = function(doc) {
|
|||||||
doc.base_operating_cost = 0.0;
|
doc.base_operating_cost = 0.0;
|
||||||
|
|
||||||
for(var i=0;i<op.length;i++) {
|
for(var i=0;i<op.length;i++) {
|
||||||
operating_cost = flt(flt(op[i].hour_rate) * flt(op[i].time_in_mins) / 60, 2);
|
var operating_cost = flt(flt(op[i].hour_rate) * flt(op[i].time_in_mins) / 60, 2);
|
||||||
base_operating_cost = flt(flt(op[i].base_hour_rate) * flt(op[i].time_in_mins) / 60, 2);
|
var base_operating_cost = flt(flt(op[i].base_hour_rate) * flt(op[i].time_in_mins) / 60, 2);
|
||||||
frappe.model.set_value('BOM Operation',op[i].name, "operating_cost", operating_cost);
|
frappe.model.set_value('BOM Operation',op[i].name, "operating_cost", operating_cost);
|
||||||
frappe.model.set_value('BOM Operation',op[i].name, "base_operating_cost", base_operating_cost);
|
frappe.model.set_value('BOM Operation',op[i].name, "base_operating_cost", base_operating_cost);
|
||||||
|
|
||||||
@@ -182,11 +182,11 @@ erpnext.bom.calculate_op_cost = function(doc) {
|
|||||||
// rm : raw material
|
// rm : raw material
|
||||||
erpnext.bom.calculate_rm_cost = function(doc) {
|
erpnext.bom.calculate_rm_cost = function(doc) {
|
||||||
var rm = doc.items || [];
|
var rm = doc.items || [];
|
||||||
total_rm_cost = 0;
|
var total_rm_cost = 0;
|
||||||
base_total_rm_cost = 0;
|
var base_total_rm_cost = 0;
|
||||||
for(var i=0;i<rm.length;i++) {
|
for(var i=0;i<rm.length;i++) {
|
||||||
amount = flt(rm[i].rate) * flt(rm[i].qty);
|
var amount = flt(rm[i].rate) * flt(rm[i].qty);
|
||||||
base_amount = flt(rm[i].rate) * flt(doc.conversion_rate) * flt(rm[i].qty);
|
var base_amount = flt(rm[i].rate) * flt(doc.conversion_rate) * flt(rm[i].qty);
|
||||||
frappe.model.set_value('BOM Item', rm[i].name, 'base_rate', flt(rm[i].rate) * flt(doc.conversion_rate))
|
frappe.model.set_value('BOM Item', rm[i].name, 'base_rate', flt(rm[i].rate) * flt(doc.conversion_rate))
|
||||||
frappe.model.set_value('BOM Item', rm[i].name, 'amount', amount)
|
frappe.model.set_value('BOM Item', rm[i].name, 'amount', amount)
|
||||||
frappe.model.set_value('BOM Item', rm[i].name, 'qty_consumed_per_unit', flt(rm[i].qty)/flt(doc.quantity))
|
frappe.model.set_value('BOM Item', rm[i].name, 'qty_consumed_per_unit', flt(rm[i].qty)/flt(doc.quantity))
|
||||||
@@ -201,13 +201,13 @@ erpnext.bom.calculate_rm_cost = function(doc) {
|
|||||||
//sm : scrap material
|
//sm : scrap material
|
||||||
erpnext.bom.calculate_scrap_materials_cost = function(doc) {
|
erpnext.bom.calculate_scrap_materials_cost = function(doc) {
|
||||||
var sm = doc.scrap_items || [];
|
var sm = doc.scrap_items || [];
|
||||||
total_sm_cost = 0;
|
var total_sm_cost = 0;
|
||||||
base_total_sm_cost = 0;
|
var base_total_sm_cost = 0;
|
||||||
|
|
||||||
for(var i=0;i<sm.length;i++) {
|
for(var i=0;i<sm.length;i++) {
|
||||||
base_rate = flt(sm[i].rate) * flt(doc.conversion_rate);
|
var base_rate = flt(sm[i].rate) * flt(doc.conversion_rate);
|
||||||
amount = flt(sm[i].rate) * flt(sm[i].qty);
|
var amount = flt(sm[i].rate) * flt(sm[i].qty);
|
||||||
base_amount = flt(sm[i].rate) * flt(sm[i].qty) * flt(doc.conversion_rate);
|
var base_amount = flt(sm[i].rate) * flt(sm[i].qty) * flt(doc.conversion_rate);
|
||||||
frappe.model.set_value('BOM Scrap Item',sm[i].name, 'base_rate', base_rate);
|
frappe.model.set_value('BOM Scrap Item',sm[i].name, 'base_rate', base_rate);
|
||||||
frappe.model.set_value('BOM Scrap Item',sm[i].name, 'amount', amount);
|
frappe.model.set_value('BOM Scrap Item',sm[i].name, 'amount', amount);
|
||||||
frappe.model.set_value('BOM Scrap Item',sm[i].name, 'base_amount', base_amount);
|
frappe.model.set_value('BOM Scrap Item',sm[i].name, 'base_amount', base_amount);
|
||||||
@@ -222,15 +222,15 @@ erpnext.bom.calculate_scrap_materials_cost = function(doc) {
|
|||||||
|
|
||||||
// Calculate Total Cost
|
// Calculate Total Cost
|
||||||
erpnext.bom.calculate_total = function(doc) {
|
erpnext.bom.calculate_total = function(doc) {
|
||||||
total_cost = flt(doc.operating_cost) + flt(doc.raw_material_cost) - flt(doc.scrap_material_cost);
|
var total_cost = flt(doc.operating_cost) + flt(doc.raw_material_cost) - flt(doc.scrap_material_cost);
|
||||||
base_total_cost = flt(doc.base_operating_cost) + flt(doc.base_raw_material_cost) - flt(doc.base_scrap_material_cost);
|
var base_total_cost = flt(doc.base_operating_cost) + flt(doc.base_raw_material_cost) - flt(doc.base_scrap_material_cost);
|
||||||
cur_frm.set_value("total_cost", total_cost);
|
cur_frm.set_value("total_cost", total_cost);
|
||||||
cur_frm.set_value("base_total_cost", base_total_cost);
|
cur_frm.set_value("base_total_cost", base_total_cost);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cur_frm.fields_dict['item'].get_query = function(doc) {
|
cur_frm.fields_dict['item'].get_query = function(doc) {
|
||||||
return{
|
return{
|
||||||
query: "erpnext.controllers.queries.item_query"
|
query: "erpnext.controllers.queries.item_query"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user