Merge branch 'develop' into fg_based_operating_cost

This commit is contained in:
Vishal Dhayagude 2023-01-11 22:30:36 +05:30 committed by GitHub
commit 467a2b5cb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 26 additions and 31 deletions

View File

@ -247,7 +247,7 @@ class PaymentEntry(AccountsController):
self.set_target_exchange_rate(ref_doc)
def set_source_exchange_rate(self, ref_doc=None):
if self.paid_from and not self.source_exchange_rate:
if self.paid_from:
if self.paid_from_account_currency == self.company_currency:
self.source_exchange_rate = 1
else:

View File

@ -743,9 +743,9 @@ class TestPurchaseOrder(FrappeTestCase):
pe = get_payment_entry("Purchase Order", po_doc.name)
pe.mode_of_payment = "Cash"
pe.paid_from = "Cash - _TC"
pe.source_exchange_rate = 80
pe.target_exchange_rate = 1
pe.paid_amount = po_doc.grand_total
pe.source_exchange_rate = 1
pe.target_exchange_rate = 80
pe.paid_amount = po_doc.base_grand_total
pe.save(ignore_permissions=True)
pe.submit()

View File

@ -216,6 +216,7 @@ class RequestforQuotation(BuyingController):
recipients=data.email_id,
sender=sender,
attachments=attachments,
print_format=self.meta.default_print_format or "Standard",
send_email=True,
doctype=self.doctype,
name=self.name,
@ -224,9 +225,7 @@ class RequestforQuotation(BuyingController):
frappe.msgprint(_("Email Sent to Supplier {0}").format(data.supplier))
def get_attachments(self):
attachments = [d.name for d in get_attachments(self.doctype, self.name)]
attachments.append(frappe.attach_print(self.doctype, self.name, doc=self))
return attachments
return [d.name for d in get_attachments(self.doctype, self.name)]
def update_rfq_supplier_status(self, sup_name=None):
for supplier in self.suppliers:

View File

@ -316,6 +316,7 @@ erpnext.patches.v14_0.create_accounting_dimensions_in_subcontracting_doctypes
erpnext.patches.v14_0.fix_subcontracting_receipt_gl_entries
erpnext.patches.v14_0.migrate_remarks_from_gl_to_payment_ledger
erpnext.patches.v13_0.update_schedule_type_in_loans
erpnext.patches.v13_0.drop_unused_sle_index_parts
erpnext.patches.v14_0.create_accounting_dimensions_for_asset_capitalization
erpnext.patches.v14_0.update_partial_tds_fields
erpnext.patches.v14_0.create_incoterms_and_migrate_shipment

View File

@ -0,0 +1,14 @@
import frappe
from erpnext.stock.doctype.stock_ledger_entry.stock_ledger_entry import on_doctype_update
def execute():
try:
frappe.db.sql_ddl("ALTER TABLE `tabStock Ledger Entry` DROP INDEX `posting_sort_index`")
except Exception:
frappe.log_error("Failed to drop index")
return
# Recreate indexes
on_doctype_update()

View File

@ -1691,7 +1691,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
var valid = true;
$.each(["company", "customer"], function(i, fieldname) {
if(frappe.meta.has_field(me.frm.doc.doctype, fieldname) && me.frm.doc.doctype != "Purchase Order") {
if(frappe.meta.has_field(me.frm.doc.doctype, fieldname) && !["Purchase Order","Purchase Invoice"].includes(me.frm.doc.doctype)) {
if (!me.frm.doc[fieldname]) {
frappe.msgprint(__("Please specify") + ": " +
frappe.meta.get_label(me.frm.doc.doctype, fieldname, me.frm.doc.name) +

View File

@ -221,14 +221,9 @@ class StockLedgerEntry(Document):
def on_doctype_update():
if not frappe.db.has_index("tabStock Ledger Entry", "posting_sort_index"):
frappe.db.commit()
frappe.db.add_index(
"Stock Ledger Entry",
fields=["posting_date", "posting_time", "name"],
index_name="posting_sort_index",
)
frappe.db.add_index(
"Stock Ledger Entry", fields=["posting_date", "posting_time"], index_name="posting_sort_index"
)
frappe.db.add_index("Stock Ledger Entry", ["voucher_no", "voucher_type"])
frappe.db.add_index("Stock Ledger Entry", ["batch_no", "item_code", "warehouse"])
frappe.db.add_index("Stock Ledger Entry", ["warehouse", "item_code"], "item_warehouse")

View File

@ -41,7 +41,7 @@ def get_data(report_filters):
key = (d.voucher_type, d.voucher_no)
gl_data = voucher_wise_gl_data.get(key) or {}
d.account_value = gl_data.get("account_value", 0)
d.difference_value = abs(d.stock_value - d.account_value)
d.difference_value = d.stock_value - d.account_value
if abs(d.difference_value) > 0.1:
data.append(d)

View File

@ -1270,20 +1270,6 @@ def get_valuation_rate(
(item_code, warehouse, voucher_no, voucher_type),
)
if not last_valuation_rate:
# Get valuation rate from last sle for the item against any warehouse
last_valuation_rate = frappe.db.sql(
"""select valuation_rate
from `tabStock Ledger Entry` force index (item_code)
where
item_code = %s
AND valuation_rate > 0
AND is_cancelled = 0
AND NOT(voucher_no = %s AND voucher_type = %s)
order by posting_date desc, posting_time desc, name desc limit 1""",
(item_code, voucher_no, voucher_type),
)
if last_valuation_rate:
return flt(last_valuation_rate[0][0])