Merge remote-tracking branch 'frappe/develop' into develop
This commit is contained in:
commit
fcfb5a3769
@ -81,7 +81,6 @@ class PurchaseInvoice(BuyingController):
|
|||||||
self.validate_write_off_account()
|
self.validate_write_off_account()
|
||||||
self.validate_multiple_billing("Purchase Receipt", "pr_detail", "amount", "items")
|
self.validate_multiple_billing("Purchase Receipt", "pr_detail", "amount", "items")
|
||||||
self.validate_fixed_asset()
|
self.validate_fixed_asset()
|
||||||
self.validate_fixed_asset_account()
|
|
||||||
self.create_remarks()
|
self.create_remarks()
|
||||||
self.set_status()
|
self.set_status()
|
||||||
validate_inter_company_party(self.doctype, self.supplier, self.company, self.inter_company_invoice_reference)
|
validate_inter_company_party(self.doctype, self.supplier, self.company, self.inter_company_invoice_reference)
|
||||||
@ -436,7 +435,7 @@ class PurchaseInvoice(BuyingController):
|
|||||||
"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
|
"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
|
||||||
"credit": flt(item.rm_supp_cost)
|
"credit": flt(item.rm_supp_cost)
|
||||||
}, warehouse_account[self.supplier_warehouse]["account_currency"]))
|
}, warehouse_account[self.supplier_warehouse]["account_currency"]))
|
||||||
else:
|
elif not item.is_fixed_asset:
|
||||||
gl_entries.append(
|
gl_entries.append(
|
||||||
self.get_gl_dict({
|
self.get_gl_dict({
|
||||||
"account": item.expense_account,
|
"account": item.expense_account,
|
||||||
@ -479,11 +478,17 @@ class PurchaseInvoice(BuyingController):
|
|||||||
|
|
||||||
asset_amount = flt(item.net_amount) + flt(item.item_tax_amount/self.conversion_rate)
|
asset_amount = flt(item.net_amount) + flt(item.item_tax_amount/self.conversion_rate)
|
||||||
base_asset_amount = flt(item.base_net_amount + item.item_tax_amount)
|
base_asset_amount = flt(item.base_net_amount + item.item_tax_amount)
|
||||||
|
item.expense_account = item.expense_account or asset_accounts[0]
|
||||||
|
|
||||||
|
if (not item.expense_account or frappe.db.get_value('Account',
|
||||||
|
item.expense_account, 'account_type') != 'Asset Received But Not Billed'):
|
||||||
|
frappe.throw(_("Row {0}: Expense account must be of type Asset Received But Not Billed").
|
||||||
|
format(item.idx))
|
||||||
|
|
||||||
if not self.update_stock:
|
if not self.update_stock:
|
||||||
asset_rbnb_currency = get_account_currency(asset_accounts[0])
|
asset_rbnb_currency = get_account_currency(item.expense_account)
|
||||||
gl_entries.append(self.get_gl_dict({
|
gl_entries.append(self.get_gl_dict({
|
||||||
"account": asset_accounts[0],
|
"account": item.expense_account,
|
||||||
"against": self.supplier,
|
"against": self.supplier,
|
||||||
"remarks": self.get("remarks") or _("Accounting Entry for Asset"),
|
"remarks": self.get("remarks") or _("Accounting Entry for Asset"),
|
||||||
"debit": base_asset_amount,
|
"debit": base_asset_amount,
|
||||||
@ -518,7 +523,7 @@ class PurchaseInvoice(BuyingController):
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
if item.item_tax_amount and not cint(erpnext.is_perpetual_inventory_enabled(self.company)):
|
if item.item_tax_amount and not cint(erpnext.is_perpetual_inventory_enabled(self.company)):
|
||||||
asset_eiiav_currency = get_account_currency(asset_accounts[0])
|
asset_eiiav_currency = get_account_currency(asset_accounts[1])
|
||||||
gl_entries.append(self.get_gl_dict({
|
gl_entries.append(self.get_gl_dict({
|
||||||
"account": asset_accounts[1],
|
"account": asset_accounts[1],
|
||||||
"against": self.supplier,
|
"against": self.supplier,
|
||||||
@ -751,13 +756,6 @@ class PurchaseInvoice(BuyingController):
|
|||||||
for pr in set(updated_pr):
|
for pr in set(updated_pr):
|
||||||
frappe.get_doc("Purchase Receipt", pr).update_billing_percentage(update_modified=update_modified)
|
frappe.get_doc("Purchase Receipt", pr).update_billing_percentage(update_modified=update_modified)
|
||||||
|
|
||||||
def validate_fixed_asset_account(self):
|
|
||||||
for d in self.get('items'):
|
|
||||||
if d.is_fixed_asset:
|
|
||||||
account_type = frappe.db.get_value("Account", d.expense_account, "account_type")
|
|
||||||
if account_type != 'Fixed Asset':
|
|
||||||
frappe.throw(_("Row {0}# Account must be of type 'Fixed Asset'").format(d.idx))
|
|
||||||
|
|
||||||
def on_recurring(self, reference_doc, auto_repeat_doc):
|
def on_recurring(self, reference_doc, auto_repeat_doc):
|
||||||
self.due_date = None
|
self.due_date = None
|
||||||
|
|
||||||
|
@ -11,6 +11,9 @@ from erpnext.accounts.utils import get_account_currency
|
|||||||
|
|
||||||
|
|
||||||
def execute(filters=None):
|
def execute(filters=None):
|
||||||
|
if not filters:
|
||||||
|
return [], []
|
||||||
|
|
||||||
account_details = {}
|
account_details = {}
|
||||||
|
|
||||||
if filters and filters.get('print_in_account_currency') and \
|
if filters and filters.get('print_in_account_currency') and \
|
||||||
|
@ -621,8 +621,8 @@ class AccountsController(TransactionBase):
|
|||||||
def validate_fixed_asset(self):
|
def validate_fixed_asset(self):
|
||||||
for d in self.get("items"):
|
for d in self.get("items"):
|
||||||
if d.is_fixed_asset:
|
if d.is_fixed_asset:
|
||||||
if d.qty > 1:
|
# if d.qty > 1:
|
||||||
frappe.throw(_("Row #{0}: Qty must be 1, as item is a fixed asset. Please use separate row for multiple qty.").format(d.idx))
|
# frappe.throw(_("Row #{0}: Qty must be 1, as item is a fixed asset. Please use separate row for multiple qty.").format(d.idx))
|
||||||
|
|
||||||
if d.meta.get_field("asset") and d.asset:
|
if d.meta.get_field("asset") and d.asset:
|
||||||
asset = frappe.get_doc("Asset", d.asset)
|
asset = frappe.get_doc("Asset", d.asset)
|
||||||
|
@ -366,7 +366,7 @@ def get_expense_account(doctype, txt, searchfield, start, page_len, filters):
|
|||||||
|
|
||||||
return frappe.db.sql("""select tabAccount.name from `tabAccount`
|
return frappe.db.sql("""select tabAccount.name from `tabAccount`
|
||||||
where (tabAccount.report_type = "Profit and Loss"
|
where (tabAccount.report_type = "Profit and Loss"
|
||||||
or tabAccount.account_type in ("Expense Account", "Fixed Asset", "Temporary"))
|
or tabAccount.account_type in ("Expense Account", "Fixed Asset", "Temporary", "Asset Received But Not Billed"))
|
||||||
and tabAccount.is_group=0
|
and tabAccount.is_group=0
|
||||||
and tabAccount.docstatus!=2
|
and tabAccount.docstatus!=2
|
||||||
and tabAccount.{key} LIKE %(txt)s
|
and tabAccount.{key} LIKE %(txt)s
|
||||||
|
Loading…
x
Reference in New Issue
Block a user