Merge branch 'develop' into education-dashboard

This commit is contained in:
Rucha Mahabal
2020-08-05 16:28:14 +05:30
committed by GitHub
51 changed files with 489 additions and 986 deletions

View File

@@ -225,7 +225,7 @@ def build_tree_from_json(chart_template, chart_data=None):
account['parent_account'] = parent account['parent_account'] = parent
account['expandable'] = True if identify_is_group(child) else False account['expandable'] = True if identify_is_group(child) else False
account['value'] = (child.get('account_number') + ' - ' + account_name) \ account['value'] = (cstr(child.get('account_number')).strip() + ' - ' + account_name) \
if child.get('account_number') else account_name if child.get('account_number') else account_name
accounts.append(account) accounts.append(account)
_import_accounts(child, account['value']) _import_accounts(child, account['value'])

View File

@@ -225,7 +225,7 @@
"idx": 1, "idx": 1,
"issingle": 1, "issingle": 1,
"links": [], "links": [],
"modified": "2020-06-22 20:13:26.043092", "modified": "2020-08-03 20:13:26.043092",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Accounts Settings", "name": "Accounts Settings",

View File

@@ -60,12 +60,12 @@ class BankClearance(Document):
""".format(condition=condition), {"account": self.account, "from":self.from_date, """.format(condition=condition), {"account": self.account, "from":self.from_date,
"to": self.to_date, "bank_account": self.bank_account}, as_dict=1) "to": self.to_date, "bank_account": self.bank_account}, as_dict=1)
pos_entries = [] pos_sales_invoices, pos_purchase_invoices = [], []
if self.include_pos_transactions: if self.include_pos_transactions:
pos_entries = frappe.db.sql(""" pos_sales_invoices = frappe.db.sql("""
select select
"Sales Invoice Payment" as payment_document, sip.name as payment_entry, sip.amount as debit, "Sales Invoice Payment" as payment_document, sip.name as payment_entry, sip.amount as debit,
si.posting_date, si.debit_to as against_account, sip.clearance_date, si.posting_date, si.customer as against_account, sip.clearance_date,
account.account_currency, 0 as credit account.account_currency, 0 as credit
from `tabSales Invoice Payment` sip, `tabSales Invoice` si, `tabAccount` account from `tabSales Invoice Payment` sip, `tabSales Invoice` si, `tabAccount` account
where where
@@ -75,7 +75,20 @@ class BankClearance(Document):
si.posting_date ASC, si.name DESC si.posting_date ASC, si.name DESC
""", {"account":self.account, "from":self.from_date, "to":self.to_date}, as_dict=1) """, {"account":self.account, "from":self.from_date, "to":self.to_date}, as_dict=1)
entries = sorted(list(payment_entries)+list(journal_entries+list(pos_entries)), pos_purchase_invoices = frappe.db.sql("""
select
"Purchase Invoice" as payment_document, pi.name as payment_entry, pi.paid_amount as credit,
pi.posting_date, pi.supplier as against_account, pi.clearance_date,
account.account_currency, 0 as debit
from `tabPurchase Invoice` pi, `tabAccount` account
where
pi.cash_bank_account=%(account)s and pi.docstatus=1 and account.name = pi.cash_bank_account
and pi.posting_date >= %(from)s and pi.posting_date <= %(to)s
order by
pi.posting_date ASC, pi.name DESC
""", {"account": self.account, "from": self.from_date, "to": self.to_date}, as_dict=1)
entries = sorted(list(payment_entries) + list(journal_entries + list(pos_sales_invoices) + list(pos_purchase_invoices)),
key=lambda k: k['posting_date'] or getdate(nowdate())) key=lambda k: k['posting_date'] or getdate(nowdate()))
self.set('payment_entries', []) self.set('payment_entries', [])

View File

@@ -26,22 +26,22 @@ def test_create_test_data():
"item_group": "_Test Item Group", "item_group": "_Test Item Group",
"item_name": "_Test Tesla Car", "item_name": "_Test Tesla Car",
"apply_warehouse_wise_reorder_level": 0, "apply_warehouse_wise_reorder_level": 0,
"warehouse":"_Test Warehouse - _TC", "warehouse":"Stores - TCP1",
"gst_hsn_code": "999800", "gst_hsn_code": "999800",
"valuation_rate": 5000, "valuation_rate": 5000,
"standard_rate":5000, "standard_rate":5000,
"item_defaults": [{ "item_defaults": [{
"company": "_Test Company", "company": "_Test Company with perpetual inventory",
"default_warehouse": "_Test Warehouse - _TC", "default_warehouse": "Stores - TCP1",
"default_price_list":"_Test Price List", "default_price_list":"_Test Price List",
"expense_account": "_Test Account Cost for Goods Sold - _TC", "expense_account": "Cost of Goods Sold - TCP1",
"buying_cost_center": "_Test Cost Center - _TC", "buying_cost_center": "Main - TCP1",
"selling_cost_center": "_Test Cost Center - _TC", "selling_cost_center": "Main - TCP1",
"income_account": "Sales - _TC" "income_account": "Sales - TCP1"
}], }],
"show_in_website": 1, "show_in_website": 1,
"route":"-test-tesla-car", "route":"-test-tesla-car",
"website_warehouse": "_Test Warehouse - _TC" "website_warehouse": "Stores - TCP1"
}) })
item.insert() item.insert()
# create test item price # create test item price
@@ -63,12 +63,12 @@ def test_create_test_data():
"items": [{ "items": [{
"item_code": "_Test Tesla Car" "item_code": "_Test Tesla Car"
}], }],
"warehouse":"_Test Warehouse - _TC", "warehouse":"Stores - TCP1",
"coupon_code_based":1, "coupon_code_based":1,
"selling": 1, "selling": 1,
"rate_or_discount": "Discount Percentage", "rate_or_discount": "Discount Percentage",
"discount_percentage": 30, "discount_percentage": 30,
"company": "_Test Company", "company": "_Test Company with perpetual inventory",
"currency":"INR", "currency":"INR",
"for_price_list":"_Test Price List" "for_price_list":"_Test Price List"
}) })
@@ -112,7 +112,10 @@ class TestCouponCode(unittest.TestCase):
self.assertEqual(coupon_code.get("used"),0) self.assertEqual(coupon_code.get("used"),0)
def test_2_sales_order_with_coupon_code(self): def test_2_sales_order_with_coupon_code(self):
so = make_sales_order(customer="_Test Customer",selling_price_list="_Test Price List",item_code="_Test Tesla Car", rate=5000,qty=1, do_not_submit=True) so = make_sales_order(company='_Test Company with perpetual inventory', warehouse='Stores - TCP1',
customer="_Test Customer", selling_price_list="_Test Price List", item_code="_Test Tesla Car", rate=5000,qty=1,
do_not_submit=True)
so = frappe.get_doc('Sales Order', so.name) so = frappe.get_doc('Sales Order', so.name)
# check item price before coupon code is applied # check item price before coupon code is applied
self.assertEqual(so.items[0].rate, 5000) self.assertEqual(so.items[0].rate, 5000)
@@ -120,7 +123,7 @@ class TestCouponCode(unittest.TestCase):
so.sales_partner='_Test Coupon Partner' so.sales_partner='_Test Coupon Partner'
so.save() so.save()
# check item price after coupon code is applied # check item price after coupon code is applied
self.assertEqual(so.items[0].rate, 3500) self.assertEqual(so.items[0].rate, 3500)
so.submit() so.submit()
def test_3_check_coupon_code_used_after_so(self): def test_3_check_coupon_code_used_after_so(self):

View File

@@ -44,6 +44,19 @@ frappe.ui.form.on("Dunning", {
); );
frm.page.set_inner_btn_group_as_primary(__("Create")); frm.page.set_inner_btn_group_as_primary(__("Create"));
} }
if(frm.doc.docstatus > 0) {
frm.add_custom_button(__('Ledger'), function() {
frappe.route_options = {
"voucher_no": frm.doc.name,
"from_date": frm.doc.posting_date,
"to_date": frm.doc.posting_date,
"company": frm.doc.company,
"show_cancelled_entries": frm.doc.docstatus === 2
};
frappe.set_route("query-report", "General Ledger");
}, __('View'));
}
}, },
overdue_days: function (frm) { overdue_days: function (frm) {
frappe.db.get_value( frappe.db.get_value(
@@ -125,9 +138,9 @@ frappe.ui.form.on("Dunning", {
}, },
calculate_interest_and_amount: function (frm) { calculate_interest_and_amount: function (frm) {
const interest_per_year = frm.doc.outstanding_amount * frm.doc.rate_of_interest / 100; const interest_per_year = frm.doc.outstanding_amount * frm.doc.rate_of_interest / 100;
const interest_amount = interest_per_year / 365 * frm.doc.overdue_days || 0; const interest_amount = flt((interest_per_year * cint(frm.doc.overdue_days)) / 365 || 0, precision('interest_amount'));
const dunning_amount = interest_amount + frm.doc.dunning_fee; const dunning_amount = flt(interest_amount + frm.doc.dunning_fee, precision('dunning_amount'));
const grand_total = frm.doc.outstanding_amount + dunning_amount; const grand_total = flt(frm.doc.outstanding_amount + dunning_amount, precision('grand_total'));
frm.set_value("interest_amount", interest_amount); frm.set_value("interest_amount", interest_amount);
frm.set_value("dunning_amount", dunning_amount); frm.set_value("dunning_amount", dunning_amount);
frm.set_value("grand_total", grand_total); frm.set_value("grand_total", grand_total);

View File

@@ -29,10 +29,10 @@
"company_address_display", "company_address_display",
"section_break_6", "section_break_6",
"dunning_type", "dunning_type",
"interest_amount", "dunning_fee",
"column_break_8", "column_break_8",
"rate_of_interest", "rate_of_interest",
"dunning_fee", "interest_amount",
"section_break_12", "section_break_12",
"dunning_amount", "dunning_amount",
"grand_total", "grand_total",
@@ -215,7 +215,7 @@
}, },
{ {
"default": "0", "default": "0",
"fetch_from": "dunning_type.interest_rate", "fetch_from": "dunning_type.rate_of_interest",
"fetch_if_empty": 1, "fetch_if_empty": 1,
"fieldname": "rate_of_interest", "fieldname": "rate_of_interest",
"fieldtype": "Float", "fieldtype": "Float",
@@ -315,7 +315,7 @@
], ],
"is_submittable": 1, "is_submittable": 1,
"links": [], "links": [],
"modified": "2020-07-21 18:20:23.512151", "modified": "2020-08-03 18:55:43.683053",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Dunning", "name": "Dunning",

View File

@@ -6,7 +6,7 @@ from __future__ import unicode_literals
import frappe import frappe
import json import json
from six import string_types from six import string_types
from frappe.utils import getdate, get_datetime, rounded, flt from frappe.utils import getdate, get_datetime, rounded, flt, cint
from erpnext.loan_management.doctype.loan_interest_accrual.loan_interest_accrual import days_in_year from erpnext.loan_management.doctype.loan_interest_accrual.loan_interest_accrual import days_in_year
from erpnext.accounts.general_ledger import make_gl_entries, make_reverse_gl_entries from erpnext.accounts.general_ledger import make_gl_entries, make_reverse_gl_entries
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions
@@ -27,11 +27,11 @@ class Dunning(AccountsController):
amounts = calculate_interest_and_amount( amounts = calculate_interest_and_amount(
self.posting_date, self.outstanding_amount, self.rate_of_interest, self.dunning_fee, self.overdue_days) self.posting_date, self.outstanding_amount, self.rate_of_interest, self.dunning_fee, self.overdue_days)
if self.interest_amount != amounts.get('interest_amount'): if self.interest_amount != amounts.get('interest_amount'):
self.interest_amount = amounts.get('interest_amount') self.interest_amount = flt(amounts.get('interest_amount'), self.precision('interest_amount'))
if self.dunning_amount != amounts.get('dunning_amount'): if self.dunning_amount != amounts.get('dunning_amount'):
self.dunning_amount = amounts.get('dunning_amount') self.dunning_amount = flt(amounts.get('dunning_amount'), self.precision('dunning_amount'))
if self.grand_total != amounts.get('grand_total'): if self.grand_total != amounts.get('grand_total'):
self.grand_total = amounts.get('grand_total') self.grand_total = flt(amounts.get('grand_total'), self.precision('grand_total'))
def on_submit(self): def on_submit(self):
self.make_gl_entries() self.make_gl_entries()
@@ -47,10 +47,13 @@ class Dunning(AccountsController):
gl_entries = [] gl_entries = []
invoice_fields = ["project", "cost_center", "debit_to", "party_account_currency", "conversion_rate", "cost_center"] invoice_fields = ["project", "cost_center", "debit_to", "party_account_currency", "conversion_rate", "cost_center"]
inv = frappe.db.get_value("Sales Invoice", self.sales_invoice, invoice_fields, as_dict=1) inv = frappe.db.get_value("Sales Invoice", self.sales_invoice, invoice_fields, as_dict=1)
accounting_dimensions = get_accounting_dimensions() accounting_dimensions = get_accounting_dimensions()
invoice_fields.extend(accounting_dimensions) invoice_fields.extend(accounting_dimensions)
dunning_in_company_currency = flt(self.dunning_amount * inv.conversion_rate) dunning_in_company_currency = flt(self.dunning_amount * inv.conversion_rate)
default_cost_center = frappe.get_cached_value('Company', self.company, 'cost_center') default_cost_center = frappe.get_cached_value('Company', self.company, 'cost_center')
gl_entries.append( gl_entries.append(
self.get_gl_dict({ self.get_gl_dict({
"account": inv.debit_to, "account": inv.debit_to,
@@ -91,9 +94,8 @@ def resolve_dunning(doc, state):
def calculate_interest_and_amount(posting_date, outstanding_amount, rate_of_interest, dunning_fee, overdue_days): def calculate_interest_and_amount(posting_date, outstanding_amount, rate_of_interest, dunning_fee, overdue_days):
interest_amount = 0 interest_amount = 0
if rate_of_interest: if rate_of_interest:
interest_per_year = rounded(flt(outstanding_amount) * flt(rate_of_interest))/100 interest_per_year = flt(outstanding_amount) * flt(rate_of_interest) / 100
interest_amount = ( interest_amount = (interest_per_year * cint(overdue_days)) / 365
interest_per_year / days_in_year(get_datetime(posting_date).year)) * int(overdue_days)
grand_total = flt(outstanding_amount) + flt(interest_amount) + flt(dunning_fee) grand_total = flt(outstanding_amount) + flt(interest_amount) + flt(dunning_fee)
dunning_amount = flt(interest_amount) + flt(dunning_fee) dunning_amount = flt(interest_amount) + flt(dunning_fee)
return { return {

View File

@@ -0,0 +1,17 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'dunning',
'non_standard_fieldnames': {
'Journal Entry': 'reference_name',
'Payment Entry': 'reference_name'
},
'transactions': [
{
'label': _('Payment'),
'items': ['Payment Entry', 'Journal Entry']
}
]
}

View File

@@ -6,6 +6,7 @@ import unittest, frappe
from frappe.utils import flt, nowdate from frappe.utils import flt, nowdate
from erpnext.accounts.doctype.account.test_account import get_inventory_account from erpnext.accounts.doctype.account.test_account import get_inventory_account
from erpnext.exceptions import InvalidAccountCurrency from erpnext.exceptions import InvalidAccountCurrency
from erpnext.accounts.general_ledger import StockAccountInvalidTransaction
class TestJournalEntry(unittest.TestCase): class TestJournalEntry(unittest.TestCase):
def test_journal_entry_with_against_jv(self): def test_journal_entry_with_against_jv(self):
@@ -81,19 +82,46 @@ class TestJournalEntry(unittest.TestCase):
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory
set_perpetual_inventory() set_perpetual_inventory()
jv = frappe.copy_doc(test_records[0]) jv = frappe.copy_doc({
"cheque_date": nowdate(),
"cheque_no": "33",
"company": "_Test Company with perpetual inventory",
"doctype": "Journal Entry",
"accounts": [
{
"account": "Debtors - TCP1",
"party_type": "Customer",
"party": "_Test Customer",
"credit_in_account_currency": 400.0,
"debit_in_account_currency": 0.0,
"doctype": "Journal Entry Account",
"parentfield": "accounts",
"cost_center": "Main - TCP1"
},
{
"account": "_Test Bank - TCP1",
"credit_in_account_currency": 0.0,
"debit_in_account_currency": 400.0,
"doctype": "Journal Entry Account",
"parentfield": "accounts",
"cost_center": "Main - TCP1"
}
],
"naming_series": "_T-Journal Entry-",
"posting_date": nowdate(),
"user_remark": "test",
"voucher_type": "Bank Entry"
})
jv.get("accounts")[0].update({ jv.get("accounts")[0].update({
"account": get_inventory_account('_Test Company'), "account": get_inventory_account('_Test Company with perpetual inventory'),
"company": "_Test Company", "company": "_Test Company with perpetual inventory",
"party_type": None, "party_type": None,
"party": None "party": None
}) })
jv.insert()
from erpnext.accounts.general_ledger import StockAccountInvalidTransaction
self.assertRaises(StockAccountInvalidTransaction, jv.submit) self.assertRaises(StockAccountInvalidTransaction, jv.submit)
jv.cancel()
set_perpetual_inventory(0) set_perpetual_inventory(0)
def test_multi_currency(self): def test_multi_currency(self):

View File

@@ -25,7 +25,7 @@ frappe.ui.form.on('Payment Entry', {
}); });
frm.set_query("party_type", function() { frm.set_query("party_type", function() {
return{ return{
"filters": { filters: {
"name": ["in", Object.keys(frappe.boot.party_account_types)], "name": ["in", Object.keys(frappe.boot.party_account_types)],
} }
} }
@@ -33,7 +33,7 @@ frappe.ui.form.on('Payment Entry', {
frm.set_query("party_bank_account", function() { frm.set_query("party_bank_account", function() {
return { return {
filters: { filters: {
"is_company_account":0, is_company_account: 0,
party_type: frm.doc.party_type, party_type: frm.doc.party_type,
party: frm.doc.party party: frm.doc.party
} }
@@ -42,7 +42,7 @@ frappe.ui.form.on('Payment Entry', {
frm.set_query("bank_account", function() { frm.set_query("bank_account", function() {
return { return {
filters: { filters: {
"is_company_account":1 is_company_account: 1
} }
} }
}); });
@@ -342,7 +342,7 @@ frappe.ui.form.on('Payment Entry', {
() => { () => {
frm.set_party_account_based_on_party = false; frm.set_party_account_based_on_party = false;
if (r.message.bank_account) { if (r.message.bank_account) {
frm.set_value("party_bank_account", r.message.bank_account); frm.set_value("bank_account", r.message.bank_account);
} }
} }
]); ]);

View File

@@ -23,13 +23,13 @@ class TestPOSInvoice(unittest.TestCase):
import time import time
time.sleep(1) time.sleep(1)
self.assertRaises(frappe.TimestampMismatchError, w2.save) self.assertRaises(frappe.TimestampMismatchError, w2.save)
def test_change_naming_series(self): def test_change_naming_series(self):
inv = create_pos_invoice(do_not_submit=1) inv = create_pos_invoice(do_not_submit=1)
inv.naming_series = 'TEST-' inv.naming_series = 'TEST-'
self.assertRaises(frappe.CannotChangeConstantError, inv.save) self.assertRaises(frappe.CannotChangeConstantError, inv.save)
def test_discount_and_inclusive_tax(self): def test_discount_and_inclusive_tax(self):
inv = create_pos_invoice(qty=100, rate=50, do_not_save=1) inv = create_pos_invoice(qty=100, rate=50, do_not_save=1)
inv.append("taxes", { inv.append("taxes", {
@@ -66,7 +66,7 @@ class TestPOSInvoice(unittest.TestCase):
self.assertEqual(inv.net_total, 4298.25) self.assertEqual(inv.net_total, 4298.25)
self.assertEqual(inv.grand_total, 4900.00) self.assertEqual(inv.grand_total, 4900.00)
def test_tax_calculation_with_multiple_items(self): def test_tax_calculation_with_multiple_items(self):
inv = create_pos_invoice(qty=84, rate=4.6, do_not_save=True) inv = create_pos_invoice(qty=84, rate=4.6, do_not_save=True)
item_row = inv.get("items")[0] item_row = inv.get("items")[0]
@@ -148,7 +148,7 @@ class TestPOSInvoice(unittest.TestCase):
self.assertEqual(inv.grand_total, 5675.57) self.assertEqual(inv.grand_total, 5675.57)
self.assertEqual(inv.rounding_adjustment, 0.43) self.assertEqual(inv.rounding_adjustment, 0.43)
self.assertEqual(inv.rounded_total, 5676.0) self.assertEqual(inv.rounded_total, 5676.0)
def test_tax_calculation_with_multiple_items_and_discount(self): def test_tax_calculation_with_multiple_items_and_discount(self):
inv = create_pos_invoice(qty=1, rate=75, do_not_save=True) inv = create_pos_invoice(qty=1, rate=75, do_not_save=True)
item_row = inv.get("items")[0] item_row = inv.get("items")[0]
@@ -194,7 +194,7 @@ class TestPOSInvoice(unittest.TestCase):
self.assertEqual(pos_return.get('payments')[0].amount, -500) self.assertEqual(pos_return.get('payments')[0].amount, -500)
self.assertEqual(pos_return.get('payments')[1].amount, -500) self.assertEqual(pos_return.get('payments')[1].amount, -500)
def test_pos_change_amount(self): def test_pos_change_amount(self):
pos = create_pos_invoice(company= "_Test Company", debit_to="Debtors - _TC", pos = create_pos_invoice(company= "_Test Company", debit_to="Debtors - _TC",
income_account = "Sales - _TC", expense_account = "Cost of Goods Sold - _TC", rate=105, income_account = "Sales - _TC", expense_account = "Cost of Goods Sold - _TC", rate=105,
@@ -208,33 +208,43 @@ class TestPOSInvoice(unittest.TestCase):
self.assertEqual(pos.grand_total, 105.0) self.assertEqual(pos.grand_total, 105.0)
self.assertEqual(pos.change_amount, 5.0) self.assertEqual(pos.change_amount, 5.0)
def test_without_payment(self): def test_without_payment(self):
inv = create_pos_invoice(do_not_save=1) inv = create_pos_invoice(do_not_save=1)
# Check that the invoice cannot be submitted without payments # Check that the invoice cannot be submitted without payments
inv.payments = [] inv.payments = []
self.assertRaises(frappe.ValidationError, inv.insert) self.assertRaises(frappe.ValidationError, inv.insert)
def test_serialized_item_transaction(self): def test_serialized_item_transaction(self):
from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
se = make_serialized_item(target_warehouse="_Test Warehouse - _TC") se = make_serialized_item(company='_Test Company with perpetual inventory',
target_warehouse="Stores - TCP1", cost_center='Main - TCP1', expense_account='Cost of Goods Sold - TCP1')
serial_nos = get_serial_nos(se.get("items")[0].serial_no) serial_nos = get_serial_nos(se.get("items")[0].serial_no)
pos = create_pos_invoice(item=se.get("items")[0].item_code, rate=1000, do_not_save=1) pos = create_pos_invoice(company='_Test Company with perpetual inventory', debit_to='Debtors - TCP1',
account_for_change_amount='Cash - TCP1', warehouse='Stores - TCP1', income_account='Sales - TCP1',
expense_account='Cost of Goods Sold - TCP1', cost_center='Main - TCP1',
item=se.get("items")[0].item_code, rate=1000, do_not_save=1)
pos.get("items")[0].serial_no = serial_nos[0] pos.get("items")[0].serial_no = serial_nos[0]
pos.append("payments", {'mode_of_payment': 'Bank Draft', 'account': '_Test Bank - _TC', 'amount': 1000}) pos.append("payments", {'mode_of_payment': 'Bank Draft', 'account': '_Test Bank - TCP1', 'amount': 1000})
pos.insert() pos.insert()
pos.submit() pos.submit()
pos2 = create_pos_invoice(item=se.get("items")[0].item_code, rate=1000, do_not_save=1) pos2 = create_pos_invoice(company='_Test Company with perpetual inventory', debit_to='Debtors - TCP1',
account_for_change_amount='Cash - TCP1', warehouse='Stores - TCP1', income_account='Sales - TCP1',
expense_account='Cost of Goods Sold - TCP1', cost_center='Main - TCP1',
item=se.get("items")[0].item_code, rate=1000, do_not_save=1)
pos2.get("items")[0].serial_no = serial_nos[0] pos2.get("items")[0].serial_no = serial_nos[0]
pos2.append("payments", {'mode_of_payment': 'Bank Draft', 'account': '_Test Bank - _TC', 'amount': 1000}) pos2.append("payments", {'mode_of_payment': 'Bank Draft', 'account': '_Test Bank - TCP1', 'amount': 1000})
self.assertRaises(frappe.ValidationError, pos2.insert) self.assertRaises(frappe.ValidationError, pos2.insert)
def test_loyalty_points(self): def test_loyalty_points(self):
from erpnext.accounts.doctype.loyalty_program.test_loyalty_program import create_records from erpnext.accounts.doctype.loyalty_program.test_loyalty_program import create_records
from erpnext.accounts.doctype.loyalty_program.loyalty_program import get_loyalty_program_details_with_points from erpnext.accounts.doctype.loyalty_program.loyalty_program import get_loyalty_program_details_with_points
@@ -255,14 +265,14 @@ class TestPOSInvoice(unittest.TestCase):
inv.cancel() inv.cancel()
after_cancel_lp_details = get_loyalty_program_details_with_points(inv.customer, company=inv.company, loyalty_program=inv.loyalty_program) after_cancel_lp_details = get_loyalty_program_details_with_points(inv.customer, company=inv.company, loyalty_program=inv.loyalty_program)
self.assertEqual(after_cancel_lp_details.loyalty_points, before_lp_details.loyalty_points) self.assertEqual(after_cancel_lp_details.loyalty_points, before_lp_details.loyalty_points)
def test_loyalty_points_redeemption(self): def test_loyalty_points_redeemption(self):
from erpnext.accounts.doctype.loyalty_program.loyalty_program import get_loyalty_program_details_with_points from erpnext.accounts.doctype.loyalty_program.loyalty_program import get_loyalty_program_details_with_points
# add 10 loyalty points # add 10 loyalty points
create_pos_invoice(customer="Test Loyalty Customer", rate=10000) create_pos_invoice(customer="Test Loyalty Customer", rate=10000)
before_lp_details = get_loyalty_program_details_with_points("Test Loyalty Customer", company="_Test Company", loyalty_program="Test Single Loyalty") before_lp_details = get_loyalty_program_details_with_points("Test Loyalty Customer", company="_Test Company", loyalty_program="Test Single Loyalty")
inv = create_pos_invoice(customer="Test Loyalty Customer", rate=10000, do_not_save=1) inv = create_pos_invoice(customer="Test Loyalty Customer", rate=10000, do_not_save=1)
inv.redeem_loyalty_points = 1 inv.redeem_loyalty_points = 1
inv.loyalty_points = before_lp_details.loyalty_points inv.loyalty_points = before_lp_details.loyalty_points
@@ -299,7 +309,7 @@ def create_pos_invoice(**args):
pos_inv.return_against = args.return_against pos_inv.return_against = args.return_against
pos_inv.currency=args.currency or "INR" pos_inv.currency=args.currency or "INR"
pos_inv.conversion_rate = args.conversion_rate or 1 pos_inv.conversion_rate = args.conversion_rate or 1
pos_inv.account_for_change_amount = "Cash - _TC" pos_inv.account_for_change_amount = args.account_for_change_amount or "Cash - _TC"
pos_inv.append("items", { pos_inv.append("items", {
"item_code": args.item or args.item_code or "_Test Item", "item_code": args.item or args.item_code or "_Test Item",

View File

@@ -969,8 +969,10 @@
{ {
"fieldname": "clearance_date", "fieldname": "clearance_date",
"fieldtype": "Date", "fieldtype": "Date",
"hidden": 1, "label": "Clearance Date",
"label": "Clearance Date" "no_copy": 1,
"print_hide": 1,
"read_only": 1
}, },
{ {
"fieldname": "col_br_payments", "fieldname": "col_br_payments",
@@ -1332,7 +1334,7 @@
"idx": 204, "idx": 204,
"is_submittable": 1, "is_submittable": 1,
"links": [], "links": [],
"modified": "2020-07-24 09:46:40.405463", "modified": "2020-08-03 12:46:01.411074",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Purchase Invoice", "name": "Purchase Invoice",

View File

@@ -18,7 +18,7 @@ def get_data():
'transactions': [ 'transactions': [
{ {
'label': _('Payment'), 'label': _('Payment'),
'items': ['Payment Entry', 'Payment Request', 'Journal Entry', 'Invoice Discounting'] 'items': ['Payment Entry', 'Payment Request', 'Journal Entry', 'Invoice Discounting', 'Dunning']
}, },
{ {
'label': _('Reference'), 'label': _('Reference'),

View File

@@ -64,6 +64,7 @@
"fieldname": "clearance_date", "fieldname": "clearance_date",
"fieldtype": "Date", "fieldtype": "Date",
"label": "Clearance Date", "label": "Clearance Date",
"no_copy": 1,
"print_hide": 1, "print_hide": 1,
"read_only": 1 "read_only": 1
}, },
@@ -78,7 +79,7 @@
], ],
"istable": 1, "istable": 1,
"links": [], "links": [],
"modified": "2020-05-05 16:51:20.091441", "modified": "2020-08-03 12:45:39.986598",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Sales Invoice Payment", "name": "Sales Invoice Payment",

View File

@@ -7,8 +7,8 @@ import unittest
import frappe import frappe
from erpnext.accounts.doctype.subscription.subscription import get_prorata_factor from erpnext.accounts.doctype.subscription.subscription import get_prorata_factor
from frappe.utils.data import nowdate, add_days, add_to_date, add_months, date_diff, flt, get_date_str from frappe.utils.data import (nowdate, add_days, add_to_date, add_months, date_diff, flt, get_date_str,
get_first_day, get_last_day)
def create_plan(): def create_plan():
if not frappe.db.exists('Subscription Plan', '_Test Plan Name'): if not frappe.db.exists('Subscription Plan', '_Test Plan Name'):
@@ -68,14 +68,14 @@ class TestSubscription(unittest.TestCase):
subscription.party_type = 'Customer' subscription.party_type = 'Customer'
subscription.party = '_Test Customer' subscription.party = '_Test Customer'
subscription.trial_period_start = nowdate() subscription.trial_period_start = nowdate()
subscription.trial_period_end = add_days(nowdate(), 30) subscription.trial_period_end = add_months(nowdate(), 1)
subscription.append('plans', {'plan': '_Test Plan Name', 'qty': 1}) subscription.append('plans', {'plan': '_Test Plan Name', 'qty': 1})
subscription.save() subscription.save()
self.assertEqual(subscription.trial_period_start, nowdate()) self.assertEqual(subscription.trial_period_start, nowdate())
self.assertEqual(subscription.trial_period_end, add_days(nowdate(), 30)) self.assertEqual(subscription.trial_period_end, add_months(nowdate(), 1))
self.assertEqual(add_days(subscription.trial_period_end, 1), get_date_str(subscription.current_invoice_start)) self.assertEqual(add_days(subscription.trial_period_end, 1), get_date_str(subscription.current_invoice_start))
self.assertEqual(add_days(subscription.current_invoice_start, 30), get_date_str(subscription.current_invoice_end)) self.assertEqual(add_to_date(subscription.current_invoice_start, months=1, days=-1), get_date_str(subscription.current_invoice_end))
self.assertEqual(subscription.invoices, []) self.assertEqual(subscription.invoices, [])
self.assertEqual(subscription.status, 'Trialling') self.assertEqual(subscription.status, 'Trialling')

View File

@@ -158,8 +158,10 @@ def validate_account_for_perpetual_inventory(gl_map):
if account not in aii_accounts: if account not in aii_accounts:
continue continue
# Always use current date to get stock and account balance as there can future entries for
# other items
account_bal, stock_bal, warehouse_list = get_stock_and_account_balance(account, account_bal, stock_bal, warehouse_list = get_stock_and_account_balance(account,
gl_map[0].posting_date, gl_map[0].company) getdate(), gl_map[0].company)
if gl_map[0].voucher_type=="Journal Entry": if gl_map[0].voucher_type=="Journal Entry":
# In case of Journal Entry, there are no corresponding SL entries, # In case of Journal Entry, there are no corresponding SL entries,
@@ -169,7 +171,6 @@ def validate_account_for_perpetual_inventory(gl_map):
frappe.throw(_("Account: {0} can only be updated via Stock Transactions") frappe.throw(_("Account: {0} can only be updated via Stock Transactions")
.format(account), StockAccountInvalidTransaction) .format(account), StockAccountInvalidTransaction)
# This has been comment for a temporary, will add this code again on release of immutable ledger
elif account_bal != stock_bal: elif account_bal != stock_bal:
precision = get_field_precision(frappe.get_meta("GL Entry").get_field("debit"), precision = get_field_precision(frappe.get_meta("GL Entry").get_field("debit"),
currency=frappe.get_cached_value('Company', gl_map[0].company, "default_currency")) currency=frappe.get_cached_value('Company', gl_map[0].company, "default_currency"))

View File

@@ -643,8 +643,10 @@ class ReceivablePayableReport(object):
account_type = "Receivable" if self.party_type == "Customer" else "Payable" account_type = "Receivable" if self.party_type == "Customer" else "Payable"
accounts = [d.name for d in frappe.get_all("Account", accounts = [d.name for d in frappe.get_all("Account",
filters={"account_type": account_type, "company": self.filters.company})] filters={"account_type": account_type, "company": self.filters.company})]
conditions.append("account in (%s)" % ','.join(['%s'] *len(accounts)))
values += accounts if accounts:
conditions.append("account in (%s)" % ','.join(['%s'] *len(accounts)))
values += accounts
def add_customer_filters(self, conditions, values): def add_customer_filters(self, conditions, values):
if self.filters.get("customer_group"): if self.filters.get("customer_group"):

View File

@@ -122,7 +122,7 @@ def get_balance_on(account=None, date=None, party_type=None, party=None, company
cost_center = frappe.form_dict.get("cost_center") cost_center = frappe.form_dict.get("cost_center")
cond = [] cond = ["is_cancelled=0"]
if date: if date:
cond.append("posting_date <= %s" % frappe.db.escape(cstr(date))) cond.append("posting_date <= %s" % frappe.db.escape(cstr(date)))
else: else:
@@ -206,7 +206,7 @@ def get_balance_on(account=None, date=None, party_type=None, party=None, company
return flt(bal) return flt(bal)
def get_count_on(account, fieldname, date): def get_count_on(account, fieldname, date):
cond = [] cond = ["is_cancelled=0"]
if date: if date:
cond.append("posting_date <= %s" % frappe.db.escape(cstr(date))) cond.append("posting_date <= %s" % frappe.db.escape(cstr(date)))
else: else:

View File

@@ -1,4 +1,5 @@
{ {
"actions": [],
"allow_import": 1, "allow_import": 1,
"allow_rename": 1, "allow_rename": 1,
"autoname": "naming_series:", "autoname": "naming_series:",
@@ -7,8 +8,9 @@
"document_type": "Document", "document_type": "Document",
"engine": "InnoDB", "engine": "InnoDB",
"field_order": [ "field_order": [
"is_existing_asset",
"section_break_2",
"naming_series", "naming_series",
"asset_name",
"item_code", "item_code",
"item_name", "item_name",
"asset_category", "asset_category",
@@ -17,29 +19,31 @@
"supplier", "supplier",
"customer", "customer",
"image", "image",
"purchase_invoice", "journal_entry_for_scrap",
"column_break_3", "column_break_3",
"company", "company",
"asset_name",
"location", "location",
"custodian", "custodian",
"department", "department",
"purchase_date",
"disposal_date", "disposal_date",
"journal_entry_for_scrap",
"purchase_receipt",
"accounting_dimensions_section", "accounting_dimensions_section",
"cost_center", "cost_center",
"dimension_col_break", "dimension_col_break",
"section_break_5", "purchase_details_section",
"gross_purchase_amount", "purchase_receipt",
"purchase_invoice",
"available_for_use_date", "available_for_use_date",
"column_break_18", "column_break_23",
"gross_purchase_amount",
"purchase_date",
"section_break_23",
"calculate_depreciation", "calculate_depreciation",
"allow_monthly_depreciation", "allow_monthly_depreciation",
"is_existing_asset", "column_break_33",
"opening_accumulated_depreciation", "opening_accumulated_depreciation",
"number_of_depreciations_booked", "number_of_depreciations_booked",
"section_break_23", "section_break_36",
"finance_books", "finance_books",
"section_break_33", "section_break_33",
"depreciation_method", "depreciation_method",
@@ -64,7 +68,6 @@
"status", "status",
"booked_fixed_asset", "booked_fixed_asset",
"column_break_51", "column_break_51",
"purchase_receipt_amount", "purchase_receipt_amount",
"default_finance_book", "default_finance_book",
"amended_from" "amended_from"
@@ -187,6 +190,8 @@
"fieldname": "purchase_date", "fieldname": "purchase_date",
"fieldtype": "Date", "fieldtype": "Date",
"label": "Purchase Date", "label": "Purchase Date",
"read_only": 1,
"read_only_depends_on": "eval:!doc.is_existing_asset",
"reqd": 1 "reqd": 1
}, },
{ {
@@ -204,25 +209,20 @@
"print_hide": 1, "print_hide": 1,
"read_only": 1 "read_only": 1
}, },
{
"fieldname": "section_break_5",
"fieldtype": "Section Break"
},
{ {
"fieldname": "gross_purchase_amount", "fieldname": "gross_purchase_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Gross Purchase Amount", "label": "Gross Purchase Amount",
"options": "Company:company:default_currency", "options": "Company:company:default_currency",
"read_only": 1,
"read_only_depends_on": "eval:!doc.is_existing_asset",
"reqd": 1 "reqd": 1
}, },
{ {
"fieldname": "available_for_use_date", "fieldname": "available_for_use_date",
"fieldtype": "Date", "fieldtype": "Date",
"label": "Available-for-use Date" "label": "Available-for-use Date",
}, "reqd": 1
{
"fieldname": "column_break_18",
"fieldtype": "Column Break"
}, },
{ {
"default": "0", "default": "0",
@@ -252,12 +252,14 @@
"no_copy": 1 "no_copy": 1
}, },
{ {
"depends_on": "calculate_depreciation", "collapsible": 1,
"collapsible_depends_on": "eval:doc.calculate_depreciation || doc.is_existing_asset",
"fieldname": "section_break_23", "fieldname": "section_break_23",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Depreciation" "label": "Depreciation"
}, },
{ {
"columns": 10,
"fieldname": "finance_books", "fieldname": "finance_books",
"fieldtype": "Table", "fieldtype": "Table",
"label": "Finance Books", "label": "Finance Books",
@@ -305,8 +307,7 @@
{ {
"depends_on": "calculate_depreciation", "depends_on": "calculate_depreciation",
"fieldname": "section_break_14", "fieldname": "section_break_14",
"fieldtype": "Section Break", "fieldtype": "Section Break"
"label": "Depreciation Schedule"
}, },
{ {
"fieldname": "schedules", "fieldname": "schedules",
@@ -456,12 +457,37 @@
"fieldname": "allow_monthly_depreciation", "fieldname": "allow_monthly_depreciation",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Allow Monthly Depreciation" "label": "Allow Monthly Depreciation"
},
{
"fieldname": "section_break_2",
"fieldtype": "Section Break"
},
{
"collapsible": 1,
"collapsible_depends_on": "is_existing_asset",
"fieldname": "purchase_details_section",
"fieldtype": "Section Break",
"label": "Purchase Details"
},
{
"fieldname": "column_break_23",
"fieldtype": "Column Break"
},
{
"fieldname": "column_break_33",
"fieldtype": "Column Break"
},
{
"depends_on": "calculate_depreciation",
"fieldname": "section_break_36",
"fieldtype": "Section Break"
} }
], ],
"idx": 72, "idx": 72,
"image_field": "image", "image_field": "image",
"is_submittable": 1, "is_submittable": 1,
"modified": "2019-10-22 15:47:36.050828", "links": [],
"modified": "2020-07-28 15:04:44.452224",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Assets", "module": "Assets",
"name": "Asset", "name": "Asset",

View File

@@ -1084,7 +1084,7 @@
"idx": 105, "idx": 105,
"is_submittable": 1, "is_submittable": 1,
"links": [], "links": [],
"modified": "2020-07-18 05:09:33.800633", "modified": "2020-07-31 14:13:44.610190",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Purchase Order", "name": "Purchase Order",
@@ -1135,5 +1135,5 @@
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"timeline_field": "supplier", "timeline_field": "supplier",
"title_field": "title" "title_field": "supplier"
} }

View File

@@ -97,7 +97,7 @@
{ {
"fieldname": "default_bank_account", "fieldname": "default_bank_account",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Default Bank Account", "label": "Default Company Bank Account",
"options": "Bank Account" "options": "Bank Account"
}, },
{ {
@@ -384,7 +384,7 @@
"idx": 370, "idx": 370,
"image_field": "image", "image_field": "image",
"links": [], "links": [],
"modified": "2020-03-17 09:48:30.578242", "modified": "2020-06-17 23:18:20",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Supplier", "name": "Supplier",

View File

@@ -6,10 +6,11 @@ frappe.ui.form.on('Assessment Result', {
if (!frm.doc.__islocal) { if (!frm.doc.__islocal) {
frm.trigger('setup_chart'); frm.trigger('setup_chart');
} }
frm.set_df_property('details', 'read_only', 1);
}, },
onload: function(frm) { onload: function(frm) {
frm.set_query('assessment_plan', function(){ frm.set_query('assessment_plan', function() {
return { return {
filters: { filters: {
docstatus: 1 docstatus: 1
@@ -27,14 +28,14 @@ frappe.ui.form.on('Assessment Result', {
}, },
callback: function(r) { callback: function(r) {
if (r.message) { if (r.message) {
frm.doc.details = []; frappe.model.clear_table(frm.doc, 'details');
$.each(r.message, function(i, d) { $.each(r.message, function(i, d) {
var row = frappe.model.add_child(frm.doc, 'Assessment Result Detail', 'details'); var row = frm.add_child('details');
row.assessment_criteria = d.assessment_criteria; row.assessment_criteria = d.assessment_criteria;
row.maximum_score = d.maximum_score; row.maximum_score = d.maximum_score;
}); });
frm.refresh_field('details');
} }
refresh_field('details');
} }
}); });
} }
@@ -80,7 +81,7 @@ frappe.ui.form.on('Assessment Result Detail', {
score: function(frm, cdt, cdn) { score: function(frm, cdt, cdn) {
var d = locals[cdt][cdn]; var d = locals[cdt][cdn];
if(!d.maximum_score || !frm.doc.grading_scale) { if (!d.maximum_score || !frm.doc.grading_scale) {
d.score = ''; d.score = '';
frappe.throw(__('Please fill in all the details to generate Assessment Result.')); frappe.throw(__('Please fill in all the details to generate Assessment Result.'));
} }

View File

@@ -1,724 +1,182 @@
{ {
"allow_copy": 0, "actions": [],
"allow_guest_to_view": 0,
"allow_import": 1, "allow_import": 1,
"allow_rename": 0,
"autoname": "EDU-RES-.YYYY.-.#####", "autoname": "EDU-RES-.YYYY.-.#####",
"beta": 0,
"creation": "2015-11-13 17:18:06.468332", "creation": "2015-11-13 17:18:06.468332",
"custom": 0,
"docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"document_type": "",
"editable_grid": 1, "editable_grid": 1,
"engine": "InnoDB", "engine": "InnoDB",
"field_order": [
"assessment_plan",
"program",
"course",
"academic_year",
"academic_term",
"column_break_3",
"student",
"student_name",
"student_group",
"assessment_group",
"grading_scale",
"section_break_5",
"details",
"section_break_8",
"maximum_score",
"column_break_11",
"total_score",
"grade",
"section_break_13",
"comment",
"amended_from"
],
"fields": [ "fields": [
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "assessment_plan", "fieldname": "assessment_plan",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1, "in_list_view": 1,
"in_standard_filter": 0,
"label": "Assessment Plan", "label": "Assessment Plan",
"length": 0,
"no_copy": 0,
"options": "Assessment Plan", "options": "Assessment Plan",
"permlevel": 0, "reqd": 1
"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,
"fetch_from": "assessment_plan.program", "fetch_from": "assessment_plan.program",
"fieldname": "program", "fieldname": "program",
"fieldtype": "Link", "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": "Program", "label": "Program",
"length": 0, "options": "Program"
"no_copy": 0,
"options": "Program",
"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,
"fetch_from": "assessment_plan.course", "fetch_from": "assessment_plan.course",
"fieldname": "course", "fieldname": "course",
"fieldtype": "Link", "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": "Course", "label": "Course",
"length": 0, "options": "Course"
"no_copy": 0,
"options": "Course",
"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,
"fetch_from": "assessment_plan.academic_year", "fetch_from": "assessment_plan.academic_year",
"fieldname": "academic_year", "fieldname": "academic_year",
"fieldtype": "Link", "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": "Academic Year", "label": "Academic Year",
"length": 0, "options": "Academic Year"
"no_copy": 0,
"options": "Academic Year",
"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,
"fetch_from": "assessment_plan.academic_term", "fetch_from": "assessment_plan.academic_term",
"fieldname": "academic_term", "fieldname": "academic_term",
"fieldtype": "Link", "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": "Academic Term", "label": "Academic Term",
"length": 0, "options": "Academic Term"
"no_copy": 0,
"options": "Academic Term",
"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": "column_break_3", "fieldname": "column_break_3",
"fieldtype": "Column Break", "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": "student", "fieldname": "student",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 1, "in_global_search": 1,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Student", "label": "Student",
"length": 0,
"no_copy": 0,
"options": "Student", "options": "Student",
"permlevel": 0, "reqd": 1
"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,
"fetch_from": "student.title", "fetch_from": "student.title",
"fieldname": "student_name", "fieldname": "student_name",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 1, "in_global_search": 1,
"in_list_view": 1, "in_list_view": 1,
"in_standard_filter": 0,
"label": "Student Name", "label": "Student Name",
"length": 0, "read_only": 1
"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,
"fetch_from": "assessment_plan.student_group", "fetch_from": "assessment_plan.student_group",
"fieldname": "student_group", "fieldname": "student_group",
"fieldtype": "Link", "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": "Student Group", "label": "Student Group",
"length": 0, "options": "Student Group"
"no_copy": 0,
"options": "Student Group",
"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,
"fetch_from": "assessment_plan.assessment_group", "fetch_from": "assessment_plan.assessment_group",
"fieldname": "assessment_group", "fieldname": "assessment_group",
"fieldtype": "Link", "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": "Assessment Group", "label": "Assessment Group",
"length": 0, "options": "Assessment Group"
"no_copy": 0,
"options": "Assessment Group",
"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,
"fetch_from": "assessment_plan.grading_scale", "fetch_from": "assessment_plan.grading_scale",
"fieldname": "grading_scale", "fieldname": "grading_scale",
"fieldtype": "Link", "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": "Grading Scale", "label": "Grading Scale",
"length": 0,
"no_copy": 0,
"options": "Grading Scale", "options": "Grading Scale",
"permlevel": 0, "read_only": 1
"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": "section_break_5", "fieldname": "section_break_5",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "label": "Result"
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Result",
"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,
"depends_on": "",
"fieldname": "details", "fieldname": "details",
"fieldtype": "Table", "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": "Details", "label": "Details",
"length": 0,
"no_copy": 0,
"options": "Assessment Result Detail", "options": "Assessment Result Detail",
"permlevel": 0, "reqd": 1
"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,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "section_break_8", "fieldname": "section_break_8",
"fieldtype": "Section Break", "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,
"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": "assessment_plan.maximum_assessment_score", "fetch_from": "assessment_plan.maximum_assessment_score",
"fieldname": "maximum_score", "fieldname": "maximum_score",
"fieldtype": "Float", "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": "Maximum Score", "label": "Maximum Score",
"length": 0, "read_only": 1
"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,
"fetch_from": "assessment_plan.maximum_assessment_score", "fetch_from": "assessment_plan.maximum_assessment_score",
"fieldname": "column_break_11", "fieldname": "column_break_11",
"fieldtype": "Column Break", "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": "total_score", "fieldname": "total_score",
"fieldtype": "Float", "fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1, "in_list_view": 1,
"in_standard_filter": 0,
"label": "Total Score", "label": "Total Score",
"length": 0, "read_only": 1
"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": "grade", "fieldname": "grade",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1, "in_list_view": 1,
"in_standard_filter": 0,
"label": "Grade", "label": "Grade",
"length": 0, "read_only": 1
"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": "section_break_13", "fieldname": "section_break_13",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "label": "Summary"
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Summary",
"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": "comment", "fieldname": "comment",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"hidden": 0, "label": "Comment"
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Comment",
"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": "amended_from", "fieldname": "amended_from",
"fieldtype": "Link", "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", "label": "Amended From",
"length": 0,
"no_copy": 1, "no_copy": 1,
"options": "Assessment Result", "options": "Assessment Result",
"permlevel": 0,
"print_hide": 1, "print_hide": 1,
"print_hide_if_no_value": 0, "read_only": 1
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"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": 1, "is_submittable": 1,
"issingle": 0, "links": [],
"istable": 0, "modified": "2020-08-03 11:47:54.119486",
"max_attachments": 0,
"modified": "2018-08-30 02:10:36.813413",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Education", "module": "Education",
"name": "Assessment Result", "name": "Assessment Result",
"name_case": "",
"owner": "Administrator", "owner": "Administrator",
"permissions": [ "permissions": [
{ {
@@ -728,28 +186,18 @@
"delete": 1, "delete": 1,
"email": 1, "email": 1,
"export": 1, "export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Academics User", "role": "Academics User",
"set_user_permissions": 0,
"share": 1, "share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
} }
], ],
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"restrict_to_domain": "Education", "restrict_to_domain": "Education",
"show_name_in_global_search": 1, "show_name_in_global_search": 1,
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"title_field": "student_name", "title_field": "student_name"
"track_changes": 0,
"track_seen": 0,
"track_views": 0
} }

View File

@@ -1,194 +1,66 @@
{ {
"allow_copy": 0, "actions": [],
"allow_guest_to_view": 0, "creation": "2016-12-14 17:44:35.583123",
"allow_import": 0, "doctype": "DocType",
"allow_rename": 0, "editable_grid": 1,
"autoname": "", "engine": "InnoDB",
"beta": 0, "field_order": [
"creation": "2016-12-14 17:44:35.583123", "assessment_criteria",
"custom": 0, "maximum_score",
"docstatus": 0, "column_break_2",
"doctype": "DocType", "score",
"document_type": "", "grade"
"editable_grid": 1, ],
"engine": "InnoDB",
"fields": [ "fields": [
{ {
"allow_bulk_edit": 0, "columns": 4,
"allow_on_submit": 0, "fieldname": "assessment_criteria",
"bold": 0, "fieldtype": "Link",
"collapsible": 0, "in_list_view": 1,
"columns": 4, "label": "Assessment Criteria",
"fieldname": "assessment_criteria", "options": "Assessment Criteria",
"fieldtype": "Link", "read_only": 1,
"hidden": 0, "reqd": 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": "Assessment Criteria",
"length": 0,
"no_copy": 0,
"options": "Assessment Criteria",
"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, "columns": 2,
"allow_on_submit": 0, "fieldname": "maximum_score",
"bold": 0, "fieldtype": "Float",
"collapsible": 0, "in_list_view": 1,
"columns": 2, "label": "Maximum Score",
"fieldname": "maximum_score", "read_only": 1
"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": "Maximum 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, "fieldname": "column_break_2",
"allow_on_submit": 0, "fieldtype": "Column Break"
"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,
"label": "",
"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, "columns": 2,
"allow_on_submit": 0, "fieldname": "score",
"bold": 0, "fieldtype": "Float",
"collapsible": 0, "in_list_view": 1,
"columns": 2, "label": "Score",
"fieldname": "score", "reqd": 1
"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": "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": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "columns": 2,
"allow_on_submit": 0, "fieldname": "grade",
"bold": 0, "fieldtype": "Data",
"collapsible": 0, "in_list_view": 1,
"columns": 2, "label": "Grade",
"fieldname": "grade", "read_only": 1
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Grade",
"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, "istable": 1,
"hide_heading": 0, "links": [],
"hide_toolbar": 0, "modified": "2020-07-31 13:27:17.699022",
"idx": 0, "modified_by": "Administrator",
"image_view": 0, "module": "Education",
"in_create": 0, "name": "Assessment Result Detail",
"is_submittable": 0, "owner": "Administrator",
"issingle": 0, "permissions": [],
"istable": 1, "quick_entry": 1,
"max_attachments": 0, "restrict_to_domain": "Education",
"modified": "2017-11-10 19:11:14.362410", "sort_field": "modified",
"modified_by": "Administrator", "sort_order": "DESC"
"module": "Education",
"name": "Assessment Result Detail",
"name_case": "",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"read_only": 0,
"read_only_onload": 0,
"restrict_to_domain": "Education",
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 0,
"track_seen": 0
} }

View File

@@ -1,8 +1,5 @@
import traceback import traceback
import pycountry
import taxjar
import frappe import frappe
from erpnext import get_default_company from erpnext import get_default_company
from frappe import _ from frappe import _
@@ -32,6 +29,7 @@ def get_client():
def create_transaction(doc, method): def create_transaction(doc, method):
import taxjar
"""Create an order transaction in TaxJar""" """Create an order transaction in TaxJar"""
if not TAXJAR_CREATE_TRANSACTIONS: if not TAXJAR_CREATE_TRANSACTIONS:
@@ -208,6 +206,7 @@ def get_shipping_address_details(doc):
def get_iso_3166_2_state_code(address): def get_iso_3166_2_state_code(address):
import pycountry
country_code = frappe.db.get_value("Country", address.get("country"), "code") country_code = frappe.db.get_value("Country", address.get("country"), "code")
error_message = _("""{0} is not a valid state! Check for typos or enter the ISO code for your state.""").format(address.get("state")) error_message = _("""{0} is not a valid state! Check for typos or enter the ISO code for your state.""").format(address.get("state"))

View File

@@ -39,7 +39,9 @@ class HealthcareServiceUnitType(Document):
def on_trash(self): def on_trash(self):
if self.item: if self.item:
try: try:
frappe.delete_doc('Item', self.item) item = self.item
self.db_set('item', '')
frappe.delete_doc('Item', item)
except Exception: except Exception:
frappe.throw(_('Not permitted. Please disable the Service Unit Type')) frappe.throw(_('Not permitted. Please disable the Service Unit Type'))

View File

@@ -5,7 +5,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe, json import frappe, json
from frappe import _ from frappe import _
from frappe.utils import today, now_datetime, getdate from frappe.utils import today, now_datetime, getdate, get_datetime
from frappe.model.document import Document from frappe.model.document import Document
from frappe.desk.reportview import get_match_cond from frappe.desk.reportview import get_match_cond
@@ -30,6 +30,11 @@ class InpatientRecord(Document):
(getdate(self.discharge_ordered_date) < getdate(self.scheduled_date)): (getdate(self.discharge_ordered_date) < getdate(self.scheduled_date)):
frappe.throw(_('Expected and Discharge dates cannot be less than Admission Schedule date')) frappe.throw(_('Expected and Discharge dates cannot be less than Admission Schedule date'))
for entry in self.inpatient_occupancies:
if entry.check_in and entry.check_out and \
get_datetime(entry.check_in) > get_datetime(entry.check_out):
frappe.throw(_('Row #{0}: Check Out datetime cannot be less than Check In datetime').format(entry.idx))
def validate_already_scheduled_or_admitted(self): def validate_already_scheduled_or_admitted(self):
query = """ query = """
select name, status select name, status

View File

@@ -40,7 +40,7 @@ def get_appointments_to_invoice(patient, company):
patient_appointments = frappe.get_list( patient_appointments = frappe.get_list(
'Patient Appointment', 'Patient Appointment',
fields = '*', fields = '*',
filters = {'patient': patient.name, 'company': company, 'invoiced': 0}, filters = {'patient': patient.name, 'company': company, 'invoiced': 0, 'status': ['not in', 'Cancelled']},
order_by = 'appointment_date' order_by = 'appointment_date'
) )

View File

@@ -7,14 +7,14 @@
"doctype": "Dashboard Chart", "doctype": "Dashboard Chart",
"document_type": "Job Applicant", "document_type": "Job Applicant",
"dynamic_filters_json": "", "dynamic_filters_json": "",
"filters_json": "[[\"Job Applicant\",\"creation\",\"Previous\",\"1 month\"]]", "filters_json": "[[\"Job Applicant\",\"creation\",\"Timespan\",\"last month\",false]]",
"group_by_based_on": "status", "group_by_based_on": "status",
"group_by_type": "Count", "group_by_type": "Count",
"idx": 0, "idx": 0,
"is_public": 1, "is_public": 1,
"is_standard": 1, "is_standard": 1,
"last_synced_on": "2020-07-22 14:27:40.118498", "last_synced_on": "2020-07-28 16:19:12.109979",
"modified": "2020-07-22 14:33:00.404144", "modified": "2020-07-28 16:19:45.279490",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Job Application Status", "name": "Job Application Status",

View File

@@ -9,6 +9,7 @@ frappe.views.calendar["Holiday List"] = {
"title": "description", "title": "description",
"allDay": "allDay" "allDay": "allDay"
}, },
order_by: `from_date`,
get_events_method: "erpnext.hr.doctype.holiday_list.holiday_list.get_events", get_events_method: "erpnext.hr.doctype.holiday_list.holiday_list.get_events",
filters: [ filters: [
{ {

View File

@@ -35,7 +35,15 @@ frappe.query_reports["Monthly Attendance Sheet"] = {
"fieldname":"employee", "fieldname":"employee",
"label": __("Employee"), "label": __("Employee"),
"fieldtype": "Link", "fieldtype": "Link",
"options": "Employee" "options": "Employee",
get_query: () => {
var company = frappe.query_report.get_filter_value('company');
return {
filters: {
'company': company
}
};
}
}, },
{ {
"fieldname":"company", "fieldname":"company",

View File

@@ -96,33 +96,35 @@ def get_data(filters):
def get_parent_row(sp_jo_map, sp, jo_ja_map, ja_joff_map): def get_parent_row(sp_jo_map, sp, jo_ja_map, ja_joff_map):
data = [] data = []
for jo in sp_jo_map[sp]: if sp in sp_jo_map.keys():
row = { for jo in sp_jo_map[sp]:
"staffing_plan" : sp, row = {
"job_opening" : jo["name"], "staffing_plan" : sp,
} "job_opening" : jo["name"],
data.append(row) }
child_row = get_child_row( jo["name"], jo_ja_map, ja_joff_map) data.append(row)
data += child_row child_row = get_child_row( jo["name"], jo_ja_map, ja_joff_map)
data += child_row
return data return data
def get_child_row(jo, jo_ja_map, ja_joff_map): def get_child_row(jo, jo_ja_map, ja_joff_map):
data = [] data = []
for ja in jo_ja_map[jo]: if jo in jo_ja_map.keys():
row = { for ja in jo_ja_map[jo]:
"indent":1, row = {
"job_applicant": ja.name, "indent":1,
"applicant_name": ja.applicant_name, "job_applicant": ja.name,
"application_status": ja.status, "applicant_name": ja.applicant_name,
} "application_status": ja.status,
if ja.name in ja_joff_map.keys(): }
jo_detail =ja_joff_map[ja.name][0] if ja.name in ja_joff_map.keys():
row["job_offer"] = jo_detail.name jo_detail =ja_joff_map[ja.name][0]
row["job_offer_status"] = jo_detail.status row["job_offer"] = jo_detail.name
row["offer_date"]= jo_detail.offer_date.strftime("%d-%m-%Y") row["job_offer_status"] = jo_detail.status
row["designation"] = jo_detail.designation row["offer_date"]= jo_detail.offer_date.strftime("%d-%m-%Y")
row["designation"] = jo_detail.designation
data.append(row) data.append(row)
return data return data
def get_staffing_plan(filters): def get_staffing_plan(filters):
@@ -177,7 +179,7 @@ def get_job_applicant(jo_list):
def get_job_offer(ja_list): def get_job_offer(ja_list):
ja_joff_map = {} ja_joff_map = {}
offers = frappe.get_all("Job offer", filters = [["job_applicant", "IN", ja_list]], fields =["name", "job_applicant", "status", 'offer_date', 'designation']) offers = frappe.get_all("Job Offer", filters = [["job_applicant", "IN", ja_list]], fields =["name", "job_applicant", "status", 'offer_date', 'designation'])
for offer in offers: for offer in offers:
if offer.job_applicant not in ja_joff_map.keys(): if offer.job_applicant not in ja_joff_map.keys():

View File

@@ -20,8 +20,8 @@
"section_break_8", "section_break_8",
"loan_type", "loan_type",
"loan_amount", "loan_amount",
"is_secured_loan",
"rate_of_interest", "rate_of_interest",
"is_secured_loan",
"disbursement_date", "disbursement_date",
"disbursed_amount", "disbursed_amount",
"column_break_11", "column_break_11",
@@ -334,7 +334,7 @@
], ],
"is_submittable": 1, "is_submittable": 1,
"links": [], "links": [],
"modified": "2020-07-02 20:46:40.128142", "modified": "2020-08-01 12:36:11.255233",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Loan Management", "module": "Loan Management",
"name": "Loan", "name": "Loan",

View File

@@ -269,7 +269,7 @@ class TestLoan(unittest.TestCase):
self.assertTrue(loan_security_shortfall) self.assertTrue(loan_security_shortfall)
self.assertEquals(loan_security_shortfall.loan_amount, 1000000.00) self.assertEquals(loan_security_shortfall.loan_amount, 1000000.00)
self.assertEquals(loan_security_shortfall.security_value, 400000.00) self.assertEquals(loan_security_shortfall.security_value, 800000.00)
self.assertEquals(loan_security_shortfall.shortfall_amount, 600000.00) self.assertEquals(loan_security_shortfall.shortfall_amount, 600000.00)
frappe.db.sql(""" UPDATE `tabLoan Security Price` SET loan_security_price = 250 frappe.db.sql(""" UPDATE `tabLoan Security Price` SET loan_security_price = 250

View File

@@ -14,6 +14,7 @@ class LoanSecurityPledge(Document):
def validate(self): def validate(self):
self.set_pledge_amount() self.set_pledge_amount()
self.validate_duplicate_securities() self.validate_duplicate_securities()
self.validate_loan_security_type()
def on_submit(self): def on_submit(self):
if self.loan: if self.loan:
@@ -31,6 +32,27 @@ class LoanSecurityPledge(Document):
frappe.throw(_('Loan Security {0} added multiple times').format(frappe.bold( frappe.throw(_('Loan Security {0} added multiple times').format(frappe.bold(
security.loan_security))) security.loan_security)))
def validate_loan_security_type(self):
existing_pledge = ''
if self.loan:
existing_pledge = frappe.db.get_value('Loan Security Pledge', {'loan': self.loan}, ['name'])
if existing_pledge:
loan_security_type = frappe.db.get_value('Pledge', {'parent': existing_pledge}, ['loan_security_type'])
else:
loan_security_type = self.securities[0].loan_security_type
ltv_ratio_map = frappe._dict(frappe.get_all("Loan Security Type",
fields=["name", "loan_to_value_ratio"], as_list=1))
ltv_ratio = ltv_ratio_map.get(loan_security_type)
for security in self.securities:
if ltv_ratio_map.get(security.loan_security_type) != ltv_ratio:
frappe.throw(_("Loan Securities with different LTV ratio cannot be pledged against one loan"))
def set_pledge_amount(self): def set_pledge_amount(self):
total_security_value = 0 total_security_value = 0
maximum_loan_value = 0 maximum_loan_value = 0

View File

@@ -7,6 +7,7 @@ import frappe
from frappe.utils import get_datetime from frappe.utils import get_datetime
from frappe.model.document import Document from frappe.model.document import Document
from six import iteritems from six import iteritems
from erpnext.loan_management.doctype.loan_security_unpledge.loan_security_unpledge import get_pledged_security_qty
class LoanSecurityShortfall(Document): class LoanSecurityShortfall(Document):
pass pass
@@ -50,31 +51,30 @@ def check_for_ltv_shortfall(process_loan_security_shortfall):
"valid_upto": (">=", update_time) "valid_upto": (">=", update_time)
}, as_list=1)) }, as_list=1))
ltv_ratio_map = frappe._dict(frappe.get_all("Loan Security Type", loans = frappe.get_all('Loan', fields=['name', 'loan_amount', 'total_principal_paid'],
fields=["name", "loan_to_value_ratio"], as_list=1)) filters={'status': 'Disbursed', 'is_secured_loan': 1})
loans = frappe.db.sql(""" SELECT l.name, l.loan_amount, l.total_principal_paid, lp.loan_security, lp.haircut, lp.qty, lp.loan_security_type
FROM `tabLoan` l, `tabPledge` lp , `tabLoan Security Pledge`p WHERE lp.parent = p.name and p.loan = l.name and l.docstatus = 1
and l.is_secured_loan and l.status = 'Disbursed' and p.status = 'Pledged'""", as_dict=1)
loan_security_map = {} loan_security_map = {}
for loan in loans: for loan in loans:
loan_security_map.setdefault(loan.name, { outstanding_amount = loan.loan_amount - loan.total_principal_paid
"loan_amount": loan.loan_amount - loan.total_principal_paid, pledged_securities = get_pledged_security_qty(loan.name)
"security_value": 0.0 ltv_ratio = ''
}) security_value = 0.0
current_loan_security_amount = loan_security_price_map.get(loan.loan_security, 0) * loan.qty for security, qty in pledged_securities.items():
ltv_ratio = ltv_ratio_map.get(loan.loan_security_type) if not ltv_ratio:
ltv_ratio = get_ltv_ratio(security)
security_value += loan_security_price_map.get(security) * qty
loan_security_map[loan.name]['security_value'] += current_loan_security_amount - (current_loan_security_amount * loan.haircut/100) current_ratio = (outstanding_amount/security_value) * 100
for loan, value in iteritems(loan_security_map): if current_ratio > ltv_ratio:
if (value["loan_amount"]/value['security_value'] * 100) > ltv_ratio: shortfall_amount = outstanding_amount - ((security_value * ltv_ratio) / 100)
create_loan_security_shortfall(loan, value, process_loan_security_shortfall) create_loan_security_shortfall(loan.name, outstanding_amount, security_value, shortfall_amount,
process_loan_security_shortfall)
def create_loan_security_shortfall(loan, value, process_loan_security_shortfall): def create_loan_security_shortfall(loan, loan_amount, security_value, shortfall_amount, process_loan_security_shortfall):
existing_shortfall = frappe.db.get_value("Loan Security Shortfall", {"loan": loan, "status": "Pending"}, "name") existing_shortfall = frappe.db.get_value("Loan Security Shortfall", {"loan": loan, "status": "Pending"}, "name")
@@ -85,9 +85,14 @@ def create_loan_security_shortfall(loan, value, process_loan_security_shortfall)
ltv_shortfall.loan = loan ltv_shortfall.loan = loan
ltv_shortfall.shortfall_time = get_datetime() ltv_shortfall.shortfall_time = get_datetime()
ltv_shortfall.loan_amount = value["loan_amount"] ltv_shortfall.loan_amount = loan_amount
ltv_shortfall.security_value = value["security_value"] ltv_shortfall.security_value = security_value
ltv_shortfall.shortfall_amount = value["loan_amount"] - value["security_value"] ltv_shortfall.shortfall_amount = shortfall_amount
ltv_shortfall.process_loan_security_shortfall = process_loan_security_shortfall ltv_shortfall.process_loan_security_shortfall = process_loan_security_shortfall
ltv_shortfall.save() ltv_shortfall.save()
def get_ltv_ratio(loan_security):
loan_security_type = frappe.db.get_value('Loan Security', loan_security, 'loan_security_type')
ltv_ratio = frappe.db.get_value('Loan Security Type', loan_security_type, 'loan_to_value_ratio')
return ltv_ratio

View File

@@ -15,7 +15,7 @@ erpnext.patches.v4_0.move_warehouse_user_to_restrictions
erpnext.patches.v4_0.global_defaults_to_system_settings erpnext.patches.v4_0.global_defaults_to_system_settings
erpnext.patches.v4_0.update_incharge_name_to_sales_person_in_maintenance_schedule erpnext.patches.v4_0.update_incharge_name_to_sales_person_in_maintenance_schedule
execute:frappe.reload_doc("accounts", "doctype", "POS Payment Method") #2020-05-28 execute:frappe.reload_doc("accounts", "doctype", "POS Payment Method") #2020-05-28
execute:frappe.reload_doc("HR", "doctype", "HR Settings") #2020-01-16 execute:frappe.reload_doc("HR", "doctype", "HR Settings") #2020-01-16 #2020-07-24
execute:frappe.reload_doc('stock', 'doctype', 'warehouse') # 2017-04-24 execute:frappe.reload_doc('stock', 'doctype', 'warehouse') # 2017-04-24
execute:frappe.reload_doc('accounts', 'doctype', 'sales_invoice') # 2016-08-31 execute:frappe.reload_doc('accounts', 'doctype', 'sales_invoice') # 2016-08-31
execute:frappe.reload_doc('selling', 'doctype', 'sales_order') # 2014-01-29 execute:frappe.reload_doc('selling', 'doctype', 'sales_order') # 2014-01-29

View File

@@ -12,11 +12,11 @@ def execute():
frappe.rename_doc('DocType', 'POS Closing Voucher Taxes', 'POS Closing Entry Taxes', force=True) frappe.rename_doc('DocType', 'POS Closing Voucher Taxes', 'POS Closing Entry Taxes', force=True)
if not frappe.db.exists('DocType', 'POS Closing Voucher Details'): if not frappe.db.exists('DocType', 'POS Closing Voucher Details'):
frappe.rename_doc('DocType', 'POS Closing Voucher Details', 'POS Closing Entry Details', force=True) frappe.rename_doc('DocType', 'POS Closing Voucher Details', 'POS Closing Entry Detail', force=True)
frappe.reload_doc('Accounts', 'doctype', 'POS Closing Entry') frappe.reload_doc('Accounts', 'doctype', 'POS Closing Entry')
frappe.reload_doc('Accounts', 'doctype', 'POS Closing Entry Taxes') frappe.reload_doc('Accounts', 'doctype', 'POS Closing Entry Taxes')
frappe.reload_doc('Accounts', 'doctype', 'POS Closing Entry Details') frappe.reload_doc('Accounts', 'doctype', 'POS Closing Entry Detail')
if frappe.db.exists("DocType", "POS Closing Voucher"): if frappe.db.exists("DocType", "POS Closing Voucher"):
frappe.delete_doc("DocType", "POS Closing Voucher") frappe.delete_doc("DocType", "POS Closing Voucher")

View File

@@ -6,7 +6,7 @@ from __future__ import unicode_literals
import frappe import frappe
def execute(): def execute():
frappe.reload_doc("Selling", "doctype", "POS Payment Method") frappe.reload_doc("accounts", "doctype", "POS Payment Method")
pos_profiles = frappe.get_all("POS Profile") pos_profiles = frappe.get_all("POS Profile")
for pos_profile in pos_profiles: for pos_profile in pos_profiles:

View File

@@ -11,9 +11,9 @@ from frappe.model.document import Document
class ProductsSettings(Document): class ProductsSettings(Document):
def validate(self): def validate(self):
if self.home_page_is_products: if self.home_page_is_products:
frappe.db.set_value("Website Settings", "home_page", "products") frappe.db.set_value("Website Settings", None, "home_page", "products")
elif frappe.db.get_single_value("Website Settings", "home_page") == 'products': elif frappe.db.get_single_value("Website Settings", "home_page") == 'products':
frappe.db.set_value("Website Settings", "home_page", "home") frappe.db.set_value("Website Settings", None, "home_page", "home")
self.validate_field_filters() self.validate_field_filters()
self.validate_attribute_filters() self.validate_attribute_filters()

View File

@@ -4,8 +4,8 @@
frappe.ui.form.on('Website Theme', { frappe.ui.form.on('Website Theme', {
validate(frm) { validate(frm) {
let theme_scss = frm.doc.theme_scss; let theme_scss = frm.doc.theme_scss;
if (theme_scss.includes('frappe/public/scss/website') if (theme_scss && (theme_scss.includes('frappe/public/scss/website')
&& !theme_scss.includes('erpnext/public/scss/website') && !theme_scss.includes('erpnext/public/scss/website'))
) { ) {
frm.set_value('theme_scss', frm.set_value('theme_scss',
`${frm.doc.theme_scss}\n@import "erpnext/public/scss/website";`); `${frm.doc.theme_scss}\n@import "erpnext/public/scss/website";`);

View File

@@ -1,7 +1,7 @@
{ {
"allow_copy": 0, "allow_copy": 0,
"allow_import": 0, "allow_import": 0,
"allow_rename": 0, "allow_rename": 1,
"autoname": "field:source_name", "autoname": "field:source_name",
"beta": 0, "beta": 0,
"creation": "2016-09-16 01:47:47.382372", "creation": "2016-09-16 01:47:47.382372",
@@ -74,7 +74,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-09-16 02:03:01.441622", "modified": "2020-09-16 02:03:01.441622",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Selling", "module": "Selling",
"name": "Lead Source", "name": "Lead Source",
@@ -128,4 +128,4 @@
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"track_seen": 0 "track_seen": 0
} }

View File

@@ -1,7 +1,6 @@
{ {
"actions": [], "actions": [],
"allow_import": 1, "allow_import": 1,
"allow_workflow": 1,
"autoname": "naming_series:", "autoname": "naming_series:",
"creation": "2013-06-18 12:39:59", "creation": "2013-06-18 12:39:59",
"doctype": "DocType", "doctype": "DocType",
@@ -1461,7 +1460,7 @@
"idx": 105, "idx": 105,
"is_submittable": 1, "is_submittable": 1,
"links": [], "links": [],
"modified": "2020-07-18 05:13:06.680696", "modified": "2020-07-31 14:13:17.962015",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Selling", "module": "Selling",
"name": "Sales Order", "name": "Sales Order",
@@ -1535,7 +1534,7 @@
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"timeline_field": "customer", "timeline_field": "customer",
"title_field": "title", "title_field": "customer",
"track_changes": 1, "track_changes": 1,
"track_seen": 1 "track_seen": 1
} }

View File

@@ -96,7 +96,7 @@ def prepare_data(data, filters):
# prepare data for report view # prepare data for report view
row["qty_to_bill"] = flt(row["qty"]) - flt(row["billed_qty"]) row["qty_to_bill"] = flt(row["qty"]) - flt(row["billed_qty"])
row["delay"] = 0 if row["delay"] < 0 else row["delay"] row["delay"] = 0 if row["delay"] and row["delay"] < 0 else row["delay"]
if filters.get("group_by_so"): if filters.get("group_by_so"):
so_name = row["sales_order"] so_name = row["sales_order"]

View File

@@ -12,5 +12,11 @@ frappe.ui.form.on("Shopping Cart Settings", {
if (frm.doc.enabled === 1) { if (frm.doc.enabled === 1) {
frm.set_value('enable_variants', 1); frm.set_value('enable_variants', 1);
} }
else {
frm.set_value('company', '');
frm.set_value('price_list', '');
frm.set_value('default_customer_group', '');
frm.set_value('quotation_series', '');
}
} }
}); });

View File

@@ -95,15 +95,16 @@
"fieldtype": "Link", "fieldtype": "Link",
"in_list_view": 1, "in_list_view": 1,
"label": "Company", "label": "Company",
"mandatory_depends_on": "eval: doc.enabled === 1",
"options": "Company", "options": "Company",
"remember_last_selected_value": 1, "remember_last_selected_value": 1
"reqd": 1
}, },
{ {
"description": "Prices will not be shown if Price List is not set", "description": "Prices will not be shown if Price List is not set",
"fieldname": "price_list", "fieldname": "price_list",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Price List", "label": "Price List",
"mandatory_depends_on": "eval: doc.enabled === 1",
"options": "Price List" "options": "Price List"
}, },
{ {
@@ -115,14 +116,14 @@
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1, "ignore_user_permissions": 1,
"label": "Default Customer Group", "label": "Default Customer Group",
"options": "Customer Group", "mandatory_depends_on": "eval: doc.enabled === 1",
"reqd": 1 "options": "Customer Group"
}, },
{ {
"fieldname": "quotation_series", "fieldname": "quotation_series",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Quotation Series", "label": "Quotation Series",
"reqd": 1 "mandatory_depends_on": "eval: doc.enabled === 1"
}, },
{ {
"collapsible": 1, "collapsible": 1,
@@ -171,7 +172,7 @@
"idx": 1, "idx": 1,
"issingle": 1, "issingle": 1,
"links": [], "links": [],
"modified": "2020-07-17 17:53:22.667228", "modified": "2020-08-02 18:21:43.873303",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Shopping Cart", "module": "Shopping Cart",
"name": "Shopping Cart Settings", "name": "Shopping Cart Settings",

View File

@@ -6,11 +6,11 @@
"docstatus": 0, "docstatus": 0,
"doctype": "Dashboard Chart", "doctype": "Dashboard Chart",
"dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"to_date\":\"frappe.datetime.nowdate()\"}", "dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"to_date\":\"frappe.datetime.nowdate()\"}",
"filters_json": "{\"show_warehouse_wise_stock\":0}", "filters_json": "{\"range1\":30,\"range2\":60,\"range3\":90,\"show_warehouse_wise_stock\":0}",
"idx": 0, "idx": 0,
"is_public": 1, "is_public": 1,
"is_standard": 1, "is_standard": 1,
"modified": "2020-07-22 13:04:36.271198", "modified": "2020-07-29 14:50:26.846482",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Oldest Items", "name": "Oldest Items",

View File

@@ -13,7 +13,7 @@ from erpnext.controllers.item_variant import (ItemVariantExistsError,
from erpnext.setup.doctype.item_group.item_group import (get_parent_item_groups, invalidate_cache_for) from erpnext.setup.doctype.item_group.item_group import (get_parent_item_groups, invalidate_cache_for)
from frappe import _, msgprint from frappe import _, msgprint
from frappe.utils import (cint, cstr, flt, formatdate, get_timestamp, getdate, from frappe.utils import (cint, cstr, flt, formatdate, get_timestamp, getdate,
now_datetime, random_string, strip, get_link_to_form) now_datetime, random_string, strip, get_link_to_form, nowtime)
from frappe.utils.html_utils import clean_html from frappe.utils.html_utils import clean_html
from frappe.website.doctype.website_slideshow.website_slideshow import \ from frappe.website.doctype.website_slideshow.website_slideshow import \
get_slideshow get_slideshow
@@ -194,7 +194,7 @@ class Item(WebsiteGenerator):
if default_warehouse: if default_warehouse:
stock_entry = make_stock_entry(item_code=self.name, target=default_warehouse, qty=self.opening_stock, stock_entry = make_stock_entry(item_code=self.name, target=default_warehouse, qty=self.opening_stock,
rate=self.valuation_rate, company=default.company) rate=self.valuation_rate, company=default.company, posting_date=getdate(), posting_time=nowtime())
stock_entry.add_comment("Comment", _("Opening Stock")) stock_entry.add_comment("Comment", _("Opening Stock"))

View File

@@ -413,7 +413,7 @@ class TestStockEntry(unittest.TestCase):
def test_serial_item_error(self): def test_serial_item_error(self):
se, serial_nos = self.test_serial_by_series() se, serial_nos = self.test_serial_by_series()
if not frappe.db.exists('Serial No', 'ABCD'): if not frappe.db.exists('Serial No', 'ABCD'):
make_serialized_item("_Test Serialized Item", "ABCD\nEFGH") make_serialized_item(item_code="_Test Serialized Item", serial_no="ABCD\nEFGH")
se = frappe.copy_doc(test_records[0]) se = frappe.copy_doc(test_records[0])
se.purpose = "Material Transfer" se.purpose = "Material Transfer"
@@ -823,15 +823,29 @@ class TestStockEntry(unittest.TestCase):
]) ])
) )
def make_serialized_item(item_code=None, serial_no=None, target_warehouse=None): def make_serialized_item(**args):
args = frappe._dict(args)
se = frappe.copy_doc(test_records[0]) se = frappe.copy_doc(test_records[0])
se.get("items")[0].item_code = item_code or "_Test Serialized Item With Series"
se.get("items")[0].serial_no = serial_no if args.company:
se.company = args.company
se.get("items")[0].item_code = args.item_code or "_Test Serialized Item With Series"
if args.serial_no:
se.get("items")[0].serial_no = args.serial_no
if args.cost_center:
se.get("items")[0].cost_center = args.cost_center
if args.expense_account:
se.get("items")[0].expense_account = args.expense_account
se.get("items")[0].qty = 2 se.get("items")[0].qty = 2
se.get("items")[0].transfer_qty = 2 se.get("items")[0].transfer_qty = 2
if target_warehouse: if args.target_warehouse:
se.get("items")[0].t_warehouse = target_warehouse se.get("items")[0].t_warehouse = args.target_warehouse
se.set_stock_entry_type() se.set_stock_entry_type()
se.insert() se.insert()

View File

@@ -45,7 +45,6 @@
"oldfieldtype": "Section Break" "oldfieldtype": "Section Break"
}, },
{ {
"description": "If blank, parent Warehouse Account or company default will be considered",
"fieldname": "warehouse_name", "fieldname": "warehouse_name",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Warehouse Name", "label": "Warehouse Name",
@@ -86,6 +85,7 @@
"fieldtype": "Column Break" "fieldtype": "Column Break"
}, },
{ {
"description": "If blank, parent Warehouse Account or company default will be considered in transactions",
"fieldname": "account", "fieldname": "account",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Account", "label": "Account",
@@ -236,7 +236,7 @@
"idx": 1, "idx": 1,
"is_tree": 1, "is_tree": 1,
"links": [], "links": [],
"modified": "2020-07-16 15:43:50.653256", "modified": "2020-08-03 18:41:52.442502",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Warehouse", "name": "Warehouse",

View File

@@ -1084,9 +1084,9 @@ lodash.set@^4.3.2:
integrity sha1-2HV7HagH3eJIFrDWqEvqGnYjCyM= integrity sha1-2HV7HagH3eJIFrDWqEvqGnYjCyM=
lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.7.14: lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.7.14:
version "4.17.15" version "4.17.19"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b"
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==
lowercase-keys@^1.0.0: lowercase-keys@^1.0.0:
version "1.0.1" version "1.0.1"