Merge branch 'hotfix' into plaid_reconciliation
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -12,3 +12,5 @@ erpnext/docs/current
|
||||
*.swo
|
||||
__pycache__
|
||||
*~
|
||||
.vscode/
|
||||
node_modules/
|
||||
@@ -18,7 +18,7 @@ Includes: Accounting, Inventory, Manufacturing, CRM, Sales, Purchase, Project Ma
|
||||
|
||||
ERPNext is built on the [Frappe](https://github.com/frappe/frappe) Framework, a full-stack web app framework in Python & JavaScript.
|
||||
|
||||
- [User Guide](https://erpnext.org/docs/user)
|
||||
- [User Guide](https://erpnext.com/docs/user)
|
||||
- [Discussion Forum](https://discuss.erpnext.com/)
|
||||
|
||||
---
|
||||
|
||||
@@ -5,7 +5,7 @@ import frappe
|
||||
from erpnext.hooks import regional_overrides
|
||||
from frappe.utils import getdate
|
||||
|
||||
__version__ = '10.1.80'
|
||||
__version__ = '11.1.6'
|
||||
|
||||
def get_default_company(user=None):
|
||||
'''Get default company for user'''
|
||||
@@ -74,7 +74,7 @@ def is_perpetual_inventory_enabled(company):
|
||||
frappe.local.enable_perpetual_inventory = {}
|
||||
|
||||
if not company in frappe.local.enable_perpetual_inventory:
|
||||
frappe.local.enable_perpetual_inventory[company] = frappe.get_cached_value('Company',
|
||||
frappe.local.enable_perpetual_inventory[company] = frappe.get_cached_value('Company',
|
||||
company, "enable_perpetual_inventory") or 0
|
||||
|
||||
return frappe.local.enable_perpetual_inventory[company]
|
||||
@@ -87,7 +87,7 @@ def get_default_finance_book(company=None):
|
||||
frappe.local.default_finance_book = {}
|
||||
|
||||
if not company in frappe.local.default_finance_book:
|
||||
frappe.local.default_finance_book[company] = frappe.get_cached_value('Company',
|
||||
frappe.local.default_finance_book[company] = frappe.get_cached_value('Company',
|
||||
company, "default_finance_book")
|
||||
|
||||
return frappe.local.default_finance_book[company]
|
||||
@@ -108,7 +108,7 @@ def get_region(company=None):
|
||||
You can also set global company flag in `frappe.flags.company`
|
||||
'''
|
||||
if company or frappe.flags.company:
|
||||
return frappe.get_cached_value('Company',
|
||||
return frappe.get_cached_value('Company',
|
||||
company or frappe.flags.company, 'country')
|
||||
elif frappe.flags.country:
|
||||
return frappe.flags.country
|
||||
|
||||
@@ -29,7 +29,7 @@ def validate_service_stop_date(doc):
|
||||
if date_diff(item.service_stop_date, item.service_end_date) > 0:
|
||||
frappe.throw(_("Service Stop Date cannot be after Service End Date"))
|
||||
|
||||
if old_stop_dates and old_stop_dates[item.name] and item.service_stop_date!=old_stop_dates[item.name]:
|
||||
if old_stop_dates and old_stop_dates.get(item.name) and item.service_stop_date!=old_stop_dates[item.name]:
|
||||
frappe.throw(_("Cannot change Service Stop Date for item in row {0}".format(item.idx)))
|
||||
|
||||
def convert_deferred_expense_to_expense(start_date=None, end_date=None):
|
||||
@@ -60,7 +60,7 @@ def get_booking_dates(doc, item, start_date=None, end_date=None):
|
||||
deferred_account = "deferred_revenue_account" if doc.doctype=="Sales Invoice" else "deferred_expense_account"
|
||||
last_gl_entry, skip = False, False
|
||||
|
||||
booking_end_date = getdate(add_days(today(), -1)) if not end_date else end_date
|
||||
booking_end_date = getdate(add_days(today(), -1) if not end_date else end_date)
|
||||
if booking_end_date < item.service_start_date or \
|
||||
(item.service_stop_date and booking_end_date.month > item.service_stop_date.month):
|
||||
return None, None, None, True
|
||||
@@ -71,7 +71,7 @@ def get_booking_dates(doc, item, start_date=None, end_date=None):
|
||||
last_gl_entry = True
|
||||
booking_end_date = item.service_stop_date
|
||||
|
||||
booking_start_date = getdate(add_months(today(), -1)) if not start_date else start_date
|
||||
booking_start_date = getdate(add_months(today(), -1) if not start_date else start_date)
|
||||
booking_start_date = booking_start_date \
|
||||
if booking_start_date > item.service_start_date else item.service_start_date
|
||||
|
||||
@@ -113,7 +113,6 @@ def calculate_amount_and_base_amount(doc, item, last_gl_entry, total_days, total
|
||||
group by voucher_detail_no
|
||||
'''.format(total_credit_debit, total_credit_debit_currency),
|
||||
(doc.company, item.get(deferred_account), doc.doctype, doc.name, item.name), as_dict=True)
|
||||
|
||||
already_booked_amount = gl_entries_details[0].total_credit if gl_entries_details else 0
|
||||
base_amount = flt(item.base_net_amount - already_booked_amount, item.precision("base_net_amount"))
|
||||
if account_currency==doc.company_currency:
|
||||
@@ -128,15 +127,19 @@ def book_deferred_income_or_expense(doc, start_date=None, end_date=None):
|
||||
# book the expense/income on the last day, but it will be trigger on the 1st of month at 12:00 AM
|
||||
# start_date: 1st of the last month or the start date
|
||||
# end_date: end_date or today-1
|
||||
enable_check = "enable_deferred_revenue" \
|
||||
if doc.doctype=="Sales Invoice" else "enable_deferred_expense"
|
||||
|
||||
gl_entries = []
|
||||
for item in doc.get('items'):
|
||||
if not item.get(enable_check): continue
|
||||
|
||||
skip = False
|
||||
last_gl_entry, booking_start_date, booking_end_date, skip = \
|
||||
get_booking_dates(doc, item, start_date, end_date)
|
||||
|
||||
if skip: continue
|
||||
total_days = date_diff(item.service_end_date, item.service_start_date)
|
||||
total_days = date_diff(item.service_end_date, item.service_start_date) + 1
|
||||
total_booking_days = date_diff(booking_end_date, booking_start_date) + 1
|
||||
|
||||
account_currency = get_account_currency(item.expense_account)
|
||||
@@ -175,6 +178,10 @@ def book_deferred_income_or_expense(doc, start_date=None, end_date=None):
|
||||
'project': project
|
||||
}, account_currency)
|
||||
)
|
||||
|
||||
if gl_entries:
|
||||
make_gl_entries(gl_entries, cancel=(doc.docstatus == 2), merge_entries=True)
|
||||
try:
|
||||
make_gl_entries(gl_entries, cancel=(doc.docstatus == 2), merge_entries=True)
|
||||
frappe.db.commit()
|
||||
except:
|
||||
frappe.db.rollback()
|
||||
frappe.log_error(message = frappe.get_traceback(), title = _("Error while processing deferred accounting for {0}").format(doc.name))
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe, os, json
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
import unittest
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -26,7 +26,7 @@ class BankReconciliation(Document):
|
||||
select
|
||||
"Journal Entry" as payment_document, t1.name as payment_entry,
|
||||
t1.cheque_no as cheque_number, t1.cheque_date,
|
||||
t2.debit_in_account_currency as debit, t2.credit_in_account_currency as credit,
|
||||
sum(t2.debit_in_account_currency) as debit, sum(t2.credit_in_account_currency) as credit,
|
||||
t1.posting_date, t2.against_account, t1.clearance_date, t2.account_currency
|
||||
from
|
||||
`tabJournal Entry` t1, `tabJournal Entry Account` t2
|
||||
@@ -34,6 +34,7 @@ class BankReconciliation(Document):
|
||||
t2.parent = t1.name and t2.account = %s and t1.docstatus=1
|
||||
and t1.posting_date >= %s and t1.posting_date <= %s
|
||||
and ifnull(t1.is_opening, 'No') = 'No' {0}
|
||||
group by t2.account, t1.name
|
||||
order by t1.posting_date ASC, t1.name DESC
|
||||
""".format(condition), (self.bank_account, self.from_date, self.to_date), as_dict=1)
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
DEFAULT_MAPPERS = [
|
||||
{
|
||||
'doctype': 'Cash Flow Mapper',
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_events_in_timeline": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
@@ -15,6 +16,7 @@
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -32,7 +34,7 @@
|
||||
"label": "Series",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Cashier-closing-\n",
|
||||
"options": "Cashier-closing-",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
@@ -43,10 +45,12 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -74,10 +78,12 @@
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -105,10 +111,12 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -135,10 +143,12 @@
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -166,10 +176,12 @@
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -188,7 +200,7 @@
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "2",
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
@@ -197,10 +209,12 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -219,7 +233,7 @@
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "2",
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
@@ -228,10 +242,12 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -250,7 +266,7 @@
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "2",
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
@@ -259,10 +275,12 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -291,10 +309,12 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -321,10 +341,12 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -351,6 +373,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
@@ -364,7 +387,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2018-09-03 10:59:54.500567",
|
||||
"modified": "2019-02-19 08:35:23.157327",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Cashier Closing",
|
||||
@@ -373,7 +396,6 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
@@ -399,5 +421,6 @@
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1,
|
||||
"track_seen": 0
|
||||
"track_seen": 0,
|
||||
"track_views": 0
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_events_in_timeline": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
@@ -14,6 +15,7 @@
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -41,10 +43,12 @@
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -63,7 +67,7 @@
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "2",
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
@@ -72,6 +76,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
@@ -85,7 +90,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2018-09-02 14:45:36.303520",
|
||||
"modified": "2019-02-19 08:34:20.268037",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Cashier Closing Payments",
|
||||
@@ -99,5 +104,6 @@
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1,
|
||||
"track_seen": 0
|
||||
"track_seen": 0,
|
||||
"track_views": 0
|
||||
}
|
||||
@@ -46,7 +46,7 @@ frappe.ui.form.on('Cost Center', {
|
||||
doctype_name: frm.doc.doctype,
|
||||
name: frm.doc.name,
|
||||
field_name: d.fields[0].fieldname,
|
||||
field_value: data.cost_center_number,
|
||||
number_value: data.cost_center_number,
|
||||
company: frm.doc.company
|
||||
},
|
||||
callback: function(r) {
|
||||
|
||||
@@ -9,6 +9,8 @@ from dateutil.relativedelta import relativedelta
|
||||
|
||||
from frappe.model.document import Document
|
||||
|
||||
class FiscalYearIncorrectDate(frappe.ValidationError): pass
|
||||
|
||||
class FiscalYear(Document):
|
||||
def set_as_default(self):
|
||||
frappe.db.set_value("Global Defaults", None, "current_fiscal_year", self.name)
|
||||
@@ -35,11 +37,14 @@ class FiscalYear(Document):
|
||||
|
||||
def validate_dates(self):
|
||||
if getdate(self.year_start_date) > getdate(self.year_end_date):
|
||||
frappe.throw(_("Fiscal Year Start Date should not be greater than Fiscal Year End Date"))
|
||||
frappe.throw(_("Fiscal Year Start Date should be one year earlier than Fiscal Year End Date"),
|
||||
FiscalYearIncorrectDate)
|
||||
|
||||
if (getdate(self.year_end_date) - getdate(self.year_start_date)).days > 366:
|
||||
date = getdate(self.year_start_date) + relativedelta(years=1) - relativedelta(days=1)
|
||||
self.year_end_date = date.strftime("%Y-%m-%d")
|
||||
date = getdate(self.year_start_date) + relativedelta(years=1) - relativedelta(days=1)
|
||||
|
||||
if getdate(self.year_end_date) != date:
|
||||
frappe.throw(_("Fiscal Year End Date should be one year after Fiscal Year Start Date"),
|
||||
FiscalYearIncorrectDate)
|
||||
|
||||
def on_update(self):
|
||||
check_duplicate_fiscal_year(self)
|
||||
|
||||
@@ -5,6 +5,8 @@ from __future__ import unicode_literals
|
||||
|
||||
import frappe, unittest
|
||||
|
||||
from erpnext.accounts.doctype.fiscal_year.fiscal_year import FiscalYearIncorrectDate
|
||||
|
||||
test_records = frappe.get_test_records('Fiscal Year')
|
||||
test_ignore = ["Company"]
|
||||
|
||||
@@ -12,12 +14,12 @@ class TestFiscalYear(unittest.TestCase):
|
||||
def test_extra_year(self):
|
||||
if frappe.db.exists("Fiscal Year", "_Test Fiscal Year 2000"):
|
||||
frappe.delete_doc("Fiscal Year", "_Test Fiscal Year 2000")
|
||||
|
||||
fy = frappe.get_doc({
|
||||
"doctype": "Fiscal Year",
|
||||
"year": "_Test Fiscal Year 2000",
|
||||
"year_end_date": "2002-12-31",
|
||||
"year_start_date": "2000-04-01"
|
||||
})
|
||||
fy.insert()
|
||||
self.assertEqual(fy.year_end_date, '2001-03-31')
|
||||
|
||||
self.assertRaises(FiscalYearIncorrectDate, fy.insert)
|
||||
|
||||
@@ -205,6 +205,13 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({
|
||||
};
|
||||
}
|
||||
|
||||
// payroll entry
|
||||
if(jvd.reference_type==="Payroll Entry") {
|
||||
return {
|
||||
query: "erpnext.hr.doctype.payroll_entry.payroll_entry.get_payroll_entries_for_jv",
|
||||
};
|
||||
}
|
||||
|
||||
var out = {
|
||||
filters: [
|
||||
[jvd.reference_type, "docstatus", "=", 1]
|
||||
@@ -227,10 +234,18 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({
|
||||
|
||||
out.filters.push([jvd.reference_type, "per_billed", "<", 100]);
|
||||
}
|
||||
|
||||
|
||||
if(jvd.party_type && jvd.party) {
|
||||
out.filters.push([jvd.reference_type,
|
||||
(jvd.reference_type.indexOf("Sales")===0 ? "customer" : "supplier"), "=", jvd.party]);
|
||||
var party_field = "";
|
||||
if(jvd.reference_type.indexOf("Sales")===0) {
|
||||
var party_field = "customer";
|
||||
} else if (jvd.reference_type.indexOf("Purchase")===0) {
|
||||
var party_field = "supplier";
|
||||
}
|
||||
|
||||
if (party_field) {
|
||||
out.filters.push([jvd.reference_type, party_field, "=", jvd.party]);
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_events_in_timeline": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
@@ -398,7 +399,7 @@
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "6",
|
||||
"precision": "9",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
@@ -911,7 +912,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2018-08-19 04:08:44.742510",
|
||||
"modified": "2019-02-18 19:00:53.662788",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Journal Entry Account",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors
|
||||
# See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ class PaymentEntry(AccountsController):
|
||||
if not frappe.db.exists(self.party_type, self.party):
|
||||
frappe.throw(_("Invalid {0}: {1}").format(self.party_type, self.party))
|
||||
|
||||
if self.party_account:
|
||||
if self.party_account and self.party_type in ("Customer", "Supplier"):
|
||||
self.validate_account_type(self.party_account,
|
||||
[erpnext.get_party_account_type(self.party_type)])
|
||||
|
||||
@@ -689,7 +689,7 @@ def get_party_details(company, party_type, party, date, cost_center=None):
|
||||
|
||||
account_currency = get_account_currency(party_account)
|
||||
account_balance = get_balance_on(party_account, date, cost_center=cost_center)
|
||||
_party_name = "title" if party_type == "Student" else party_type.lower() + "_name"
|
||||
_party_name = "title" if party_type in ("Student", "Shareholder") else party_type.lower() + "_name"
|
||||
party_name = frappe.db.get_value(party_type, party, _party_name)
|
||||
party_balance = get_balance_on(party_type=party_type, party=party, cost_center=cost_center)
|
||||
if party_type in ["Customer", "Supplier"]:
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -54,7 +54,7 @@ frappe.ui.form.on("Payment Request", "is_a_subscription", function(frm) {
|
||||
frm.toggle_reqd("payment_gateway_account", frm.doc.is_a_subscription);
|
||||
frm.toggle_reqd("subscription_plans", frm.doc.is_a_subscription);
|
||||
|
||||
if (frm.doc.is_a_subscription) {
|
||||
if (frm.doc.is_a_subscription && frm.doc.reference_doctype && frm.doc.reference_name) {
|
||||
frappe.call({
|
||||
method: "erpnext.accounts.doctype.payment_request.payment_request.get_subscription_details",
|
||||
args: {"reference_doctype": frm.doc.reference_doctype, "reference_name": frm.doc.reference_name},
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_events_in_timeline": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
@@ -425,7 +426,7 @@
|
||||
"no_copy": 0,
|
||||
"options": "currency",
|
||||
"permlevel": 0,
|
||||
"precision": "2",
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
@@ -1501,7 +1502,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2018-09-06 14:44:43.563367",
|
||||
"modified": "2019-02-18 18:52:34.203239",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Payment Request",
|
||||
|
||||
@@ -196,8 +196,9 @@ def get_pricing_rule_for_item(args):
|
||||
pricing_rule_rate = 0.0
|
||||
if pricing_rule.currency == args.currency:
|
||||
pricing_rule_rate = pricing_rule.rate
|
||||
|
||||
item_details.update({
|
||||
"price_list_rate": pricing_rule_rate,
|
||||
"price_list_rate": pricing_rule_rate * args.get("conversion_factor"),
|
||||
"discount_percentage": 0.0
|
||||
})
|
||||
else:
|
||||
|
||||
@@ -9,9 +9,12 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
|
||||
this.setup_posting_date_time_check();
|
||||
this._super(doc);
|
||||
|
||||
// formatter for material request item
|
||||
this.frm.set_indicator_formatter('item_code',
|
||||
function(doc) { return (doc.qty<=doc.received_qty) ? "green" : "orange" })
|
||||
// formatter for purchase invoice item
|
||||
if(this.frm.doc.update_stock) {
|
||||
this.frm.set_indicator_formatter('item_code', function(doc) {
|
||||
return (doc.qty<=doc.received_qty) ? "green" : "orange";
|
||||
});
|
||||
}
|
||||
},
|
||||
onload: function() {
|
||||
this._super();
|
||||
|
||||
@@ -231,7 +231,7 @@ class PurchaseInvoice(BuyingController):
|
||||
item.expense_account = warehouse_account[item.warehouse]["account"]
|
||||
else:
|
||||
item.expense_account = stock_not_billed_account
|
||||
elif item.is_fixed_asset and d.pr_detail:
|
||||
elif item.is_fixed_asset and item.pr_detail:
|
||||
item.expense_account = asset_received_but_not_billed
|
||||
elif not item.expense_account and for_validate:
|
||||
throw(_("Expense account is mandatory for item {0}").format(item.item_code or item.item_name))
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -293,7 +293,7 @@
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "2",
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
@@ -321,7 +321,7 @@
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Qty",
|
||||
"label": "Accepted Qty",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "qty",
|
||||
@@ -358,7 +358,7 @@
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "2",
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
@@ -2626,7 +2626,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2019-01-07 16:52:00.749414",
|
||||
"modified": "2019-02-18 19:03:19.250280",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Purchase Invoice Item",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import json
|
||||
|
||||
@@ -55,6 +54,7 @@ def get_pos_data():
|
||||
'barcode_data': get_barcode_data(items_list),
|
||||
'tax_data': get_item_tax_data(),
|
||||
'price_list_data': get_price_list_data(doc.selling_price_list),
|
||||
'customer_wise_price_list': get_customer_wise_price_list(),
|
||||
'bin_data': get_bin_data(pos_profile),
|
||||
'pricing_rules': get_pricing_rule_data(doc),
|
||||
'print_template': print_template,
|
||||
@@ -328,15 +328,32 @@ def get_price_list_data(selling_price_list):
|
||||
|
||||
return itemwise_price_list
|
||||
|
||||
def get_customer_wise_price_list():
|
||||
customer_wise_price = {}
|
||||
customer_price_list_mapping = frappe._dict(frappe.get_all('Customer',fields = ['default_price_list', 'name'], as_list=1))
|
||||
|
||||
price_lists = frappe.db.sql(""" Select ifnull(price_list_rate, 0) as price_list_rate,
|
||||
item_code, price_list from `tabItem Price` """, as_dict=1)
|
||||
|
||||
for item in price_lists:
|
||||
if item.price_list and customer_price_list_mapping.get(item.price_list):
|
||||
|
||||
customer_wise_price.setdefault(customer_price_list_mapping.get(item.price_list),{}).setdefault(
|
||||
item.item_code, item.price_list_rate
|
||||
)
|
||||
|
||||
return customer_wise_price
|
||||
|
||||
def get_bin_data(pos_profile):
|
||||
itemwise_bin_data = {}
|
||||
cond = "1=1"
|
||||
if pos_profile.get('warehouse'):
|
||||
cond = "warehouse = '{0}'".format(pos_profile.get('warehouse'))
|
||||
cond = "warehouse = %(warehouse)s"
|
||||
|
||||
bin_data = frappe.db.sql(""" select item_code, warehouse, actual_qty from `tabBin`
|
||||
where actual_qty > 0 and {cond}""".format(cond=cond), as_dict=1)
|
||||
where actual_qty > 0 and {cond}""".format(cond=cond), {
|
||||
'warehouse': frappe.db.escape(pos_profile.get('warehouse'))
|
||||
}, as_dict=1)
|
||||
|
||||
for bins in bin_data:
|
||||
if bins.item_code not in itemwise_bin_data:
|
||||
|
||||
@@ -217,6 +217,9 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
this.get_terms();
|
||||
},
|
||||
customer: function() {
|
||||
if (this.frm.doc.is_pos){
|
||||
var pos_profile = this.frm.doc.pos_profile;
|
||||
}
|
||||
var me = this;
|
||||
if(this.frm.updating_party_details) return;
|
||||
erpnext.utils.get_party_details(this.frm,
|
||||
@@ -226,6 +229,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
party_type: "Customer",
|
||||
account: this.frm.doc.debit_to,
|
||||
price_list: this.frm.doc.selling_price_list,
|
||||
pos_profile: pos_profile
|
||||
}, function() {
|
||||
me.apply_pricing_rule();
|
||||
});
|
||||
|
||||
@@ -1966,7 +1966,7 @@
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "2",
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
@@ -5644,7 +5644,7 @@
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2019-01-07 16:51:53.914523",
|
||||
"modified": "2019-02-18 18:56:51.265257",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Sales Invoice",
|
||||
|
||||
@@ -24,6 +24,7 @@ from erpnext.accounts.general_ledger import get_round_off_account_and_cost_cente
|
||||
from erpnext.accounts.doctype.loyalty_program.loyalty_program import \
|
||||
get_loyalty_program_details_with_points, get_loyalty_details, validate_loyalty_points
|
||||
from erpnext.accounts.deferred_revenue import validate_service_stop_date
|
||||
from erpnext.controllers.accounts_controller import on_submit_regional, on_cancel_regional
|
||||
|
||||
from erpnext.healthcare.utils import manage_invoice_submit_cancel
|
||||
|
||||
@@ -198,6 +199,8 @@ class SalesInvoice(SellingController):
|
||||
if "Healthcare" in active_domains:
|
||||
manage_invoice_submit_cancel(self, "on_submit")
|
||||
|
||||
on_submit_regional(self)
|
||||
|
||||
def validate_pos_paid_amount(self):
|
||||
if len(self.payments) == 0 and self.is_pos:
|
||||
frappe.throw(_("At least one mode of payment is required for POS invoice."))
|
||||
@@ -253,6 +256,8 @@ class SalesInvoice(SellingController):
|
||||
if "Healthcare" in active_domains:
|
||||
manage_invoice_submit_cancel(self, "on_cancel")
|
||||
|
||||
on_cancel_regional(self)
|
||||
|
||||
def update_status_updater_args(self):
|
||||
if cint(self.update_stock):
|
||||
self.status_updater.extend([{
|
||||
@@ -398,11 +403,16 @@ class SalesInvoice(SellingController):
|
||||
self.account_for_change_amount = pos.get('account_for_change_amount')
|
||||
|
||||
for fieldname in ('territory', 'naming_series', 'currency', 'taxes_and_charges', 'letter_head', 'tc_name',
|
||||
'selling_price_list', 'company', 'select_print_heading', 'cash_bank_account', 'company_address',
|
||||
'company', 'select_print_heading', 'cash_bank_account', 'company_address',
|
||||
'write_off_account', 'write_off_cost_center', 'apply_discount_on'):
|
||||
if (not for_validate) or (for_validate and not self.get(fieldname)):
|
||||
self.set(fieldname, pos.get(fieldname))
|
||||
|
||||
customer_price_list = frappe.get_value("Customer", self.customer, 'default_price_list')
|
||||
|
||||
if not customer_price_list:
|
||||
self.set('selling_price_list', pos.get('selling_price_list'))
|
||||
|
||||
if not for_validate:
|
||||
self.update_stock = cint(pos.get("update_stock"))
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -779,7 +779,7 @@
|
||||
"no_copy": 0,
|
||||
"options": "currency",
|
||||
"permlevel": 0,
|
||||
"precision": "2",
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
@@ -913,7 +913,7 @@
|
||||
"no_copy": 0,
|
||||
"options": "Company:company:default_currency",
|
||||
"permlevel": 0,
|
||||
"precision": "2",
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
@@ -2766,7 +2766,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2019-01-07 16:51:55.018091",
|
||||
"modified": "2019-02-18 18:59:52.223628",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Sales Invoice Item",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_events_in_timeline": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
@@ -13,6 +14,7 @@
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -40,11 +42,12 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -72,16 +75,17 @@
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "0.0",
|
||||
"default": "",
|
||||
"depends_on": "eval:parent.doctype == 'Sales Invoice'",
|
||||
"fieldname": "amount",
|
||||
"fieldtype": "Currency",
|
||||
@@ -97,7 +101,7 @@
|
||||
"no_copy": 0,
|
||||
"options": "currency",
|
||||
"permlevel": 0,
|
||||
"precision": "2",
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
@@ -106,11 +110,12 @@
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -136,11 +141,12 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -168,16 +174,17 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_from": "mode_of_payment.type",
|
||||
"fetch_from": "mode_of_payment.type",
|
||||
"fieldname": "type",
|
||||
"fieldtype": "Read Only",
|
||||
"hidden": 0,
|
||||
@@ -201,11 +208,12 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -233,11 +241,12 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -264,7 +273,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
@@ -278,7 +287,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2018-05-16 22:42:52.033991",
|
||||
"modified": "2019-02-18 15:03:59.720469",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Sales Invoice Payment",
|
||||
@@ -292,5 +301,6 @@
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 0,
|
||||
"track_seen": 0
|
||||
"track_seen": 0,
|
||||
"track_views": 0
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_events_in_timeline": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 0,
|
||||
@@ -12,6 +14,8 @@
|
||||
"engine": "InnoDB",
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -39,9 +43,12 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -68,9 +75,12 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -88,7 +98,7 @@
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "2",
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
@@ -97,9 +107,12 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 1,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -126,20 +139,21 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 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-02-17 16:47:04.413420",
|
||||
"modified": "2019-02-18 18:50:44.770361",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Sales Invoice Timesheet",
|
||||
@@ -153,5 +167,6 @@
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1,
|
||||
"track_seen": 0
|
||||
"track_seen": 0,
|
||||
"track_views": 0
|
||||
}
|
||||
@@ -125,7 +125,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
|
||||
this.page.add_menu_item(__("Cashier Closing"), function () {
|
||||
frappe.set_route('List', 'Cashier Closing');
|
||||
});
|
||||
});
|
||||
|
||||
this.page.add_menu_item(__("POS Profile"), function () {
|
||||
frappe.set_route('List', 'POS Profile');
|
||||
@@ -313,6 +313,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
this.contacts = r.message.contacts;
|
||||
this.address = r.message.address || {};
|
||||
this.price_list_data = r.message.price_list_data;
|
||||
this.customer_wise_price_list = r.message.customer_wise_price_list
|
||||
this.bin_data = r.message.bin_data;
|
||||
this.pricing_rules = r.message.pricing_rules;
|
||||
this.print_template = r.message.print_template;
|
||||
@@ -602,7 +603,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
this.remove_item = []
|
||||
idx = $(this.wrapper).find(".pos-selected-item-action").attr("data-idx")
|
||||
this.remove_item.push(idx)
|
||||
this.remove_zero_qty_item()
|
||||
this.remove_zero_qty_items_from_cart()
|
||||
this.update_paid_amount_status(false)
|
||||
},
|
||||
|
||||
@@ -798,6 +799,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
if (item.action) {
|
||||
$(this).val("");
|
||||
}
|
||||
me.make_item_list(item.customer_name);
|
||||
});
|
||||
},
|
||||
|
||||
@@ -1037,7 +1039,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
this.numeric_keypad.show();
|
||||
},
|
||||
|
||||
make_item_list: function () {
|
||||
make_item_list: function (customer) {
|
||||
var me = this;
|
||||
if (!this.price_list) {
|
||||
frappe.msgprint(__("Price List not found or disabled"));
|
||||
@@ -1051,10 +1053,17 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
|
||||
if (this.items.length > 0) {
|
||||
$.each(this.items, function(index, obj) {
|
||||
let customer_price_list = me.customer_wise_price_list[customer];
|
||||
let item_price
|
||||
if (customer && customer_price_list && customer_price_list[obj.name]) {
|
||||
item_price = format_currency(customer_price_list[obj.name], me.frm.doc.currency);
|
||||
} else {
|
||||
item_price = format_currency(me.price_list_data[obj.name], me.frm.doc.currency);
|
||||
}
|
||||
if(index < me.page_len) {
|
||||
$(frappe.render_template("pos_item", {
|
||||
item_code: obj.name,
|
||||
item_price: format_currency(me.price_list_data[obj.name], me.frm.doc.currency),
|
||||
item_price: item_price,
|
||||
item_name: obj.name === obj.item_name ? "" : obj.item_name,
|
||||
item_image: obj.image,
|
||||
item_stock: __('Stock Qty') + ": " + me.get_actual_qty(obj),
|
||||
@@ -1167,20 +1176,27 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
$(this.wrapper).on("change", ".pos-item-qty", function () {
|
||||
var item_code = $(this).parents(".pos-selected-item-action").attr("data-item-code");
|
||||
var qty = $(this).val();
|
||||
me.update_qty(item_code, qty)
|
||||
me.update_value()
|
||||
me.update_qty(item_code, qty);
|
||||
me.update_value();
|
||||
})
|
||||
|
||||
$(this.wrapper).on("focusout", ".pos-item-qty", function () {
|
||||
var item_code = $(this).parents(".pos-selected-item-action").attr("data-item-code");
|
||||
var qty = $(this).val();
|
||||
me.update_qty(item_code, qty, true);
|
||||
me.update_value();
|
||||
})
|
||||
|
||||
$(this.wrapper).find("[data-action='increase-qty']").on("click", function () {
|
||||
var item_code = $(this).parents(".pos-bill-item").attr("data-item-code");
|
||||
var qty = flt($(this).parents(".pos-bill-item").find('.pos-item-qty').val()) + 1;
|
||||
me.update_qty(item_code, qty)
|
||||
me.update_qty(item_code, qty);
|
||||
})
|
||||
|
||||
$(this.wrapper).find("[data-action='decrease-qty']").on("click", function () {
|
||||
var item_code = $(this).parents(".pos-bill-item").attr("data-item-code");
|
||||
var qty = flt($(this).parents(".pos-bill-item").find('.pos-item-qty').val()) - 1;
|
||||
me.update_qty(item_code, qty)
|
||||
me.update_qty(item_code, qty);
|
||||
})
|
||||
|
||||
$(this.wrapper).on("change", ".pos-item-disc", function () {
|
||||
@@ -1219,11 +1235,11 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
me.bind_delete_event()
|
||||
},
|
||||
|
||||
update_qty: function (item_code, qty) {
|
||||
update_qty: function (item_code, qty, remove_zero_qty_items) {
|
||||
var me = this;
|
||||
this.items = this.get_items(item_code);
|
||||
this.validate_serial_no()
|
||||
this.set_item_details(item_code, "qty", qty);
|
||||
this.set_item_details(item_code, "qty", qty, remove_zero_qty_items);
|
||||
},
|
||||
|
||||
update_discount: function(item_code, discount) {
|
||||
@@ -1284,7 +1300,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
})
|
||||
},
|
||||
|
||||
set_item_details: function (item_code, field, value) {
|
||||
set_item_details: function (item_code, field, value, remove_zero_qty_items) {
|
||||
var me = this;
|
||||
if (value < 0) {
|
||||
frappe.throw(__("Enter value must be positive"));
|
||||
@@ -1299,7 +1315,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
|
||||
d[field] = flt(value);
|
||||
d.amount = flt(d.rate) * flt(d.qty);
|
||||
if (d.qty == 0) {
|
||||
if (d.qty == 0 && remove_zero_qty_items) {
|
||||
me.remove_item.push(d.idx)
|
||||
}
|
||||
|
||||
@@ -1309,10 +1325,14 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
}
|
||||
});
|
||||
|
||||
if (field == 'qty') {
|
||||
this.remove_zero_qty_items_from_cart();
|
||||
}
|
||||
|
||||
this.update_paid_amount_status(false)
|
||||
},
|
||||
|
||||
remove_zero_qty_item: function () {
|
||||
remove_zero_qty_items_from_cart: function () {
|
||||
var me = this;
|
||||
var idx = 0;
|
||||
this.items = []
|
||||
@@ -1417,8 +1437,20 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
this.child.income_account = this.pos_profile_data['income_account'] || this.items[0].income_account;
|
||||
this.child.warehouse = (this.item_serial_no[this.child.item_code]
|
||||
? this.item_serial_no[this.child.item_code][1] : (this.pos_profile_data['warehouse'] || this.items[0].default_warehouse));
|
||||
this.child.price_list_rate = flt(this.price_list_data[this.child.item_code] * this.child.conversion_factor, 9) / flt(this.frm.doc.conversion_rate, 9);
|
||||
this.child.rate = flt(this.price_list_data[this.child.item_code] * this.child.conversion_factor, 9) / flt(this.frm.doc.conversion_rate, 9);
|
||||
|
||||
customer = this.frm.doc.customer;
|
||||
let rate;
|
||||
|
||||
customer_price_list = this.customer_wise_price_list[customer]
|
||||
if (customer_price_list && customer_price_list[this.child.item_code]){
|
||||
rate = flt(this.customer_wise_price_list[customer][this.child.item_code] * this.child.conversion_factor, 9) / flt(this.frm.doc.conversion_rate, 9);
|
||||
}
|
||||
else{
|
||||
rate = flt(this.price_list_data[this.child.item_code] * this.child.conversion_factor, 9) / flt(this.frm.doc.conversion_rate, 9);
|
||||
}
|
||||
|
||||
this.child.price_list_rate = rate;
|
||||
this.child.rate = rate;
|
||||
this.child.actual_qty = me.get_actual_qty(this.items[0]);
|
||||
this.child.amount = flt(this.child.qty) * flt(this.child.rate);
|
||||
this.child.batch_no = this.item_batch_no[this.child.item_code];
|
||||
@@ -1826,10 +1858,25 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
validate: function () {
|
||||
var me = this;
|
||||
this.customer_validate();
|
||||
this.validate_zero_qty_items();
|
||||
this.item_validate();
|
||||
this.validate_mode_of_payments();
|
||||
},
|
||||
|
||||
validate_zero_qty_items: function() {
|
||||
this.remove_item = [];
|
||||
|
||||
this.frm.doc.items.forEach(d => {
|
||||
if (d.qty == 0) {
|
||||
this.remove_item.push(d.idx);
|
||||
}
|
||||
});
|
||||
|
||||
if(this.remove_item) {
|
||||
this.remove_zero_qty_items_from_cart();
|
||||
}
|
||||
},
|
||||
|
||||
item_validate: function () {
|
||||
if (this.frm.doc.items.length == 0) {
|
||||
frappe.throw(__("Select items to save the invoice"))
|
||||
|
||||
@@ -22,18 +22,20 @@ class DuplicatePartyAccountError(frappe.ValidationError): pass
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_party_details(party=None, account=None, party_type="Customer", company=None, posting_date=None,
|
||||
bill_date=None, price_list=None, currency=None, doctype=None, ignore_permissions=False, fetch_payment_terms_template=True, party_address=None, shipping_address=None):
|
||||
bill_date=None, price_list=None, currency=None, doctype=None, ignore_permissions=False, fetch_payment_terms_template=True,
|
||||
party_address=None, shipping_address=None, pos_profile=None):
|
||||
|
||||
if not party:
|
||||
return {}
|
||||
if not frappe.db.exists(party_type, party):
|
||||
frappe.throw(_("{0}: {1} does not exists").format(party_type, party))
|
||||
return _get_party_details(party, account, party_type,
|
||||
company, posting_date, bill_date, price_list, currency, doctype, ignore_permissions, fetch_payment_terms_template, party_address, shipping_address)
|
||||
company, posting_date, bill_date, price_list, currency, doctype, ignore_permissions,
|
||||
fetch_payment_terms_template, party_address, shipping_address, pos_profile)
|
||||
|
||||
def _get_party_details(party=None, account=None, party_type="Customer", company=None, posting_date=None,
|
||||
bill_date=None, price_list=None, currency=None, doctype=None, ignore_permissions=False,
|
||||
fetch_payment_terms_template=True, party_address=None, shipping_address=None):
|
||||
fetch_payment_terms_template=True, party_address=None, shipping_address=None, pos_profile=None):
|
||||
|
||||
out = frappe._dict(set_account_and_due_date(party, account, party_type, company, posting_date, bill_date, doctype))
|
||||
party = out[party_type.lower()]
|
||||
@@ -49,7 +51,7 @@ def _get_party_details(party=None, account=None, party_type="Customer", company=
|
||||
set_address_details(out, party, party_type, doctype, company, party_address, shipping_address)
|
||||
set_contact_details(out, party, party_type)
|
||||
set_other_values(out, party, party_type)
|
||||
set_price_list(out, party, party_type, price_list)
|
||||
set_price_list(out, party, party_type, price_list, pos_profile)
|
||||
|
||||
out["taxes_and_charges"] = set_taxes(party.name, party_type, posting_date, company, out.customer_group, out.supplier_type)
|
||||
|
||||
@@ -149,12 +151,20 @@ def get_default_price_list(party):
|
||||
|
||||
return None
|
||||
|
||||
def set_price_list(out, party, party_type, given_price_list):
|
||||
def set_price_list(out, party, party_type, given_price_list, pos=None):
|
||||
# price list
|
||||
price_list = get_permitted_documents('Price List')
|
||||
|
||||
if price_list:
|
||||
price_list = price_list[0]
|
||||
elif pos and party_type == 'Customer':
|
||||
customer_price_list = frappe.get_value('Customer', party.name, 'default_price_list')
|
||||
|
||||
if customer_price_list:
|
||||
price_list = customer_price_list
|
||||
else:
|
||||
pos_price_list = frappe.get_value('POS Profile', pos, 'selling_price_list')
|
||||
price_list = pos_price_list or given_price_list
|
||||
else:
|
||||
price_list = get_default_price_list(party) or given_price_list
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
"docstatus": 0,
|
||||
"doctype": "Print Format",
|
||||
"font": "Default",
|
||||
"html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ doc.company }}<br>\n\t{% if doc.company_address_display %}\n\t\t{% set company_address = doc.company_address_display.replace(\"\\n\", \" \").replace(\"<br>\", \" \") %}\n\t\t{% if \"GSTIN\" not in company_address %}\n\t\t\t{{ company_address }}\n\t\t\t<b>{{ _(\"GSTIN\") }}:</b>{{ doc.company_gstin }}\n\t\t{% else %}\n\t\t\t{{ company_address.replace(\"GSTIN\", \"<br>GSTIN\") }}\n\t\t{% endif %}\n\t{% endif %}\n\t<br>\n\t{% if doc.docstatus == 0 %}\n\t\t<b>{{ doc.status + \" \"+ (doc.select_print_heading or _(\"Invoice\")) }}</b><br>\n\t{% else %}\n\t\t<b>{{ doc.select_print_heading or _(\"Invoice\") }}</b><br>\n\t{% endif %}\n</p>\n<p>\n\t<b>{{ _(\"Receipt No\") }}:</b> {{ doc.name }}<br>\n\t<b>{{ _(\"Date\") }}:</b> {{ doc.get_formatted(\"posting_date\") }}<br>\n\t{% if doc.grand_total > 50000 %}\n\t\t{% set customer_address = doc.address_display.replace(\"\\n\", \" \").replace(\"<br>\", \" \") %}\n\t\t<b>{{ _(\"Customer\") }}:</b><br>\n\t\t{{ doc.customer_name }}<br>\n\t\t{{ customer_address }}\n\t{% endif %}\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"40%\">{{ _(\"Item\") }}</b></th>\n\t\t\t<th width=\"30%\" class=\"text-right\">{{ _(\"Qty\") }}</th>\n\t\t\t<th width=\"30%\" class=\"text-right\">{{ _(\"Amount\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{%- for item in doc.items -%}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_code }}\n\t\t\t\t{%- if item.item_name != item.item_code -%}\n\t\t\t\t\t<br>{{ item.item_name }}\n\t\t\t\t{%- endif -%}\n\t\t\t\t{%- if item.gst_hsn_code -%}\n\t\t\t\t\t<br><b>{{ _(\"HSN/SAC\") }}:</b> {{ item.gst_hsn_code }}\n\t\t\t\t{%- endif -%}\n\t\t\t\t{%- if item.serial_no -%}\n\t\t\t\t\t<br><b>{{ _(\"Serial No\") }}:</b> {{ item.serial_no }}\n\t\t\t\t{%- endif -%}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ item.qty }}<br>@ {{ item.rate }}</td>\n\t\t\t<td class=\"text-right\">{{ item.get_formatted(\"amount\") }}</td>\n\t\t</tr>\n\t\t{%- endfor -%}\n\t</tbody>\n</table>\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t{% if doc.flags.show_inclusive_tax_in_print %}\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ _(\"Total Excl. Tax\") }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"net_total\", doc) }}\n\t\t\t\t</td>\n\t\t\t{% else %}\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ _(\"Total\") }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"total\", doc) }}\n\t\t\t\t</td>\n\t\t\t{% endif %}\n\t\t</tr>\n\t\t{%- for row in doc.taxes -%}\n\t\t {%- if not row.included_in_print_rate or doc.flags.show_inclusive_tax_in_print -%}\n\t\t\t<tr>\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ row.description }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t\t</td>\n\t\t\t<tr>\n\t\t {%- endif -%}\n\t\t{%- endfor -%}\n\t\t{%- if doc.discount_amount -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t{{ _(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"discount_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"grand_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- if doc.rounded_total -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Rounded Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"rounded_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Paid Amount\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"paid_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t{%- if doc.change_amount -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Change Amount\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"change_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t{%- endif -%}\n\t</tbody>\n</table>\n<p><b>Tax Breakup:</b></p>\n<div style=\"font-size: 8px\">\n\t{{ doc.other_charges_calculation }}\n</div>\n<p>{{ doc.terms or \"\" }}</p>\n<p class=\"text-center\">{{ _(\"Thank you, please visit again.\") }}</p>",
|
||||
"html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ doc.company }}<br>\n\t{% if doc.company_address_display %}\n\t\t{% set company_address = doc.company_address_display.replace(\"\\n\", \" \").replace(\"<br>\", \" \") %}\n\t\t{% if \"GSTIN\" not in company_address %}\n\t\t\t{{ company_address }}\n\t\t\t<b>{{ _(\"GSTIN\") }}:</b>{{ doc.company_gstin }}\n\t\t{% else %}\n\t\t\t{{ company_address.replace(\"GSTIN\", \"<br>GSTIN\") }}\n\t\t{% endif %}\n\t{% endif %}\n\t<br>\n\t{% if doc.docstatus == 0 %}\n\t\t<b>{{ doc.status + \" \"+ (doc.select_print_heading or _(\"Invoice\")) }}</b><br>\n\t{% else %}\n\t\t<b>{{ doc.select_print_heading or _(\"Invoice\") }}</b><br>\n\t{% endif %}\n</p>\n<p>\n\t<b>{{ _(\"Receipt No\") }}:</b> {{ doc.name }}<br>\n\t<b>{{ _(\"Date\") }}:</b> {{ doc.get_formatted(\"posting_date\") }}<br>\n\t{% if doc.grand_total > 50000 %}\n\t\t{% set customer_address = doc.address_display.replace(\"\\n\", \" \").replace(\"<br>\", \" \") %}\n\t\t<b>{{ _(\"Customer\") }}:</b><br>\n\t\t{{ doc.customer_name }}<br>\n\t\t{{ customer_address }}\n\t{% endif %}\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"40%\">{{ _(\"Item\") }}</b></th>\n\t\t\t<th width=\"30%\" class=\"text-right\">{{ _(\"Qty\") }}</th>\n\t\t\t<th width=\"30%\" class=\"text-right\">{{ _(\"Amount\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{%- for item in doc.items -%}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_code }}\n\t\t\t\t{%- if item.item_name != item.item_code -%}\n\t\t\t\t\t<br>{{ item.item_name }}\n\t\t\t\t{%- endif -%}\n\t\t\t\t{%- if item.gst_hsn_code -%}\n\t\t\t\t\t<br><b>{{ _(\"HSN/SAC\") }}:</b> {{ item.gst_hsn_code }}\n\t\t\t\t{%- endif -%}\n\t\t\t\t{%- if item.serial_no -%}\n\t\t\t\t\t<br><b>{{ _(\"Serial No\") }}:</b> {{ item.serial_no }}\n\t\t\t\t{%- endif -%}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ item.qty }}<br>@ {{ item.rate }}</td>\n\t\t\t<td class=\"text-right\">{{ item.get_formatted(\"amount\") }}</td>\n\t\t</tr>\n\t\t{%- endfor -%}\n\t</tbody>\n</table>\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t{% if doc.flags.show_inclusive_tax_in_print %}\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ _(\"Total Excl. Tax\") }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"net_total\", doc) }}\n\t\t\t\t</td>\n\t\t\t{% else %}\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ _(\"Total\") }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"total\", doc) }}\n\t\t\t\t</td>\n\t\t\t{% endif %}\n\t\t</tr>\n\t\t{%- for row in doc.taxes -%}\n\t\t {%- if (not row.included_in_print_rate or doc.flags.show_inclusive_tax_in_print) and row.tax_amount != 0 -%}\n\t\t\t<tr>\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ row.description }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t\t</td>\n\t\t\t<tr>\n\t\t {%- endif -%}\n\t\t{%- endfor -%}\n\t\t{%- if doc.discount_amount -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t{{ _(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"discount_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"grand_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- if doc.rounded_total -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Rounded Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"rounded_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Paid Amount\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"paid_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t{%- if doc.change_amount -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Change Amount\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"change_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t{%- endif -%}\n\t</tbody>\n</table>\n<p>{{ doc.terms or \"\" }}</p>\n<p class=\"text-center\">{{ _(\"Thank you, please visit again.\") }}</p>",
|
||||
"idx": 0,
|
||||
"line_breaks": 0,
|
||||
"modified": "2018-03-20 14:24:08.167930",
|
||||
"modified": "2019-01-24 17:09:27.190929",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "GST POS Invoice",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
import frappe.defaults
|
||||
import unittest
|
||||
|
||||
@@ -190,7 +190,7 @@ class AccountsReceivableSummary(ReceivablePayableReport):
|
||||
def get_voucherwise_data(self, party_naming_by, args):
|
||||
voucherwise_data = ReceivablePayableReport(self.filters).run(args)[1]
|
||||
|
||||
cols = ["posting_date", "party", "customer-contact"]
|
||||
cols = ["posting_date", "party"]
|
||||
|
||||
if party_naming_by == "Naming Series":
|
||||
cols += ["party_name"]
|
||||
|
||||
@@ -36,8 +36,8 @@ def get_conditions(filters):
|
||||
def get_entries(filters):
|
||||
conditions = get_conditions(filters)
|
||||
journal_entries = frappe.db.sql("""SELECT
|
||||
"Journal Entry", jv.name, jv.posting_date, jv.cheque_no, jv.clearance_date, jvd.against_account,
|
||||
if((jvd.debit - jvd.credit) < 0, (jvd.debit - jvd.credit) * -1, (jvd.debit - jvd.credit))
|
||||
"Journal Entry", jv.name, jv.posting_date, jv.cheque_no,
|
||||
jv.clearance_date, jvd.against_account, jvd.debit - jvd.credit
|
||||
FROM
|
||||
`tabJournal Entry Account` jvd, `tabJournal Entry` jv
|
||||
WHERE
|
||||
@@ -46,7 +46,7 @@ def get_entries(filters):
|
||||
|
||||
payment_entries = frappe.db.sql("""SELECT
|
||||
"Payment Entry", name, posting_date, reference_no, clearance_date, party,
|
||||
if(paid_from=%(account)s, paid_amount, received_amount)
|
||||
if(paid_from=%(account)s, paid_amount * -1, received_amount)
|
||||
FROM
|
||||
`tabPayment Entry`
|
||||
WHERE
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
/* eslint-disable */
|
||||
|
||||
frappe.query_reports["Customer Ledger Summary"] = {
|
||||
"filters": [
|
||||
{
|
||||
"fieldname":"company",
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("Company")
|
||||
},
|
||||
{
|
||||
"fieldname":"from_date",
|
||||
"label": __("From Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.datetime.add_months(frappe.datetime.get_today(), -1),
|
||||
"reqd": 1,
|
||||
"width": "60px"
|
||||
},
|
||||
{
|
||||
"fieldname":"to_date",
|
||||
"label": __("To Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.datetime.get_today(),
|
||||
"reqd": 1,
|
||||
"width": "60px"
|
||||
},
|
||||
{
|
||||
"fieldname":"finance_book",
|
||||
"label": __("Finance Book"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Finance Book"
|
||||
},
|
||||
{
|
||||
"fieldname":"party",
|
||||
"label": __("Customer"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Customer",
|
||||
on_change: () => {
|
||||
var party = frappe.query_report.get_filter_value('party');
|
||||
if (party) {
|
||||
frappe.db.get_value('Customer', party, ["tax_id", "customer_name"], function(value) {
|
||||
frappe.query_report.set_filter_value('tax_id', value["tax_id"]);
|
||||
frappe.query_report.set_filter_value('customer_name', value["customer_name"]);
|
||||
});
|
||||
} else {
|
||||
frappe.query_report.set_filter_value('tax_id', "");
|
||||
frappe.query_report.set_filter_value('customer_name', "");
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"fieldname":"customer_group",
|
||||
"label": __("Customer Group"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Customer Group"
|
||||
},
|
||||
{
|
||||
"fieldname":"payment_terms_template",
|
||||
"label": __("Payment Terms Template"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Payment Terms Template"
|
||||
},
|
||||
{
|
||||
"fieldname":"territory",
|
||||
"label": __("Territory"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Territory"
|
||||
},
|
||||
{
|
||||
"fieldname":"sales_partner",
|
||||
"label": __("Sales Partner"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Sales Partner"
|
||||
},
|
||||
{
|
||||
"fieldname":"sales_person",
|
||||
"label": __("Sales Person"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Sales Person"
|
||||
},
|
||||
{
|
||||
"fieldname":"tax_id",
|
||||
"label": __("Tax Id"),
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1
|
||||
},
|
||||
{
|
||||
"fieldname":"customer_name",
|
||||
"label": __("Customer Name"),
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"add_total_row": 1,
|
||||
"creation": "2018-12-11 00:58:19.078506",
|
||||
"disabled": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "Report",
|
||||
"idx": 0,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2018-12-11 00:59:21.708343",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Customer Ledger Summary",
|
||||
"owner": "Administrator",
|
||||
"prepared_report": 0,
|
||||
"ref_doctype": "Sales Invoice",
|
||||
"report_name": "Customer Ledger Summary",
|
||||
"report_type": "Script Report",
|
||||
"roles": [
|
||||
{
|
||||
"role": "Accounts Manager"
|
||||
},
|
||||
{
|
||||
"role": "Accounts User"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,321 @@
|
||||
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
import erpnext
|
||||
from frappe import _
|
||||
from frappe.utils import getdate, nowdate
|
||||
from six import iteritems, itervalues
|
||||
|
||||
class PartyLedgerSummaryReport(object):
|
||||
def __init__(self, filters=None):
|
||||
self.filters = frappe._dict(filters or {})
|
||||
self.filters.from_date = getdate(self.filters.from_date or nowdate())
|
||||
self.filters.to_date = getdate(self.filters.to_date or nowdate())
|
||||
|
||||
def run(self, args):
|
||||
if self.filters.from_date > self.filters.to_date:
|
||||
frappe.throw(_("From Date must be before To Date"))
|
||||
|
||||
self.filters.party_type = args.get("party_type")
|
||||
self.party_naming_by = frappe.db.get_value(args.get("naming_by")[0], None, args.get("naming_by")[1])
|
||||
|
||||
discount_account_field = "discount_allowed_account" if self.filters.party_type == "Customer" \
|
||||
else "discount_received_account"
|
||||
self.round_off_account, self.write_off_account, self.discount_account = frappe.get_cached_value('Company',
|
||||
self.filters.company, ["round_off_account", "write_off_account", discount_account_field])
|
||||
|
||||
columns = self.get_columns()
|
||||
data = self.get_data()
|
||||
return columns, data
|
||||
|
||||
def get_columns(self):
|
||||
columns = [{
|
||||
"label": _(self.filters.party_type),
|
||||
"fieldtype": "Link",
|
||||
"fieldname": "party",
|
||||
"options": self.filters.party_type,
|
||||
"width": 200
|
||||
}]
|
||||
|
||||
if self.party_naming_by == "Naming Series":
|
||||
columns.append({
|
||||
"label": _(self.filters.party_type + "Name"),
|
||||
"fieldtype": "Data",
|
||||
"fieldname": "party_name",
|
||||
"width": 110
|
||||
})
|
||||
|
||||
credit_or_debit_note = "Credit Note" if self.filters.party_type == "Customer" else "Debit Note"
|
||||
discount_allowed_or_received = "Discount Allowed" if self.filters.party_type == "Customer" else "Discount Received"
|
||||
|
||||
columns += [
|
||||
{
|
||||
"label": _("Opening Balance"),
|
||||
"fieldname": "opening_balance",
|
||||
"fieldtype": "Currency",
|
||||
"options": "currency",
|
||||
"width": 120
|
||||
},
|
||||
{
|
||||
"label": _("Invoiced Amount"),
|
||||
"fieldname": "invoiced_amount",
|
||||
"fieldtype": "Currency",
|
||||
"options": "currency",
|
||||
"width": 120
|
||||
},
|
||||
{
|
||||
"label": _("Paid Amount"),
|
||||
"fieldname": "paid_amount",
|
||||
"fieldtype": "Currency",
|
||||
"options": "currency",
|
||||
"width": 120
|
||||
},
|
||||
{
|
||||
"label": _(credit_or_debit_note),
|
||||
"fieldname": "return_amount",
|
||||
"fieldtype": "Currency",
|
||||
"options": "currency",
|
||||
"width": 120
|
||||
},
|
||||
{
|
||||
"label": _(discount_allowed_or_received),
|
||||
"fieldname": "discount_amount",
|
||||
"fieldtype": "Currency",
|
||||
"options": "currency",
|
||||
"width": 120
|
||||
},
|
||||
{
|
||||
"label": _("Write Off Amount"),
|
||||
"fieldname": "write_off_amount",
|
||||
"fieldtype": "Currency",
|
||||
"options": "currency",
|
||||
"width": 120
|
||||
},
|
||||
{
|
||||
"label": _("Other Adjustments"),
|
||||
"fieldname": "adjustment_amount",
|
||||
"fieldtype": "Currency",
|
||||
"options": "currency",
|
||||
"width": 120
|
||||
},
|
||||
{
|
||||
"label": _("Closing Balance"),
|
||||
"fieldname": "closing_balance",
|
||||
"fieldtype": "Currency",
|
||||
"options": "currency",
|
||||
"width": 120
|
||||
},
|
||||
{
|
||||
"label": _("Currency"),
|
||||
"fieldname": "currency",
|
||||
"fieldtype": "Link",
|
||||
"options": "Currency",
|
||||
"width": 50
|
||||
}
|
||||
]
|
||||
|
||||
return columns
|
||||
|
||||
def get_data(self):
|
||||
if not self.filters.get("company"):
|
||||
self.filters["company"] = frappe.db.get_single_value('Global Defaults', 'default_company')
|
||||
|
||||
company_currency = frappe.get_cached_value('Company', self.filters.get("company"), "default_currency")
|
||||
invoice_dr_or_cr = "debit" if self.filters.party_type == "Customer" else "credit"
|
||||
reverse_dr_or_cr = "credit" if self.filters.party_type == "Customer" else "debit"
|
||||
|
||||
self.get_gl_entries()
|
||||
self.get_return_invoices()
|
||||
self.get_party_adjustment_amounts()
|
||||
|
||||
self.party_data = frappe._dict({})
|
||||
for gle in self.gl_entries:
|
||||
self.party_data.setdefault(gle.party, frappe._dict({
|
||||
"party": gle.party,
|
||||
"party_name": gle.party_name,
|
||||
"opening_balance": 0,
|
||||
"invoiced_amount": 0,
|
||||
"paid_amount": 0,
|
||||
"return_amount": 0,
|
||||
"closing_balance": 0,
|
||||
"currency": company_currency
|
||||
}))
|
||||
|
||||
amount = gle.get(invoice_dr_or_cr) - gle.get(reverse_dr_or_cr)
|
||||
self.party_data[gle.party].closing_balance += amount
|
||||
|
||||
if gle.posting_date < self.filters.from_date:
|
||||
self.party_data[gle.party].opening_balance += amount
|
||||
else:
|
||||
if amount > 0:
|
||||
self.party_data[gle.party].invoiced_amount += amount
|
||||
elif gle.voucher_no in self.return_invoices:
|
||||
self.party_data[gle.party].return_amount -= amount
|
||||
else:
|
||||
self.party_data[gle.party].paid_amount -= amount
|
||||
|
||||
out = []
|
||||
for party, row in iteritems(self.party_data):
|
||||
if row.opening_balance or row.invoiced_amount or row.paid_amount or row.return_amount or row.closing_amount:
|
||||
total_party_adjustment = sum([amount for amount in itervalues(self.party_adjustment_details.get(party, {}))])
|
||||
row.paid_amount -= total_party_adjustment
|
||||
row.discount_amount = self.party_adjustment_details.get(party, {}).get(self.discount_account, 0)
|
||||
row.write_off_amount = self.party_adjustment_details.get(party, {}).get(self.write_off_account, 0)
|
||||
row.adjustment_amount = total_party_adjustment - row.discount_amount - row.write_off_amount
|
||||
|
||||
out.append(row)
|
||||
|
||||
return out
|
||||
|
||||
def get_gl_entries(self):
|
||||
conditions = self.prepare_conditions()
|
||||
join = join_field = ""
|
||||
if self.filters.party_type == "Customer":
|
||||
join_field = ", p.customer_name as party_name"
|
||||
join = "left join `tabCustomer` p on gle.party = p.name"
|
||||
elif self.filters.party_type == "Supplier":
|
||||
join_field = ", p.supplier_name as party_name"
|
||||
join = "left join `tabSupplier` p on gle.party = p.name"
|
||||
|
||||
self.gl_entries = frappe.db.sql("""
|
||||
select
|
||||
gle.posting_date, gle.party, gle.voucher_type, gle.voucher_no, gle.against_voucher_type,
|
||||
gle.against_voucher, gle.debit, gle.credit {join_field}
|
||||
from `tabGL Entry` gle
|
||||
{join}
|
||||
where
|
||||
gle.docstatus < 2 and gle.party_type=%(party_type)s and ifnull(gle.party, '') != ''
|
||||
and gle.posting_date <= %(to_date)s {conditions}
|
||||
order by gle.posting_date
|
||||
""".format(join=join, join_field=join_field, conditions=conditions), self.filters, as_dict=True)
|
||||
|
||||
def prepare_conditions(self):
|
||||
conditions = [""]
|
||||
|
||||
if self.filters.company:
|
||||
conditions.append("company=%(company)s")
|
||||
|
||||
self.filters.company_finance_book = erpnext.get_default_finance_book(self.filters.company)
|
||||
|
||||
if not self.filters.finance_book or (self.filters.finance_book == self.filters.company_finance_book):
|
||||
conditions.append("ifnull(finance_book,'') in (%(company_finance_book)s, '')")
|
||||
elif self.filters.finance_book:
|
||||
conditions.append("ifnull(finance_book,'') = %(finance_book)s")
|
||||
|
||||
if self.filters.get("party"):
|
||||
conditions.append("party=%(party)s")
|
||||
|
||||
if self.filters.party_type == "Customer":
|
||||
if self.filters.get("customer_group"):
|
||||
lft, rgt = frappe.db.get_value("Customer Group",
|
||||
self.filters.get("customer_group"), ["lft", "rgt"])
|
||||
|
||||
conditions.append("""party in (select name from tabCustomer
|
||||
where exists(select name from `tabCustomer Group` where lft >= {0} and rgt <= {1}
|
||||
and name=tabCustomer.customer_group))""".format(lft, rgt))
|
||||
|
||||
if self.filters.get("territory"):
|
||||
lft, rgt = frappe.db.get_value("Territory",
|
||||
self.filters.get("territory"), ["lft", "rgt"])
|
||||
|
||||
conditions.append("""party in (select name from tabCustomer
|
||||
where exists(select name from `tabTerritory` where lft >= {0} and rgt <= {1}
|
||||
and name=tabCustomer.territory))""".format(lft, rgt))
|
||||
|
||||
if self.filters.get("payment_terms_template"):
|
||||
conditions.append("party in (select name from tabCustomer where payment_terms=%(payment_terms_template)s)")
|
||||
|
||||
if self.filters.get("sales_partner"):
|
||||
conditions.append("party in (select name from tabCustomer where default_sales_partner=%(sales_partner)s)")
|
||||
|
||||
if self.filters.get("sales_person"):
|
||||
lft, rgt = frappe.db.get_value("Sales Person",
|
||||
self.filters.get("sales_person"), ["lft", "rgt"])
|
||||
|
||||
conditions.append("""exists(select name from `tabSales Team` steam where
|
||||
steam.sales_person in (select name from `tabSales Person` where lft >= {0} and rgt <= {1})
|
||||
and ((steam.parent = voucher_no and steam.parenttype = voucher_type)
|
||||
or (steam.parent = against_voucher and steam.parenttype = against_voucher_type)
|
||||
or (steam.parent = party and steam.parenttype = 'Customer')))""".format(lft, rgt))
|
||||
|
||||
if self.filters.party_type == "Supplier":
|
||||
if self.filters.get("supplier_group"):
|
||||
conditions.append("""party in (select name from tabSupplier
|
||||
where supplier_group=%(supplier_group)s)""")
|
||||
|
||||
return " and ".join(conditions)
|
||||
|
||||
def get_return_invoices(self):
|
||||
doctype = "Sales Invoice" if self.filters.party_type == "Customer" else "Purchase Invoice"
|
||||
self.return_invoices = [d.name for d in frappe.get_all(doctype, filters={"is_return": 1, "docstatus": 1,
|
||||
"posting_date": ["between", [self.filters.from_date, self.filters.to_date]]})]
|
||||
|
||||
def get_party_adjustment_amounts(self):
|
||||
conditions = self.prepare_conditions()
|
||||
income_or_expense = "Expense" if self.filters.party_type == "Customer" else "Income"
|
||||
invoice_dr_or_cr = "debit" if self.filters.party_type == "Customer" else "credit"
|
||||
reverse_dr_or_cr = "credit" if self.filters.party_type == "Customer" else "debit"
|
||||
|
||||
gl_entries = frappe.db.sql("""
|
||||
select
|
||||
posting_date, account, party, voucher_type, voucher_no, debit, credit
|
||||
from
|
||||
`tabGL Entry`
|
||||
where
|
||||
docstatus < 2
|
||||
and (voucher_type, voucher_no) in (
|
||||
select voucher_type, voucher_no from `tabGL Entry` gle, `tabAccount` acc
|
||||
where acc.name = gle.account and acc.root_type = '{income_or_expense}'
|
||||
and gle.posting_date between %(from_date)s and %(to_date)s and gle.docstatus < 2
|
||||
) and (voucher_type, voucher_no) in (
|
||||
select voucher_type, voucher_no from `tabGL Entry` gle
|
||||
where gle.party_type=%(party_type)s and ifnull(party, '') != ''
|
||||
and gle.posting_date between %(from_date)s and %(to_date)s and gle.docstatus < 2 {conditions}
|
||||
)
|
||||
""".format(conditions=conditions, income_or_expense=income_or_expense), self.filters, as_dict=True)
|
||||
|
||||
self.party_adjustment_details = {}
|
||||
adjustment_voucher_entries = {}
|
||||
for gle in gl_entries:
|
||||
adjustment_voucher_entries.setdefault((gle.voucher_type, gle.voucher_no), [])
|
||||
adjustment_voucher_entries[(gle.voucher_type, gle.voucher_no)].append(gle)
|
||||
|
||||
for voucher_gl_entries in itervalues(adjustment_voucher_entries):
|
||||
parties = {}
|
||||
accounts = {}
|
||||
has_irrelevant_entry = False
|
||||
|
||||
for gle in voucher_gl_entries:
|
||||
if gle.account == self.round_off_account:
|
||||
continue
|
||||
elif gle.party:
|
||||
parties.setdefault(gle.party, 0)
|
||||
parties[gle.party] += gle.get(reverse_dr_or_cr) - gle.get(invoice_dr_or_cr)
|
||||
elif frappe.get_cached_value("Account", gle.account, "root_type") == income_or_expense:
|
||||
accounts.setdefault(gle.account, 0)
|
||||
accounts[gle.account] += gle.get(invoice_dr_or_cr) - gle.get(reverse_dr_or_cr)
|
||||
else:
|
||||
has_irrelevant_entry = True
|
||||
|
||||
if parties and accounts:
|
||||
if len(parties) == 1:
|
||||
party = parties.keys()[0]
|
||||
for account, amount in iteritems(accounts):
|
||||
self.party_adjustment_details.setdefault(party, {})
|
||||
self.party_adjustment_details[party].setdefault(account, 0)
|
||||
self.party_adjustment_details[party][account] += amount
|
||||
elif len(accounts) == 1 and not has_irrelevant_entry:
|
||||
account = accounts.keys()[0]
|
||||
for party, amount in iteritems(parties):
|
||||
self.party_adjustment_details.setdefault(party, {})
|
||||
self.party_adjustment_details[party].setdefault(account, 0)
|
||||
self.party_adjustment_details[party][account] += amount
|
||||
|
||||
def execute(filters=None):
|
||||
args = {
|
||||
"party_type": "Customer",
|
||||
"naming_by": ["Selling Settings", "cust_master_name"],
|
||||
}
|
||||
return PartyLedgerSummaryReport(filters).run(args)
|
||||
@@ -101,7 +101,7 @@ def set_account_currency(filters):
|
||||
frappe.db.get_value(filters.party_type, filters.party[0], "default_currency"))
|
||||
|
||||
filters["account_currency"] = account_currency or filters.company_currency
|
||||
if filters.account_currency != filters.company_currency:
|
||||
if filters.account_currency != filters.company_currency and not filters.presentation_currency:
|
||||
filters.presentation_currency = filters.account_currency
|
||||
|
||||
return filters
|
||||
|
||||
@@ -193,7 +193,7 @@ def get_invoice_po_pr_map(invoice_list):
|
||||
pi_items = frappe.db.sql("""
|
||||
select parent, purchase_order, purchase_receipt, po_detail, project
|
||||
from `tabPurchase Invoice Item`
|
||||
where parent in (%s) and (ifnull(purchase_order, '') != '' or ifnull(purchase_receipt, '') != '')
|
||||
where parent in (%s)
|
||||
""" % ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
|
||||
|
||||
invoice_po_pr_map = {}
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
/* eslint-disable */
|
||||
|
||||
frappe.query_reports["Supplier Ledger Summary"] = {
|
||||
"filters": [
|
||||
{
|
||||
"fieldname":"company",
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("Company")
|
||||
},
|
||||
{
|
||||
"fieldname":"from_date",
|
||||
"label": __("From Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.datetime.add_months(frappe.datetime.get_today(), -1),
|
||||
"reqd": 1,
|
||||
"width": "60px"
|
||||
},
|
||||
{
|
||||
"fieldname":"to_date",
|
||||
"label": __("To Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.datetime.get_today(),
|
||||
"reqd": 1,
|
||||
"width": "60px"
|
||||
},
|
||||
{
|
||||
"fieldname":"finance_book",
|
||||
"label": __("Finance Book"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Finance Book"
|
||||
},
|
||||
{
|
||||
"fieldname":"party",
|
||||
"label": __("Customer"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Customer",
|
||||
on_change: () => {
|
||||
var party = frappe.query_report.get_filter_value('party');
|
||||
if (party) {
|
||||
frappe.db.get_value('Supplier', party, ["tax_id", "supplier_name"], function(value) {
|
||||
frappe.query_report.set_filter_value('tax_id', value["tax_id"]);
|
||||
frappe.query_report.set_filter_value('supplier_name', value["supplier_name"]);
|
||||
});
|
||||
} else {
|
||||
frappe.query_report.set_filter_value('tax_id', "");
|
||||
frappe.query_report.set_filter_value('supplier_name', "");
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"fieldname":"supplier_group",
|
||||
"label": __("Supplier Group"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Supplier Group"
|
||||
},
|
||||
{
|
||||
"fieldname":"payment_terms_template",
|
||||
"label": __("Payment Terms Template"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Payment Terms Template"
|
||||
},
|
||||
{
|
||||
"fieldname":"territory",
|
||||
"label": __("Territory"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Territory"
|
||||
},
|
||||
{
|
||||
"fieldname":"sales_partner",
|
||||
"label": __("Sales Partner"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Sales Partner"
|
||||
},
|
||||
{
|
||||
"fieldname":"sales_person",
|
||||
"label": __("Sales Person"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Sales Person"
|
||||
},
|
||||
{
|
||||
"fieldname":"tax_id",
|
||||
"label": __("Tax Id"),
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1
|
||||
},
|
||||
{
|
||||
"fieldname":"supplier_name",
|
||||
"label": __("Supplier Name"),
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"add_total_row": 1,
|
||||
"creation": "2018-12-12 05:10:02.987274",
|
||||
"disabled": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "Report",
|
||||
"idx": 0,
|
||||
"is_standard": "Yes",
|
||||
"letter_head": "Capital Traders",
|
||||
"modified": "2018-12-12 05:10:02.987274",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Supplier Ledger Summary",
|
||||
"owner": "Administrator",
|
||||
"prepared_report": 0,
|
||||
"ref_doctype": "Purchase Invoice",
|
||||
"report_name": "Supplier Ledger Summary",
|
||||
"report_type": "Script Report",
|
||||
"roles": [
|
||||
{
|
||||
"role": "Accounts Manager"
|
||||
},
|
||||
{
|
||||
"role": "Accounts User"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from erpnext.accounts.report.customer_ledger_summary.customer_ledger_summary import PartyLedgerSummaryReport
|
||||
|
||||
def execute(filters=None):
|
||||
args = {
|
||||
"party_type": "Supplier",
|
||||
"naming_by": ["Buying Settings", "supp_master_name"],
|
||||
}
|
||||
return PartyLedgerSummaryReport(filters).run(args)
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import flt
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from erpnext import get_company_currency, get_default_company
|
||||
from erpnext.setup.utils import get_exchange_rate
|
||||
@@ -103,7 +104,7 @@ def convert_to_presentation_currency(gl_entries, currency_info):
|
||||
credit_in_account_currency = flt(entry['credit_in_account_currency'])
|
||||
account_currency = entry['account_currency']
|
||||
|
||||
if account_currency != presentation_currency or (account_currency == presentation_currency and not is_p_or_l_account(account)):
|
||||
if account_currency != presentation_currency:
|
||||
value = debit or credit
|
||||
|
||||
date = currency_info['report_date'] if not is_p_or_l_account(account) else entry['posting_date']
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
import unittest
|
||||
from erpnext.accounts.party import get_party_shipping_address
|
||||
from frappe.test_runner import make_test_objects
|
||||
|
||||
@@ -615,38 +615,26 @@ def get_held_invoices(party_type, party):
|
||||
return held_invoices
|
||||
|
||||
|
||||
def get_outstanding_invoices(party_type, party, account, condition=None, limit=1000):
|
||||
def get_outstanding_invoices(party_type, party, account, condition=None, limit=None):
|
||||
outstanding_invoices = []
|
||||
precision = frappe.get_precision("Sales Invoice", "outstanding_amount")
|
||||
precision = frappe.get_precision("Sales Invoice", "outstanding_amount") or 2
|
||||
|
||||
if erpnext.get_party_account_type(party_type) == 'Receivable':
|
||||
dr_or_cr = "debit_in_account_currency - credit_in_account_currency"
|
||||
payment_dr_or_cr = "payment_gl_entry.credit_in_account_currency - payment_gl_entry.debit_in_account_currency"
|
||||
payment_dr_or_cr = "credit_in_account_currency - debit_in_account_currency"
|
||||
else:
|
||||
dr_or_cr = "credit_in_account_currency - debit_in_account_currency"
|
||||
payment_dr_or_cr = "payment_gl_entry.debit_in_account_currency - payment_gl_entry.credit_in_account_currency"
|
||||
payment_dr_or_cr = "debit_in_account_currency - credit_in_account_currency"
|
||||
|
||||
invoice = 'Sales Invoice' if erpnext.get_party_account_type(party_type) == 'Receivable' else 'Purchase Invoice'
|
||||
held_invoices = get_held_invoices(party_type, party)
|
||||
limit_cond = "limit %s" % (limit or 1000)
|
||||
limit_cond = "limit %s" % limit if limit else ""
|
||||
|
||||
invoice_list = frappe.db.sql("""
|
||||
select
|
||||
voucher_no, voucher_type, posting_date, ifnull(sum({dr_or_cr}), 0) as invoice_amount,
|
||||
(
|
||||
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 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
|
||||
and {payment_dr_or_cr} > 0
|
||||
) as payment_amount
|
||||
voucher_no, voucher_type, posting_date, ifnull(sum({dr_or_cr}), 0) as invoice_amount
|
||||
from
|
||||
`tabGL Entry` invoice_gl_entry
|
||||
`tabGL Entry`
|
||||
where
|
||||
party_type = %(party_type)s and party = %(party)s
|
||||
and account = %(account)s and {dr_or_cr} > 0
|
||||
@@ -655,11 +643,9 @@ def get_outstanding_invoices(party_type, party, account, condition=None, limit=1
|
||||
and (against_voucher = '' or against_voucher is null))
|
||||
or (voucher_type not in ('Journal Entry', 'Payment Entry')))
|
||||
group by voucher_type, voucher_no
|
||||
having (invoice_amount - payment_amount) > 0.005
|
||||
order by posting_date, name {limit_cond}""".format(
|
||||
dr_or_cr=dr_or_cr,
|
||||
invoice = invoice,
|
||||
payment_dr_or_cr=payment_dr_or_cr,
|
||||
condition=condition or "",
|
||||
limit_cond = limit_cond
|
||||
), {
|
||||
@@ -668,25 +654,46 @@ def get_outstanding_invoices(party_type, party, account, condition=None, limit=1
|
||||
"account": account,
|
||||
}, as_dict=True)
|
||||
|
||||
for d in invoice_list:
|
||||
if not d.voucher_type == "Purchase Invoice" or d.voucher_no not in held_invoices:
|
||||
due_date = frappe.db.get_value(
|
||||
d.voucher_type, d.voucher_no, "posting_date" if party_type == "Employee" else "due_date")
|
||||
payment_entries = frappe.db.sql("""
|
||||
select against_voucher_type, against_voucher,
|
||||
ifnull(sum({payment_dr_or_cr}), 0) as payment_amount
|
||||
from `tabGL Entry`
|
||||
where party_type = %(party_type)s and party = %(party)s
|
||||
and account = %(account)s
|
||||
and {payment_dr_or_cr} > 0
|
||||
and against_voucher is not null and against_voucher != ''
|
||||
group by against_voucher_type, against_voucher
|
||||
""".format(payment_dr_or_cr=payment_dr_or_cr), {
|
||||
"party_type": party_type,
|
||||
"party": party,
|
||||
"account": account,
|
||||
}, as_dict=True)
|
||||
|
||||
outstanding_invoices.append(
|
||||
frappe._dict({
|
||||
'voucher_no': d.voucher_no,
|
||||
'voucher_type': d.voucher_type,
|
||||
'posting_date': d.posting_date,
|
||||
'invoice_amount': flt(d.invoice_amount),
|
||||
'payment_amount': flt(d.payment_amount),
|
||||
'outstanding_amount': flt(d.invoice_amount - d.payment_amount, precision),
|
||||
'due_date': due_date
|
||||
})
|
||||
)
|
||||
pe_map = frappe._dict()
|
||||
for d in payment_entries:
|
||||
pe_map.setdefault((d.against_voucher_type, d.against_voucher), d.payment_amount)
|
||||
|
||||
for d in invoice_list:
|
||||
payment_amount = pe_map.get((d.voucher_type, d.voucher_no), 0)
|
||||
outstanding_amount = flt(d.invoice_amount - payment_amount, precision)
|
||||
if outstanding_amount > 0.5 / (10**precision):
|
||||
if not d.voucher_type == "Purchase Invoice" or d.voucher_no not in held_invoices:
|
||||
due_date = frappe.db.get_value(
|
||||
d.voucher_type, d.voucher_no, "posting_date" if party_type == "Employee" else "due_date")
|
||||
|
||||
outstanding_invoices.append(
|
||||
frappe._dict({
|
||||
'voucher_no': d.voucher_no,
|
||||
'voucher_type': d.voucher_type,
|
||||
'posting_date': d.posting_date,
|
||||
'invoice_amount': flt(d.invoice_amount),
|
||||
'payment_amount': payment_amount,
|
||||
'outstanding_amount': outstanding_amount,
|
||||
'due_date': due_date
|
||||
})
|
||||
)
|
||||
|
||||
outstanding_invoices = sorted(outstanding_invoices, key=lambda k: k['due_date'] or getdate(nowdate()))
|
||||
|
||||
return outstanding_invoices
|
||||
|
||||
|
||||
@@ -859,5 +866,3 @@ def get_allow_cost_center_in_entry_of_bs_account():
|
||||
def generator():
|
||||
return cint(frappe.db.get_value('Accounts Settings', None, 'allow_cost_center_in_entry_of_bs_account'))
|
||||
return frappe.local_cache("get_allow_cost_center_in_entry_of_bs_account", (), generator, regenerate_if_none=True)
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -1812,8 +1812,9 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_from": "company.default_finance_book",
|
||||
"fieldname": "default_finance_book",
|
||||
"fieldtype": "Read Only",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
@@ -1824,12 +1825,12 @@
|
||||
"label": "Default Finance Book",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "company.default_finance_book",
|
||||
"options": "Finance Book",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -1882,7 +1883,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2019-01-15 16:12:48.314196",
|
||||
"modified": "2019-02-12 11:29:01.747819",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Assets",
|
||||
"name": "Asset",
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
def get_data():
|
||||
return {
|
||||
'fieldname': 'asset_name',
|
||||
|
||||
@@ -69,6 +69,17 @@ class TestAsset(unittest.TestCase):
|
||||
self.assertFalse(frappe.db.get_value("GL Entry",
|
||||
{"voucher_type": "Purchase Invoice", "voucher_no": pi.name}))
|
||||
|
||||
def test_is_fixed_asset_set(self):
|
||||
doc = frappe.new_doc('Purchase Invoice')
|
||||
doc.supplier = '_Test Supplier'
|
||||
doc.append('items', {
|
||||
'item_code': 'Macbook Pro',
|
||||
'qty': 1
|
||||
})
|
||||
|
||||
doc.set_missing_values()
|
||||
self.assertEquals(doc.items[0].is_fixed_asset, 1)
|
||||
|
||||
|
||||
def test_schedule_for_straight_line_method(self):
|
||||
pr = make_purchase_receipt(item_code="Macbook Pro",
|
||||
|
||||
@@ -456,7 +456,7 @@ def make_rm_stock_entry(purchase_order, rm_items):
|
||||
items_dict = {
|
||||
rm_item_code: {
|
||||
"item_name": rm_item_data["item_name"],
|
||||
"description": item_wh[rm_item_code].get('description'),
|
||||
"description": item_wh.get(rm_item_code, {}).get('description', ""),
|
||||
'qty': rm_item_data["qty"],
|
||||
'from_warehouse': rm_item_data["warehouse"],
|
||||
'stock_uom': rm_item_data["stock_uom"],
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -848,7 +848,7 @@
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"permlevel": 0,
|
||||
"precision": "2",
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"print_width": "100px",
|
||||
@@ -1786,7 +1786,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2019-01-07 16:52:02.125715",
|
||||
"modified": "2019-02-18 18:58:10.351451",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Supplier Quotation Item",
|
||||
|
||||
@@ -13,15 +13,23 @@ frappe.ui.form.on("Supplier Scorecard", {
|
||||
},
|
||||
onload: function(frm) {
|
||||
if (frm.doc.__unsaved == 1) {
|
||||
loadAllCriteria(frm);
|
||||
loadAllStandings(frm);
|
||||
}
|
||||
|
||||
},
|
||||
refresh: function(frm) {
|
||||
if (frm.dashboard.hasOwnProperty('heatmap')) {
|
||||
frm.dashboard.heatmap.setLegend([0,20,40,60,80,101],["#991600","#169900"]);
|
||||
}
|
||||
load_criteria: function(frm) {
|
||||
frappe.call({
|
||||
method: "erpnext.buying.doctype.supplier_scorecard_criteria.supplier_scorecard_criteria.get_criteria_list",
|
||||
callback: function(r) {
|
||||
frm.set_value('criteria', []);
|
||||
for (var i = 0; i < r.message.length; i++)
|
||||
{
|
||||
var row = frm.add_child("criteria");
|
||||
row.criteria_name = r.message[i].name;
|
||||
frm.script_manager.trigger("criteria_name", row.doctype, row.name);
|
||||
}
|
||||
refresh_field("criteria");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
@@ -29,8 +37,8 @@ frappe.ui.form.on("Supplier Scorecard", {
|
||||
frappe.ui.form.on("Supplier Scorecard Scoring Standing", {
|
||||
|
||||
standing_name: function(frm, cdt, cdn) {
|
||||
if (frm.doc.standing_name != undefined) {
|
||||
var d = frappe.get_doc(cdt, cdn);
|
||||
var d = frappe.get_doc(cdt, cdn);
|
||||
if (d.standing_name) {
|
||||
return frm.call({
|
||||
method: "erpnext.buying.doctype.supplier_scorecard_standing.supplier_scorecard_standing.get_scoring_standing",
|
||||
child: d,
|
||||
@@ -42,86 +50,29 @@ frappe.ui.form.on("Supplier Scorecard Scoring Standing", {
|
||||
}
|
||||
});
|
||||
|
||||
frappe.ui.form.on("Supplier Scorecard Scoring Variable", {
|
||||
|
||||
variable_label: function(frm, cdt, cdn) {
|
||||
if (frm.doc.variable_label != undefined) {
|
||||
var d = frappe.get_doc(cdt, cdn);
|
||||
return frm.call({
|
||||
method: "erpnext.buying.doctype.supplier_scorecard_variable.supplier_scorecard_variable.get_scoring_variable",
|
||||
child: d,
|
||||
args: {
|
||||
variable_label: d.variable_label
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
frappe.ui.form.on("Supplier Scorecard Scoring Criteria", {
|
||||
|
||||
criteria_name: function(frm, cdt, cdn) {
|
||||
if (frm.doc.criteria_name != undefined) {
|
||||
var d = frappe.get_doc(cdt, cdn);
|
||||
frm.call({
|
||||
method: "erpnext.buying.doctype.supplier_scorecard_criteria.supplier_scorecard_criteria.get_variables",
|
||||
var d = frappe.get_doc(cdt, cdn);
|
||||
if (d.criteria_name) {
|
||||
return frm.call({
|
||||
method: "frappe.client.get",
|
||||
args: {
|
||||
criteria_name: d.criteria_name
|
||||
fieldname: "weight",
|
||||
doctype: "Supplier Scorecard Criteria",
|
||||
filters: {name: d.criteria_name}
|
||||
},
|
||||
callback: function(r) {
|
||||
for (var i = 0; i < r.message.length; i++)
|
||||
{
|
||||
var exists = false;
|
||||
for (var j = 0; j < frm.doc.variables.length; j++)
|
||||
{
|
||||
if(!frm.doc.variables[j].hasOwnProperty("variable_label")) {
|
||||
frm.get_field("variables").grid.grid_rows[j].remove();
|
||||
}
|
||||
else if(frm.doc.variables[j].variable_label === r.message[i]) {
|
||||
exists = true;
|
||||
}
|
||||
}
|
||||
if (!exists){
|
||||
var new_row = frm.add_child("variables");
|
||||
new_row.variable_label = r.message[i];
|
||||
frm.script_manager.trigger("variable_label", new_row.doctype, new_row.name);
|
||||
}
|
||||
|
||||
if(r.message){
|
||||
d.weight = r.message.weight;
|
||||
frm.refresh_field('criteria', 'weight');
|
||||
}
|
||||
refresh_field("variables");
|
||||
}
|
||||
});
|
||||
return frm.call({
|
||||
method: "erpnext.buying.doctype.supplier_scorecard_criteria.supplier_scorecard_criteria.get_scoring_criteria",
|
||||
child: d,
|
||||
args: {
|
||||
criteria_name: d.criteria_name
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var loadAllCriteria = function(frm) {
|
||||
frappe.call({
|
||||
method: "erpnext.buying.doctype.supplier_scorecard_criteria.supplier_scorecard_criteria.get_criteria_list",
|
||||
callback: function(r) {
|
||||
for (var j = 0; j < frm.doc.criteria.length; j++)
|
||||
{
|
||||
if(!frm.doc.criteria[j].hasOwnProperty("criteria_name")) {
|
||||
frm.get_field("criteria").grid.grid_rows[j].remove();
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < r.message.length; i++)
|
||||
{
|
||||
var new_row = frm.add_child("criteria");
|
||||
new_row.criteria_name = r.message[i].name;
|
||||
frm.script_manager.trigger("criteria_name", new_row.doctype, new_row.name);
|
||||
}
|
||||
refresh_field("criteria");
|
||||
}
|
||||
});
|
||||
};
|
||||
var loadAllStandings = function(frm) {
|
||||
frappe.call({
|
||||
method: "erpnext.buying.doctype.supplier_scorecard_standing.supplier_scorecard_standing.get_standings_list",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -54,6 +54,7 @@ class SupplierScorecard(Document):
|
||||
`tabSupplier Scorecard Period` scp
|
||||
WHERE
|
||||
scp.scorecard = %(sc)s
|
||||
AND scp.docstatus = 1
|
||||
ORDER BY
|
||||
scp.end_date DESC""",
|
||||
{"sc": self.name}, as_dict=1)
|
||||
@@ -110,7 +111,8 @@ def get_timeline_data(doctype, name):
|
||||
FROM
|
||||
`tabSupplier Scorecard Period` sc
|
||||
WHERE
|
||||
sc.scorecard = %(scs)s""",
|
||||
sc.scorecard = %(scs)s
|
||||
AND sc.docstatus = 1""",
|
||||
{"scs": scs.name}, as_dict=1)
|
||||
|
||||
for sc in scorecards:
|
||||
@@ -162,6 +164,7 @@ def make_all_scorecards(docname):
|
||||
`tabSupplier Scorecard Period` scp
|
||||
WHERE
|
||||
scp.scorecard = %(sc)s
|
||||
AND scp.docstatus = 1
|
||||
AND (
|
||||
(scp.start_date > %(end_date)s
|
||||
AND scp.end_date < %(start_date)s)
|
||||
@@ -170,12 +173,12 @@ def make_all_scorecards(docname):
|
||||
AND scp.end_date > %(start_date)s))
|
||||
ORDER BY
|
||||
scp.end_date DESC""",
|
||||
{"sc": docname, "start_date": start_date, "end_date": end_date, "supplier": supplier}, as_dict=1)
|
||||
{"sc": docname, "start_date": start_date, "end_date": end_date}, as_dict=1)
|
||||
if len(scorecards) == 0:
|
||||
period_card = make_supplier_scorecard(docname, None)
|
||||
period_card.start_date = start_date
|
||||
period_card.end_date = end_date
|
||||
period_card.save()
|
||||
period_card.submit()
|
||||
scp_count = scp_count + 1
|
||||
if start_date < first_start_date:
|
||||
first_start_date = start_date
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -21,12 +21,6 @@ class TestSupplierScorecard(unittest.TestCase):
|
||||
d.weight = 0
|
||||
self.assertRaises(frappe.ValidationError,my_doc.insert)
|
||||
|
||||
def test_missing_variable(self):
|
||||
delete_test_scorecards()
|
||||
my_doc = make_supplier_scorecard()
|
||||
del my_doc.variables
|
||||
self.assertRaises(frappe.ValidationError,my_doc.insert)
|
||||
|
||||
def make_supplier_scorecard():
|
||||
my_doc = frappe.get_doc(valid_scorecard[0])
|
||||
|
||||
@@ -118,56 +112,6 @@ valid_scorecard = [
|
||||
}
|
||||
],
|
||||
"prevent_pos":0,
|
||||
"variables": [
|
||||
{
|
||||
"param_name":"cost_of_on_time_shipments",
|
||||
"doctype":"Supplier Scorecard Scoring Variable",
|
||||
"parenttype":"Supplier Scorecard",
|
||||
"variable_label":"Cost of On Time Shipments",
|
||||
"path":"get_cost_of_on_time_shipments",
|
||||
"parentfield":"variables"
|
||||
},
|
||||
{
|
||||
"param_name":"tot_cost_shipments",
|
||||
"doctype":"Supplier Scorecard Scoring Variable",
|
||||
"parenttype":"Supplier Scorecard",
|
||||
"variable_label":"Total Cost of Shipments",
|
||||
"path":"get_total_cost_of_shipments",
|
||||
"parentfield":"variables"
|
||||
},
|
||||
{
|
||||
"param_name":"tot_days_late",
|
||||
"doctype":"Supplier Scorecard Scoring Variable",
|
||||
"parenttype":"Supplier Scorecard",
|
||||
"variable_label":"Total Days Late",
|
||||
"path":"get_total_days_late",
|
||||
"parentfield":"variables"
|
||||
},
|
||||
{
|
||||
"param_name":"total_working_days",
|
||||
"doctype":"Supplier Scorecard Scoring Variable",
|
||||
"parenttype":"Supplier Scorecard",
|
||||
"variable_label":"Total Working Days",
|
||||
"path":"get_total_workdays",
|
||||
"parentfield":"variables"
|
||||
},
|
||||
{
|
||||
"param_name":"on_time_shipment_num",
|
||||
"doctype":"Supplier Scorecard Scoring Variable",
|
||||
"parenttype":"Supplier Scorecard",
|
||||
"variable_label":"# of On Time Shipments",
|
||||
"path":"get_on_time_shipments",
|
||||
"parentfield":"variables"
|
||||
},
|
||||
{
|
||||
"param_name":"total_shipments",
|
||||
"doctype":"Supplier Scorecard Scoring Variable",
|
||||
"parenttype":"Supplier Scorecard",
|
||||
"variable_label":"Total Shipments",
|
||||
"path":"get_total_shipments",
|
||||
"parentfield":"variables"
|
||||
}
|
||||
],
|
||||
"period":"Per Month",
|
||||
"doctype":"Supplier Scorecard",
|
||||
"warn_pos":0,
|
||||
@@ -177,14 +121,12 @@ valid_scorecard = [
|
||||
{
|
||||
"weight":100.0,
|
||||
"doctype":"Supplier Scorecard Scoring Criteria",
|
||||
"formula":"(({cost_of_on_time_shipments} / {tot_cost_shipments}) if {tot_cost_shipments} > 0 else 1 )* 100 ",
|
||||
"criteria_name":"Delivery",
|
||||
"max_score":100.0,
|
||||
"criteria_name":"Delivery"
|
||||
}
|
||||
],
|
||||
"supplier":"_Test Supplier",
|
||||
"name":"_Test Supplier",
|
||||
"weighting_function":"{total_score} * max( 0, min ( 1 , (12 - {period_number}) / 12) )",
|
||||
"weighting_function":"{total_score} * max( 0, min ( 1 , (12 - {period_number}) / 12) )"
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"autoname": "field:criteria_name",
|
||||
"beta": 1,
|
||||
"beta": 0,
|
||||
"creation": "2017-05-29 01:32:43.064891",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
@@ -43,36 +43,6 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "weight",
|
||||
"fieldtype": "Percent",
|
||||
"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": "Criteria Weight",
|
||||
"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": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@@ -87,7 +57,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": "Max Score",
|
||||
"length": 0,
|
||||
@@ -114,10 +84,10 @@
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"ignore_xss_filter": 1,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Criteria Formula",
|
||||
"length": 0,
|
||||
@@ -133,6 +103,36 @@
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "weight",
|
||||
"fieldtype": "Percent",
|
||||
"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": "Criteria Weight",
|
||||
"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
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
@@ -145,7 +145,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-07-17 10:30:47.458285",
|
||||
"modified": "2019-01-22 10:47:00.000822",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Supplier Scorecard Criteria",
|
||||
|
||||
@@ -30,21 +30,11 @@ class SupplierScorecardCriteria(Document):
|
||||
for dummy2 in range(0, len(match.groups())):
|
||||
test_formula = test_formula.replace('{' + match.group(1) + '}', "0")
|
||||
|
||||
test_formula = test_formula.replace('<','<').replace('>','>')
|
||||
try:
|
||||
frappe.safe_eval(test_formula, None, {'max':max, 'min': min})
|
||||
except Exception:
|
||||
frappe.throw(_("Error evaluating the criteria formula"))
|
||||
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_scoring_criteria(criteria_name):
|
||||
criteria = frappe.get_doc("Supplier Scorecard Criteria", criteria_name)
|
||||
|
||||
return criteria
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_criteria_list():
|
||||
criteria = frappe.db.sql("""
|
||||
@@ -56,7 +46,6 @@ def get_criteria_list():
|
||||
|
||||
return criteria
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_variables(criteria_name):
|
||||
criteria = frappe.get_doc("Supplier Scorecard Criteria", criteria_name)
|
||||
return _get_variables(criteria)
|
||||
@@ -69,21 +58,16 @@ def _get_variables(criteria):
|
||||
for dummy1, match in enumerate(mylist):
|
||||
for dummy2 in range(0, len(match.groups())):
|
||||
try:
|
||||
#var = frappe.get_doc("Supplier Scorecard Variable", {'param_name' : d})
|
||||
var = frappe.db.sql("""
|
||||
SELECT
|
||||
scv.name
|
||||
scv.variable_label, scv.description, scv.param_name, scv.path
|
||||
FROM
|
||||
`tabSupplier Scorecard Variable` scv
|
||||
WHERE
|
||||
param_name=%(param)s""",
|
||||
{'param':match.group(1)},)[0][0]
|
||||
{'param':match.group(1)}, as_dict=1)[0]
|
||||
my_variables.append(var)
|
||||
except Exception:
|
||||
# Ignore the ones where the variable can't be found
|
||||
frappe.throw(_('Unable to find variable: ') + str(match.group(1)), InvalidFormulaVariable)
|
||||
#pass
|
||||
|
||||
|
||||
#frappe.msgprint(str(my_variables))
|
||||
return my_variables
|
||||
|
||||
@@ -6,9 +6,11 @@
|
||||
|
||||
frappe.ui.form.on("Supplier Scorecard Period", {
|
||||
onload: function(frm) {
|
||||
frm.get_field("variables").grid.toggle_display("value", true);
|
||||
frm.get_field("criteria").grid.toggle_display("score", true);
|
||||
|
||||
|
||||
let criteria_grid = frm.get_field("criteria").grid;
|
||||
criteria_grid.toggle_enable("criteria_name", false);
|
||||
criteria_grid.toggle_enable("weight", false);
|
||||
criteria_grid.toggle_display("max_score", true);
|
||||
criteria_grid.toggle_display("formula", true);
|
||||
criteria_grid.toggle_display("score", true);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,420 +1,450 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"autoname": "naming_series:",
|
||||
"beta": 1,
|
||||
"creation": "2017-05-30 00:38:18.773013",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"autoname": "naming_series:",
|
||||
"beta": 0,
|
||||
"creation": "2017-05-30 00:38:18.773013",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"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,
|
||||
"precision": "",
|
||||
"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,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"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,
|
||||
"precision": "",
|
||||
"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,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "",
|
||||
"fieldname": "naming_series",
|
||||
"fieldtype": "Select",
|
||||
"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": "Naming Series",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "PU-SSP-.YYYY.-",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"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,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "",
|
||||
"fieldname": "naming_series",
|
||||
"fieldtype": "Select",
|
||||
"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": "Naming Series",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "PU-SSP-.YYYY.-",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"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,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "total_score",
|
||||
"fieldtype": "Percent",
|
||||
"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": "Period Score",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"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,
|
||||
"translatable": 0,
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "total_score",
|
||||
"fieldtype": "Percent",
|
||||
"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": "Period Score",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"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,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_2",
|
||||
"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,
|
||||
"translatable": 0,
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_2",
|
||||
"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,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "start_date",
|
||||
"fieldtype": "Date",
|
||||
"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": "Start Date",
|
||||
"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": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "start_date",
|
||||
"fieldtype": "Date",
|
||||
"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": "Start Date",
|
||||
"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": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "end_date",
|
||||
"fieldtype": "Date",
|
||||
"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": "End Date",
|
||||
"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": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "end_date",
|
||||
"fieldtype": "Date",
|
||||
"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": "End Date",
|
||||
"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": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 1,
|
||||
"columns": 0,
|
||||
"fieldname": "section_break_11",
|
||||
"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": "Calculations",
|
||||
"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,
|
||||
"translatable": 0,
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 1,
|
||||
"columns": 0,
|
||||
"fieldname": "section_break_11",
|
||||
"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": "Calculations",
|
||||
"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,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "criteria",
|
||||
"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": "Criteria",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Supplier Scorecard Scoring Criteria",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"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,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "criteria",
|
||||
"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": "Criteria",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Supplier Scorecard Scoring Criteria",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"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,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "variables",
|
||||
"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": "Variables",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Supplier Scorecard Scoring Variable",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"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,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "variables",
|
||||
"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": "Variables",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Supplier Scorecard Scoring Variable",
|
||||
"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,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 1,
|
||||
"columns": 0,
|
||||
"fieldname": "sec_ref",
|
||||
"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": "Reference",
|
||||
"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,
|
||||
"translatable": 0,
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 1,
|
||||
"columns": 0,
|
||||
"fieldname": "sec_ref",
|
||||
"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": "Reference",
|
||||
"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,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "scorecard",
|
||||
"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": "Supplier Scorecard Setup",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Supplier Scorecard",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"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,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "scorecard",
|
||||
"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": "Supplier Scorecard Setup",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Supplier Scorecard",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"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,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "amended_from",
|
||||
"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": "Amended From",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"options": "Supplier Scorecard Period",
|
||||
"permlevel": 0,
|
||||
"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
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 1,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2018-08-21 14:44:36.438832",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Supplier Scorecard Period",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 1,
|
||||
"is_submittable": 1,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2019-01-23 13:58:26.137770",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Supplier Scorecard Period",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 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": "System Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"amend": 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": "System Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 0,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 0,
|
||||
"track_seen": 0,
|
||||
],
|
||||
"quick_entry": 0,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 0,
|
||||
"track_seen": 0,
|
||||
"track_views": 0
|
||||
}
|
||||
@@ -8,6 +8,7 @@ from frappe import throw, _
|
||||
from frappe.model.document import Document
|
||||
from frappe.model.mapper import get_mapped_doc
|
||||
import erpnext.buying.doctype.supplier_scorecard_variable.supplier_scorecard_variable as variable_functions
|
||||
from erpnext.buying.doctype.supplier_scorecard_criteria.supplier_scorecard_criteria import get_variables
|
||||
|
||||
class SupplierScorecardPeriod(Document):
|
||||
|
||||
@@ -28,7 +29,6 @@ class SupplierScorecardPeriod(Document):
|
||||
|
||||
def calculate_variables(self):
|
||||
for var in self.variables:
|
||||
|
||||
if '.' in var.path:
|
||||
method_to_call = import_string_path(var.path)
|
||||
var.value = method_to_call(self)
|
||||
@@ -39,29 +39,9 @@ class SupplierScorecardPeriod(Document):
|
||||
|
||||
|
||||
def calculate_criteria(self):
|
||||
#Get the criteria
|
||||
for crit in self.criteria:
|
||||
|
||||
#me = ""
|
||||
my_eval_statement = crit.formula.replace("\r", "").replace("\n", "")
|
||||
#for let in my_eval_statement:
|
||||
# me += let.encode('hex') + " "
|
||||
#frappe.msgprint(me)
|
||||
|
||||
for var in self.variables:
|
||||
if var.value:
|
||||
if var.param_name in my_eval_statement:
|
||||
my_eval_statement = my_eval_statement.replace('{' + var.param_name + '}', "{:.2f}".format(var.value))
|
||||
else:
|
||||
if var.param_name in my_eval_statement:
|
||||
my_eval_statement = my_eval_statement.replace('{' + var.param_name + '}', '0.0')
|
||||
|
||||
#frappe.msgprint(my_eval_statement )
|
||||
|
||||
my_eval_statement = my_eval_statement.replace('<','<').replace('>','>')
|
||||
|
||||
try:
|
||||
crit.score = min(crit.max_score, max( 0 ,frappe.safe_eval(my_eval_statement, None, {'max':max, 'min': min})))
|
||||
crit.score = min(crit.max_score, max( 0 ,frappe.safe_eval(self.get_eval_statement(crit.formula), None, {'max':max, 'min': min})))
|
||||
except Exception:
|
||||
frappe.throw(_("Could not solve criteria score function for {0}. Make sure the formula is valid.".format(crit.criteria_name)),frappe.ValidationError)
|
||||
crit.score = 0
|
||||
@@ -73,26 +53,27 @@ class SupplierScorecardPeriod(Document):
|
||||
self.total_score = myscore
|
||||
|
||||
def calculate_weighted_score(self, weighing_function):
|
||||
my_eval_statement = weighing_function.replace("\r", "").replace("\n", "")
|
||||
|
||||
for var in self.variables:
|
||||
if var.value:
|
||||
if var.param_name in my_eval_statement:
|
||||
my_eval_statement = my_eval_statement.replace('{' + var.param_name + '}', "{:.2f}".format(var.value))
|
||||
else:
|
||||
if var.param_name in my_eval_statement:
|
||||
my_eval_statement = my_eval_statement.replace('{' + var.param_name + '}', '0.0')
|
||||
|
||||
my_eval_statement = my_eval_statement.replace('<','<').replace('>','>')
|
||||
|
||||
try:
|
||||
weighed_score = frappe.safe_eval(my_eval_statement, None, {'max':max, 'min': min})
|
||||
weighed_score = frappe.safe_eval(self.get_eval_statement(weighing_function), None, {'max':max, 'min': min})
|
||||
except Exception:
|
||||
frappe.throw(_("Could not solve weighted score function. Make sure the formula is valid."),frappe.ValidationError)
|
||||
weighed_score = 0
|
||||
return weighed_score
|
||||
|
||||
|
||||
def get_eval_statement(self, formula):
|
||||
my_eval_statement = formula.replace("\r", "").replace("\n", "")
|
||||
|
||||
for var in self.variables:
|
||||
if var.value:
|
||||
if var.param_name in my_eval_statement:
|
||||
my_eval_statement = my_eval_statement.replace('{' + var.param_name + '}', "{:.2f}".format(var.value))
|
||||
else:
|
||||
if var.param_name in my_eval_statement:
|
||||
my_eval_statement = my_eval_statement.replace('{' + var.param_name + '}', '0.0')
|
||||
|
||||
return my_eval_statement
|
||||
|
||||
|
||||
def import_string_path(path):
|
||||
components = path.split('.')
|
||||
@@ -102,30 +83,28 @@ def import_string_path(path):
|
||||
return mod
|
||||
|
||||
|
||||
def post_process(source, target):
|
||||
pass
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_supplier_scorecard(source_name, target_doc=None):
|
||||
#def update_item(obj, target, source_parent):
|
||||
# target.qty = flt(obj.qty) - flt(obj.received_qty)
|
||||
# target.stock_qty = (flt(obj.qty) - flt(obj.received_qty)) * flt(obj.conversion_factor)
|
||||
# target.amount = (flt(obj.qty) - flt(obj.received_qty)) * flt(obj.rate)
|
||||
# target.base_amount = (flt(obj.qty) - flt(obj.received_qty)) * \
|
||||
# flt(obj.rate) * flt(source_parent.conversion_rate)
|
||||
def update_criteria_fields(obj, target, source_parent):
|
||||
target.max_score, target.formula = frappe.db.get_value('Supplier Scorecard Criteria',
|
||||
obj.criteria_name, ['max_score', 'formula'])
|
||||
|
||||
def post_process(source, target):
|
||||
variables = []
|
||||
for cr in target.criteria:
|
||||
for var in get_variables(cr.criteria_name):
|
||||
if var not in variables:
|
||||
variables.append(var)
|
||||
|
||||
target.extend('variables', variables)
|
||||
|
||||
doc = get_mapped_doc("Supplier Scorecard", source_name, {
|
||||
"Supplier Scorecard": {
|
||||
"doctype": "Supplier Scorecard Period"
|
||||
},
|
||||
"Supplier Scorecard Scoring Variable": {
|
||||
"doctype": "Supplier Scorecard Scoring Variable",
|
||||
"add_if_empty": True
|
||||
},
|
||||
"Supplier Scorecard Scoring Constraint": {
|
||||
"doctype": "Supplier Scorecard Scoring Constraint",
|
||||
"add_if_empty": True
|
||||
"Supplier Scorecard Scoring Criteria": {
|
||||
"doctype": "Supplier Scorecard Scoring Criteria",
|
||||
"postprocess": update_criteria_fields,
|
||||
}
|
||||
}, target_doc, post_process)
|
||||
|
||||
|
||||
@@ -1,280 +1,252 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 1,
|
||||
"creation": "2017-05-29 01:32:17.988454",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 0,
|
||||
"creation": "2017-05-29 01:32:17.988454",
|
||||
"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": 3,
|
||||
"fieldname": "criteria_name",
|
||||
"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": "Criteria Name",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Supplier Scorecard Criteria",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"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,
|
||||
"set_only_once": 0,
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 5,
|
||||
"fieldname": "criteria_name",
|
||||
"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": "Criteria Name",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Supplier Scorecard Criteria",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"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,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "section_break_2",
|
||||
"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,
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 2,
|
||||
"fieldname": "score",
|
||||
"fieldtype": "Percent",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Score",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"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": 2,
|
||||
"fieldname": "weight",
|
||||
"fieldtype": "Percent",
|
||||
"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": "Criteria Weight",
|
||||
"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": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 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": "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,
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 2,
|
||||
"fieldname": "weight",
|
||||
"fieldtype": "Percent",
|
||||
"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": "Criteria Weight",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"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,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "100",
|
||||
"fieldname": "max_score",
|
||||
"fieldtype": "Float",
|
||||
"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": "Max Score",
|
||||
"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,
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "100",
|
||||
"fieldname": "max_score",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Max Score",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"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": "section_break_6",
|
||||
"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,
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "section_break_6",
|
||||
"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,
|
||||
"fieldname": "formula",
|
||||
"fieldtype": "Small 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": "Criteria Formula",
|
||||
"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": 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": "score",
|
||||
"fieldtype": "Percent",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Score",
|
||||
"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,
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "formula",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 1,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Criteria Formula",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"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-07-12 07:33:41.532361",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Supplier Scorecard Scoring Criteria",
|
||||
"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,
|
||||
],
|
||||
"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": "2019-01-23 13:49:13.350095",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Supplier Scorecard Scoring Criteria",
|
||||
"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
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 1,
|
||||
"beta": 0,
|
||||
"creation": "2017-05-29 01:36:22.697234",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
@@ -473,7 +473,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-07-12 07:33:20.615684",
|
||||
"modified": "2019-01-22 10:47:41.146704",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Supplier Scorecard Scoring Standing",
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 1,
|
||||
"beta": 0,
|
||||
"creation": "2017-05-29 01:30:06.105240",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
@@ -35,7 +35,7 @@
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
@@ -65,7 +65,37 @@
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 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": 2,
|
||||
"fieldname": "value",
|
||||
"fieldtype": "Float",
|
||||
"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": "Value",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"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,
|
||||
@@ -73,36 +103,6 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "is_custom",
|
||||
"fieldtype": "Check",
|
||||
"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": "Custom?",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"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,
|
||||
@@ -111,7 +111,7 @@
|
||||
"columns": 0,
|
||||
"fieldname": "param_name",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
@@ -128,7 +128,7 @@
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
@@ -141,7 +141,7 @@
|
||||
"columns": 0,
|
||||
"fieldname": "path",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
@@ -158,36 +158,6 @@
|
||||
"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": 2,
|
||||
"fieldname": "value",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Value",
|
||||
"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,
|
||||
@@ -204,7 +174,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-07-12 07:33:36.671502",
|
||||
"modified": "2019-01-23 09:55:19.749828",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Supplier Scorecard Scoring Variable",
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"autoname": "field:standing_name",
|
||||
"beta": 1,
|
||||
"beta": 0,
|
||||
"creation": "2017-05-29 01:36:47.893639",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
@@ -385,7 +385,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-07-12 07:33:16.560273",
|
||||
"modified": "2019-01-22 10:47:49.195421",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Supplier Scorecard Standing",
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"autoname": "field:variable_label",
|
||||
"beta": 1,
|
||||
"beta": 0,
|
||||
"creation": "2017-05-29 01:30:34.688389",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
@@ -101,7 +101,7 @@
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
"unique": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
@@ -203,7 +203,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-07-12 07:33:31.395262",
|
||||
"modified": "2019-01-23 09:39:59.866398",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Supplier Scorecard Variable",
|
||||
|
||||
@@ -27,13 +27,6 @@ class SupplierScorecardVariable(Document):
|
||||
if not hasattr(sys.modules[__name__], self.path):
|
||||
frappe.throw(_("Could not find path for " + self.path), VariablePathNotFound)
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_scoring_variable(variable_label):
|
||||
variable = frappe.get_doc("Supplier Scorecard Variable", variable_label)
|
||||
|
||||
return variable
|
||||
|
||||
def get_total_workdays(scorecard):
|
||||
""" Gets the number of days in this period"""
|
||||
delta = getdate(scorecard.end_date) - getdate(scorecard.start_date)
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
{
|
||||
"add_total_row": 0,
|
||||
"add_total_row": 1,
|
||||
"creation": "2018-10-05 16:08:24.156448",
|
||||
"disable_prepared_report": 0,
|
||||
"disabled": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "Report",
|
||||
"idx": 0,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2018-10-05 16:08:33.272201",
|
||||
"modified": "2019-02-12 14:32:29.107109",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Purchase Analytics",
|
||||
|
||||
80
erpnext/change_log/v11/v11_1_0.md
Normal file
80
erpnext/change_log/v11/v11_1_0.md
Normal file
@@ -0,0 +1,80 @@
|
||||
- Enhancements
|
||||
|
||||
- Accounting
|
||||
|
||||
- Company Tree
|
||||
- Multiple Finance Books
|
||||
- Bank Statement Upload
|
||||
- Tax Withholding
|
||||
- Subscriptions
|
||||
- Deferred Revenue and Expenses
|
||||
- Exchange Rate Revaluation
|
||||
- Inter Company Transactions
|
||||
- Standalone Credit / Debit Note
|
||||
- Reverse Journal Entry
|
||||
- Enhanced Bank Guarantee
|
||||
- Cost Center Numbering
|
||||
- Loyalty Points Management
|
||||
- Enhanced General ledger report
|
||||
|
||||
- Human Resources
|
||||
|
||||
- Department Hierarchy
|
||||
- Leave Management
|
||||
- Leave Period
|
||||
- New Leave Types
|
||||
- Leave Encashment
|
||||
- Compensatory Leave
|
||||
- Attendance Request
|
||||
- Enhanced Payroll
|
||||
- New Salary Structure
|
||||
- Additional Salary
|
||||
- Payroll Period
|
||||
- Employee Benefits
|
||||
- Employee Tax Exemptions
|
||||
- Auto Calculation of Tax Deduction
|
||||
- Enhanced Salary Processing
|
||||
- Employee Onboarding
|
||||
- Employee Separation
|
||||
- Employee Transfer
|
||||
- Employee Promotion
|
||||
- Employee Incentive
|
||||
- Retention Bonus
|
||||
- Shift Planning
|
||||
- Staffing Plan
|
||||
|
||||
- Asset Management
|
||||
|
||||
- Capital-Work-in-Progress (CWIP) Accounting
|
||||
- Multiple depreciation schedule based on finance book
|
||||
- Asset Value Adjustment
|
||||
- Improved Asset Movement between location or employee
|
||||
- New Depreciation method Written Down Value (WDV)
|
||||
|
||||
- POS
|
||||
|
||||
- Allow draft mode print in online POS
|
||||
- Allowed print before pay
|
||||
- Save the invoice before print
|
||||
|
||||
- Other Features
|
||||
|
||||
- A free marketplace where any ERPNext user can list their products and be discovered by thousands of other companies using ERPNext
|
||||
- Add/Update quantity in Sales & Purchase Order without amending document
|
||||
- Enhanced Item Price (Based on UOM, Party, Min. Qty, etc.)
|
||||
- Shareholder Management
|
||||
- Production Plan and Job Card
|
||||
- Delivery Trip
|
||||
- Updated Timesheets
|
||||
- Lead Notes
|
||||
- Better Sales / Purchase / Stock Analytics report
|
||||
- Currency exchange API is changed to frankfurter public domain
|
||||
|
||||
- GST (India)
|
||||
- Auto selection of GST tax template based on company and shipping address
|
||||
- GSTR-1 based on the address
|
||||
- HSN-wise summary of outwards supplies
|
||||
|
||||
- Changes have been made to ensure ERPNext is compatible with Python 3
|
||||
- Better documentation is now available with support for more languages
|
||||
- A lot of other fixes have been done to ensure a better overall user experience
|
||||
@@ -1 +1 @@
|
||||
- [ERPNext Manual in German](http://erpnext.org/docs/user/manual/de/) contributed by [CWT Connector & Wire Technology GmbH](http://www.cwt-assembly.com/)
|
||||
- [ERPNext Manual in German](http://erpnext.com/docs/user/manual/de/) contributed by [CWT Connector & Wire Technology GmbH](http://www.cwt-assembly.com/)
|
||||
|
||||
@@ -365,6 +365,36 @@ def get_data():
|
||||
"is_query_report": True,
|
||||
"doctype": "Sales Invoice"
|
||||
},
|
||||
{
|
||||
"type": "report",
|
||||
"name": "Item-wise Sales Register",
|
||||
"is_query_report": True,
|
||||
"doctype": "Sales Invoice"
|
||||
},
|
||||
{
|
||||
"type": "report",
|
||||
"name": "Item-wise Purchase Register",
|
||||
"is_query_report": True,
|
||||
"doctype": "Purchase Invoice"
|
||||
},
|
||||
{
|
||||
"type": "report",
|
||||
"name": "Profitability Analysis",
|
||||
"doctype": "GL Entry",
|
||||
"is_query_report": True,
|
||||
},
|
||||
{
|
||||
"type": "report",
|
||||
"name": "Customer Ledger Summary",
|
||||
"doctype": "Sales Invoice",
|
||||
"is_query_report": True,
|
||||
},
|
||||
{
|
||||
"type": "report",
|
||||
"name": "Supplier Ledger Summary",
|
||||
"doctype": "Sales Invoice",
|
||||
"is_query_report": True,
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -377,12 +407,6 @@ def get_data():
|
||||
"doctype": "GL Entry",
|
||||
"is_query_report": True,
|
||||
},
|
||||
{
|
||||
"type": "report",
|
||||
"name": "Profitability Analysis",
|
||||
"doctype": "GL Entry",
|
||||
"is_query_report": True,
|
||||
},
|
||||
{
|
||||
"type": "report",
|
||||
"name": "Payment Period Based On Invoice Date",
|
||||
@@ -395,18 +419,6 @@ def get_data():
|
||||
"is_query_report": True,
|
||||
"doctype": "Sales Invoice"
|
||||
},
|
||||
{
|
||||
"type": "report",
|
||||
"name": "Item-wise Sales Register",
|
||||
"is_query_report": True,
|
||||
"doctype": "Sales Invoice"
|
||||
},
|
||||
{
|
||||
"type": "report",
|
||||
"name": "Item-wise Purchase Register",
|
||||
"is_query_report": True,
|
||||
"doctype": "Purchase Invoice"
|
||||
},
|
||||
{
|
||||
"type": "report",
|
||||
"name": "Accounts Receivable Summary",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -94,6 +94,8 @@ class AccountsController(TransactionBase):
|
||||
if self.is_return:
|
||||
self.validate_qty()
|
||||
|
||||
validate_regional(self)
|
||||
|
||||
def validate_invoice_documents_schedule(self):
|
||||
self.validate_payment_schedule_dates()
|
||||
self.set_due_date()
|
||||
@@ -264,6 +266,9 @@ class AccountsController(TransactionBase):
|
||||
if item_qty != len(get_serial_nos(item.get('serial_no'))):
|
||||
item.set(fieldname, value)
|
||||
|
||||
if self.doctype in ["Purchase Invoice", "Sales Invoice"] and item.meta.get_field('is_fixed_asset'):
|
||||
item.set('is_fixed_asset', ret.get('is_fixed_asset', 0))
|
||||
|
||||
if ret.get("pricing_rule"):
|
||||
# if user changed the discount percentage then set user's discount percentage ?
|
||||
item.set("pricing_rule", ret.get("pricing_rule"))
|
||||
@@ -1129,3 +1134,15 @@ def update_child_qty_rate(parent_doctype, trans_items, parent_doctype_name):
|
||||
p_doctype.update_blanket_order()
|
||||
p_doctype.update_billing_percentage()
|
||||
p_doctype.set_status()
|
||||
|
||||
@erpnext.allow_regional
|
||||
def validate_regional(doc):
|
||||
pass
|
||||
|
||||
@erpnext.allow_regional
|
||||
def on_submit_regional(doc):
|
||||
pass
|
||||
|
||||
@erpnext.allow_regional
|
||||
def on_cancel_regional(doc):
|
||||
pass
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe, json
|
||||
from frappe.utils.make_random import get_random
|
||||
@@ -162,7 +163,7 @@ def make_assessment_groups():
|
||||
|
||||
def get_json_path(doctype):
|
||||
return frappe.get_app_path('erpnext', 'demo', 'data', frappe.scrub(doctype) + '.json')
|
||||
|
||||
|
||||
def weighted_choice(weights):
|
||||
totals = []
|
||||
running_total = 0
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe, json
|
||||
from frappe.utils.make_random import get_random
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
data = {
|
||||
'desktop_icons': [
|
||||
'Agriculture Task',
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
data = {
|
||||
'desktop_icons': [
|
||||
'Item',
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
data = {
|
||||
'desktop_icons': [
|
||||
'Student',
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
data = {
|
||||
'desktop_icons': [
|
||||
'Patient',
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
data = {
|
||||
'desktop_icons': [
|
||||
'Restaurant',
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
data = {
|
||||
'desktop_icons': [
|
||||
'Item',
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
data = {
|
||||
'desktop_icons': [
|
||||
'Non Profit',
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
data = {
|
||||
'desktop_icons': [
|
||||
'POS',
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
data = {
|
||||
'desktop_icons': [
|
||||
'Project',
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user