Compare commits
84 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7cf945c975 | ||
|
|
4bc12b68e4 | ||
|
|
4dc5f0efaf | ||
|
|
96abfd2ab9 | ||
|
|
75443a94ee | ||
|
|
cc884578b5 | ||
|
|
179e0c1d8d | ||
|
|
34d6340be6 | ||
|
|
77940493a8 | ||
|
|
a5b53e9480 | ||
|
|
f773af6053 | ||
|
|
119a50e228 | ||
|
|
11ec2c50e0 | ||
|
|
1e74519726 | ||
|
|
05ed86a00e | ||
|
|
d40ae81fc9 | ||
|
|
44f7b157ff | ||
|
|
3499ba08df | ||
|
|
51a397c97f | ||
|
|
bb34c57603 | ||
|
|
f7e6934d7c | ||
|
|
21cbbae88f | ||
|
|
94704beba3 | ||
|
|
429e5d57d5 | ||
|
|
0abec034df | ||
|
|
3a9ca883b9 | ||
|
|
bf59b5927f | ||
|
|
bab226698f | ||
|
|
43edd5d03c | ||
|
|
3f83afe4e1 | ||
|
|
ea3e6b93a7 | ||
|
|
42274a4591 | ||
|
|
66f460ffbc | ||
|
|
0590d1da05 | ||
|
|
98aa581864 | ||
|
|
758c389ef3 | ||
|
|
58ab203fc0 | ||
|
|
6605919ecd | ||
|
|
feeb47dbbe | ||
|
|
deeb1380b1 | ||
|
|
0f86d86e27 | ||
|
|
731b66b788 | ||
|
|
241139001e | ||
|
|
a10cd10640 | ||
|
|
44ef8654f9 | ||
|
|
71862f9024 | ||
|
|
a5e3c3a79f | ||
|
|
cc97ec9202 | ||
|
|
022ab63a0f | ||
|
|
cdf8016bcd | ||
|
|
18c8cf965f | ||
|
|
8e3da7f70e | ||
|
|
887285ed1a | ||
|
|
aeb0026354 | ||
|
|
1ce48e7032 | ||
|
|
99e31f97b8 | ||
|
|
4a864c1eea | ||
|
|
3e998bccba | ||
|
|
40016372c6 | ||
|
|
af22f84809 | ||
|
|
3894a5ed94 | ||
|
|
045b2877b7 | ||
|
|
148b62a206 | ||
|
|
d2cef208fe | ||
|
|
4c617d6496 | ||
|
|
f985ae1379 | ||
|
|
98aa544f25 | ||
|
|
e850655c1d | ||
|
|
62fd4007b0 | ||
|
|
c799a22d55 | ||
|
|
b445633e56 | ||
|
|
6500af9aa2 | ||
|
|
8f2500083c | ||
|
|
cd3dbcb2ef | ||
|
|
bafcd7418a | ||
|
|
085b4842a1 | ||
|
|
49a7bde6e2 | ||
|
|
07ab4622e8 | ||
|
|
47caf51efe | ||
|
|
7862eb444f | ||
|
|
1f99bea6ce | ||
|
|
a5eee4629f | ||
|
|
5c5a853894 | ||
|
|
b06f155ceb |
@@ -4,7 +4,7 @@ import inspect
|
||||
import frappe
|
||||
from erpnext.hooks import regional_overrides
|
||||
|
||||
__version__ = '9.2.5'
|
||||
__version__ = '9.2.16'
|
||||
|
||||
def get_default_company(user=None):
|
||||
'''Get default company for user'''
|
||||
|
||||
@@ -851,7 +851,7 @@
|
||||
"4457-Taxes sur le chiffre d'affaires collect\u00e9es par l'entreprise": {
|
||||
"44571-TVA collect\u00e9e": {
|
||||
"account_type": "Tax",
|
||||
"tax_rate": 20.0
|
||||
"is_group": 1
|
||||
},
|
||||
"44578-Taxes assimil\u00e9es \u00e0 la TVA": {}
|
||||
},
|
||||
|
||||
@@ -151,11 +151,14 @@ def restore_asset(asset_name):
|
||||
asset.set_status()
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_gl_entries_on_asset_disposal(asset, selling_amount=0):
|
||||
def get_gl_entries_on_asset_disposal(asset, is_sale=False):
|
||||
fixed_asset_account, accumulated_depr_account, depr_expense_account = get_depreciation_accounts(asset)
|
||||
disposal_account, depreciation_cost_center = get_disposal_account_and_cost_center(asset.company)
|
||||
accumulated_depr_amount = flt(asset.gross_purchase_amount) - flt(asset.value_after_depreciation)
|
||||
|
||||
expense_account, cost_center = get_disposal_account_and_cost_center(asset.company)
|
||||
if is_sale:
|
||||
expense_account = depr_expense_account
|
||||
|
||||
gl_entries = [
|
||||
{
|
||||
"account": fixed_asset_account,
|
||||
@@ -169,14 +172,12 @@ def get_gl_entries_on_asset_disposal(asset, selling_amount=0):
|
||||
}
|
||||
]
|
||||
|
||||
profit_amount = flt(selling_amount) - flt(asset.value_after_depreciation)
|
||||
if flt(asset.value_after_depreciation) and profit_amount:
|
||||
debit_or_credit = "debit" if profit_amount < 0 else "credit"
|
||||
if flt(asset.value_after_depreciation):
|
||||
gl_entries.append({
|
||||
"account": disposal_account,
|
||||
"cost_center": depreciation_cost_center,
|
||||
debit_or_credit: abs(profit_amount),
|
||||
debit_or_credit + "_in_account_currency": abs(profit_amount)
|
||||
"account": expense_account,
|
||||
"cost_center": cost_center,
|
||||
"debit": flt(asset.value_after_depreciation),
|
||||
"debit_in_account_currency": flt(asset.value_after_depreciation)
|
||||
})
|
||||
|
||||
return gl_entries
|
||||
|
||||
@@ -188,7 +188,6 @@ class TestAsset(unittest.TestCase):
|
||||
asset.load_from_db()
|
||||
depr_entry = asset.get("schedules")[0].journal_entry
|
||||
self.assertFalse(depr_entry)
|
||||
|
||||
|
||||
def test_scrap_asset(self):
|
||||
asset = frappe.get_doc("Asset", "Macbook Pro 1")
|
||||
@@ -234,8 +233,9 @@ class TestAsset(unittest.TestCase):
|
||||
|
||||
expected_gle = (
|
||||
("_Test Accumulated Depreciations - _TC", 30000.0, 0.0),
|
||||
("_Test Depreciations - _TC", 70000.0, 0.0),
|
||||
("_Test Fixed Asset - _TC", 0.0, 100000.0),
|
||||
("_Test Gain/Loss on Asset Disposal - _TC", 45000.0, 0.0),
|
||||
("_Test Gain/Loss on Asset Disposal - _TC", 0.0, 25000.0),
|
||||
("Debtors - _TC", 25000.0, 0.0)
|
||||
)
|
||||
|
||||
|
||||
@@ -11,36 +11,6 @@
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 0,
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break0",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"print_width": "50%",
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@@ -438,7 +408,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 3,
|
||||
"modified": "2017-06-13 14:28:56.667292",
|
||||
"modified": "2017-11-10 18:44:44.081464",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "C-Form",
|
||||
|
||||
@@ -252,22 +252,25 @@ frappe.ui.form.on('Payment Entry', {
|
||||
date: frm.doc.posting_date
|
||||
},
|
||||
callback: function(r, rt) {
|
||||
console.log(r, rt);
|
||||
if(r.message) {
|
||||
if(frm.doc.payment_type == "Receive") {
|
||||
frm.set_value("paid_from", r.message.party_account);
|
||||
frm.set_value("paid_from_account_currency", r.message.party_account_currency);
|
||||
frm.set_value("paid_from_account_balance", r.message.account_balance);
|
||||
} else if (frm.doc.payment_type == "Pay"){
|
||||
frm.set_value("paid_to", r.message.party_account);
|
||||
frm.set_value("paid_to_account_currency", r.message.party_account_currency);
|
||||
frm.set_value("paid_to_account_balance", r.message.account_balance);
|
||||
}
|
||||
frm.set_value("party_balance", r.message.party_balance);
|
||||
frm.events.get_outstanding_documents(frm);
|
||||
frm.events.hide_unhide_fields(frm);
|
||||
frm.events.set_dynamic_labels(frm);
|
||||
frm.set_party_account_based_on_party = false;
|
||||
frappe.run_serially([
|
||||
() => {
|
||||
if(frm.doc.payment_type == "Receive") {
|
||||
frm.set_value("paid_from", r.message.party_account);
|
||||
frm.set_value("paid_from_account_currency", r.message.party_account_currency);
|
||||
frm.set_value("paid_from_account_balance", r.message.account_balance);
|
||||
} else if (frm.doc.payment_type == "Pay"){
|
||||
frm.set_value("paid_to", r.message.party_account);
|
||||
frm.set_value("paid_to_account_currency", r.message.party_account_currency);
|
||||
frm.set_value("paid_to_account_balance", r.message.account_balance);
|
||||
}
|
||||
},
|
||||
() => frm.set_value("party_balance", r.message.party_balance),
|
||||
() => frm.events.get_outstanding_documents(frm),
|
||||
() => frm.events.hide_unhide_fields(frm),
|
||||
() => frm.events.set_dynamic_labels(frm),
|
||||
() => { frm.set_party_account_based_on_party = false; }
|
||||
]);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"autoname": "PCE/.###",
|
||||
@@ -12,34 +13,7 @@
|
||||
"engine": "InnoDB",
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break0",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "Column Break",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -50,6 +24,7 @@
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Transaction Date",
|
||||
@@ -69,6 +44,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -79,6 +55,7 @@
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Posting Date",
|
||||
@@ -98,6 +75,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -108,6 +86,7 @@
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Closing Fiscal Year",
|
||||
@@ -128,6 +107,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -138,6 +118,7 @@
|
||||
"ignore_user_permissions": 1,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Amended From",
|
||||
@@ -158,6 +139,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -168,6 +150,7 @@
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Company",
|
||||
@@ -188,6 +171,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -198,6 +182,7 @@
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
@@ -215,6 +200,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -226,6 +212,7 @@
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Closing Account Head",
|
||||
@@ -246,6 +233,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -256,6 +244,7 @@
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Remarks",
|
||||
@@ -275,18 +264,18 @@
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"icon": "fa fa-file-text",
|
||||
"idx": 1,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 1,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-11-07 05:32:15.691681",
|
||||
"modified": "2017-11-10 18:41:10.881530",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Period Closing Voucher",
|
||||
@@ -302,7 +291,6 @@
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"is_custom": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
@@ -323,7 +311,6 @@
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"is_custom": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
@@ -339,8 +326,10 @@
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"search_fields": "posting_date, fiscal_year",
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"title_field": "closing_account_head",
|
||||
"track_changes": 0,
|
||||
"track_seen": 0
|
||||
}
|
||||
@@ -24,11 +24,11 @@ frappe.ui.form.on("POS Profile", "onload", function(frm) {
|
||||
|
||||
frappe.ui.form.on('POS Profile', {
|
||||
setup: function(frm) {
|
||||
frm.set_query("online_print_format", function() {
|
||||
frm.set_query("print_format_for_online", function() {
|
||||
return {
|
||||
filters: [
|
||||
['Print Format', 'doc_type', '=', 'Sales Invoice'],
|
||||
['Print Format', 'print_format_type', '!=', 'Js'],
|
||||
['Print Format', 'print_format_type', '=', 'Server'],
|
||||
]
|
||||
};
|
||||
});
|
||||
|
||||
@@ -12,8 +12,5 @@ class POSSettings(Document):
|
||||
|
||||
def set_link_for_pos(self):
|
||||
link = 'pos' if self.use_pos_in_offline_mode else 'point-of-sale'
|
||||
desktop_icon = frappe.db.get_value('Desktop Icon',
|
||||
{'standard': 1, 'module_name': 'POS'}, 'name')
|
||||
|
||||
if desktop_icon:
|
||||
frappe.db.set_value('Desktop Icon', desktop_icon, 'link', link)
|
||||
frappe.db.sql(""" update `tabDesktop Icon` set link = '{0}'
|
||||
where module_name like '%pos%'""".format(link))
|
||||
@@ -247,7 +247,7 @@ class SalesInvoice(SellingController):
|
||||
super(SalesInvoice, self).set_missing_values(for_validate)
|
||||
|
||||
if pos:
|
||||
return {"print_format": pos.get("print_format") }
|
||||
return {"print_format": pos.get("print_format_for_online") }
|
||||
|
||||
def update_time_sheet(self, sales_invoice):
|
||||
for d in self.timesheets:
|
||||
@@ -670,28 +670,28 @@ class SalesInvoice(SellingController):
|
||||
# income account gl entries
|
||||
for item in self.get("items"):
|
||||
if flt(item.base_net_amount):
|
||||
account_currency = get_account_currency(item.income_account)
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": item.income_account,
|
||||
"against": self.customer,
|
||||
"credit": item.base_net_amount,
|
||||
"credit_in_account_currency": item.base_net_amount \
|
||||
if account_currency==self.company_currency else item.net_amount,
|
||||
"cost_center": item.cost_center
|
||||
}, account_currency)
|
||||
)
|
||||
|
||||
if item.is_fixed_asset:
|
||||
asset = frappe.get_doc("Asset", item.asset)
|
||||
|
||||
fixed_asset_gl_entries = get_gl_entries_on_asset_disposal(asset, item.base_net_amount)
|
||||
fixed_asset_gl_entries = get_gl_entries_on_asset_disposal(asset, is_sale=True)
|
||||
for gle in fixed_asset_gl_entries:
|
||||
gle["against"] = self.customer
|
||||
gl_entries.append(self.get_gl_dict(gle))
|
||||
|
||||
asset.db_set("disposal_date", self.posting_date)
|
||||
asset.set_status("Sold" if self.docstatus==1 else None)
|
||||
else:
|
||||
account_currency = get_account_currency(item.income_account)
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": item.income_account,
|
||||
"against": self.customer,
|
||||
"credit": item.base_net_amount,
|
||||
"credit_in_account_currency": item.base_net_amount \
|
||||
if account_currency==self.company_currency else item.net_amount,
|
||||
"cost_center": item.cost_center
|
||||
}, account_currency)
|
||||
)
|
||||
|
||||
# expense account gl entries
|
||||
if cint(self.update_stock) and \
|
||||
|
||||
@@ -176,29 +176,31 @@ def get_party_account(party_type, party, company):
|
||||
if not company:
|
||||
frappe.throw(_("Please select a Company"))
|
||||
|
||||
if party:
|
||||
if not party:
|
||||
return
|
||||
|
||||
account = frappe.db.get_value("Party Account",
|
||||
{"parenttype": party_type, "parent": party, "company": company}, "account")
|
||||
|
||||
if not account and party_type in ['Customer', 'Supplier']:
|
||||
party_group_doctype = "Customer Group" if party_type=="Customer" else "Supplier Type"
|
||||
group = frappe.db.get_value(party_type, party, scrub(party_group_doctype))
|
||||
account = frappe.db.get_value("Party Account",
|
||||
{"parenttype": party_type, "parent": party, "company": company}, "account")
|
||||
{"parenttype": party_group_doctype, "parent": group, "company": company}, "account")
|
||||
|
||||
if not account and party_type in ['Customer', 'Supplier']:
|
||||
party_group_doctype = "Customer Group" if party_type=="Customer" else "Supplier Type"
|
||||
group = frappe.db.get_value(party_type, party, scrub(party_group_doctype))
|
||||
account = frappe.db.get_value("Party Account",
|
||||
{"parenttype": party_group_doctype, "parent": group, "company": company}, "account")
|
||||
if not account and party_type in ['Customer', 'Supplier']:
|
||||
default_account_name = "default_receivable_account" \
|
||||
if party_type=="Customer" else "default_payable_account"
|
||||
account = frappe.db.get_value("Company", company, default_account_name)
|
||||
|
||||
if not account and party_type in ['Customer', 'Supplier']:
|
||||
default_account_name = "default_receivable_account" \
|
||||
if party_type=="Customer" else "default_payable_account"
|
||||
account = frappe.db.get_value("Company", company, default_account_name)
|
||||
existing_gle_currency = get_party_gle_currency(party_type, party, company)
|
||||
if existing_gle_currency:
|
||||
if account:
|
||||
account_currency = frappe.db.get_value("Account", account, "account_currency")
|
||||
if (account and account_currency != existing_gle_currency) or not account:
|
||||
account = get_party_gle_account(party_type, party, company)
|
||||
|
||||
existing_gle_currency = get_party_gle_currency(party_type, party, company)
|
||||
if existing_gle_currency:
|
||||
if account:
|
||||
account_currency = frappe.db.get_value("Account", account, "account_currency")
|
||||
if (account and account_currency != existing_gle_currency) or not account:
|
||||
account = get_party_gle_account(party_type, party, company)
|
||||
|
||||
return account
|
||||
return account
|
||||
|
||||
def get_party_account_currency(party_type, party, company):
|
||||
def generator():
|
||||
|
||||
@@ -36,8 +36,14 @@
|
||||
<br>{%= data[i][__("Voucher No")] %}</td>
|
||||
<td>
|
||||
{% if(!(filters.customer || filters.supplier)) { %}
|
||||
{%= data[i][__("Customer Name")] || data[i][__("Customer")] || data[i][__("Supplier Name")] || data[i][__("Supplier")] %}<br>{%= __("Remarks") %}:
|
||||
{%= data[i][__("Customer")] || data[i][__("Supplier")] %}
|
||||
{% if(data[i][__("Customer Name")] && data[i][__("Customer Name")] != data[i][__("Customer")]) { %}
|
||||
<br> {%= data[i][__("Customer Name")] %}
|
||||
{% } else if(data[i][__("Supplier Name")] != data[i][__("Supplier")]) { %}
|
||||
<br> {%= data[i][__("Supplier Name")] %}
|
||||
{% } %}
|
||||
{% } %}
|
||||
<br>{%= __("Remarks") %}:
|
||||
{%= data[i][__("Remarks")] %}
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
@@ -66,8 +72,13 @@
|
||||
<td>
|
||||
{% if(!(filters.customer || filters.supplier)) { %}
|
||||
{%= data[i][__("Customer")] || data[i][__("Supplier")] %}
|
||||
<br>{%= __("Remarks") %}:
|
||||
{% if(data[i][__("Customer Name")] && data[i][__("Customer Name")] != data[i][__("Customer")]) { %}
|
||||
<br> {%= data[i][__("Customer Name")] %}
|
||||
{% } else if(data[i][__("Supplier Name")] != data[i][__("Supplier")]) { %}
|
||||
<br> {%= data[i][__("Supplier Name")] %}
|
||||
{% } %}
|
||||
{% } %}
|
||||
<br>{%= __("Remarks") %}:
|
||||
{%= data[i][__("Remarks")] %}
|
||||
</td>
|
||||
{% } else { %}
|
||||
|
||||
@@ -593,7 +593,9 @@ def get_outstanding_invoices(party_type, party, account, condition=None):
|
||||
select ifnull(sum({payment_dr_or_cr}), 0)
|
||||
from `tabGL Entry` payment_gl_entry
|
||||
where payment_gl_entry.against_voucher_type = invoice_gl_entry.voucher_type
|
||||
and payment_gl_entry.against_voucher = invoice_gl_entry.voucher_no
|
||||
and if(invoice_gl_entry.voucher_type='Journal Entry',
|
||||
payment_gl_entry.against_voucher = invoice_gl_entry.voucher_no,
|
||||
payment_gl_entry.against_voucher = invoice_gl_entry.against_voucher)
|
||||
and payment_gl_entry.party_type = invoice_gl_entry.party_type
|
||||
and payment_gl_entry.party = invoice_gl_entry.party
|
||||
and payment_gl_entry.account = invoice_gl_entry.account
|
||||
|
||||
@@ -209,10 +209,10 @@ class AccountsController(TransactionBase):
|
||||
|
||||
tax_master_doctype = self.meta.get_field("taxes_and_charges").options
|
||||
|
||||
if not self.get("taxes"):
|
||||
if self.is_new() and not self.get("taxes"):
|
||||
if not self.get("taxes_and_charges"):
|
||||
# get the default tax master
|
||||
self.set("taxes_and_charges", frappe.db.get_value(tax_master_doctype, {"is_default": 1}))
|
||||
self.taxes_and_charges = frappe.db.get_value(tax_master_doctype, {"is_default": 1})
|
||||
|
||||
self.append_taxes_from_master(tax_master_doctype)
|
||||
|
||||
@@ -608,7 +608,10 @@ def get_tax_rate(account_head):
|
||||
@frappe.whitelist()
|
||||
def get_default_taxes_and_charges(master_doctype):
|
||||
default_tax = frappe.db.get_value(master_doctype, {"is_default": 1})
|
||||
return get_taxes_and_charges(master_doctype, default_tax)
|
||||
return {
|
||||
'taxes_and_charges': default_tax,
|
||||
'taxes': get_taxes_and_charges(master_doctype, default_tax)
|
||||
}
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_taxes_and_charges(master_doctype, master_name):
|
||||
|
||||
@@ -171,7 +171,7 @@ class BuyingController(StockController):
|
||||
for item in self.get("items"):
|
||||
if self.doctype in ["Purchase Receipt", "Purchase Invoice"]:
|
||||
item.rm_supp_cost = 0.0
|
||||
if item.item_code in self.sub_contracted_items:
|
||||
if item.bom and item.item_code in self.sub_contracted_items:
|
||||
self.update_raw_materials_supplied(item, raw_material_table)
|
||||
|
||||
if [item.item_code, item.name] not in parent_items:
|
||||
|
||||
@@ -204,8 +204,8 @@ def bom(doctype, txt, searchfield, start, page_len, filters):
|
||||
{
|
||||
'txt': "%%%s%%" % frappe.db.escape(txt),
|
||||
'_txt': txt.replace("%", ""),
|
||||
'start': start,
|
||||
'page_len': page_len
|
||||
'start': start or 0,
|
||||
'page_len': page_len or 20
|
||||
})
|
||||
|
||||
def get_project_name(doctype, txt, searchfield, start, page_len, filters):
|
||||
|
||||
@@ -48,16 +48,16 @@ class Opportunity(TransactionBase):
|
||||
# check if customer is already created agains the self.contact_email
|
||||
customer = frappe.db.sql("""select
|
||||
distinct `tabDynamic Link`.link_name as customer
|
||||
from
|
||||
from
|
||||
`tabContact`,
|
||||
`tabDynamic Link`
|
||||
where `tabContact`.email_id='{0}'
|
||||
and
|
||||
and
|
||||
`tabContact`.name=`tabDynamic Link`.parent
|
||||
and
|
||||
ifnull(`tabDynamic Link`.link_name, '')<>''
|
||||
and
|
||||
`tabDynamic Link`.link_doctype='Customer'
|
||||
ifnull(`tabDynamic Link`.link_name, '')<>''
|
||||
and
|
||||
`tabDynamic Link`.link_doctype='Customer'
|
||||
""".format(self.contact_email), as_dict=True)
|
||||
if customer and customer[0].customer:
|
||||
self.customer = customer[0].customer
|
||||
@@ -118,9 +118,9 @@ class Opportunity(TransactionBase):
|
||||
|
||||
def has_ordered_quotation(self):
|
||||
return frappe.db.sql("""
|
||||
select q.name
|
||||
select q.name
|
||||
from `tabQuotation` q, `tabQuotation Item` qi
|
||||
where q.name = qi.parent and q.docstatus=1 and qi.prevdoc_docname =%s
|
||||
where q.name = qi.parent and q.docstatus=1 and qi.prevdoc_docname =%s
|
||||
and q.status = 'Ordered'""", self.name)
|
||||
|
||||
def has_lost_quotation(self):
|
||||
@@ -233,8 +233,8 @@ def make_quotation(source_name, target_doc=None):
|
||||
|
||||
# get default taxes
|
||||
taxes = get_default_taxes_and_charges("Sales Taxes and Charges Template")
|
||||
if taxes:
|
||||
quotation.extend("taxes", taxes)
|
||||
if taxes.get('taxes'):
|
||||
quotation.update(taxes)
|
||||
|
||||
quotation.run_method("set_missing_values")
|
||||
quotation.run_method("calculate_taxes_and_totals")
|
||||
|
||||
@@ -348,8 +348,10 @@ def setup_budget():
|
||||
budget.action_if_annual_budget_exceeded = "Warn"
|
||||
expense_ledger_count = frappe.db.count("Account", {"is_group": "0", "root_type": "Expense"})
|
||||
|
||||
add_random_children(budget, "accounts", rows=random.randint(10, expense_ledger_count), randomize = { "account": ("Account", {"is_group": "0", "root_type": "Expense"})
|
||||
}, unique="account")
|
||||
add_random_children(budget, "accounts", rows=random.randint(10, expense_ledger_count),
|
||||
randomize = {
|
||||
"account": ("Account", {"is_group": "0", "root_type": "Expense"})
|
||||
}, unique="account")
|
||||
|
||||
for d in budget.accounts:
|
||||
d.budget_amount = random.randint(5, 100) * 10000
|
||||
@@ -361,6 +363,7 @@ def setup_pos_profile():
|
||||
company_abbr = frappe.db.get_value("Company", erpnext.get_default_company(), "abbr")
|
||||
pos = frappe.new_doc('POS Profile')
|
||||
pos.user = frappe.db.get_global('demo_accounts_user')
|
||||
pos.pos_profile_name = "Demo POS Profile"
|
||||
pos.naming_series = 'SINV-'
|
||||
pos.update_stock = 0
|
||||
pos.write_off_account = 'Cost of Goods Sold - '+ company_abbr
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
introduction
|
||||
accounts
|
||||
projects
|
||||
schools
|
||||
|
||||
0
erpnext/docs/user/manual/es/projects/__init__.py
Normal file
0
erpnext/docs/user/manual/es/projects/__init__.py
Normal file
6
erpnext/docs/user/manual/es/projects/activity-cost.md
Normal file
6
erpnext/docs/user/manual/es/projects/activity-cost.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# Costo de Actividad
|
||||
|
||||
El costo de la actividad registra la tasa de facturación por hora y la tasa de costos de un empleado en comparación con un tipo de actividad.
|
||||
El sistema hace uso de esta tasa mientras hace registros de tiempo. Se usa para Costeo de proyectos.
|
||||
|
||||
<img class="screenshot" alt="Activity Cost" src="/docs/assets/img/project/activity_cost.png">
|
||||
15
erpnext/docs/user/manual/es/projects/activity-type.md
Normal file
15
erpnext/docs/user/manual/es/projects/activity-type.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# Tipo de Actividad
|
||||
|
||||
Los tipos de actividad son la lista de los diferentes tipos de actividades sobre las que se hacen registro de tiempo.
|
||||
|
||||
<img class="screenshot" alt="Activity Type" src="/docs/assets/img/project/activity_type.png">
|
||||
|
||||
Por defecto, los siguientes tipos de actividades son creados.
|
||||
|
||||
* Planning
|
||||
* Research
|
||||
* Proposal Writing
|
||||
* Execution
|
||||
* Communication
|
||||
|
||||
{next}
|
||||
3
erpnext/docs/user/manual/es/projects/articles/index.md
Normal file
3
erpnext/docs/user/manual/es/projects/articles/index.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Artículos
|
||||
|
||||
{index}
|
||||
1
erpnext/docs/user/manual/es/projects/articles/index.txt
Normal file
1
erpnext/docs/user/manual/es/projects/articles/index.txt
Normal file
@@ -0,0 +1 @@
|
||||
project-costing
|
||||
@@ -0,0 +1,40 @@
|
||||
# Costeo de proyectos
|
||||
|
||||
Cada proyecto tiene multiples tareas asociadas a el. Para hacer el seguimiento del costo actual de un proyecto, primeramente en términos de servicios, el usuario
|
||||
tiene que crear un registro de tiempo basado en el tiempo que invirtió en una tarea del proyecto. Siguiendo los pasos de como puedes hacer el seguimiento del costo actual de un servicio usando el proyecto.
|
||||
|
||||
#### Tipo de actividad
|
||||
|
||||
Tipo de actividad es un maestro de los servicios ofrecidos por su personal. Puedes agregar un nuevo Tipo de Actividad desde:
|
||||
|
||||
`Project > Activity Type > New`
|
||||
|
||||
#### Costo de actividad
|
||||
|
||||
Costo de actividad es un maestro donde puedes hacer el seguimiento de los montos de facturación y costo de cada empleado, y por cada tipo de Tipo de Actividad.
|
||||
|
||||
<img alt="Activity Cost" class="screenshot" src="/docs/assets/img/articles/Screen Shot 2015-06-11 at 4.57.01 pm.png">
|
||||
|
||||
#### Registro de Tiempo
|
||||
|
||||
Basados en el tiempo actual invertido en una Tarea del Proyecto, El empleado va a crear un registro de tiempo.
|
||||
|
||||
<img alt="Time Log" class="screenshot" src="/docs/assets/img/articles/Screen Shot 2015-06-11 at 4.59.49 pm.png">
|
||||
|
||||
Al momento de seleccionar el Tipo de Actividad en el Registro de tiempo, el monto de Facturación y Costo del empleado va a ser traído de su respectivo registro en el master de Costo de Actividad.
|
||||
|
||||
<img alt="Time Log Costing" class="screenshot" src="/docs/assets/img/articles/Screen Shot 2015-06-11 at 5.00.06 pm.png">
|
||||
|
||||
Multiplicando esos montos con el total de número de horas en el registro de tiempo, nos da el monto de costos y Facturación para el registro de tiempo específico.
|
||||
|
||||
#### Costeo en Proyectos y Tareas
|
||||
|
||||
Basados en el total de registros de tiempos creados por una tarea en específico, su costo va a ser actualizado en el registro maestro de la tarea, o sea, en el detalle de la tarea.
|
||||
|
||||
<img alt="Costing in Task" class="screenshot" src="/docs/assets/img/articles/Screen Shot 2015-06-11 at 5.02.54 pm.png">
|
||||
|
||||
De la misma manera, el detalle del Proyecto va a actualizar su costo basado en el total de registros de tiempo a ese proyecto, y las tareas asociadas a ese proyecto.
|
||||
|
||||
<img alt="Costing in Project" class="screenshot" src="/docs/assets/img/articles/Screen Shot 2015-06-11 at 5.02.29 pm.png">
|
||||
|
||||
<!-- markdown -->
|
||||
15
erpnext/docs/user/manual/es/projects/index.md
Normal file
15
erpnext/docs/user/manual/es/projects/index.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# Proyectos
|
||||
|
||||
ERPNext le ayuda en la administración de su proyecto a traves de la creacion de tareas y
|
||||
poder asignarlas a diferentes personas.
|
||||
|
||||
Las compras y las ventas también se pueden rastrear en relación con los proyectos y
|
||||
esto puede ayudar a la empresa a controlar su presupuesto, entrega y rentabilidad para un proyecto.
|
||||
|
||||
Los proyectos pueden ser usados para manejar los proyectos internos, trabajos de manufacturación y
|
||||
planificación de servicios. Para los trabajos de servicios, los Time Sheets (hojas de tiempo) pueden ser creadas
|
||||
para facturar a los clientes, en caso que el proceso de facturación se haga basado en tiempo y dinero de tareas.
|
||||
|
||||
### Temas
|
||||
|
||||
{index}
|
||||
7
erpnext/docs/user/manual/es/projects/index.txt
Normal file
7
erpnext/docs/user/manual/es/projects/index.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
tasks
|
||||
project
|
||||
time-log-batch
|
||||
activity-type
|
||||
activity-cost
|
||||
articles
|
||||
timesheet
|
||||
110
erpnext/docs/user/manual/es/projects/project.md
Normal file
110
erpnext/docs/user/manual/es/projects/project.md
Normal file
@@ -0,0 +1,110 @@
|
||||
# Proyecto
|
||||
|
||||
El manejo de proyectos en ERPNext se hace a traves de tareas. Puedes crear un proyecto y asignar varias tareas al mismo.
|
||||
|
||||
<img class="screenshot" alt="Project" src="/docs/assets/img/project/project.png">
|
||||
|
||||
También puedes hacer el seguimiento del % completado del proyecto usando diferentes métodos.
|
||||
|
||||
1. Tareas Completadas
|
||||
2. Progreso de tareas
|
||||
3. Peso de tarea
|
||||
|
||||
<img class="screenshot" alt="Project" src="/docs/assets/img/project/project-percent-complete.png">
|
||||
|
||||
Algunos ejemplos de como el % completado es cálculado basado en tareas.
|
||||
|
||||
<img class="screenshot" alt="Project" src="/docs/assets/img/project/percent-complete-calc.png">
|
||||
|
||||
<img class="screenshot" alt="Project" src="/docs/assets/img/project/percent-complete-formula.png">
|
||||
|
||||
### Manejando tareas
|
||||
|
||||
Los proyecto pueden ser divididos en multiples tareas.
|
||||
Las tareas pueden ser creadas a traves del documento de Proyecto o pueden ser creadas via [Tarea](/docs/user/manual/en/projects/tasks.html)
|
||||
|
||||
<img class="screenshot" alt="Project" src="/docs/assets/img/project/project_task.png">
|
||||
|
||||
* Para ver las tareas creadas a un proyecto click en 'Tasks'
|
||||
|
||||
<img class="screenshot" alt="Project - View Task" src="/docs/assets/img/project/project_view_task.png">
|
||||
|
||||
<img class="screenshot" alt="Project - Task List" src="/docs/assets/img/project/project_task_list.png">
|
||||
|
||||
* También puedes ver las tareas desde la misma vista del proyecto.
|
||||
|
||||
<img class="screenshot" alt="Project - Task Grid" src="/docs/assets/img/project/project_task_grid.png">
|
||||
|
||||
* Para agregar peso a las tareas puedes seguir los pasos siguientes
|
||||
|
||||
<img class="screenshot" alt="Project - Task Grid" src="/docs/assets/img/project/tasks.png">
|
||||
<img class="screenshot" alt="Project - Task Grid" src="/docs/assets/img/project/task-weights.png">
|
||||
|
||||
|
||||
### Manejando tiempo
|
||||
|
||||
ERPNext usa [Time Log](/docs/user/manual/en/projects/time-log.html) para hacer el seguimiento del progreso de un Proyecto.
|
||||
Puedes crear registros de tiempo sobre cada Tarea.
|
||||
El tiempo actual de inicio y finalización junto con el costo deben ser actualizados basados en los Registros de Tiempo.
|
||||
|
||||
* Para ver los Registros de Tiempo realizados a un proyecto, dar click en 'Time Logs'
|
||||
|
||||
<img class="screenshot" alt="Project - View Time Log" src="/docs/assets/img/project/project_view_time_log.png">
|
||||
|
||||
<img class="screenshot" alt="Project - Time Log List" src="/docs/assets/img/project/project_time_log_list.png">
|
||||
|
||||
* Puedes agregar un registro de tiempo directamente y luego asociarlo con el proyecto.
|
||||
|
||||
<img class="screenshot" alt="Project - Link Time Log" src="/docs/assets/img/project/project_time_log_link.png">
|
||||
|
||||
### Gestión de gastos
|
||||
|
||||
Puede reservar la [Reclamación de gastos](/docs/user/manual/en/human-resources/expense-claim.html) contra una tarea de proyecto.
|
||||
El sistema actualizará el monto total de las reclamaciones de gastos en la sección de costos del proyecto.
|
||||
|
||||
* Para ver las reclamaciones de gastos realizadas en un proyecto, haga clic en 'Reclamaciones de gastos'
|
||||
|
||||
<img class="screenshot" alt="Project - View Expense Claim" src="/docs/assets/img/project/project_view_expense_claim.png">
|
||||
|
||||
* También puede crear un Reclamo de gastos directamente y vincularlo al Proyecto.
|
||||
|
||||
<img class="screenshot" alt="Project - Link Expense Claim" src="/docs/assets/img/project/project_expense_claim_link.png">
|
||||
|
||||
* El monto total de los Reclamos de gastos reservados contra un proyecto se muestra en 'Reclamo de gastos totales' en la Sección de Costos del proyecto
|
||||
|
||||
<img class="screenshot" alt="Project - Total Expense Claim" src="/docs/assets/img/project/project_total_expense_claim.png">
|
||||
|
||||
### Centro de Costo
|
||||
|
||||
Puedes crear un [Cost Center](/docs/user/manual/en/accounts/setup/cost-center.html) sobre un proyecto o usar un centro de costo existente para hacer el seguimiento de todos los gastos realizados al proyecto.
|
||||
|
||||
<img class="screenshot" alt="Project - Cost Center" src="/docs/assets/img/project/project_cost_center.png">
|
||||
|
||||
###Costeo del proyecto
|
||||
|
||||
La sección Costeo del proyecto le ayuda a rastrear el tiempo y los gastos incurridos en relación con el proyecto.
|
||||
|
||||
<img class="screenshot" alt="Project - Costing" src="/docs/assets/img/project/project_costing.png">
|
||||
|
||||
* La sección de cálculo de costos se actualiza según los registros de tiempo realizados.
|
||||
|
||||
* El margen bruto es la diferencia entre el monto total de costos y el monto total de facturación
|
||||
|
||||
###Facturación
|
||||
|
||||
Puedes crear/enlazar una [Sales Order](/docs/user/manual/en/selling/sales-order.html) a un proyecto. Una vez asociada puedes usar el módulo de ventas para facturar a un cliente sobre el proyecto.
|
||||
|
||||
<img class="screenshot" alt="Project - Sales Order" src="/docs/assets/img/project/project_sales_order.png">
|
||||
|
||||
###Gantt Chart
|
||||
|
||||
Un Gantt Chart muestra la planificación del proyecto.
|
||||
ERPNext te provee con una vista para visualizar las tareas de forma calendarizada usando un Gantt Chart (Hoja de Gantt).
|
||||
|
||||
* Para visualizar el gantt chart de un proyecto, ve hasta el proyecto y dar click en 'Gantt Chart'
|
||||
|
||||
<img class="screenshot" alt="Project - View Gantt Chart" src="/docs/assets/img/project/project_view_gantt_chart.png">
|
||||
|
||||
<img class="screenshot" alt="Project - Gantt Chart" src="/docs/assets/img/project/project_gantt_chart.png">
|
||||
|
||||
{next}
|
||||
61
erpnext/docs/user/manual/es/projects/tasks.md
Normal file
61
erpnext/docs/user/manual/es/projects/tasks.md
Normal file
@@ -0,0 +1,61 @@
|
||||
# Tareas
|
||||
|
||||
Proyecto es dividido en Tareas.
|
||||
En ERPNext, puedes crear las tareas de forma independiente.
|
||||
|
||||
<img class="screenshot" alt="Task" src="/docs/assets/img/project/task.png">
|
||||
|
||||
### Estado de una Tarea
|
||||
|
||||
Una tarea puede tener uno de los siguientes estados - Abierto, Trabajando, Pendiente de Revisión, Cerrado, o Cancelado.
|
||||
|
||||
<img class="screenshot" alt="Task - Status" src="/docs/assets/img/project/task_status.png">
|
||||
|
||||
* Por defecto, cada nueva tarea creada se le establece el estado 'Abierto'.
|
||||
|
||||
* Si un registro de tiempo es realizado sobre una tarea, su estado es asignado a 'Working'.
|
||||
|
||||
### Tarea Dependiente
|
||||
|
||||
Puedes especificar una lista de tareas dependientes en la sección 'Depende de'
|
||||
|
||||
<img class="screenshot" alt="Depends On" src="/docs/assets/img/project/task_depends_on.png">
|
||||
|
||||
* No puedes cerrar una tarea padre hasta que todas las tareas dependientes esten cerradas.
|
||||
|
||||
* Si una tarea dependiente se encuentra en retraso y se sobrepone con la fecha esperada de inicio de la tarea padre, el sistema va a re calandarizar la tarea padre.
|
||||
|
||||
### Manejando el tiempo
|
||||
|
||||
ERPNext usa [Time Log](/docs/user/manual/en/projects/time-log.html) para seguir el progreso de una tarea.
|
||||
Puedes crear varios registros de tiempo para cada tarea.
|
||||
El tiempo de inicio y fin actual junto con el costo es actualizado en base al Registro de Tiempo.
|
||||
|
||||
* Para ver el Registro de tiempo realizado a una tarea, dar click en 'Time Logs'
|
||||
|
||||
<img class="screenshot" alt="Task - View Time Log" src="/docs/assets/img/project/task_view_time_log.png">
|
||||
|
||||
<img class="screenshot" alt="Task - Time Log List" src="/docs/assets/img/project/task_time_log_list.png">
|
||||
|
||||
* Puedes también crear un Registro de Tiempo directamente y luego asociarlo a una Tarea.
|
||||
|
||||
<img class="screenshot" alt="Task - Link Time Log" src="/docs/assets/img/project/task_time_log_link.png">
|
||||
|
||||
### Gestión de gastos
|
||||
|
||||
Puede reservar la [Reclamación de gastos](/docs/user/manual/en/human-resources/expense-claim.html) contra una tarea de proyecto.
|
||||
El sistema actualizará el monto total de las reclamaciones de gastos en la sección de costos del proyecto.
|
||||
|
||||
* Para ver las reclamaciones de gastos realizadas en un proyecto, haga clic en 'Reclamaciones de gastos'
|
||||
|
||||
<img class="screenshot" alt="Task - View Expense Claim" src="/docs/assets/img/project/task_view_expense_claim.png">
|
||||
|
||||
* También puede crear un Reclamo de gastos directamente y vincularlo al Proyecto.
|
||||
|
||||
<img class="screenshot" alt="Task - Link Expense Claim" src="/docs/assets/img/project/task_expense_claim_link.png">
|
||||
|
||||
* El monto total de los Reclamos de gastos reservados contra un proyecto se muestra en 'Reclamo de gastos totales' en la Sección de Costos del proyecto
|
||||
|
||||
<img class="screenshot" alt="Task - Total Expense Claim" src="/docs/assets/img/project/task_total_expense_claim.png">
|
||||
|
||||
{next}
|
||||
25
erpnext/docs/user/manual/es/projects/time-log-batch.md
Normal file
25
erpnext/docs/user/manual/es/projects/time-log-batch.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Lote de registro de tiempo
|
||||
|
||||
Puede facturar Registros de tiempo viéndolos juntos. Esto le da la flexibilidad de administrar la facturación de su cliente de la manera que desee. Para crear una nueva hoja de tiempo, ve a
|
||||
|
||||
> Projects > Time Sheet > New Time Sheet
|
||||
|
||||
O
|
||||
|
||||
Simplemente abra su lista de registro de tiempo y marque los elementos que desea agregar al registro de tiempo. A continuación, haga clic en el botón "Crear hoja de tiempo" y se seleccionarán estos registros de tiempo.
|
||||
|
||||
<img class="screenshot" alt="Time Log - Drag Calender" src="/docs/assets/img/project/time_sheet.gif">
|
||||
|
||||
###Creando Factura de Venta
|
||||
|
||||
* Despues de crear la Hoja de Tiempo/Horario, el botón "Crear Factura" debe aparecer.
|
||||
|
||||
<img class="screenshot" alt="Time Log - Drag Calender" src="/docs/assets/img/project/time_sheet_make_invoice.png">
|
||||
|
||||
* Haga clic en ese botón para hacer una factura de venta usando la hoja de tiempo.
|
||||
|
||||
<img class="screenshot" alt="Time Log - Drag Calender" src="/docs/assets/img/project/time_sheet_sales_invoice.png">
|
||||
|
||||
* Cuando "Presente" la Factura de Ventas, el número de Factura de Ventas se actualizará en los Registros de Tiempo y la Hoja de Horario y su estado cambiará a "Facturado".
|
||||
|
||||
{next}
|
||||
@@ -8,12 +8,12 @@ from frappe import _
|
||||
from frappe.model.document import Document
|
||||
from frappe.utils import getdate
|
||||
import json
|
||||
from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_receivable_account,get_income_account
|
||||
from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_receivable_account, get_income_account
|
||||
|
||||
class Consultation(Document):
|
||||
def on_update(self):
|
||||
if(self.appointment):
|
||||
frappe.db.set_value("Patient Appointment",self.appointment,"status","Closed")
|
||||
frappe.db.set_value("Patient Appointment", self.appointment, "status", "Closed")
|
||||
update_consultation_to_medical_record(self)
|
||||
|
||||
def after_insert(self):
|
||||
@@ -23,9 +23,10 @@ class Consultation(Document):
|
||||
if not self.diagnosis or not self.symptoms:
|
||||
frappe.throw("Diagnosis and Complaints cannot be left blank")
|
||||
|
||||
physician = frappe.get_doc("Physician",self.physician)
|
||||
if(frappe.session.user != physician.user_id):
|
||||
frappe.throw(_("You don't have permission to submit"))
|
||||
def on_cancel(self):
|
||||
if(self.appointment):
|
||||
frappe.db.set_value("Patient Appointment", self.appointment, "status", "Open")
|
||||
delete_medical_record(self)
|
||||
|
||||
def set_sales_invoice_fields(company, patient):
|
||||
sales_invoice = frappe.new_doc("Sales Invoice")
|
||||
@@ -91,8 +92,8 @@ def create_invoice_items(physician, invoice, company):
|
||||
item_line.qty = 1
|
||||
item_line.uom = "Nos"
|
||||
item_line.conversion_factor = 1
|
||||
item_line.income_account = get_income_account(physician,company)
|
||||
op_consulting_charge = frappe.get_value("Physician",physician,"op_consulting_charge")
|
||||
item_line.income_account = get_income_account(physician, company)
|
||||
op_consulting_charge = frappe.get_value("Physician", physician, "op_consulting_charge")
|
||||
if op_consulting_charge:
|
||||
item_line.rate = op_consulting_charge
|
||||
item_line.amount = op_consulting_charge
|
||||
@@ -111,10 +112,13 @@ def insert_consultation_to_medical_record(doc):
|
||||
medical_record.save(ignore_permissions=True)
|
||||
|
||||
def update_consultation_to_medical_record(consultation):
|
||||
medical_record_id = frappe.db.sql("select name from `tabPatient Medical Record` where reference_name=%s",(consultation.name))
|
||||
medical_record_id = frappe.db.sql("select name from `tabPatient Medical Record` where reference_name=%s", (consultation.name))
|
||||
if(medical_record_id[0][0]):
|
||||
subject = set_subject_field(consultation)
|
||||
frappe.db.set_value("Patient Medical Record",medical_record_id[0][0],"subject",subject)
|
||||
frappe.db.set_value("Patient Medical Record", medical_record_id[0][0], "subject", subject)
|
||||
|
||||
def delete_medical_record(consultation):
|
||||
frappe.db.sql("""delete from `tabPatient Medical Record` where reference_name = %s""", (consultation.name))
|
||||
|
||||
def set_subject_field(consultation):
|
||||
subject = "No Diagnosis "
|
||||
|
||||
@@ -9,6 +9,7 @@ frappe.ui.form.on('Healthcare Settings', {
|
||||
filters: {
|
||||
'account_type': 'Receivable',
|
||||
'company': d.company,
|
||||
'is_group': 0
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -18,6 +19,7 @@ frappe.ui.form.on('Healthcare Settings', {
|
||||
filters: {
|
||||
'root_type': 'Income',
|
||||
'company': d.company,
|
||||
'is_group': 0
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
@@ -11,8 +11,8 @@ def get_data():
|
||||
'items': ['Patient Appointment', 'Consultation']
|
||||
},
|
||||
{
|
||||
'label': _('Lab Tests'),
|
||||
'items': ['Lab Test']
|
||||
'label': _('Lab Tests and Vital Signs'),
|
||||
'items': ['Lab Test', 'Vital Signs']
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -25,6 +25,14 @@ frappe.ui.form.on('Patient Appointment', {
|
||||
frm.add_custom_button(__('Cancel'), function() {
|
||||
btn_update_status(frm, "Cancelled");
|
||||
});
|
||||
|
||||
frm.add_custom_button(__("Consultation"),function(){
|
||||
btn_create_consultation(frm);
|
||||
},"Create");
|
||||
|
||||
frm.add_custom_button(__('Vital Signs'), function() {
|
||||
btn_create_vital_signs(frm);
|
||||
},"Create");
|
||||
}
|
||||
if(frm.doc.status == "Scheduled" && !frm.doc.__islocal){
|
||||
frm.add_custom_button(__('Cancel'), function() {
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Patient",
|
||||
"length": 0,
|
||||
@@ -174,7 +174,7 @@
|
||||
"ignore_xss_filter": 1,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Subject",
|
||||
"length": 0,
|
||||
@@ -236,7 +236,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Datetime",
|
||||
"length": 0,
|
||||
@@ -266,7 +266,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Reference DocType",
|
||||
"length": 0,
|
||||
@@ -297,7 +297,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Reference Name",
|
||||
"length": 0,
|
||||
@@ -389,7 +389,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-10-04 16:09:55.597866",
|
||||
"modified": "2017-11-15 12:48:59.945615",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Patient Medical Record",
|
||||
@@ -425,6 +425,7 @@
|
||||
"show_name_in_global_search": 1,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"title_field": "patient",
|
||||
"track_changes": 1,
|
||||
"track_seen": 1
|
||||
}
|
||||
@@ -9,6 +9,7 @@ frappe.ui.form.on('Physician', {
|
||||
filters: {
|
||||
'root_type': 'Income',
|
||||
'company': d.company,
|
||||
'is_group': 0
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
@@ -33,7 +33,7 @@ frappe.ui.form.on('Physician Schedule', {
|
||||
|
||||
while(cur_time < end_time) {
|
||||
let to_time = cur_time.clone().add(values.duration, 'minutes');
|
||||
if(to_time < end_time) {
|
||||
if(to_time <= end_time) {
|
||||
|
||||
// add a new timeslot
|
||||
frm.add_child('time_slots', {
|
||||
|
||||
@@ -38,9 +38,8 @@ class TestEmployeeLoan(unittest.TestCase):
|
||||
self.assertEquals(employee_loan.total_interest_payable, 22712)
|
||||
self.assertEquals(employee_loan.total_payment, 302712)
|
||||
|
||||
|
||||
def create_loan_type(loan_name, maximum_loan_amount, rate_of_interest):
|
||||
if not frappe.db.get_value("Loan Type", loan_name):
|
||||
if not frappe.db.exists("Loan Type", loan_name):
|
||||
frappe.get_doc({
|
||||
"doctype": "Loan Type",
|
||||
"loan_name": loan_name,
|
||||
@@ -49,6 +48,7 @@ def create_loan_type(loan_name, maximum_loan_amount, rate_of_interest):
|
||||
}).insert()
|
||||
|
||||
def create_employee_loan(employee, loan_type, loan_amount, repayment_method, repayment_periods):
|
||||
create_loan_type(loan_type, 500000, 8.4)
|
||||
if not frappe.db.get_value("Employee Loan", {"employee":employee}):
|
||||
employee_loan = frappe.new_doc("Employee Loan")
|
||||
employee_loan.update({
|
||||
|
||||
@@ -13,35 +13,6 @@
|
||||
"editable_grid": 0,
|
||||
"engine": "InnoDB",
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break0",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@@ -507,7 +478,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-06-13 14:29:01.066538",
|
||||
"modified": "2017-11-10 18:41:38.845159",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Leave Allocation",
|
||||
|
||||
@@ -11,34 +11,7 @@
|
||||
"editable_grid": 0,
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break0",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -69,6 +42,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -99,6 +73,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -129,6 +104,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -159,6 +135,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -189,6 +166,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -217,6 +195,7 @@
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -246,6 +225,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -275,6 +255,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -304,6 +285,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -333,6 +315,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -361,6 +344,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -401,7 +385,7 @@
|
||||
"issingle": 1,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-03-29 11:24:17.013862",
|
||||
"modified": "2017-11-10 18:42:17.060492",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Leave Control Panel",
|
||||
|
||||
@@ -27,13 +27,13 @@ QUnit.test("Test: Offer Letter [HR]", function (assert) {
|
||||
]},
|
||||
]);
|
||||
},
|
||||
() => frappe.timeout(12),
|
||||
() => frappe.timeout(10),
|
||||
() => frappe.click_button('Submit'),
|
||||
() => frappe.timeout(2),
|
||||
() => frappe.click_button('Yes'),
|
||||
() => frappe.timeout(8),
|
||||
() => frappe.timeout(5),
|
||||
// To check if the fields are correctly set
|
||||
() => {
|
||||
// To check if the fields are correctly set
|
||||
assert.ok(cur_frm.get_field('status').value=='Accepted',
|
||||
'Status of job offer is correct');
|
||||
assert.ok(cur_frm.get_field('designation').value=='Software Developer',
|
||||
@@ -45,7 +45,7 @@ QUnit.test("Test: Offer Letter [HR]", function (assert) {
|
||||
() => {
|
||||
assert.ok(cur_list.data[0].docstatus==1,'Offer Letter Submitted successfully');
|
||||
},
|
||||
() => frappe.timeout(4),
|
||||
() => frappe.timeout(2),
|
||||
() => done()
|
||||
]);
|
||||
});
|
||||
@@ -190,23 +190,28 @@ class ProcessPayroll(Document):
|
||||
def format_as_links(self, salary_slip):
|
||||
return ['<a href="#Form/Salary Slip/{0}">{0}</a>'.format(salary_slip)]
|
||||
|
||||
def get_total_salary_and_loan_amounts(self):
|
||||
def get_loan_details(self):
|
||||
"""
|
||||
Get total loan principal, loan interest and salary amount from submitted salary slip based on selected criteria
|
||||
Get loan details from submitted salary slip based on selected criteria
|
||||
"""
|
||||
cond = self.get_filter_condition()
|
||||
totals = frappe.db.sql("""
|
||||
select sum(principal_amount) as total_principal_amount, sum(interest_amount) as total_interest_amount,
|
||||
sum(total_loan_repayment) as total_loan_repayment, sum(rounded_total) as rounded_total from `tabSalary Slip` t1
|
||||
return frappe.db.sql(""" select eld.employee_loan_account,
|
||||
eld.interest_income_account, eld.principal_amount, eld.interest_amount, eld.total_payment
|
||||
from
|
||||
`tabSalary Slip` t1, `tabSalary Slip Loan` eld
|
||||
where
|
||||
t1.docstatus = 1 and t1.name = eld.parent and start_date >= %s and end_date <= %s %s
|
||||
""" % ('%s', '%s', cond), (self.start_date, self.end_date), as_dict=True) or []
|
||||
|
||||
def get_total_salary_amount(self):
|
||||
"""
|
||||
Get total salary amount from submitted salary slip based on selected criteria
|
||||
"""
|
||||
cond = self.get_filter_condition()
|
||||
totals = frappe.db.sql(""" select sum(rounded_total) as rounded_total from `tabSalary Slip` t1
|
||||
where t1.docstatus = 1 and start_date >= %s and end_date <= %s %s
|
||||
""" % ('%s', '%s', cond), (self.start_date, self.end_date), as_dict=True)
|
||||
return totals[0]
|
||||
|
||||
def get_loan_accounts(self):
|
||||
loan_accounts = frappe.get_all("Employee Loan", fields=["employee_loan_account", "interest_income_account"],
|
||||
filters = {"company": self.company, "docstatus":1})
|
||||
if loan_accounts:
|
||||
return loan_accounts[0]
|
||||
return totals and totals[0] or None
|
||||
|
||||
def get_salary_component_account(self, salary_component):
|
||||
account = frappe.db.get_value("Salary Component Account",
|
||||
@@ -257,8 +262,7 @@ class ProcessPayroll(Document):
|
||||
earnings = self.get_salary_component_total(component_type = "earnings") or {}
|
||||
deductions = self.get_salary_component_total(component_type = "deductions") or {}
|
||||
default_payroll_payable_account = self.get_default_payroll_payable_account()
|
||||
loan_amounts = self.get_total_salary_and_loan_amounts()
|
||||
loan_accounts = self.get_loan_accounts()
|
||||
loan_details = self.get_loan_details()
|
||||
jv_name = ""
|
||||
precision = frappe.get_precision("Journal Entry Account", "debit_in_account_currency")
|
||||
|
||||
@@ -294,18 +298,18 @@ class ProcessPayroll(Document):
|
||||
})
|
||||
|
||||
# Employee loan
|
||||
if loan_amounts.total_loan_repayment:
|
||||
for data in loan_details:
|
||||
accounts.append({
|
||||
"account": loan_accounts.employee_loan_account,
|
||||
"credit_in_account_currency": loan_amounts.total_principal_amount
|
||||
"account": data.employee_loan_account,
|
||||
"credit_in_account_currency": data.principal_amount
|
||||
})
|
||||
accounts.append({
|
||||
"account": loan_accounts.interest_income_account,
|
||||
"credit_in_account_currency": loan_amounts.total_interest_amount,
|
||||
"account": data.interest_income_account,
|
||||
"credit_in_account_currency": data.interest_amount,
|
||||
"cost_center": self.cost_center,
|
||||
"project": self.project
|
||||
})
|
||||
payable_amount -= flt(loan_amounts.total_loan_repayment, precision)
|
||||
payable_amount -= flt(data.total_payment, precision)
|
||||
|
||||
# Payable amount
|
||||
accounts.append({
|
||||
@@ -327,11 +331,11 @@ class ProcessPayroll(Document):
|
||||
|
||||
def make_payment_entry(self):
|
||||
self.check_permission('write')
|
||||
total_salary_amount = self.get_total_salary_and_loan_amounts()
|
||||
total_salary_amount = self.get_total_salary_amount()
|
||||
default_payroll_payable_account = self.get_default_payroll_payable_account()
|
||||
precision = frappe.get_precision("Journal Entry Account", "debit_in_account_currency")
|
||||
|
||||
if total_salary_amount.rounded_total:
|
||||
if total_salary_amount and total_salary_amount.rounded_total:
|
||||
journal_entry = frappe.new_doc('Journal Entry')
|
||||
journal_entry.voucher_type = 'Bank Entry'
|
||||
journal_entry.user_remark = _('Payment of salary from {0} to {1}')\
|
||||
|
||||
@@ -6,9 +6,9 @@ import unittest
|
||||
|
||||
import erpnext
|
||||
import frappe
|
||||
from frappe.utils import nowdate
|
||||
from erpnext.hr.doctype.process_payroll.process_payroll import get_end_date
|
||||
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from erpnext.accounts.utils import get_fiscal_year, getdate, nowdate
|
||||
from erpnext.hr.doctype.process_payroll.process_payroll import get_start_end_dates, get_end_date
|
||||
|
||||
class TestProcessPayroll(unittest.TestCase):
|
||||
def test_process_payroll(self):
|
||||
@@ -19,22 +19,9 @@ class TestProcessPayroll(unittest.TestCase):
|
||||
if not frappe.db.get_value('Salary Component Account',
|
||||
{'parent': data.name, 'company': erpnext.get_default_company()}, 'name'):
|
||||
get_salary_component_account(data.name)
|
||||
|
||||
payment_account = frappe.get_value('Account',
|
||||
{'account_type': 'Cash', 'company': erpnext.get_default_company(),'is_group':0}, "name")
|
||||
|
||||
if not frappe.db.get_value("Salary Slip", {"start_date": "2016-11-01", "end_date": "2016-11-30"}):
|
||||
process_payroll = frappe.get_doc("Process Payroll", "Process Payroll")
|
||||
process_payroll.company = erpnext.get_default_company()
|
||||
process_payroll.start_date = "2016-11-01"
|
||||
process_payroll.end_date = "2016-11-30"
|
||||
process_payroll.payment_account = payment_account
|
||||
process_payroll.posting_date = nowdate()
|
||||
process_payroll.payroll_frequency = "Monthly"
|
||||
process_payroll.create_salary_slips()
|
||||
process_payroll.submit_salary_slips()
|
||||
if process_payroll.get_sal_slip_list(ss_status = 1):
|
||||
r = process_payroll.make_payment_entry()
|
||||
make_process_payroll()
|
||||
|
||||
def test_get_end_date(self):
|
||||
self.assertEqual(get_end_date('2017-01-01', 'monthly'), {'end_date': '2017-01-31'})
|
||||
@@ -45,7 +32,99 @@ class TestProcessPayroll(unittest.TestCase):
|
||||
self.assertEqual(get_end_date('2020-02-15', 'bimonthly'), {'end_date': ''})
|
||||
self.assertEqual(get_end_date('2017-02-15', 'monthly'), {'end_date': '2017-03-14'})
|
||||
self.assertEqual(get_end_date('2017-02-15', 'daily'), {'end_date': '2017-02-15'})
|
||||
|
||||
|
||||
def test_employee_loan(self):
|
||||
from erpnext.hr.doctype.salary_structure.test_salary_structure import (make_employee,
|
||||
make_salary_structure)
|
||||
from erpnext.hr.doctype.employee_loan.test_employee_loan import create_employee_loan
|
||||
|
||||
branch = "Test Employee Branch"
|
||||
employee = make_employee("test_employee@loan.com")
|
||||
company = erpnext.get_default_company()
|
||||
holiday_list = make_holiday("test holiday for loan")
|
||||
|
||||
if not frappe.db.exists('Salary Component', 'Basic Salary'):
|
||||
frappe.get_doc({
|
||||
'doctype': 'Salary Component',
|
||||
'salary_component': 'Basic Salary',
|
||||
'salary_component_abbr': 'BS',
|
||||
'type': 'Earning',
|
||||
'accounts': [{
|
||||
'company': company,
|
||||
'default_account': frappe.db.get_value('Account',
|
||||
{'company': company, 'root_type': 'Expense', 'account_type': ''}, 'name')
|
||||
}]
|
||||
}).insert()
|
||||
|
||||
if not frappe.db.get_value('Salary Component Account',
|
||||
{'parent': 'Basic Salary', 'company': company}):
|
||||
salary_component = frappe.get_doc('Salary Component', 'Basic Salary')
|
||||
salary_component.append('accounts', {
|
||||
'company': company,
|
||||
'default_account': 'Salary - WP'
|
||||
})
|
||||
|
||||
company_doc = frappe.get_doc('Company', company)
|
||||
if not company_doc.default_payroll_payable_account:
|
||||
company_doc.default_payroll_payable_account = frappe.db.get_value('Account',
|
||||
{'company': company, 'root_type': 'Liability', 'account_type': ''}, 'name')
|
||||
company_doc.save()
|
||||
|
||||
if not frappe.db.exists('Branch', branch):
|
||||
frappe.get_doc({
|
||||
'doctype': 'Branch',
|
||||
'branch': branch
|
||||
}).insert()
|
||||
|
||||
employee_doc = frappe.get_doc('Employee', employee)
|
||||
employee_doc.branch = branch
|
||||
employee_doc.holiday_list = holiday_list
|
||||
employee_doc.save()
|
||||
|
||||
employee_loan = create_employee_loan(employee,
|
||||
"Personal Loan", 280000, "Repay Over Number of Periods", 20)
|
||||
employee_loan.repay_from_salary = 1
|
||||
employee_loan.submit()
|
||||
|
||||
salary_strcture = "Test Salary Structure for Loan"
|
||||
if not frappe.db.exists('Salary Structure', salary_strcture):
|
||||
salary_strcture = make_salary_structure(salary_strcture, [{
|
||||
'employee': employee,
|
||||
'from_date': '2017-01-01',
|
||||
'base': 30000
|
||||
}])
|
||||
|
||||
salary_strcture = frappe.get_doc('Salary Structure', salary_strcture)
|
||||
salary_strcture.set('earnings', [{
|
||||
'salary_component': 'Basic Salary',
|
||||
'abbr': 'BS',
|
||||
'amount_based_on_formula':1,
|
||||
'formula': 'base*.5'
|
||||
}])
|
||||
salary_strcture.save()
|
||||
|
||||
dates = get_start_end_dates('Monthly', nowdate())
|
||||
make_process_payroll(start_date=dates.start_date,
|
||||
end_date=dates.end_date, branch=branch)
|
||||
|
||||
name = frappe.db.get_value('Salary Slip',
|
||||
{'posting_date': nowdate(), 'employee': employee}, 'name')
|
||||
|
||||
salary_slip = frappe.get_doc('Salary Slip', name)
|
||||
for row in salary_slip.loans:
|
||||
if row.employee_loan == employee_loan.name:
|
||||
interest_amount = (280000 * 8.4)/(12*100)
|
||||
principal_amount = employee_loan.monthly_repayment_amount - interest_amount
|
||||
self.assertEqual(row.interest_amount, interest_amount)
|
||||
self.assertEqual(row.principal_amount, principal_amount)
|
||||
self.assertEqual(row.total_payment,
|
||||
interest_amount + principal_amount)
|
||||
|
||||
if salary_slip.docstatus == 0:
|
||||
frappe.delete_doc('Salary Slip', name)
|
||||
|
||||
employee_loan.cancel()
|
||||
frappe.delete_doc('Employee Loan', employee_loan.name)
|
||||
|
||||
def get_salary_component_account(sal_comp):
|
||||
company = erpnext.get_default_company()
|
||||
@@ -63,4 +142,54 @@ def create_account(company):
|
||||
"parent_account": "Indirect Expenses - " + frappe.db.get_value('Company', company, 'abbr'),
|
||||
"company": company
|
||||
}).insert()
|
||||
return salary_account
|
||||
return salary_account
|
||||
|
||||
def make_process_payroll(**args):
|
||||
args = frappe._dict(args)
|
||||
|
||||
process_payroll = frappe.get_doc("Process Payroll", "Process Payroll")
|
||||
process_payroll.company = erpnext.get_default_company()
|
||||
process_payroll.start_date = args.start_date or "2016-11-01"
|
||||
process_payroll.end_date = args.end_date or "2016-11-30"
|
||||
process_payroll.payment_account = get_payment_account()
|
||||
process_payroll.posting_date = nowdate()
|
||||
process_payroll.payroll_frequency = "Monthly"
|
||||
process_payroll.branch = args.branch or None
|
||||
process_payroll.create_salary_slips()
|
||||
process_payroll.submit_salary_slips()
|
||||
if process_payroll.get_sal_slip_list(ss_status = 1):
|
||||
r = process_payroll.make_payment_entry()
|
||||
|
||||
return process_payroll
|
||||
|
||||
def get_payment_account():
|
||||
return frappe.get_value('Account',
|
||||
{'account_type': 'Cash', 'company': erpnext.get_default_company(),'is_group':0}, "name")
|
||||
|
||||
def make_holiday(holiday_list_name):
|
||||
if not frappe.db.exists('Holiday List', holiday_list_name):
|
||||
current_fiscal_year = get_fiscal_year(nowdate(), as_dict=True)
|
||||
dt = getdate(nowdate())
|
||||
|
||||
new_year = dt + relativedelta(month=01, day=01, year=dt.year)
|
||||
republic_day = dt + relativedelta(month=01, day=26, year=dt.year)
|
||||
test_holiday = dt + relativedelta(month=02, day=02, year=dt.year)
|
||||
|
||||
frappe.get_doc({
|
||||
'doctype': 'Holiday List',
|
||||
'from_date': current_fiscal_year.year_start_date,
|
||||
'to_date': current_fiscal_year.year_end_date,
|
||||
'holiday_list_name': holiday_list_name,
|
||||
'holidays': [{
|
||||
'holiday_date': new_year,
|
||||
'description': 'New Year'
|
||||
}, {
|
||||
'holiday_date': republic_day,
|
||||
'description': 'Republic Day'
|
||||
}, {
|
||||
'holiday_date': test_holiday,
|
||||
'description': 'Test Holiday'
|
||||
}]
|
||||
}).insert()
|
||||
|
||||
return holiday_list_name
|
||||
|
||||
@@ -161,18 +161,15 @@ var calculate_earning_total = function(doc, dt, dn, reset_amount) {
|
||||
|
||||
tbl[i].amount = Math.round(tbl[i].default_amount)*(flt(doc.payment_days) /
|
||||
cint(doc.total_working_days)*100)/100;
|
||||
refresh_field('amount', tbl[i].name, 'earnings');
|
||||
|
||||
} else if(reset_amount) {
|
||||
tbl[i].amount = tbl[i].default_amount;
|
||||
refresh_field('amount', tbl[i].name, 'earnings');
|
||||
}
|
||||
if(!tbl[i].do_not_include_in_total) {
|
||||
total_earn += flt(tbl[i].amount);
|
||||
}
|
||||
}
|
||||
doc.gross_pay = total_earn;
|
||||
refresh_many(['amount','gross_pay']);
|
||||
refresh_many(['earnings', 'amount','gross_pay']);
|
||||
}
|
||||
|
||||
// Calculate deduction total
|
||||
@@ -183,17 +180,15 @@ var calculate_ded_total = function(doc, dt, dn, reset_amount) {
|
||||
for(var i = 0; i < tbl.length; i++){
|
||||
if(cint(tbl[i].depends_on_lwp) == 1) {
|
||||
tbl[i].amount = Math.round(tbl[i].default_amount)*(flt(doc.payment_days)/cint(doc.total_working_days)*100)/100;
|
||||
refresh_field('amount', tbl[i].name, 'deductions');
|
||||
} else if(reset_amount) {
|
||||
tbl[i].amount = tbl[i].default_amount;
|
||||
refresh_field('amount', tbl[i].name, 'deductions');
|
||||
}
|
||||
if(!tbl[i].do_not_include_in_total) {
|
||||
total_ded += flt(tbl[i].amount);
|
||||
}
|
||||
}
|
||||
doc.total_deduction = total_ded;
|
||||
refresh_field('total_deduction');
|
||||
refresh_many(['deductions', 'total_deduction']);
|
||||
}
|
||||
|
||||
// Calculate net payable amount
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 0,
|
||||
@@ -12,35 +13,7 @@
|
||||
"editable_grid": 0,
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break0",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "Column Break",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -53,7 +26,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Posting Date",
|
||||
"length": 0,
|
||||
@@ -71,6 +44,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -82,7 +56,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 1,
|
||||
"in_list_view": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Employee",
|
||||
"length": 0,
|
||||
@@ -102,6 +76,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -113,7 +88,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 1,
|
||||
"in_list_view": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Employee Name",
|
||||
"length": 0,
|
||||
@@ -133,6 +108,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -164,6 +140,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -196,6 +173,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -227,6 +205,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -256,6 +235,7 @@
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -286,6 +266,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -316,6 +297,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -327,7 +309,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Company",
|
||||
"length": 0,
|
||||
@@ -345,6 +327,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 1,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -374,6 +357,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -402,6 +386,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -433,6 +418,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -463,6 +449,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -494,6 +481,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -522,6 +510,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -553,6 +542,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -585,6 +575,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -616,6 +607,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -647,6 +639,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -678,6 +671,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -708,6 +702,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -739,6 +734,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -767,6 +763,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -796,6 +793,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -826,6 +824,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -856,6 +855,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -886,6 +886,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -916,6 +917,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -944,6 +946,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -975,6 +978,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -1004,6 +1008,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -1034,6 +1039,7 @@
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -1066,6 +1072,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -1096,6 +1103,7 @@
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -1127,6 +1135,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -1156,6 +1165,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -1187,6 +1197,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -1214,6 +1225,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -1245,6 +1257,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -1275,11 +1288,73 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "principal_amount",
|
||||
"fieldname": "loans",
|
||||
"fieldtype": "Table",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Employee Loan",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Salary Slip Loan",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "section_break_43",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "0",
|
||||
"fieldname": "total_principal_amount",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
@@ -1288,7 +1363,7 @@
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Principal Amount",
|
||||
"label": "Total Principal Amount",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Company:company:default_currency",
|
||||
@@ -1305,11 +1380,13 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "interest_amount",
|
||||
"default": "0",
|
||||
"fieldname": "total_interest_amount",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
@@ -1318,7 +1395,7 @@
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Interest Amount",
|
||||
"label": "Total Interest Amount",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Company:company:default_currency",
|
||||
@@ -1335,11 +1412,12 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_48",
|
||||
"fieldname": "column_break_45",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
@@ -1363,10 +1441,12 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "0",
|
||||
"fieldname": "total_loan_repayment",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
@@ -1393,6 +1473,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -1422,6 +1503,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -1454,6 +1536,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -1482,6 +1565,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 1,
|
||||
"collapsible": 0,
|
||||
@@ -1511,6 +1595,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -1539,6 +1624,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -1570,18 +1656,18 @@
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"icon": "fa fa-file-text",
|
||||
"idx": 9,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 1,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-03-02 02:25:53.844701",
|
||||
"modified": "2017-11-13 23:55:37.504856",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Salary Slip",
|
||||
|
||||
@@ -348,7 +348,8 @@ class SalarySlip(TransactionBase):
|
||||
/ 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 and \
|
||||
cint(d.depends_on_lwp):
|
||||
d.amount = 0
|
||||
elif not d.amount:
|
||||
d.amount = d.default_amount
|
||||
@@ -374,15 +375,34 @@ class SalarySlip(TransactionBase):
|
||||
self.precision("net_pay") if disable_rounded_total else 0)
|
||||
|
||||
def set_loan_repayment(self):
|
||||
employee_loan = frappe.db.sql("""select sum(principal_amount) as principal_amount, sum(interest_amount) as interest_amount,
|
||||
sum(total_payment) as total_loan_repayment from `tabRepayment Schedule`
|
||||
where payment_date between %s and %s and parent in (select name from `tabEmployee Loan`
|
||||
where employee = %s and repay_from_salary = 1 and docstatus = 1)""",
|
||||
(self.start_date, self.end_date, self.employee), as_dict=True)
|
||||
if employee_loan:
|
||||
self.principal_amount = employee_loan[0].principal_amount
|
||||
self.interest_amount = employee_loan[0].interest_amount
|
||||
self.total_loan_repayment = employee_loan[0].total_loan_repayment
|
||||
self.set('loans', [])
|
||||
self.total_loan_repayment = 0
|
||||
self.total_interest_amount = 0
|
||||
self.total_principal_amount = 0
|
||||
|
||||
for loan in self.get_employee_loan_details():
|
||||
self.append('loans', {
|
||||
'employee_loan': loan.name,
|
||||
'total_payment': loan.total_payment,
|
||||
'interest_amount': loan.interest_amount,
|
||||
'principal_amount': loan.principal_amount,
|
||||
'employee_loan_account': loan.employee_loan_account,
|
||||
'interest_income_account': loan.interest_income_account
|
||||
})
|
||||
|
||||
self.total_loan_repayment += loan.total_payment
|
||||
self.total_interest_amount += loan.interest_amount
|
||||
self.total_principal_amount += loan.principal_amount
|
||||
|
||||
def get_employee_loan_details(self):
|
||||
return frappe.db.sql("""select rps.principal_amount, rps.interest_amount, el.name,
|
||||
rps.total_payment, el.employee_loan_account, el.interest_income_account
|
||||
from
|
||||
`tabRepayment Schedule` as rps, `tabEmployee Loan` as el
|
||||
where
|
||||
el.name = rps.parent and rps.payment_date between %s and %s and
|
||||
el.repay_from_salary = 1 and el.docstatus = 1 and el.employee = %s""",
|
||||
(self.start_date, self.end_date, self.employee), as_dict=True) or []
|
||||
|
||||
def on_submit(self):
|
||||
if self.net_pay < 0:
|
||||
|
||||
0
erpnext/hr/doctype/salary_slip_loan/__init__.py
Normal file
0
erpnext/hr/doctype/salary_slip_loan/__init__.py
Normal file
256
erpnext/hr/doctype/salary_slip_loan/salary_slip_loan.json
Normal file
256
erpnext/hr/doctype/salary_slip_loan/salary_slip_loan.json
Normal file
@@ -0,0 +1,256 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 0,
|
||||
"creation": "2017-11-08 12:51:12.834479",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "employee_loan",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Employee Loan",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Employee Loan",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "employee_loan_account",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Employee Loan Account",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Account",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "interest_income_account",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Interest Income Account",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Account",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_4",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "principal_amount",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Principal Amount",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "interest_amount",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Interest Amount",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "total_payment",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Total Payment",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-11-13 23:59:47.237689",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Salary Slip Loan",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1,
|
||||
"track_seen": 0
|
||||
}
|
||||
10
erpnext/hr/doctype/salary_slip_loan/salary_slip_loan.py
Normal file
10
erpnext/hr/doctype/salary_slip_loan/salary_slip_loan.py
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
class SalarySlipLoan(Document):
|
||||
pass
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"autoname": "Prompt",
|
||||
@@ -12,34 +13,7 @@
|
||||
"editable_grid": 0,
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break0",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -69,6 +43,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -99,6 +74,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -127,6 +103,7 @@
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -159,6 +136,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -191,6 +169,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -222,6 +201,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -250,6 +230,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -281,6 +262,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -310,6 +292,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -340,6 +323,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -368,6 +352,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -400,6 +385,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -431,6 +417,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -464,6 +451,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -495,6 +483,7 @@
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -527,6 +516,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -558,6 +548,7 @@
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -589,6 +580,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -618,6 +610,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -646,6 +639,7 @@
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -677,6 +671,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -708,6 +703,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -737,6 +733,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -766,6 +763,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -796,6 +794,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -824,6 +823,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -854,18 +854,18 @@
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"icon": "fa fa-file-text",
|
||||
"idx": 1,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-02-22 06:09:55.491748",
|
||||
"modified": "2017-11-10 18:45:07.120254",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Salary Structure",
|
||||
|
||||
@@ -17,11 +17,9 @@ class TestSalaryStructure(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.make_holiday_list()
|
||||
frappe.db.set_value("Company", erpnext.get_default_company(), "default_holiday_list", "Salary Structure Test Holiday List")
|
||||
make_earning_salary_component(["Basic Salary", "Special Allowance", "HRA"])
|
||||
make_deduction_salary_component(["Professional Tax", "TDS"])
|
||||
make_employee("test_employee@salary.com")
|
||||
make_employee("test_employee_2@salary.com")
|
||||
|
||||
|
||||
def make_holiday_list(self):
|
||||
if not frappe.db.get_value("Holiday List", "Salary Structure Test Holiday List"):
|
||||
holiday_list = frappe.get_doc({
|
||||
@@ -33,7 +31,7 @@ class TestSalaryStructure(unittest.TestCase):
|
||||
}).insert()
|
||||
holiday_list.get_weekly_off_dates()
|
||||
holiday_list.save()
|
||||
|
||||
|
||||
def test_amount_totals(self):
|
||||
sal_slip = frappe.get_value("Salary Slip", {"employee_name":"test_employee@salary.com"})
|
||||
if not sal_slip:
|
||||
@@ -64,7 +62,7 @@ class TestSalaryStructure(unittest.TestCase):
|
||||
|
||||
for row in salary_structure.deductions:
|
||||
self.assertFalse(("\n" in row.formula) or ("\n" in row.condition))
|
||||
|
||||
|
||||
def make_employee(user):
|
||||
if not frappe.db.get_value("User", user):
|
||||
frappe.get_doc({
|
||||
@@ -74,7 +72,6 @@ def make_employee(user):
|
||||
"new_password": "password",
|
||||
"roles": [{"doctype": "Has Role", "role": "Employee"}]
|
||||
}).insert()
|
||||
|
||||
|
||||
if not frappe.db.get_value("Employee", {"user_id": user}):
|
||||
emp = frappe.get_doc({
|
||||
@@ -95,7 +92,7 @@ def make_employee(user):
|
||||
return emp.name
|
||||
else:
|
||||
return frappe.get_value("Employee", {"employee_name":user}, "name")
|
||||
|
||||
|
||||
def make_salary_slip_from_salary_structure(employee):
|
||||
sal_struct = make_salary_structure('Salary Structure Sample')
|
||||
sal_slip = make_salary_slip(sal_struct, employee = employee)
|
||||
@@ -106,22 +103,21 @@ def make_salary_slip_from_salary_structure(employee):
|
||||
sal_slip.insert()
|
||||
sal_slip.submit()
|
||||
return sal_slip
|
||||
|
||||
def make_salary_structure(sal_struct):
|
||||
|
||||
def make_salary_structure(sal_struct, employees=None):
|
||||
if not frappe.db.exists('Salary Structure', sal_struct):
|
||||
frappe.get_doc({
|
||||
"doctype": "Salary Structure",
|
||||
"name": sal_struct,
|
||||
"company": erpnext.get_default_company(),
|
||||
"employees": get_employee_details(),
|
||||
"employees": employees or get_employee_details(),
|
||||
"earnings": get_earnings_component(),
|
||||
"deductions": get_deductions_component(),
|
||||
"payroll_frequency": "Monthly",
|
||||
"payment_account": frappe.get_value('Account', {'account_type': 'Cash', 'company': erpnext.get_default_company(),'is_group':0}, "name")
|
||||
}).insert()
|
||||
return sal_struct
|
||||
|
||||
|
||||
return sal_struct
|
||||
|
||||
def get_employee_details():
|
||||
return [{"employee": frappe.get_value("Employee", {"employee_name":"test_employee@salary.com"}, "name"),
|
||||
"base": 25000,
|
||||
@@ -136,8 +132,11 @@ def get_employee_details():
|
||||
"idx": 2
|
||||
}
|
||||
]
|
||||
|
||||
def get_earnings_component():
|
||||
|
||||
def get_earnings_component():
|
||||
make_earning_salary_component(["Basic Salary", "Special Allowance", "HRA"])
|
||||
make_deduction_salary_component(["Professional Tax", "TDS"])
|
||||
|
||||
return [
|
||||
{
|
||||
"salary_component": 'Basic Salary',
|
||||
@@ -167,7 +166,7 @@ def get_earnings_component():
|
||||
"idx": 4
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
def get_deductions_component():
|
||||
return [
|
||||
{
|
||||
@@ -191,5 +190,4 @@ def get_deductions_component():
|
||||
"formula": 'base*.1',
|
||||
"idx": 3
|
||||
}
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
QUnit.module('hr');
|
||||
|
||||
QUnit.test("Test: Training Event [HR]", function (assert) {
|
||||
assert.expect(4);
|
||||
assert.expect(5);
|
||||
let done = assert.async();
|
||||
let employee_name;
|
||||
|
||||
@@ -21,7 +21,8 @@ QUnit.test("Test: Training Event [HR]", function (assert) {
|
||||
{ employees: [
|
||||
[
|
||||
{employee: employee_name},
|
||||
{employee_name: 'Test Employee 1'}
|
||||
{employee_name: 'Test Employee 1'},
|
||||
{attendance: 'Optional'}
|
||||
]
|
||||
]},
|
||||
]);
|
||||
@@ -41,6 +42,9 @@ QUnit.test("Test: Training Event [HR]", function (assert) {
|
||||
|
||||
assert.ok(cur_frm.doc.employees[0].employee_name=='Test Employee 1',
|
||||
'Attendee Employee is correctly set');
|
||||
|
||||
assert.ok(cur_frm.doc.employees[0].attendance=='Optional',
|
||||
'Attendance is correctly set');
|
||||
},
|
||||
|
||||
() => frappe.set_route('List','Training Event','List'),
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
QUnit.module('hr');
|
||||
|
||||
QUnit.test("test: Training Event", function (assert) {
|
||||
// number of asserts
|
||||
assert.expect(1);
|
||||
let done = assert.async();
|
||||
|
||||
frappe.run_serially([
|
||||
// insert a new Training Event
|
||||
() => frappe.set_route("List", "Training Event", "List"),
|
||||
() => frappe.new_doc("Training Event"),
|
||||
() => frappe.timeout(1),
|
||||
() => frappe.click_link('Edit in full page'),
|
||||
() => cur_frm.set_value("event_name", "Test Event " + frappe.utils.get_random(10)),
|
||||
() => cur_frm.set_value("start_time", "2017-07-26, 2:00 pm PDT"),
|
||||
() => cur_frm.set_value("end_time", "2017-07-26, 2:30 pm PDT"),
|
||||
() => cur_frm.set_value("introduction", "This is a test report"),
|
||||
() => cur_frm.set_value("location", "Fake office"),
|
||||
() => frappe.click_button('Add Row'),
|
||||
() => frappe.db.get_value('Employee', {'employee_name':'Test Employee 1'}, 'name'),
|
||||
(r) => {
|
||||
console.log(r);
|
||||
return cur_frm.fields_dict.employees.grid.grid_rows[0].doc.employee = r.message.name;
|
||||
},
|
||||
() => {
|
||||
return cur_frm.fields_dict.employees.grid.grid_rows[0].doc.attendance = "Optional";
|
||||
},
|
||||
() => frappe.click_button('Save'),
|
||||
() => frappe.timeout(2),
|
||||
() => frappe.click_button('Submit'),
|
||||
() => frappe.timeout(2),
|
||||
() => frappe.click_button('Yes'),
|
||||
() => frappe.timeout(1),
|
||||
() => {
|
||||
assert.equal(cur_frm.doc.docstatus, 1);
|
||||
},
|
||||
() => done()
|
||||
]);
|
||||
|
||||
});
|
||||
@@ -809,7 +809,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-10-18 11:22:20.143491",
|
||||
"modified": "2017-10-23 06:13:29.065781",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Training Event",
|
||||
@@ -837,7 +837,7 @@
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"quick_entry": 0,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"search_fields": "event_name",
|
||||
|
||||
@@ -5,7 +5,7 @@ def get_data():
|
||||
'fieldname': 'training_program',
|
||||
'transactions': [
|
||||
{
|
||||
'label': _('Training Event'),
|
||||
'label': _('Training Events'),
|
||||
'items': ['Training Event']
|
||||
},
|
||||
]
|
||||
|
||||
@@ -484,7 +484,7 @@ erpnext.hub.Hub = class Hub {
|
||||
}
|
||||
frappe.call({
|
||||
method: 'erpnext.hub_node.get_company_details',
|
||||
args: {company_id: company_id}
|
||||
args: {hub_sync_id: company_id}
|
||||
}).then((r) => {
|
||||
if (r.message) {
|
||||
const company_details = r.message.company_details;
|
||||
|
||||
@@ -456,3 +456,8 @@ erpnext.patches.v9_0.set_variant_item_description
|
||||
erpnext.patches.v9_0.set_uoms_in_variant_field
|
||||
erpnext.patches.v9_0.copy_old_fees_field_data
|
||||
erpnext.patches.v9_0.set_pos_profile_name
|
||||
erpnext.patches.v9_0.remove_non_existing_warehouse_from_stock_settings
|
||||
execute:frappe.delete_doc_if_exists("DocType", "Program Fee")
|
||||
erpnext.patches.v9_0.update_employee_loan_details
|
||||
erpnext.patches.v9_2.delete_healthcare_domain_default_items
|
||||
erpnext.patches.v9_2.rename_translated_domains_in_en
|
||||
|
||||
@@ -5,6 +5,8 @@ from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("schools", "doctype", "fees")
|
||||
|
||||
if "total_amount" not in frappe.db.get_table_columns("Fees"):
|
||||
return
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
default_warehouse = frappe.db.get_value("Stock Settings", None, "default_warehouse")
|
||||
if default_warehouse:
|
||||
if not frappe.db.get_value("Warehouse", {"name": default_warehouse}):
|
||||
frappe.db.set_value("Stock Settings", None, "default_warehouse", "")
|
||||
@@ -8,12 +8,17 @@ def execute():
|
||||
doctype = 'POS Profile'
|
||||
frappe.reload_doctype(doctype)
|
||||
|
||||
for pos in frappe.get_all(doctype):
|
||||
for pos in frappe.get_all(doctype, filters={'disabled': 0}):
|
||||
doc = frappe.get_doc(doctype, pos.name)
|
||||
|
||||
if not doc.user: continue
|
||||
if not doc.user or doc.pos_profile_name: continue
|
||||
|
||||
doc.pos_profile_name = doc.user + ' - ' + doc.company
|
||||
doc.save()
|
||||
try:
|
||||
doc.pos_profile_name = doc.user + ' - ' + doc.company
|
||||
doc.flags.ignore_validate = True
|
||||
doc.flags.ignore_mandatory = True
|
||||
doc.save()
|
||||
|
||||
frappe.rename_doc(doctype, doc.name, doc.pos_profile_name, force=True)
|
||||
frappe.rename_doc(doctype, doc.name, doc.pos_profile_name, force=True)
|
||||
except frappe.LinkValidationError:
|
||||
frappe.db.set_value("POS Profile", doc.name, 'disabled', 1)
|
||||
|
||||
24
erpnext/patches/v9_0/update_employee_loan_details.py
Normal file
24
erpnext/patches/v9_0/update_employee_loan_details.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# Copyright (c) 2017, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc('hr', 'doctype', 'salary_slip_loan')
|
||||
frappe.reload_doc('hr', 'doctype', 'salary_slip')
|
||||
|
||||
for data in frappe.db.sql(""" select name,
|
||||
start_date, end_date, total_loan_repayment
|
||||
from
|
||||
`tabSalary Slip`
|
||||
where
|
||||
docstatus < 2 and ifnull(total_loan_repayment, 0) > 0""", as_dict=1):
|
||||
salary_slip = frappe.get_doc('Salary Slip', data.name)
|
||||
salary_slip.set_loan_repayment()
|
||||
|
||||
if salary_slip.total_loan_repayment == data.total_loan_repayment:
|
||||
for row in salary_slip.loans:
|
||||
row.db_update()
|
||||
|
||||
salary_slip.db_update()
|
||||
0
erpnext/patches/v9_2/__init__.py
Normal file
0
erpnext/patches/v9_2/__init__.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import frappe
|
||||
from frappe.utils import getdate
|
||||
|
||||
def execute():
|
||||
domain_settings = frappe.get_doc('Domain Settings')
|
||||
active_domains = [d.domain for d in domain_settings.active_domains]
|
||||
|
||||
if "Healthcare" not in active_domains:
|
||||
items = ["TTT", "MCH", "LDL", "GTT", "HDL", "BILT", "BILD", "BP", "BS"]
|
||||
for item_code in items:
|
||||
try:
|
||||
item = frappe.db.get_value("Item", {"item_code": item_code}, ["name", "creation"], as_dict=1)
|
||||
if item and getdate(item.creation) >= getdate("2017-11-10"):
|
||||
frappe.delete_doc("Item", item.name)
|
||||
except:
|
||||
pass
|
||||
31
erpnext/patches/v9_2/rename_translated_domains_in_en.py
Normal file
31
erpnext/patches/v9_2/rename_translated_domains_in_en.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import frappe
|
||||
from frappe import _
|
||||
|
||||
def execute():
|
||||
language = frappe.get_single("System Settings").language
|
||||
|
||||
if language and language.startswith('en'): return
|
||||
|
||||
frappe.local.lang = language
|
||||
|
||||
all_domains = frappe.get_hooks("domains")
|
||||
|
||||
for domain in all_domains:
|
||||
translated_domain = _(domain, lang=language)
|
||||
if frappe.db.exists("Domain", translated_domain):
|
||||
frappe.rename_doc("Domain", translated_domain, domain, ignore_permissions=True, merge=True)
|
||||
|
||||
domain_settings = frappe.get_single("Domain Settings")
|
||||
active_domains = [d.domain for d in domain_settings.active_domains]
|
||||
|
||||
try:
|
||||
for domain in active_domains:
|
||||
domain = frappe.get_doc("Domain", domain)
|
||||
domain.setup_domain()
|
||||
|
||||
if int(frappe.db.get_single_value('System Settings', 'setup_complete')):
|
||||
domain.setup_sidebar_items()
|
||||
domain.setup_desktop_icons()
|
||||
domain.set_default_portal_role()
|
||||
except frappe.LinkValidationError:
|
||||
pass
|
||||
@@ -191,7 +191,6 @@ var update_time_rates = function(frm, cdt, cdn){
|
||||
var child = locals[cdt][cdn];
|
||||
if(!child.billable){
|
||||
frappe.model.set_value(cdt, cdn, 'billing_rate', 0.0);
|
||||
frappe.model.set_value(cdt, cdn, 'costing_rate', 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,9 +201,8 @@ var calculate_billing_costing_amount = function(frm, cdt, cdn){
|
||||
|
||||
if(child.billing_hours && child.billable){
|
||||
billing_amount = (child.billing_hours * child.billing_rate);
|
||||
costing_amount = flt(child.costing_rate * child.billing_hours);
|
||||
}
|
||||
|
||||
costing_amount = flt(child.costing_rate * child.hours);
|
||||
frappe.model.set_value(cdt, cdn, 'billing_amount', billing_amount);
|
||||
frappe.model.set_value(cdt, cdn, 'costing_amount', costing_amount);
|
||||
calculate_time_and_amount(frm);
|
||||
|
||||
@@ -49,10 +49,10 @@ class Timesheet(Document):
|
||||
self.update_time_rates(d)
|
||||
|
||||
self.total_hours += flt(d.hours)
|
||||
self.total_costing_amount += flt(d.costing_amount)
|
||||
if d.billable:
|
||||
self.total_billable_hours += flt(d.billing_hours)
|
||||
self.total_billable_amount += flt(d.billing_amount)
|
||||
self.total_costing_amount += flt(d.costing_amount)
|
||||
self.total_billed_amount += flt(d.billing_amount) if d.sales_invoice else 0.0
|
||||
self.total_billed_hours += flt(d.billing_hours) if d.sales_invoice else 0.0
|
||||
|
||||
@@ -265,19 +265,19 @@ class Timesheet(Document):
|
||||
|
||||
def update_cost(self):
|
||||
for data in self.time_logs:
|
||||
if data.activity_type and data.billable:
|
||||
if data.activity_type or data.billable:
|
||||
rate = get_activity_cost(self.employee, data.activity_type)
|
||||
hours = data.billing_hours or 0
|
||||
costing_hours = data.billing_hours or data.hours or 0
|
||||
if rate:
|
||||
data.billing_rate = flt(rate.get('billing_rate')) if flt(data.billing_rate) == 0 else data.billing_rate
|
||||
data.costing_rate = flt(rate.get('costing_rate')) if flt(data.costing_rate) == 0 else data.costing_rate
|
||||
data.billing_amount = data.billing_rate * hours
|
||||
data.costing_amount = data.costing_rate * hours
|
||||
data.costing_amount = data.costing_rate * costing_hours
|
||||
|
||||
def update_time_rates(self, ts_detail):
|
||||
if not ts_detail.billable:
|
||||
ts_detail.billing_rate = 0.0
|
||||
ts_detail.costing_rate = 0.0
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_projectwise_timesheet_data(project, parent=None):
|
||||
|
||||
@@ -231,8 +231,16 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
},
|
||||
callback: function(r) {
|
||||
if(!r.exc) {
|
||||
me.frm.set_value("taxes", r.message);
|
||||
me.calculate_taxes_and_totals();
|
||||
frappe.run_serially([
|
||||
() => {
|
||||
// directly set in doc, so as not to call triggers
|
||||
me.frm.doc.taxes_and_charges = r.message.taxes_and_charges;
|
||||
|
||||
// set taxes table
|
||||
me.frm.set_value("taxes", r.message.taxes);
|
||||
},
|
||||
() => me.calculate_taxes_and_totals()
|
||||
]);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -935,19 +943,27 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
return;
|
||||
}
|
||||
|
||||
if (me.in_apply_price_list == true) return;
|
||||
|
||||
me.in_apply_price_list = true;
|
||||
return this.frm.call({
|
||||
method: "erpnext.stock.get_item_details.apply_price_list",
|
||||
args: { args: args },
|
||||
callback: function(r) {
|
||||
if (!r.exc) {
|
||||
me.in_apply_price_list = true;
|
||||
me.frm.set_value("price_list_currency", r.message.parent.price_list_currency);
|
||||
me.frm.set_value("plc_conversion_rate", r.message.parent.plc_conversion_rate);
|
||||
me.in_apply_price_list = false;
|
||||
frappe.run_serially([
|
||||
() => me.frm.set_value("price_list_currency", r.message.parent.price_list_currency),
|
||||
() => me.frm.set_value("plc_conversion_rate", r.message.parent.plc_conversion_rate),
|
||||
() => {
|
||||
if(args.items.length) {
|
||||
me._set_values_for_item_list(r.message.children);
|
||||
}
|
||||
},
|
||||
() => { me.in_apply_price_list = false; }
|
||||
]);
|
||||
|
||||
if(args.items.length) {
|
||||
me._set_values_for_item_list(r.message.children);
|
||||
}
|
||||
} else {
|
||||
me.in_apply_price_list = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1112,11 +1128,11 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
filters: {'item': item.item_code}
|
||||
}
|
||||
} else {
|
||||
filters = {
|
||||
let filters = {
|
||||
'item_code': item.item_code,
|
||||
'posting_date': me.frm.doc.posting_date || frappe.datetime.nowdate(),
|
||||
}
|
||||
if(item.warehouse) filters["warehouse"] = item.warehouse
|
||||
if (item.warehouse) filters["warehouse"] = item.warehouse
|
||||
|
||||
return {
|
||||
query : "erpnext.controllers.queries.get_batch_no",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
QUnit.module('schools');
|
||||
|
||||
QUnit.test('Test: Assessment Plan', function(assert){
|
||||
assert.expect(7);
|
||||
assert.expect(6);
|
||||
let done = assert.async();
|
||||
let room_name, instructor_name, assessment_name;
|
||||
|
||||
@@ -49,10 +49,6 @@ QUnit.test('Test: Assessment Plan', function(assert){
|
||||
assert.equal(cur_frm.doc.assessment_plan, assessment_name, 'Assessment correctly set');
|
||||
assert.equal(cur_frm.doc.student_group, 'test-course-wise-group-2', 'Course for Assessment correctly set');
|
||||
},
|
||||
() => cur_frm.print_doc(),
|
||||
() => frappe.timeout(1),
|
||||
() => {assert.ok($('.btn-print-print').is(':visible'), "Print Format Available");},
|
||||
|
||||
() => done()
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -7,23 +7,25 @@ cur_frm.add_fetch("assessment_plan", "maximum_assessment_score", "maximum_score"
|
||||
|
||||
frappe.ui.form.on("Assessment Result", {
|
||||
assessment_plan: function(frm) {
|
||||
frappe.call({
|
||||
method: "erpnext.schools.api.get_assessment_details",
|
||||
args: {
|
||||
assessment_plan: frm.doc.assessment_plan
|
||||
},
|
||||
callback: function(r) {
|
||||
if (r.message) {
|
||||
frm.doc.details = [];
|
||||
$.each(r.message, function(i, d) {
|
||||
var row = frappe.model.add_child(frm.doc, "Assessment Result Detail", "details");
|
||||
row.assessment_criteria = d.assessment_criteria;
|
||||
row.maximum_score = d.maximum_score;
|
||||
});
|
||||
if (frm.doc.assessment_plan) {
|
||||
frappe.call({
|
||||
method: "erpnext.schools.api.get_assessment_details",
|
||||
args: {
|
||||
assessment_plan: frm.doc.assessment_plan
|
||||
},
|
||||
callback: function(r) {
|
||||
if (r.message) {
|
||||
frm.doc.details = [];
|
||||
$.each(r.message, function(i, d) {
|
||||
var row = frappe.model.add_child(frm.doc, "Assessment Result Detail", "details");
|
||||
row.assessment_criteria = d.assessment_criteria;
|
||||
row.maximum_score = d.maximum_score;
|
||||
});
|
||||
}
|
||||
refresh_field("details");
|
||||
}
|
||||
refresh_field("details");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@
|
||||
"issingle": 1,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-06-30 08:21:47.184562",
|
||||
"modified": "2017-11-08 11:51:43.247815",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Schools",
|
||||
"name": "Assessment Result Tool",
|
||||
@@ -188,17 +188,17 @@
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
"email": 1,
|
||||
"email": 0,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"print": 0,
|
||||
"read": 1,
|
||||
"report": 0,
|
||||
"role": "Academics User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"share": 0,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2017-06-30 08:21:47.851347",
|
||||
"modified": "2017-11-02 17:57:18.069158",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Schools",
|
||||
"name": "Fee Category",
|
||||
@@ -116,6 +116,46 @@
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 1,
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_global_search": 1,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Fee Structure",
|
||||
@@ -1029,7 +1029,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-09-19 16:24:17.266071",
|
||||
"modified": "2017-11-02 17:55:22.851581",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Schools",
|
||||
"name": "Fee Schedule",
|
||||
@@ -1039,7 +1039,7 @@
|
||||
{
|
||||
"amend": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
@@ -1053,6 +1053,46 @@
|
||||
"role": "Academics User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
}
|
||||
@@ -1060,6 +1100,7 @@
|
||||
"quick_entry": 0,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"restrict_to_domain": "Education",
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
|
||||
@@ -9,6 +9,7 @@ from frappe.model.mapper import get_mapped_doc
|
||||
from frappe.utils import money_in_words
|
||||
from frappe.utils import cint, flt, cstr
|
||||
from frappe.utils.background_jobs import enqueue
|
||||
from frappe import _
|
||||
|
||||
|
||||
class FeeSchedule(Document):
|
||||
@@ -57,6 +58,10 @@ def generate_fee(fee_schedule):
|
||||
error = False
|
||||
total_records = sum([int(d.total_students) for d in doc.student_groups])
|
||||
created_records = 0
|
||||
|
||||
if not total_records:
|
||||
frappe.throw(_("Please setup Students under Student Groups"))
|
||||
|
||||
for d in doc.student_groups:
|
||||
students = frappe.db.sql(""" select sg.program, sg.batch, sgs.student, sgs.student_name
|
||||
from `tabStudent Group` sg, `tabStudent Group Student` sgs
|
||||
|
||||
@@ -165,7 +165,7 @@
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"reqd": 0,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"unique": 0,
|
||||
@@ -197,7 +197,7 @@
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
@@ -577,7 +577,7 @@
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2017-09-11 15:18:27.975666",
|
||||
"modified": "2017-11-02 17:43:16.796845",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Schools",
|
||||
"name": "Fee Structure",
|
||||
@@ -587,7 +587,7 @@
|
||||
{
|
||||
"amend": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
@@ -601,6 +601,46 @@
|
||||
"role": "Academics User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
}
|
||||
@@ -609,6 +649,7 @@
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"restrict_to_domain": "Education",
|
||||
"search_fields": "program, student_category, academic_year",
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 0,
|
||||
"autoname": "naming_series:",
|
||||
"beta": 1,
|
||||
@@ -87,7 +87,7 @@
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_global_search": 1,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Student Name",
|
||||
@@ -118,7 +118,7 @@
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_global_search": 1,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Fee Schedule",
|
||||
@@ -158,7 +158,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
@@ -249,7 +249,7 @@
|
||||
"options": "Company",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 1,
|
||||
@@ -310,7 +310,7 @@
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
@@ -494,7 +494,7 @@
|
||||
"options": "Student Batch Name",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
@@ -708,7 +708,7 @@
|
||||
"options": "Currency",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
@@ -739,7 +739,7 @@
|
||||
"options": "Fee Structure",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
@@ -1011,7 +1011,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
@@ -1132,7 +1132,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
@@ -1163,7 +1163,7 @@
|
||||
"options": "Account",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
@@ -1194,7 +1194,7 @@
|
||||
"options": "Account",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
@@ -1223,7 +1223,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
@@ -1254,6 +1254,35 @@
|
||||
"options": "Cost Center",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "data_42",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
@@ -1276,13 +1305,53 @@
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2017-09-20 23:17:09.819606",
|
||||
"modified": "2017-11-02 17:31:47.155873",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Schools",
|
||||
"name": "Fees",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Academics User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
@@ -1297,7 +1366,7 @@
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Academics User",
|
||||
"role": "Accounts Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 1,
|
||||
@@ -1308,7 +1377,8 @@
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"restrict_to_domain": "Education",
|
||||
"show_name_in_global_search": 0,
|
||||
"search_fields": "student, student_name",
|
||||
"show_name_in_global_search": 1,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"title_field": "student_name",
|
||||
|
||||
@@ -223,67 +223,6 @@
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "fee_schedule",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Fee Schedule",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "fees",
|
||||
"fieldtype": "Table",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Fees",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Program Fee",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
@@ -297,7 +236,7 @@
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2017-06-30 08:21:49.176708",
|
||||
"modified": "2017-11-02 18:08:20.823972",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Schools",
|
||||
"name": "Program",
|
||||
|
||||
@@ -12,10 +12,14 @@ class StudentApplicant(Document):
|
||||
def autoname(self):
|
||||
from frappe.model.naming import set_name_by_naming_series
|
||||
if self.student_admission:
|
||||
naming_series = None
|
||||
if self.program:
|
||||
# set the naming series from the student admission if provided.
|
||||
student_admission = get_student_admission_data(self.student_admission, self.program)
|
||||
if student_admission:
|
||||
naming_series = student_admission.get("applicant_naming_series")
|
||||
else:
|
||||
naming_series = None
|
||||
else:
|
||||
frappe.throw(_("Select the program first"))
|
||||
|
||||
@@ -40,15 +44,16 @@ class StudentApplicant(Document):
|
||||
|
||||
def validation_from_student_admission(self):
|
||||
student_admission = get_student_admission_data(self.student_admission, self.program)
|
||||
if student_admission:
|
||||
if ((
|
||||
student_admission.minimum_age
|
||||
and getdate(student_admission.minimum_age) > getdate(self.date_of_birth)
|
||||
) or (
|
||||
student_admission.maximum_age
|
||||
and getdate(student_admission.maximum_age) < getdate(self.date_of_birth)
|
||||
)):
|
||||
frappe.throw(_("Not eligible for the admission in this program as per DOB"))
|
||||
|
||||
# different validation for minimum and maximum age so that either min/max can also work independently.
|
||||
if student_admission and student_admission.minimum_age and \
|
||||
getdate(student_admission.minimum_age) < getdate(self.date_of_birth):
|
||||
frappe.throw(_("Not eligible for the admission in this program as per DOB"))
|
||||
|
||||
if student_admission and student_admission.maximum_age and \
|
||||
getdate(student_admission.maximum_age) > getdate(self.date_of_birth):
|
||||
frappe.throw(_("Not eligible for the admission in this program as per DOB"))
|
||||
|
||||
|
||||
def on_payment_authorized(self, *args, **kwargs):
|
||||
self.db_set('paid', 1)
|
||||
|
||||
@@ -273,7 +273,7 @@
|
||||
"issingle": 1,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-06-30 08:21:51.390809",
|
||||
"modified": "2017-11-08 11:53:27.994112",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Schools",
|
||||
"name": "Student Attendance Tool",
|
||||
@@ -306,17 +306,17 @@
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
"email": 1,
|
||||
"email": 0,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"print": 0,
|
||||
"read": 1,
|
||||
"report": 0,
|
||||
"role": "Academics User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"share": 0,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import frappe
|
||||
from frappe.model.document import Document
|
||||
from frappe import _
|
||||
from erpnext.schools.utils import validate_duplicate_student
|
||||
from frappe.utils import cint
|
||||
|
||||
class StudentGroup(Document):
|
||||
def validate(self):
|
||||
@@ -34,9 +35,13 @@ class StudentGroup(Document):
|
||||
for d in self.students:
|
||||
if not frappe.db.get_value("Student", d.student, "enabled") and d.active:
|
||||
frappe.throw(_("{0} - {1} is inactive student".format(d.group_roll_number, d.student_name)))
|
||||
if self.group_based_on == "Batch" and d.student not in students and frappe.defaults.get_defaults().validate_batch:
|
||||
|
||||
if (self.group_based_on == "Batch") and cint(frappe.defaults.get_defaults().validate_batch)\
|
||||
and d.student not in students:
|
||||
frappe.throw(_("{0} - {1} is not enrolled in the Batch {2}".format(d.group_roll_number, d.student_name, self.batch)))
|
||||
if self.group_based_on == "Course" and d.student not in students and frappe.defaults.get_defaults().validate_course:
|
||||
|
||||
if (self.group_based_on == "Course") and cint(frappe.defaults.get_defaults().validate_course)\
|
||||
and (d.student not in students):
|
||||
frappe.throw(_("{0} - {1} is not enrolled in the Course {2}".format(d.group_roll_number, d.student_name, self.course)))
|
||||
|
||||
def validate_and_set_child_table_fields(self):
|
||||
@@ -108,14 +113,14 @@ def fetch_students(doctype, txt, searchfield, start, page_len, filters):
|
||||
students = ([d.student for d in enrolled_students if d.student not in student_group_student]
|
||||
if enrolled_students else [""]) or [""]
|
||||
return frappe.db.sql("""select name, title from tabStudent
|
||||
where name in ({0}) and `{1}` LIKE %s
|
||||
where name in ({0}) and (`{1}` LIKE %s or title LIKE %s)
|
||||
order by idx desc, name
|
||||
limit %s, %s""".format(", ".join(['%s']*len(students)), searchfield),
|
||||
tuple(students + ["%%%s%%" % txt, start, page_len]))
|
||||
tuple(students + ["%%%s%%" % txt, "%%%s%%" % txt, start, page_len]))
|
||||
else:
|
||||
return frappe.db.sql("""select name, title from tabStudent
|
||||
where `{0}` LIKE %s
|
||||
where `{0}` LIKE %s or title LIKE %s
|
||||
order by idx desc, name
|
||||
limit %s, %s""".format(searchfield),
|
||||
tuple(["%%%s%%" % txt, start, page_len]))
|
||||
tuple(["%%%s%%" % txt, "%%%s%%" % txt, start, page_len]))
|
||||
|
||||
|
||||
@@ -173,14 +173,16 @@ def get_column(assessment_criteria, total_maximum_score):
|
||||
def get_chart_data(grades, assessment_criteria_list, kounter):
|
||||
grades = sorted(grades)
|
||||
datasets = []
|
||||
|
||||
for grade in grades:
|
||||
tmp = []
|
||||
for ac in assessment_criteria_list:
|
||||
if grade in kounter[ac]:
|
||||
tmp.append(kounter[ac][grade])
|
||||
tmp = frappe._dict({"values":[], "title": grade})
|
||||
for criteria in assessment_criteria_list:
|
||||
if grade in kounter[criteria]:
|
||||
tmp["values"].append(kounter[criteria][grade])
|
||||
else:
|
||||
tmp.append(0)
|
||||
tmp["values"].append(0)
|
||||
datasets.append(tmp)
|
||||
|
||||
return {
|
||||
"data": {
|
||||
"labels": assessment_criteria_list,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 0,
|
||||
"beta": 0,
|
||||
@@ -12,6 +13,7 @@
|
||||
"editable_grid": 0,
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -40,6 +42,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -72,6 +75,37 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Description",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -101,6 +135,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -132,6 +167,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -160,6 +196,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -190,19 +227,19 @@
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"icon": "fa fa-sitemap",
|
||||
"idx": 1,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-02-22 05:06:30.143089",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2017-10-18 14:23:06.538568",
|
||||
"modified_by": "tundebabzy@gmail.com",
|
||||
"module": "Selling",
|
||||
"name": "Product Bundle",
|
||||
"owner": "Administrator",
|
||||
|
||||
@@ -103,7 +103,7 @@ class SalesOrder(SellingController):
|
||||
def validate_delivery_date(self):
|
||||
if self.order_type == 'Sales':
|
||||
if not self.delivery_date:
|
||||
self.delivery_date = max([d.delivery_date for d in self.get("items")])
|
||||
self.delivery_date = max([d.delivery_date for d in self.get("items") if d.delivery_date])
|
||||
|
||||
if self.delivery_date:
|
||||
for d in self.get("items"):
|
||||
|
||||
@@ -1,49 +1,39 @@
|
||||
{
|
||||
"allow_copy": 1,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 0,
|
||||
"creation": "2013-01-10 16:34:22",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 0,
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "column_break1",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "send_to",
|
||||
"fieldtype": "Select",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Send To",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "\nAll Contact\nAll Customer Contact\nAll Supplier Contact\nAll Sales Partner Contact\nAll Lead (Open)\nAll Employee (Active)\nAll Sales Person",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
@@ -51,22 +41,30 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "eval:doc.send_to=='All Customer Contact'",
|
||||
"fieldname": "customer",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Customer",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Customer",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
@@ -74,22 +72,30 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "eval:doc.send_to=='All Supplier Contact'",
|
||||
"fieldname": "supplier",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Supplier",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Supplier",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
@@ -97,23 +103,31 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "eval:doc.send_to=='All Sales Partner Contact'",
|
||||
"fieldname": "sales_partner",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Sales Partner",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Sales Partner",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
@@ -121,22 +135,30 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "eval:doc.send_to=='All Employee (Active)'",
|
||||
"fieldname": "department",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Department",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Department",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
@@ -144,22 +166,30 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "eval:doc.send_to=='All Employee (Active)'",
|
||||
"fieldname": "branch",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Branch",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Branch",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
@@ -167,21 +197,29 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "create_receiver_list",
|
||||
"fieldtype": "Button",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Create Receiver List",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "create_receiver_list",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
@@ -189,20 +227,28 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "receiver_list",
|
||||
"fieldtype": "Code",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Receiver List",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
@@ -210,19 +256,27 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break9",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
@@ -231,21 +285,29 @@
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"description": "Messages greater than 160 characters will be split into multiple messages",
|
||||
"fieldname": "message",
|
||||
"fieldtype": "Text",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Message",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
@@ -253,20 +315,28 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "total_characters",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Total Characters",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
@@ -274,20 +344,28 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "total_messages",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Total Message(s)",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
@@ -295,21 +373,29 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "send_sms",
|
||||
"fieldtype": "Button",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Send SMS",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "send_sms",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
@@ -317,16 +403,18 @@
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"icon": "fa fa-mobile-phone",
|
||||
"idx": 1,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 1,
|
||||
"istable": 0,
|
||||
"modified": "2015-05-25 17:46:37.555503",
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-11-10 18:46:21.021767",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "SMS Center",
|
||||
@@ -353,8 +441,12 @@
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 0,
|
||||
"read_only": 1,
|
||||
"read_only_onload": 0,
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC"
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 0,
|
||||
"track_seen": 0
|
||||
}
|
||||
@@ -53,8 +53,6 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
||||
() => this.setup_pos_profile(),
|
||||
() => this.make_new_invoice(),
|
||||
() => {
|
||||
frappe.timeout(1);
|
||||
this.make_items();
|
||||
this.bind_events();
|
||||
frappe.dom.unfreeze();
|
||||
},
|
||||
@@ -323,16 +321,20 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
||||
|
||||
make_new_invoice() {
|
||||
return frappe.run_serially([
|
||||
() => this.make_sales_invoice_frm(),
|
||||
() => {
|
||||
if (this.cart) {
|
||||
this.cart.frm = this.frm;
|
||||
this.cart.reset();
|
||||
} else {
|
||||
this.make_cart();
|
||||
}
|
||||
this.toggle_editing(true);
|
||||
}
|
||||
this.make_sales_invoice_frm()
|
||||
.then(() => this.set_pos_profile_data())
|
||||
.then(() => {
|
||||
if (this.cart) {
|
||||
this.cart.frm = this.frm;
|
||||
this.cart.reset();
|
||||
} else {
|
||||
this.make_items();
|
||||
this.make_cart();
|
||||
}
|
||||
this.toggle_editing(true);
|
||||
})
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -359,12 +361,29 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
||||
if(!frm.doc.company) {
|
||||
frm.set_value('company', pos_profile.company);
|
||||
}
|
||||
frm.set_value('is_pos', 1);
|
||||
frm.meta.default_print_format = 'POS Invoice';
|
||||
frm.doc.is_pos = 1;
|
||||
return frm;
|
||||
}
|
||||
}
|
||||
|
||||
set_pos_profile_data() {
|
||||
return new Promise(resolve => {
|
||||
return this.frm.call({
|
||||
doc: this.frm.doc,
|
||||
method: "set_missing_values",
|
||||
}).then((r) => {
|
||||
if(!r.exc) {
|
||||
this.frm.script_manager.trigger("update_stock");
|
||||
frappe.model.set_default_values(this.frm.doc);
|
||||
this.frm.cscript.calculate_taxes_and_totals();
|
||||
this.frm.meta.default_print_format = r.message.print_format || 'POS Invoice';
|
||||
}
|
||||
|
||||
resolve();
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
prepare_menu() {
|
||||
var me = this;
|
||||
this.page.clear_menu();
|
||||
@@ -392,9 +411,6 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
||||
if(this.frm.doc.docstatus !== 1) return;
|
||||
|
||||
this.page.set_secondary_action(__("Print"), () => {
|
||||
if (this.pos_profile && this.pos_profile.print_format_for_online) {
|
||||
this.frm.meta.default_print_format = this.pos_profile.print_format_for_online;
|
||||
}
|
||||
this.frm.print_preview.printit(true);
|
||||
});
|
||||
|
||||
@@ -990,18 +1006,18 @@ class POSItems {
|
||||
}
|
||||
|
||||
this.get_items({search_value: search_term, item_group })
|
||||
.then(({ items, serial_no, batch_no }) => {
|
||||
if (search_term) {
|
||||
.then(({ items, serial_no, batch_no, barcode }) => {
|
||||
if (search_term && !barcode) {
|
||||
this.search_index[search_term] = items;
|
||||
}
|
||||
|
||||
this.items = items;
|
||||
this.render_items(items);
|
||||
this.set_item_in_the_cart(items, serial_no, batch_no);
|
||||
this.set_item_in_the_cart(items, serial_no, batch_no, barcode);
|
||||
});
|
||||
}
|
||||
|
||||
set_item_in_the_cart(items, serial_no, batch_no) {
|
||||
set_item_in_the_cart(items, serial_no, batch_no, barcode) {
|
||||
if (serial_no) {
|
||||
this.events.update_cart(items[0].item_code,
|
||||
'serial_no', serial_no);
|
||||
@@ -1016,7 +1032,7 @@ class POSItems {
|
||||
return;
|
||||
}
|
||||
|
||||
if (items.length === 1) {
|
||||
if (items.length === 1 && (serial_no || batch_no || barcode)) {
|
||||
this.events.update_cart(items[0].item_code,
|
||||
'qty', '+1');
|
||||
this.reset_search_field();
|
||||
@@ -1264,6 +1280,16 @@ class Payment {
|
||||
$(this.dialog.body).find('.input-with-feedback').focusin(function() {
|
||||
me.numpad.reset_value();
|
||||
me.fieldname = $(this).prop('dataset').fieldname;
|
||||
if (me.frm.doc.outstanding_amount > 0 &&
|
||||
!in_list(['write_off_amount', 'change_amount'], me.fieldname)) {
|
||||
me.frm.doc.payments.forEach((data) => {
|
||||
if (data.mode_of_payment == me.fieldname && !data.amount) {
|
||||
me.dialog.set_value(me.fieldname,
|
||||
me.frm.doc.outstanding_amount / me.frm.doc.conversion_rate);
|
||||
return;
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1403,4 +1429,4 @@ class Payment {
|
||||
this.dialog.set_value("paid_amount", this.frm.doc.paid_amount);
|
||||
this.dialog.set_value("outstanding_amount", this.frm.doc.outstanding_amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,6 +67,11 @@ def get_items(start, page_length, price_list, item_group, search_value=""):
|
||||
'batch_no': batch_no
|
||||
})
|
||||
|
||||
if barcode:
|
||||
res.update({
|
||||
'barcode': barcode
|
||||
})
|
||||
|
||||
return res
|
||||
|
||||
def get_conditions(item_code, serial_no, batch_no, barcode):
|
||||
|
||||
@@ -17,11 +17,11 @@ class CustomerGroup(NestedSet):
|
||||
|
||||
def validate_name_with_customer(self):
|
||||
if frappe.db.exists("Customer", self.name):
|
||||
frappe.msgprint(_("An Customer exists with same name"), raise_exception=1)
|
||||
frappe.msgprint(_("A customer with the same name already exists"), raise_exception=1)
|
||||
|
||||
def get_parent_customer_groups(customer_group):
|
||||
lft, rgt = frappe.db.get_value("Customer Group", customer_group, ['lft', 'rgt'])
|
||||
|
||||
return frappe.db.sql("""select name from `tabCustomer Group`
|
||||
where lft <= %s and rgt >= %s
|
||||
order by lft asc""", (lft, rgt), as_dict=True)
|
||||
order by lft asc""", (lft, rgt), as_dict=True)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
frappe.ui.form.on('Sales Partner', {
|
||||
refresh: function(frm) {
|
||||
frappe.dynamic_link = {doc: frm.doc, fieldname: 'name', doctype: 'Sales Person'}
|
||||
frappe.dynamic_link = {doc: frm.doc, fieldname: 'name', doctype: 'Sales Partner'}
|
||||
|
||||
if(frm.doc.__islocal){
|
||||
hide_field(['address_html', 'contact_html', 'address_contacts']);
|
||||
|
||||
@@ -14,12 +14,12 @@ default_lead_sources = ["Existing Customer", "Reference", "Advertisement",
|
||||
def install(country=None):
|
||||
records = [
|
||||
# domains
|
||||
{ 'doctype': 'Domain', 'domain': _('Distribution')},
|
||||
{ 'doctype': 'Domain', 'domain': _('Manufacturing')},
|
||||
{ 'doctype': 'Domain', 'domain': _('Retail')},
|
||||
{ 'doctype': 'Domain', 'domain': _('Services')},
|
||||
{ 'doctype': 'Domain', 'domain': _('Education')},
|
||||
{ 'doctype': 'Domain', 'domain': _('Healthcare')},
|
||||
{ 'doctype': 'Domain', 'domain': 'Distribution'},
|
||||
{ 'doctype': 'Domain', 'domain': 'Manufacturing'},
|
||||
{ 'doctype': 'Domain', 'domain': 'Retail'},
|
||||
{ 'doctype': 'Domain', 'domain': 'Services'},
|
||||
{ 'doctype': 'Domain', 'domain': 'Education'},
|
||||
{ 'doctype': 'Domain', 'domain': 'Healthcare'},
|
||||
|
||||
# Setup Progress
|
||||
{'doctype': "Setup Progress", "actions": [
|
||||
|
||||
@@ -40,7 +40,7 @@ def setup_complete(args=None):
|
||||
|
||||
frappe.local.message_log = []
|
||||
domain_settings = frappe.get_single('Domain Settings')
|
||||
domain_settings.set_active_domains([_(args.get('domain'))])
|
||||
domain_settings.set_active_domains([args.get('domain')])
|
||||
|
||||
frappe.db.commit()
|
||||
login_as_first_user(args)
|
||||
@@ -186,10 +186,6 @@ def set_defaults(args):
|
||||
hr_settings.emp_created_by = "Naming Series"
|
||||
hr_settings.save()
|
||||
|
||||
domain_settings = frappe.get_doc("Domain Settings")
|
||||
domain_settings.append('active_domains', dict(domain=_(args.get('domain'))))
|
||||
domain_settings.save()
|
||||
|
||||
def create_feed_and_todo():
|
||||
"""update Activity feed and create todo for creation of item, customer, vendor"""
|
||||
add_info_comment(**{
|
||||
|
||||
@@ -88,10 +88,11 @@ class Bin(Document):
|
||||
and item.source_warehouse = %s
|
||||
and pro.status not in ("Stopped", "Completed")''', (self.item_code, self.warehouse))[0][0]
|
||||
|
||||
self.set_projected_qty()
|
||||
if self.reserved_qty_for_production:
|
||||
self.set_projected_qty()
|
||||
|
||||
self.db_set('reserved_qty_for_production', self.reserved_qty_for_production)
|
||||
self.db_set('projected_qty', self.projected_qty)
|
||||
self.db_set('reserved_qty_for_production', self.reserved_qty_for_production)
|
||||
self.db_set('projected_qty', self.projected_qty)
|
||||
|
||||
|
||||
def update_item_projected_qty(item_code):
|
||||
|
||||
@@ -91,7 +91,7 @@ class Item(WebsiteGenerator):
|
||||
self.validate_barcode()
|
||||
self.cant_change()
|
||||
self.validate_warehouse_for_reorder()
|
||||
self.update_item_desc()
|
||||
self.update_bom_item_desc()
|
||||
self.synced_with_hub = 0
|
||||
|
||||
self.validate_has_variants()
|
||||
@@ -157,7 +157,7 @@ class Item(WebsiteGenerator):
|
||||
def make_route(self):
|
||||
if not self.route:
|
||||
return cstr(frappe.db.get_value('Item Group', self.item_group,
|
||||
'route')) + '/' + self.scrub(self.item_name + '-' + random_string(5))
|
||||
'route')) + '/' + self.scrub((self.item_name if self.item_name else self.item_code) + '-' + random_string(5))
|
||||
|
||||
def validate_website_image(self):
|
||||
"""Validate if the website image is a public file"""
|
||||
@@ -599,13 +599,27 @@ class Item(WebsiteGenerator):
|
||||
row.label = label
|
||||
row.description = desc
|
||||
|
||||
def update_item_desc(self):
|
||||
if frappe.db.get_value('BOM',self.name, 'description') != self.description:
|
||||
frappe.db.sql("""update `tabBOM` set description = %s where item = %s and docstatus < 2""",(self.description, self.name))
|
||||
frappe.db.sql("""update `tabBOM Item` set description = %s where
|
||||
item_code = %s and docstatus < 2""",(self.description, self.name))
|
||||
frappe.db.sql("""update `tabBOM Explosion Item` set description = %s where
|
||||
item_code = %s and docstatus < 2""",(self.description, self.name))
|
||||
def update_bom_item_desc(self):
|
||||
if self.is_new(): return
|
||||
|
||||
if self.db_get('description') != self.description:
|
||||
frappe.db.sql("""
|
||||
update `tabBOM`
|
||||
set description = %s
|
||||
where item = %s and docstatus < 2
|
||||
""", (self.description, self.name))
|
||||
|
||||
frappe.db.sql("""
|
||||
update `tabBOM Item`
|
||||
set description = %s
|
||||
where item_code = %s and docstatus < 2
|
||||
""", (self.description, self.name))
|
||||
|
||||
frappe.db.sql("""
|
||||
update `tabBOM Explosion Item`
|
||||
set description = %s
|
||||
where item_code = %s and docstatus < 2
|
||||
""", (self.description, self.name))
|
||||
|
||||
def update_template_item(self):
|
||||
"""Set Show in Website for Template Item if True for its Variant"""
|
||||
|
||||
@@ -14,8 +14,6 @@ frappe.ui.form.on('Stock Entry', {
|
||||
]
|
||||
}
|
||||
});
|
||||
// },
|
||||
// onload_post_render: function(frm) {
|
||||
|
||||
frm.set_query('batch_no', 'items', function(doc, cdt, cdn) {
|
||||
var item = locals[cdt][cdn];
|
||||
@@ -40,9 +38,8 @@ frappe.ui.form.on('Stock Entry', {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
|
||||
refresh: function(frm) {
|
||||
if(!frm.doc.docstatus) {
|
||||
frm.add_custom_button(__('Make Material Request'), function() {
|
||||
@@ -73,10 +70,12 @@ frappe.ui.form.on('Stock Entry', {
|
||||
frm.trigger("toggle_display_account_head");
|
||||
}
|
||||
},
|
||||
|
||||
purpose: function(frm) {
|
||||
frm.fields_dict.items.grid.refresh();
|
||||
frm.cscript.toggle_related_fields(frm.doc);
|
||||
},
|
||||
|
||||
company: function(frm) {
|
||||
if(frm.doc.company) {
|
||||
var company_doc = frappe.get_doc(":Company", frm.doc.company);
|
||||
@@ -86,6 +85,7 @@ frappe.ui.form.on('Stock Entry', {
|
||||
frm.trigger("toggle_display_account_head");
|
||||
}
|
||||
},
|
||||
|
||||
set_serial_no: function(frm, cdt, cdn) {
|
||||
var d = frappe.model.get_doc(cdt, cdn);
|
||||
if(!d.item_code && !d.s_warehouse && !d.qty) return;
|
||||
@@ -104,20 +104,142 @@ frappe.ui.form.on('Stock Entry', {
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
toggle_display_account_head: function(frm) {
|
||||
var enabled = erpnext.is_perpetual_inventory_enabled(frm.doc.company);
|
||||
frm.fields_dict["items"].grid.set_column_disp(["cost_center", "expense_account"], enabled);
|
||||
}
|
||||
},
|
||||
|
||||
set_basic_rate: function(frm, cdt, cdn, callback) {
|
||||
const item = locals[cdt][cdn];
|
||||
item.transfer_qty = flt(item.qty) * flt(item.conversion_factor);
|
||||
|
||||
const args = {
|
||||
'item_code' : item.item_code,
|
||||
'posting_date' : frm.doc.posting_date,
|
||||
'posting_time' : frm.doc.posting_time,
|
||||
'warehouse' : cstr(item.s_warehouse) || cstr(item.t_warehouse),
|
||||
'serial_no ' : item.serial_no,
|
||||
'company' : frm.doc.company,
|
||||
'qty' : item.s_warehouse ? -1*flt(item.transfer_qty) : flt(item.transfer_qty)
|
||||
};
|
||||
|
||||
frappe.call({
|
||||
method: "erpnext.stock.utils.get_incoming_rate",
|
||||
args: {
|
||||
args: args
|
||||
},
|
||||
callback: function(r) {
|
||||
frappe.model.set_value(cdt, cdn, 'basic_rate', r.message);
|
||||
frm.events.calculate_basic_amount(frm, item);
|
||||
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
get_warehouse_details: function(frm, cdt, cdn, callback) {
|
||||
var child = locals[cdt][cdn];
|
||||
if(!child.bom_no) {
|
||||
frappe.call({
|
||||
method: "erpnext.stock.doctype.stock_entry.stock_entry.get_warehouse_details",
|
||||
args: {
|
||||
"args": {
|
||||
'item_code': child.item_code,
|
||||
'warehouse': cstr(child.s_warehouse) || cstr(child.t_warehouse),
|
||||
'transfer_qty': child.transfer_qty,
|
||||
'serial_no': child.serial_no,
|
||||
'qty': child.s_warehouse ? -1* child.transfer_qty : child.transfer_qty,
|
||||
'posting_date': frm.doc.posting_date,
|
||||
'posting_time': frm.doc.posting_time
|
||||
}
|
||||
},
|
||||
callback: function(r) {
|
||||
if (!r.exc) {
|
||||
$.extend(child, r.message);
|
||||
frm.events.calculate_basic_amount(frm, child);
|
||||
}
|
||||
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
calculate_basic_amount: function(frm, item) {
|
||||
item.basic_amount = flt(flt(item.transfer_qty) * flt(item.basic_rate),
|
||||
precision("basic_amount", item));
|
||||
|
||||
frm.events.calculate_amount(frm);
|
||||
},
|
||||
|
||||
calculate_amount: function(frm) {
|
||||
frm.events.calculate_total_additional_costs(frm);
|
||||
|
||||
const total_basic_amount = frappe.utils.sum(
|
||||
(frm.doc.items || []).map(function(i) { return i.t_warehouse ? flt(i.basic_amount) : 0; })
|
||||
);
|
||||
|
||||
for (let i in frm.doc.items) {
|
||||
let item = frm.doc.items[i];
|
||||
|
||||
if (item.t_warehouse && total_basic_amount) {
|
||||
item.additional_cost = (flt(item.basic_amount) / total_basic_amount) * frm.doc.total_additional_costs;
|
||||
} else {
|
||||
item.additional_cost = 0;
|
||||
}
|
||||
|
||||
item.amount = flt(item.basic_amount + flt(item.additional_cost),
|
||||
precision("amount", item));
|
||||
|
||||
item.valuation_rate = flt(flt(item.basic_rate)
|
||||
+ (flt(item.additional_cost) / flt(item.transfer_qty)),
|
||||
precision("valuation_rate", item));
|
||||
}
|
||||
|
||||
refresh_field('items');
|
||||
},
|
||||
|
||||
calculate_total_additional_costs: function(frm) {
|
||||
const total_additional_costs = frappe.utils.sum(
|
||||
(frm.doc.additional_costs || []).map(function(c) { return flt(c.amount); })
|
||||
);
|
||||
|
||||
frm.set_value("total_additional_costs",
|
||||
flt(total_additional_costs, precision("total_additional_costs")));
|
||||
},
|
||||
})
|
||||
|
||||
frappe.ui.form.on('Stock Entry Detail', {
|
||||
qty: function(frm, cdt, cdn) {
|
||||
frm.events.set_serial_no(frm, cdt, cdn);
|
||||
frm.events.set_basic_rate(frm, cdt, cdn, () => {
|
||||
frm.events.set_serial_no(frm, cdt, cdn);
|
||||
});
|
||||
},
|
||||
|
||||
conversion_factor: function(frm, cdt, cdn) {
|
||||
frm.events.set_basic_rate(frm, cdt, cdn);
|
||||
},
|
||||
|
||||
s_warehouse: function(frm, cdt, cdn) {
|
||||
frm.events.set_serial_no(frm, cdt, cdn);
|
||||
frm.events.get_warehouse_details(frm, cdt, cdn, () => {
|
||||
frm.events.set_serial_no(frm, cdt, cdn);
|
||||
});
|
||||
},
|
||||
|
||||
t_warehouse: function(frm, cdt, cdn) {
|
||||
frm.events.get_warehouse_details(frm, cdt, cdn);
|
||||
},
|
||||
|
||||
basic_rate: function(frm, cdt, cdn) {
|
||||
var item = locals[cdt][cdn];
|
||||
frm.events.calculate_basic_amount(frm, item);
|
||||
},
|
||||
|
||||
barcode: function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if (d.barcode) {
|
||||
@@ -132,6 +254,7 @@ frappe.ui.form.on('Stock Entry Detail', {
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
uom: function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if(d.uom && d.item_code){
|
||||
@@ -150,6 +273,7 @@ frappe.ui.form.on('Stock Entry Detail', {
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
item_code: function(frm, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if(d.item_code) {
|
||||
@@ -191,7 +315,7 @@ frappe.ui.form.on('Stock Entry Detail', {
|
||||
|
||||
frappe.ui.form.on('Landed Cost Taxes and Charges', {
|
||||
amount: function(frm) {
|
||||
frm.events.calculate_amount();
|
||||
frm.events.calculate_amount(frm);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -330,12 +454,6 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
||||
}
|
||||
},
|
||||
|
||||
qty: function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
d.transfer_qty = flt(d.qty) * flt(d.conversion_factor);
|
||||
this.calculate_basic_amount(d);
|
||||
},
|
||||
|
||||
production_order: function() {
|
||||
var me = this;
|
||||
this.toggle_enable_bom();
|
||||
@@ -434,88 +552,6 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
||||
erpnext.setup_serial_no();
|
||||
},
|
||||
|
||||
basic_rate: function(doc, cdt, cdn) {
|
||||
var item = frappe.model.get_doc(cdt, cdn);
|
||||
this.calculate_basic_amount(item);
|
||||
},
|
||||
|
||||
s_warehouse: function(doc, cdt, cdn) {
|
||||
this.get_warehouse_details(doc, cdt, cdn)
|
||||
},
|
||||
|
||||
t_warehouse: function(doc, cdt, cdn) {
|
||||
this.get_warehouse_details(doc, cdt, cdn)
|
||||
},
|
||||
|
||||
get_warehouse_details: function(doc, cdt, cdn) {
|
||||
var me = this;
|
||||
var d = locals[cdt][cdn];
|
||||
if(!d.bom_no) {
|
||||
frappe.call({
|
||||
method: "erpnext.stock.doctype.stock_entry.stock_entry.get_warehouse_details",
|
||||
args: {
|
||||
"args": {
|
||||
'item_code': d.item_code,
|
||||
'warehouse': cstr(d.s_warehouse) || cstr(d.t_warehouse),
|
||||
'transfer_qty': d.transfer_qty,
|
||||
'serial_no': d.serial_no,
|
||||
'qty': d.s_warehouse ? -1* d.qty : d.qty,
|
||||
'posting_date': this.frm.doc.posting_date,
|
||||
'posting_time': this.frm.doc.posting_time
|
||||
}
|
||||
},
|
||||
callback: function(r) {
|
||||
if (!r.exc) {
|
||||
$.extend(d, r.message);
|
||||
me.calculate_basic_amount(d);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
calculate_basic_amount: function(item) {
|
||||
item.basic_amount = flt(flt(item.transfer_qty) * flt(item.basic_rate),
|
||||
precision("basic_amount", item));
|
||||
|
||||
this.calculate_amount();
|
||||
},
|
||||
|
||||
calculate_amount: function() {
|
||||
this.calculate_total_additional_costs();
|
||||
|
||||
var total_basic_amount = frappe.utils.sum(
|
||||
(this.frm.doc.items || []).map(function(i) { return i.t_warehouse ? flt(i.basic_amount) : 0; })
|
||||
);
|
||||
|
||||
for (var i in this.frm.doc.items) {
|
||||
var item = this.frm.doc.items[i];
|
||||
|
||||
if (item.t_warehouse && total_basic_amount) {
|
||||
item.additional_cost = (flt(item.basic_amount) / total_basic_amount) * this.frm.doc.total_additional_costs;
|
||||
} else {
|
||||
item.additional_cost = 0;
|
||||
}
|
||||
|
||||
item.amount = flt(item.basic_amount + flt(item.additional_cost),
|
||||
precision("amount", item));
|
||||
|
||||
item.valuation_rate = flt(flt(item.basic_rate)
|
||||
+ (flt(item.additional_cost) / flt(item.transfer_qty)),
|
||||
precision("valuation_rate", item));
|
||||
}
|
||||
|
||||
refresh_field('items');
|
||||
},
|
||||
|
||||
calculate_total_additional_costs: function() {
|
||||
var total_additional_costs = frappe.utils.sum(
|
||||
(this.frm.doc.additional_costs || []).map(function(c) { return flt(c.amount); })
|
||||
);
|
||||
|
||||
this.frm.set_value("total_additional_costs", flt(total_additional_costs, precision("total_additional_costs")));
|
||||
},
|
||||
|
||||
toggle_related_fields: function(doc) {
|
||||
this.frm.toggle_enable("from_warehouse", doc.purpose!='Material Receipt');
|
||||
this.frm.toggle_enable("to_warehouse", doc.purpose!='Material Issue');
|
||||
|
||||
@@ -517,7 +517,7 @@ class StockEntry(StockController):
|
||||
args['posting_date'] = self.posting_date
|
||||
args['posting_time'] = self.posting_time
|
||||
|
||||
stock_and_rate = args.get('warehouse') and get_warehouse_details(args) or {}
|
||||
stock_and_rate = get_warehouse_details(args) if args.get('warehouse') else {}
|
||||
ret.update(stock_and_rate)
|
||||
|
||||
# automatically select batch for outgoing item
|
||||
|
||||
@@ -96,16 +96,6 @@ def get_item_details(args):
|
||||
|
||||
return out
|
||||
|
||||
# print(frappe._dict({
|
||||
# 'has_serial_no' : out.has_serial_no,
|
||||
# 'has_batch_no' : out.has_batch_no
|
||||
# }))
|
||||
|
||||
# return frappe._dict({
|
||||
# 'has_serial_no' : out.has_serial_no,
|
||||
# 'has_batch_no' : out.has_batch_no
|
||||
# })
|
||||
|
||||
def process_args(args):
|
||||
if isinstance(args, basestring):
|
||||
args = json.loads(args)
|
||||
@@ -532,8 +522,6 @@ def get_default_bom(item_code=None):
|
||||
bom = frappe.db.get_value("BOM", {"docstatus": 1, "is_default": 1, "is_active": 1, "item": item_code})
|
||||
if bom:
|
||||
return bom
|
||||
else:
|
||||
frappe.throw(_("No default BOM exists for Item {0}").format(item_code))
|
||||
|
||||
def get_valuation_rate(item_code, warehouse=None):
|
||||
item = frappe.get_doc("Item", item_code)
|
||||
|
||||
@@ -28,11 +28,12 @@ def send_message(subject="Website Query", message="", sender="", status="Open"):
|
||||
)).insert(ignore_permissions=True)
|
||||
|
||||
opportunity = frappe.get_doc(dict(
|
||||
doctype='Opportunity',
|
||||
doctype ='Opportunity',
|
||||
enquiry_from = 'Customer' if customer else 'Lead',
|
||||
status = 'Open',
|
||||
title = subject,
|
||||
to_discuss=message
|
||||
contact_email = sender,
|
||||
to_discuss = message
|
||||
))
|
||||
|
||||
if customer:
|
||||
|
||||
@@ -72,7 +72,6 @@ erpnext/hr/doctype/appraisal/test_appraisal.js
|
||||
erpnext/hr/doctype/expense_claim_type/test_expense_claim_type.js
|
||||
erpnext/hr/doctype/expense_claim/test_expense_claim.js
|
||||
erpnext/hr/doctype/training_event/tests/test_training_event.js
|
||||
erpnext/hr/doctype/training_event/tests/test_training_event_attendance.js
|
||||
erpnext/hr/doctype/training_result_employee/test_training_result.js
|
||||
erpnext/hr/doctype/training_feedback/test_training_feedback.js
|
||||
erpnext/hr/doctype/loan_type/test_loan_type.js
|
||||
|
||||
Reference in New Issue
Block a user