Merge branch 'hotfix'

This commit is contained in:
Saurabh
2018-08-07 12:55:51 +05:30
14 changed files with 218 additions and 76 deletions

View File

@@ -5,7 +5,7 @@ import frappe
from erpnext.hooks import regional_overrides from erpnext.hooks import regional_overrides
from frappe.utils import getdate from frappe.utils import getdate
__version__ = '10.1.45' __version__ = '10.1.46'
def get_default_company(user=None): def get_default_company(user=None):
'''Get default company for user''' '''Get default company for user'''

View File

@@ -21,8 +21,6 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
if(!this.frm.doc.supplier && this.frm.doc.credit_to) { if(!this.frm.doc.supplier && this.frm.doc.credit_to) {
this.frm.set_df_property("credit_to", "print_hide", 0); this.frm.set_df_property("credit_to", "print_hide", 0);
} }
} else {
this.frm.set_value("disable_rounded_total", cint(frappe.sys_defaults.disable_rounded_total));
} }
}, },

View File

@@ -32,7 +32,7 @@ frappe.query_reports["Accounts Payable"] = {
"fieldname":"ageing_based_on", "fieldname":"ageing_based_on",
"label": __("Ageing Based On"), "label": __("Ageing Based On"),
"fieldtype": "Select", "fieldtype": "Select",
"options": 'Posting Date\nDue Date', "options": 'Posting Date\nDue Date\nSupplier Invoice Date',
"default": "Posting Date" "default": "Posting Date"
}, },
{ {

View File

@@ -151,6 +151,7 @@ class ReceivablePayableReport(object):
# get due date # get due date
due_date = voucher_details.get(gle.voucher_no, {}).get("due_date", "") due_date = voucher_details.get(gle.voucher_no, {}).get("due_date", "")
bill_date = voucher_details.get(gle.voucher_no, {}).get("bill_date", "")
row += [gle.voucher_type, gle.voucher_no, due_date] row += [gle.voucher_type, gle.voucher_no, due_date]
@@ -167,15 +168,25 @@ class ReceivablePayableReport(object):
row += [invoiced_amount, paid_amt, credit_note_amount, outstanding_amount] row += [invoiced_amount, paid_amt, credit_note_amount, outstanding_amount]
# ageing data # ageing data
entry_date = due_date if self.filters.ageing_based_on == "Due Date" else gle.posting_date if self.filters.ageing_based_on == "Due Date":
entry_date = due_date
elif self.filters.ageing_based_on == "Supplier Invoice Date":
entry_date = bill_date
else:
entry_date = gle.posting_date
row += get_ageing_data(cint(self.filters.range1), cint(self.filters.range2), row += get_ageing_data(cint(self.filters.range1), cint(self.filters.range2),
cint(self.filters.range3), self.age_as_on, entry_date, outstanding_amount) cint(self.filters.range3), self.age_as_on, entry_date, outstanding_amount)
# issue 6371-Ageing buckets should not have amounts if due date is not reached # issue 6371-Ageing buckets should not have amounts if due date is not reached
if self.filters.ageing_based_on == "Due Date" \ if self.filters.ageing_based_on == "Due Date" \
and getdate(due_date) > getdate(self.filters.report_date): and getdate(due_date) > getdate(self.filters.report_date):
row[-1]=row[-2]=row[-3]=row[-4]=0 row[-1]=row[-2]=row[-3]=row[-4]=0
if self.filters.ageing_based_on == "Supplier Invoice Date" \
and getdate(bill_date) > getdate(self.filters.report_date):
row[-1]=row[-2]=row[-3]=row[-4]=0
if self.filters.get(scrub(args.get("party_type"))): if self.filters.get(scrub(args.get("party_type"))):
row.append(gle.account_currency) row.append(gle.account_currency)
else: else:

View File

@@ -223,13 +223,13 @@ def get_tax_accounts(item_list, columns, company_currency,
item_tax_amount = flt((tax_amount * d.base_net_amount) / item_net_amount) \ item_tax_amount = flt((tax_amount * d.base_net_amount) / item_net_amount) \
if item_net_amount else 0 if item_net_amount else 0
if item_tax_amount: if item_tax_amount:
tax_amount = flt(item_tax_amount, tax_amount_precision) tax_value = flt(item_tax_amount, tax_amount_precision)
tax_amount = (tax_amount * -1 tax_value = (tax_value * -1
if (doctype == 'Purchase Invoice' and name in deducted_tax) else tax_amount) if (doctype == 'Purchase Invoice' and name in deducted_tax) else tax_value)
itemised_tax.setdefault(d.name, {})[description] = frappe._dict({ itemised_tax.setdefault(d.name, {})[description] = frappe._dict({
"tax_rate": tax_rate, "tax_rate": tax_rate,
"tax_amount": tax_amount "tax_amount": tax_value
}) })
except ValueError: except ValueError:

View File

@@ -2378,6 +2378,37 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "rounded_total",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Rounded Total",
"length": 0,
"no_copy": 0,
"options": "currency",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
@@ -2409,6 +2440,36 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "disable_rounded_total",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Disable Rounded Total",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
@@ -3293,7 +3354,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2018-07-18 07:49:53.131408", "modified": "2018-08-01 15:18:33.155409",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Purchase Order", "name": "Purchase Order",

View File

@@ -1983,6 +1983,37 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "rounded_total",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Rounded Total",
"length": 0,
"no_copy": 0,
"options": "currency",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
@@ -2014,6 +2045,36 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "disable_rounded_total",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Disable Rounded Total",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
@@ -2549,7 +2610,7 @@
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"menu_index": 0, "menu_index": 0,
"modified": "2018-07-06 02:45:48.616334", "modified": "2018-08-01 15:18:23.265621",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Supplier Quotation", "name": "Supplier Quotation",

View File

@@ -99,9 +99,16 @@ class BuyingController(StockController):
def set_total_in_words(self): def set_total_in_words(self):
from frappe.utils import money_in_words from frappe.utils import money_in_words
if self.meta.get_field("base_in_words"): if self.meta.get_field("base_in_words"):
self.base_in_words = money_in_words(self.base_grand_total, self.company_currency) amount = (self.base_rounded_total
if not self.get("disable_rounded_total") else self.base_grand_total)
self.base_in_words = money_in_words(amount, self.company_currency)
if self.meta.get_field("in_words"): if self.meta.get_field("in_words"):
self.in_words = money_in_words(self.grand_total, self.currency) amount = (self.rounded_total
if not self.get("disable_rounded_total") else self.grand_total)
self.in_words = money_in_words(amount, self.currency)
# update valuation rate # update valuation rate
def update_valuation_rate(self, parentfield): def update_valuation_rate(self, parentfield):

View File

@@ -33,7 +33,7 @@ class StudentGroup(Document):
program_enrollment = get_program_enrollment(self.academic_year, self.academic_term, self.program, self.batch, self.course) program_enrollment = get_program_enrollment(self.academic_year, self.academic_term, self.program, self.batch, self.course)
students = [d.student for d in program_enrollment] if program_enrollment else [] students = [d.student for d in program_enrollment] if program_enrollment else []
for d in self.students: for d in self.students:
if not frappe.db.get_value("Student", d.student, "enabled") and d.active: if not frappe.db.get_value("Student", d.student, "enabled") and d.active and not self.disabled:
frappe.throw(_("{0} - {1} is inactive student".format(d.group_roll_number, d.student_name))) frappe.throw(_("{0} - {1} is inactive student".format(d.group_roll_number, d.student_name)))
if (self.group_based_on == "Batch") and cint(frappe.defaults.get_defaults().validate_batch)\ if (self.group_based_on == "Batch") and cint(frappe.defaults.get_defaults().validate_batch)\

View File

@@ -34,7 +34,7 @@ class LabTestTemplate(Document):
# remove template refernce from item and disable item # remove template refernce from item and disable item
if(self.item): if(self.item):
try: try:
frappe.delete_doc("Item",self.item) frappe.delete_doc("Item",self.item, force=True)
except Exception: except Exception:
frappe.throw("""Not permitted. Please disable the Test Template""") frappe.throw("""Not permitted. Please disable the Test Template""")

View File

@@ -292,10 +292,10 @@ def get_events(start, end, filters=None):
conditions = get_event_conditions("Patient Appointment", filters) conditions = get_event_conditions("Patient Appointment", filters)
data = frappe.db.sql("""select name, patient, physician, status, data = frappe.db.sql("""select name, patient, physician, status,
duration, timestamp(appointment_date, appointment_time) as duration, timestamp(appointment_date, appointment_time) as
'start' from `tabPatient Appointment` where 'appointment_date' from `tabPatient Appointment` where
(appointment_date between %(start)s and %(end)s) (appointment_date between %(start)s and %(end)s)
and docstatus < 2 {conditions}""".format(conditions=conditions), and docstatus < 2 {conditions}""".format(conditions=conditions),
{"start": start, "end": end}, as_dict=True, update={"allDay": 0}) {"start": start, "end": end}, as_dict=True, update={"allDay": 0})
for item in data: for item in data:
item.end = item.start + datetime.timedelta(minutes = item.duration) item.appointment_datetime = item.appointment_date + datetime.timedelta(minutes = item.duration)
return data return data

View File

@@ -30,7 +30,7 @@ class ExpenseClaim(AccountsController):
self.validate_expense_approver() self.validate_expense_approver()
self.calculate_total_amount() self.calculate_total_amount()
set_employee_name(self) set_employee_name(self)
self.set_expense_account() self.set_expense_account(validate=True)
self.set_payable_account() self.set_payable_account()
self.set_cost_center() self.set_cost_center()
self.set_status() self.set_status()
@@ -235,9 +235,9 @@ class ExpenseClaim(AccountsController):
if flt(d.sanctioned_amount) > flt(d.claim_amount): if flt(d.sanctioned_amount) > flt(d.claim_amount):
frappe.throw(_("Sanctioned Amount cannot be greater than Claim Amount in Row {0}.").format(d.idx)) frappe.throw(_("Sanctioned Amount cannot be greater than Claim Amount in Row {0}.").format(d.idx))
def set_expense_account(self): def set_expense_account(self, validate=False):
for expense in self.expenses: for expense in self.expenses:
if not expense.default_account: if not expense.default_account or not validate:
expense.default_account = get_expense_claim_account(expense.expense_type, self.company)["account"] expense.default_account = get_expense_claim_account(expense.expense_type, self.company)["account"]
def update_reimbursed_amount(doc): def update_reimbursed_amount(doc):

View File

@@ -120,7 +120,7 @@ class Project(Document):
"modified": now() "modified": now()
}) })
task.validate() task.run_method("validate")
task.db_update() task.db_update()
else: else:
task.save(ignore_permissions = True) task.save(ignore_permissions = True)

View File

@@ -26,6 +26,10 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
}; };
}); });
if (this.frm.doc.__islocal) {
this.frm.set_value("disable_rounded_total", cint(frappe.sys_defaults.disable_rounded_total));
}
/* eslint-disable */ /* eslint-disable */
// no idea where me is coming from // no idea where me is coming from
if(this.frm.get_field('shipping_address')) { if(this.frm.get_field('shipping_address')) {