Merge branch 'develop'
This commit is contained in:
commit
c8da7b7d32
@ -1,2 +1,2 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
__version__ = '5.0.26'
|
__version__ = '5.0.27'
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
|
|
||||||
from frappe.utils import flt, fmt_money, getdate, formatdate
|
from frappe.utils import flt, fmt_money, getdate, formatdate, cstr
|
||||||
from frappe import _
|
from frappe import _
|
||||||
|
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
@ -118,7 +118,7 @@ def update_outstanding_amt(account, party_type, party, against_voucher_type, aga
|
|||||||
bal = flt(frappe.db.sql("""select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
|
bal = flt(frappe.db.sql("""select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
|
||||||
from `tabGL Entry`
|
from `tabGL Entry`
|
||||||
where against_voucher_type=%s and against_voucher=%s
|
where against_voucher_type=%s and against_voucher=%s
|
||||||
and account = %s and party_type=%s and party=%s""",
|
and account = %s and ifnull(party_type, '')=%s and ifnull(party, '')=%s""",
|
||||||
(against_voucher_type, against_voucher, account, party_type, party))[0][0] or 0.0)
|
(against_voucher_type, against_voucher, account, party_type, party))[0][0] or 0.0)
|
||||||
|
|
||||||
if against_voucher_type == 'Purchase Invoice':
|
if against_voucher_type == 'Purchase Invoice':
|
||||||
@ -127,8 +127,9 @@ def update_outstanding_amt(account, party_type, party, against_voucher_type, aga
|
|||||||
against_voucher_amount = flt(frappe.db.sql("""
|
against_voucher_amount = flt(frappe.db.sql("""
|
||||||
select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
|
select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
|
||||||
from `tabGL Entry` where voucher_type = 'Journal Entry' and voucher_no = %s
|
from `tabGL Entry` where voucher_type = 'Journal Entry' and voucher_no = %s
|
||||||
and account = %s and party_type=%s and party=%s and ifnull(against_voucher, '') = ''""",
|
and account = %s and ifnull(party_type, '')=%s and ifnull(party, '')=%s
|
||||||
(against_voucher, account, party_type, party))[0][0])
|
and ifnull(against_voucher, '') = ''""",
|
||||||
|
(against_voucher, account, cstr(party_type), cstr(party)))[0][0])
|
||||||
|
|
||||||
if not against_voucher_amount:
|
if not against_voucher_amount:
|
||||||
frappe.throw(_("Against Journal Entry {0} is already adjusted against some other voucher")
|
frappe.throw(_("Against Journal Entry {0} is already adjusted against some other voucher")
|
||||||
|
|||||||
@ -274,30 +274,28 @@ class JournalEntry(AccountsController):
|
|||||||
r.append(_('Reference #{0} dated {1}').format(self.cheque_no, formatdate(self.cheque_date)))
|
r.append(_('Reference #{0} dated {1}').format(self.cheque_no, formatdate(self.cheque_date)))
|
||||||
else:
|
else:
|
||||||
msgprint(_("Please enter Reference date"), raise_exception=frappe.MandatoryError)
|
msgprint(_("Please enter Reference date"), raise_exception=frappe.MandatoryError)
|
||||||
|
|
||||||
|
company_currency = get_company_currency(self.company)
|
||||||
|
|
||||||
for d in self.get('accounts'):
|
for d in self.get('accounts'):
|
||||||
if d.against_invoice and d.credit:
|
if d.against_invoice and d.credit:
|
||||||
currency = frappe.db.get_value("Sales Invoice", d.against_invoice, "currency")
|
r.append(_("{0} against Sales Invoice {1}").format(fmt_money(flt(d.credit), currency = company_currency), \
|
||||||
|
|
||||||
r.append(_("{0} against Sales Invoice {1}").format(fmt_money(flt(d.credit), currency = currency), \
|
|
||||||
d.against_invoice))
|
d.against_invoice))
|
||||||
|
|
||||||
if d.against_sales_order and d.credit:
|
if d.against_sales_order and d.credit:
|
||||||
currency = frappe.db.get_value("Sales Order", d.against_sales_order, "currency")
|
r.append(_("{0} against Sales Order {1}").format(fmt_money(flt(d.credit), currency = company_currency), \
|
||||||
r.append(_("{0} against Sales Order {1}").format(fmt_money(flt(d.credit), currency = currency), \
|
|
||||||
d.against_sales_order))
|
d.against_sales_order))
|
||||||
|
|
||||||
if d.against_voucher and d.debit:
|
if d.against_voucher and d.debit:
|
||||||
bill_no = frappe.db.sql("""select bill_no, bill_date, currency
|
bill_no = frappe.db.sql("""select bill_no, bill_date
|
||||||
from `tabPurchase Invoice` where name=%s""", d.against_voucher)
|
from `tabPurchase Invoice` where name=%s""", d.against_voucher)
|
||||||
if bill_no and bill_no[0][0] and bill_no[0][0].lower().strip() \
|
if bill_no and bill_no[0][0] and bill_no[0][0].lower().strip() \
|
||||||
not in ['na', 'not applicable', 'none']:
|
not in ['na', 'not applicable', 'none']:
|
||||||
r.append(_('{0} against Bill {1} dated {2}').format(fmt_money(flt(d.debit), currency=bill_no[0][2]), bill_no[0][0],
|
r.append(_('{0} against Bill {1} dated {2}').format(fmt_money(flt(d.debit), currency=company_currency), bill_no[0][0],
|
||||||
bill_no[0][1] and formatdate(bill_no[0][1].strftime('%Y-%m-%d'))))
|
bill_no[0][1] and formatdate(bill_no[0][1].strftime('%Y-%m-%d'))))
|
||||||
|
|
||||||
if d.against_purchase_order and d.debit:
|
if d.against_purchase_order and d.debit:
|
||||||
currency = frappe.db.get_value("Purchase Order", d.against_purchase_order, "currency")
|
r.append(_("{0} against Purchase Order {1}").format(fmt_money(flt(d.credit), currency = company_currency), \
|
||||||
r.append(_("{0} against Purchase Order {1}").format(fmt_money(flt(d.credit), currency = currency), \
|
|
||||||
d.against_purchase_order))
|
d.against_purchase_order))
|
||||||
|
|
||||||
if self.user_remark:
|
if self.user_remark:
|
||||||
|
|||||||
@ -88,9 +88,7 @@ class PurchaseInvoice(BuyingController):
|
|||||||
throw(_("Conversion rate cannot be 0 or 1"))
|
throw(_("Conversion rate cannot be 0 or 1"))
|
||||||
|
|
||||||
def validate_credit_to_acc(self):
|
def validate_credit_to_acc(self):
|
||||||
root_type, account_type = frappe.db.get_value("Account", self.credit_to, ["root_type", "account_type"])
|
account_type = frappe.db.get_value("Account", self.credit_to, "account_type")
|
||||||
if root_type != "Liability":
|
|
||||||
frappe.throw(_("Credit To account must be a liability account"))
|
|
||||||
if account_type != "Payable":
|
if account_type != "Payable":
|
||||||
frappe.throw(_("Credit To account must be a Payable account"))
|
frappe.throw(_("Credit To account must be a Payable account"))
|
||||||
|
|
||||||
|
|||||||
@ -235,9 +235,7 @@ class SalesInvoice(SellingController):
|
|||||||
reconcile_against_document(lst)
|
reconcile_against_document(lst)
|
||||||
|
|
||||||
def validate_debit_to_acc(self):
|
def validate_debit_to_acc(self):
|
||||||
root_type, account_type = frappe.db.get_value("Account", self.debit_to, ["root_type", "account_type"])
|
account_type = frappe.db.get_value("Account", self.debit_to, "account_type")
|
||||||
if root_type != "Asset":
|
|
||||||
frappe.throw(_("Debit To account must be a liability account"))
|
|
||||||
if account_type != "Receivable":
|
if account_type != "Receivable":
|
||||||
frappe.throw(_("Debit To account must be a Receivable account"))
|
frappe.throw(_("Debit To account must be a Receivable account"))
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
from frappe.utils import flt, cstr
|
from frappe.utils import flt, cstr, cint
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.model.meta import get_field_precision
|
from frappe.model.meta import get_field_precision
|
||||||
from erpnext.accounts.utils import validate_expense_against_budget
|
from erpnext.accounts.utils import validate_expense_against_budget
|
||||||
@ -82,14 +82,15 @@ def make_entry(args, adv_adj, update_outstanding):
|
|||||||
gle.submit()
|
gle.submit()
|
||||||
|
|
||||||
def validate_account_for_auto_accounting_for_stock(gl_map):
|
def validate_account_for_auto_accounting_for_stock(gl_map):
|
||||||
if gl_map[0].voucher_type=="Journal Entry":
|
if cint(frappe.db.get_single_value("Accounts Settings", "auto_accounting_for_stock")) \
|
||||||
aii_accounts = [d[0] for d in frappe.db.sql("""select name from tabAccount
|
and gl_map[0].voucher_type=="Journal Entry":
|
||||||
where account_type = 'Warehouse' and ifnull(warehouse, '')!=''""")]
|
aii_accounts = [d[0] for d in frappe.db.sql("""select name from tabAccount
|
||||||
|
where account_type = 'Warehouse' and ifnull(warehouse, '')!=''""")]
|
||||||
|
|
||||||
for entry in gl_map:
|
for entry in gl_map:
|
||||||
if entry.account in aii_accounts:
|
if entry.account in aii_accounts:
|
||||||
frappe.throw(_("Account: {0} can only be updated via Stock Transactions")
|
frappe.throw(_("Account: {0} can only be updated via Stock Transactions")
|
||||||
.format(entry.account), StockAccountInvalidTransaction)
|
.format(entry.account), StockAccountInvalidTransaction)
|
||||||
|
|
||||||
def round_off_debit_credit(gl_map):
|
def round_off_debit_credit(gl_map):
|
||||||
precision = get_field_precision(frappe.get_meta("GL Entry").get_field("debit"),
|
precision = get_field_precision(frappe.get_meta("GL Entry").get_field("debit"),
|
||||||
|
|||||||
@ -66,7 +66,7 @@ def get_gl_entries(filters):
|
|||||||
|
|
||||||
gl_entries = frappe.db.sql("""select posting_date, account, party_type, party,
|
gl_entries = frappe.db.sql("""select posting_date, account, party_type, party,
|
||||||
sum(ifnull(debit, 0)) as debit, sum(ifnull(credit, 0)) as credit,
|
sum(ifnull(debit, 0)) as debit, sum(ifnull(credit, 0)) as credit,
|
||||||
voucher_type, voucher_no, cost_center, remarks, against
|
voucher_type, voucher_no, cost_center, remarks, against, is_opening
|
||||||
from `tabGL Entry`
|
from `tabGL Entry`
|
||||||
where company=%(company)s {conditions}
|
where company=%(company)s {conditions}
|
||||||
{group_by_condition}
|
{group_by_condition}
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.utils import cint, flt, getdate, formatdate
|
from frappe.utils import cint, flt, getdate, formatdate, cstr
|
||||||
from erpnext.accounts.report.financial_statements import filter_accounts, get_gl_entries
|
from erpnext.accounts.report.financial_statements import filter_accounts, get_gl_entries
|
||||||
|
|
||||||
value_fields = ("opening_debit", "opening_credit", "debit", "credit", "closing_debit", "closing_credit")
|
value_fields = ("opening_debit", "opening_credit", "debit", "credit", "closing_debit", "closing_credit")
|
||||||
@ -133,10 +133,7 @@ def calculate_values(accounts, gl_entries_by_account, opening_balances, filters)
|
|||||||
d["opening_credit"] = opening_balances.get(d.name, {}).get("opening_credit", 0)
|
d["opening_credit"] = opening_balances.get(d.name, {}).get("opening_credit", 0)
|
||||||
|
|
||||||
for entry in gl_entries_by_account.get(d.name, []):
|
for entry in gl_entries_by_account.get(d.name, []):
|
||||||
if entry.is_opening == "Yes" and d.root_type in ("Asset", "Liability", "Equity"):
|
if cstr(entry.is_opening) != "Yes":
|
||||||
d["opening_debit"] += flt(entry.debit)
|
|
||||||
d["opening_credit"] += flt(entry.credit)
|
|
||||||
else:
|
|
||||||
d["debit"] += flt(entry.debit)
|
d["debit"] += flt(entry.debit)
|
||||||
d["credit"] += flt(entry.credit)
|
d["credit"] += flt(entry.credit)
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@ app_publisher = "Frappe Technologies Pvt. Ltd. and Contributors"
|
|||||||
app_description = "Open Source Enterprise Resource Planning for Small and Midsized Organizations"
|
app_description = "Open Source Enterprise Resource Planning for Small and Midsized Organizations"
|
||||||
app_icon = "icon-th"
|
app_icon = "icon-th"
|
||||||
app_color = "#e74c3c"
|
app_color = "#e74c3c"
|
||||||
app_version = "5.0.26"
|
app_version = "5.0.27"
|
||||||
|
|
||||||
error_report_email = "support@erpnext.com"
|
error_report_email = "support@erpnext.com"
|
||||||
|
|
||||||
|
|||||||
@ -339,6 +339,7 @@ def add_block_dates(events, start, end, employee, company):
|
|||||||
events.append({
|
events.append({
|
||||||
"doctype": "Leave Block List Date",
|
"doctype": "Leave Block List Date",
|
||||||
"from_date": block_date.block_date,
|
"from_date": block_date.block_date,
|
||||||
|
"to_date": block_date.block_date,
|
||||||
"title": _("Leave Blocked") + ": " + block_date.reason,
|
"title": _("Leave Blocked") + ": " + block_date.reason,
|
||||||
"name": "_" + str(cnt),
|
"name": "_" + str(cnt),
|
||||||
})
|
})
|
||||||
@ -355,6 +356,7 @@ def add_holidays(events, start, end, employee, company):
|
|||||||
events.append({
|
events.append({
|
||||||
"doctype": "Holiday",
|
"doctype": "Holiday",
|
||||||
"from_date": holiday.holiday_date,
|
"from_date": holiday.holiday_date,
|
||||||
|
"to_date": holiday.holiday_date,
|
||||||
"title": _("Holiday") + ": " + cstr(holiday.description),
|
"title": _("Holiday") + ": " + cstr(holiday.description),
|
||||||
"name": holiday.name
|
"name": holiday.name
|
||||||
})
|
})
|
||||||
|
|||||||
@ -30,8 +30,8 @@ def create_receivable_payable_account():
|
|||||||
|
|
||||||
account_id = account.name
|
account_id = account.name
|
||||||
|
|
||||||
frappe.db.set_value("Company", args["company"], ("default_receivable_account"
|
frappe.db.set_value("Company", args["company"], ("default_receivable_account"
|
||||||
if args["account_type"]=="Receivable" else "default_payable_account"), account_id)
|
if args["account_type"]=="Receivable" else "default_payable_account"), account_id)
|
||||||
|
|
||||||
receivable_payable_accounts.setdefault(args["company"], {}).setdefault(args["account_type"], account_id)
|
receivable_payable_accounts.setdefault(args["company"], {}).setdefault(args["account_type"], account_id)
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,6 @@ def execute():
|
|||||||
account_settings = frappe.get_doc("Accounts Settings")
|
account_settings = frappe.get_doc("Accounts Settings")
|
||||||
|
|
||||||
if not account_settings.frozen_accounts_modifier and account_settings.bde_auth_role:
|
if not account_settings.frozen_accounts_modifier and account_settings.bde_auth_role:
|
||||||
frappe.db.set_value("Account Settings", None,
|
frappe.db.set_value("Accounts Settings", None,
|
||||||
"frozen_accounts_modifier", account_settings.bde_auth_role)
|
"frozen_accounts_modifier", account_settings.bde_auth_role)
|
||||||
|
|
||||||
|
|||||||
@ -54,7 +54,7 @@ def get_stock_ledger_entries(filters):
|
|||||||
return frappe.db.sql("""select item_code, batch_no, warehouse,
|
return frappe.db.sql("""select item_code, batch_no, warehouse,
|
||||||
posting_date, actual_qty
|
posting_date, actual_qty
|
||||||
from `tabStock Ledger Entry`
|
from `tabStock Ledger Entry`
|
||||||
where docstatus < 2 %s order by item_code, warehouse""" %
|
where docstatus < 2 and ifnull(batch_no, '') != '' %s order by item_code, warehouse""" %
|
||||||
conditions, as_dict=1)
|
conditions, as_dict=1)
|
||||||
|
|
||||||
def get_item_warehouse_batch_map(filters, float_precision):
|
def get_item_warehouse_batch_map(filters, float_precision):
|
||||||
|
|||||||
2
setup.py
2
setup.py
@ -1,6 +1,6 @@
|
|||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
version = "5.0.26"
|
version = "5.0.27"
|
||||||
|
|
||||||
with open("requirements.txt", "r") as f:
|
with open("requirements.txt", "r") as f:
|
||||||
install_requires = f.readlines()
|
install_requires = f.readlines()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user