mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-16 08:05:00 +00:00
Merge branch 'develop' into fix_discount_mismatch
This commit is contained in:
@@ -317,7 +317,7 @@ def get_already_booked_amount(doc, item):
|
||||
def book_deferred_income_or_expense(doc, deferred_process, posting_date=None):
|
||||
enable_check = "enable_deferred_revenue" if doc.doctype == "Sales Invoice" else "enable_deferred_expense"
|
||||
|
||||
accounts_frozen_upto = frappe.db.get_single_value("Accounts Settings", "acc_frozen_upto")
|
||||
accounts_frozen_upto = frappe.get_single_value("Accounts Settings", "acc_frozen_upto")
|
||||
|
||||
def _book_deferred_revenue_or_expense(
|
||||
item,
|
||||
|
||||
@@ -92,7 +92,7 @@ class Account(NestedSet):
|
||||
super().on_update()
|
||||
|
||||
def onload(self):
|
||||
frozen_accounts_modifier = frappe.db.get_single_value("Accounts Settings", "frozen_accounts_modifier")
|
||||
frozen_accounts_modifier = frappe.get_single_value("Accounts Settings", "frozen_accounts_modifier")
|
||||
if not frozen_accounts_modifier or frozen_accounts_modifier in frappe.get_roles():
|
||||
self.set_onload("can_freeze_account", True)
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ class AutoMatchParty:
|
||||
deposit=self.deposit,
|
||||
).match()
|
||||
|
||||
fuzzy_matching_enabled = frappe.db.get_single_value("Accounts Settings", "enable_fuzzy_matching")
|
||||
fuzzy_matching_enabled = frappe.get_single_value("Accounts Settings", "enable_fuzzy_matching")
|
||||
if not result and fuzzy_matching_enabled:
|
||||
result = AutoMatchbyPartyNameDescription(
|
||||
bank_party_name=self.bank_party_name, description=self.description, deposit=self.deposit
|
||||
|
||||
@@ -121,7 +121,7 @@ class BankTransaction(Document):
|
||||
self.allocate_payment_entries()
|
||||
self.set_status()
|
||||
|
||||
if frappe.db.get_single_value("Accounts Settings", "enable_party_matching"):
|
||||
if frappe.get_single_value("Accounts Settings", "enable_party_matching"):
|
||||
self.auto_set_party()
|
||||
|
||||
def before_update_after_submit(self):
|
||||
|
||||
@@ -7,7 +7,7 @@ from frappe import _
|
||||
from frappe.model.document import Document
|
||||
from frappe.model.meta import get_field_precision
|
||||
from frappe.model.naming import set_name_from_naming_options
|
||||
from frappe.utils import flt, fmt_money, now
|
||||
from frappe.utils import create_batch, flt, fmt_money, now
|
||||
|
||||
import erpnext
|
||||
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
|
||||
@@ -451,12 +451,15 @@ def rename_gle_sle_docs():
|
||||
def rename_temporarily_named_docs(doctype):
|
||||
"""Rename temporarily named docs using autoname options"""
|
||||
docs_to_rename = frappe.get_all(doctype, {"to_rename": "1"}, order_by="creation", limit=50000)
|
||||
for doc in docs_to_rename:
|
||||
oldname = doc.name
|
||||
set_name_from_naming_options(frappe.get_meta(doctype).autoname, doc)
|
||||
newname = doc.name
|
||||
frappe.db.sql(
|
||||
f"UPDATE `tab{doctype}` SET name = %s, to_rename = 0, modified = %s where name = %s",
|
||||
(newname, now(), oldname),
|
||||
auto_commit=True,
|
||||
)
|
||||
autoname = frappe.get_meta(doctype).autoname
|
||||
|
||||
for batch in create_batch(docs_to_rename, 100):
|
||||
for doc in batch:
|
||||
oldname = doc.name
|
||||
set_name_from_naming_options(autoname, doc)
|
||||
newname = doc.name
|
||||
frappe.db.sql(
|
||||
f"UPDATE `tab{doctype}` SET name = %s, to_rename = 0, modified = %s where name = %s",
|
||||
(newname, now(), oldname),
|
||||
)
|
||||
frappe.db.commit()
|
||||
|
||||
@@ -1171,7 +1171,7 @@ class JournalEntry(AccountsController):
|
||||
def make_gl_entries(self, cancel=0, adv_adj=0):
|
||||
from erpnext.accounts.general_ledger import make_gl_entries
|
||||
|
||||
merge_entries = frappe.db.get_single_value("Accounts Settings", "merge_similar_account_heads")
|
||||
merge_entries = frappe.get_single_value("Accounts Settings", "merge_similar_account_heads")
|
||||
|
||||
gl_map = self.build_gl_map()
|
||||
if self.voucher_type in ("Deferred Revenue", "Deferred Expense"):
|
||||
|
||||
@@ -2969,7 +2969,7 @@ def get_payment_entry(
|
||||
created_from_payment_request=False,
|
||||
):
|
||||
doc = frappe.get_doc(dt, dn)
|
||||
over_billing_allowance = frappe.db.get_single_value("Accounts Settings", "over_billing_allowance")
|
||||
over_billing_allowance = frappe.get_single_value("Accounts Settings", "over_billing_allowance")
|
||||
if dt in ("Sales Order", "Purchase Order") and flt(doc.per_billed, 2) >= (100.0 + over_billing_allowance):
|
||||
frappe.throw(_("Can only make payment against unbilled {0}").format(_(dt)))
|
||||
|
||||
@@ -3109,7 +3109,7 @@ def get_payment_entry(
|
||||
if party_account and bank:
|
||||
if discount_amount:
|
||||
base_total_discount_loss = 0
|
||||
if frappe.db.get_single_value("Accounts Settings", "book_tax_discount_loss"):
|
||||
if frappe.get_single_value("Accounts Settings", "book_tax_discount_loss"):
|
||||
base_total_discount_loss = split_early_payment_discount_loss(pe, doc, valid_discounts)
|
||||
|
||||
set_pending_discount_loss(
|
||||
@@ -3463,7 +3463,7 @@ def set_pending_discount_loss(pe, doc, discount_amount, base_total_discount_loss
|
||||
|
||||
# If tax loss booking is enabled, pending loss will be rounding loss.
|
||||
# Otherwise it will be the total discount loss.
|
||||
book_tax_loss = frappe.db.get_single_value("Accounts Settings", "book_tax_discount_loss")
|
||||
book_tax_loss = frappe.get_single_value("Accounts Settings", "book_tax_discount_loss")
|
||||
account_type = "round_off_account" if book_tax_loss else "default_discount_account"
|
||||
|
||||
pe.append(
|
||||
|
||||
@@ -407,7 +407,7 @@ class PaymentReconciliation(Document):
|
||||
|
||||
@frappe.whitelist()
|
||||
def is_auto_process_enabled(self):
|
||||
return frappe.db.get_single_value("Accounts Settings", "auto_reconcile_payments")
|
||||
return frappe.get_single_value("Accounts Settings", "auto_reconcile_payments")
|
||||
|
||||
@frappe.whitelist()
|
||||
def calculate_difference_on_allocation_change(self, payment_entry, invoice, allocated_amount):
|
||||
@@ -532,7 +532,7 @@ class PaymentReconciliation(Document):
|
||||
|
||||
@frappe.whitelist()
|
||||
def reconcile(self):
|
||||
if frappe.db.get_single_value("Accounts Settings", "auto_reconcile_payments"):
|
||||
if frappe.get_single_value("Accounts Settings", "auto_reconcile_payments"):
|
||||
running_doc = is_any_doc_running(
|
||||
dict(
|
||||
company=self.company,
|
||||
|
||||
@@ -60,7 +60,7 @@ class POSClosingEntry(StatusUpdater):
|
||||
if frappe.db.get_value("POS Opening Entry", self.pos_opening_entry, "status") != "Open":
|
||||
frappe.throw(_("Selected POS Opening Entry should be open."), title=_("Invalid Opening Entry"))
|
||||
|
||||
self.is_pos_using_sales_invoice = frappe.db.get_single_value(
|
||||
self.is_pos_using_sales_invoice = frappe.get_single_value(
|
||||
"Accounts Settings", "use_sales_invoice_in_pos"
|
||||
)
|
||||
|
||||
@@ -301,7 +301,7 @@ def make_closing_entry_from_opening(opening_entry):
|
||||
closing_entry.net_total = 0
|
||||
closing_entry.total_quantity = 0
|
||||
|
||||
is_pos_using_sales_invoice = frappe.db.get_single_value("Accounts Settings", "use_sales_invoice_in_pos")
|
||||
is_pos_using_sales_invoice = frappe.get_single_value("Accounts Settings", "use_sales_invoice_in_pos")
|
||||
|
||||
pos_invoices = (
|
||||
get_pos_invoices(
|
||||
|
||||
@@ -424,7 +424,7 @@ class POSInvoice(SalesInvoice):
|
||||
)
|
||||
|
||||
def validate_is_pos_using_sales_invoice(self):
|
||||
self.is_pos_using_sales_invoice = frappe.db.get_single_value(
|
||||
self.is_pos_using_sales_invoice = frappe.get_single_value(
|
||||
"Accounts Settings", "use_sales_invoice_in_pos"
|
||||
)
|
||||
if self.is_pos_using_sales_invoice and not self.is_return:
|
||||
|
||||
@@ -142,7 +142,7 @@ def trigger_job_for_doc(docname: str | None = None):
|
||||
if not docname:
|
||||
return
|
||||
|
||||
if not frappe.db.get_single_value("Accounts Settings", "auto_reconcile_payments"):
|
||||
if not frappe.get_single_value("Accounts Settings", "auto_reconcile_payments"):
|
||||
frappe.throw(
|
||||
_("Auto Reconciliation of Payments has been disabled. Enable it through {0}").format(
|
||||
get_link_to_form("Accounts Settings", "Accounts Settings")
|
||||
@@ -190,7 +190,7 @@ def trigger_reconciliation_for_queued_docs():
|
||||
Will be called from Cron Job
|
||||
Fetch queued docs and start reconciliation process for each one
|
||||
"""
|
||||
if not frappe.db.get_single_value("Accounts Settings", "auto_reconcile_payments"):
|
||||
if not frappe.get_single_value("Accounts Settings", "auto_reconcile_payments"):
|
||||
frappe.msgprint(
|
||||
_("Auto Reconciliation of Payments has been disabled. Enable it through {0}").format(
|
||||
get_link_to_form("Accounts Settings", "Accounts Settings")
|
||||
@@ -210,7 +210,7 @@ def trigger_reconciliation_for_queued_docs():
|
||||
|
||||
docs_to_trigger = []
|
||||
unique_filters = set()
|
||||
queue_size = frappe.db.get_single_value("Accounts Settings", "reconciliation_queue_size") or 5
|
||||
queue_size = frappe.get_single_value("Accounts Settings", "reconciliation_queue_size") or 5
|
||||
|
||||
fields = ["company", "party_type", "party", "receivable_payable_account", "default_advance_account"]
|
||||
|
||||
|
||||
@@ -1729,7 +1729,7 @@ class PurchaseInvoice(BuyingController):
|
||||
frappe.throw(_("Supplier Invoice Date cannot be greater than Posting Date"))
|
||||
|
||||
if self.bill_no:
|
||||
if cint(frappe.db.get_single_value("Accounts Settings", "check_supplier_invoice_uniqueness")):
|
||||
if cint(frappe.get_single_value("Accounts Settings", "check_supplier_invoice_uniqueness")):
|
||||
fiscal_year = get_fiscal_year(self.posting_date, company=self.company, as_dict=True)
|
||||
|
||||
pi = frappe.db.sql(
|
||||
|
||||
@@ -495,7 +495,7 @@ class SalesInvoice(SellingController):
|
||||
|
||||
self.update_time_sheet(self.name)
|
||||
|
||||
if frappe.db.get_single_value("Selling Settings", "sales_update_frequency") == "Each Transaction":
|
||||
if frappe.get_single_value("Selling Settings", "sales_update_frequency") == "Each Transaction":
|
||||
update_company_current_month_sales(self.company)
|
||||
self.update_project()
|
||||
update_linked_doc(self.doctype, self.name, self.inter_company_invoice_reference)
|
||||
@@ -611,7 +611,7 @@ class SalesInvoice(SellingController):
|
||||
if self.coupon_code:
|
||||
update_coupon_code_count(self.coupon_code, "cancelled")
|
||||
|
||||
if frappe.db.get_single_value("Selling Settings", "sales_update_frequency") == "Each Transaction":
|
||||
if frappe.get_single_value("Selling Settings", "sales_update_frequency") == "Each Transaction":
|
||||
update_company_current_month_sales(self.company)
|
||||
self.update_project()
|
||||
if not self.is_return and not self.is_consolidated and self.loyalty_program:
|
||||
@@ -1016,7 +1016,7 @@ class SalesInvoice(SellingController):
|
||||
)
|
||||
|
||||
if (
|
||||
cint(frappe.db.get_single_value("Selling Settings", "maintain_same_sales_rate"))
|
||||
cint(frappe.get_single_value("Selling Settings", "maintain_same_sales_rate"))
|
||||
and not self.is_return
|
||||
and not self.is_internal_customer
|
||||
):
|
||||
@@ -1063,7 +1063,7 @@ class SalesInvoice(SellingController):
|
||||
"Delivery Note": ["dn_required", "update_stock"],
|
||||
}
|
||||
for key, value in prev_doc_field_map.items():
|
||||
if frappe.db.get_single_value("Selling Settings", value[0]) == "Yes":
|
||||
if frappe.get_single_value("Selling Settings", value[0]) == "Yes":
|
||||
if frappe.get_value("Customer", self.customer, value[0]):
|
||||
continue
|
||||
|
||||
@@ -1096,7 +1096,7 @@ class SalesInvoice(SellingController):
|
||||
if self.is_created_using_pos and not self.pos_profile:
|
||||
frappe.throw(_("POS Profile is mandatory to mark this invoice as POS Transaction."))
|
||||
|
||||
self.is_pos_using_sales_invoice = frappe.db.get_single_value(
|
||||
self.is_pos_using_sales_invoice = frappe.get_single_value(
|
||||
"Accounts Settings", "use_sales_invoice_in_pos"
|
||||
)
|
||||
if not self.is_pos_using_sales_invoice and not self.is_return:
|
||||
@@ -1468,7 +1468,7 @@ class SalesInvoice(SellingController):
|
||||
|
||||
def make_tax_gl_entries(self, gl_entries):
|
||||
enable_discount_accounting = cint(
|
||||
frappe.db.get_single_value("Selling Settings", "enable_discount_accounting")
|
||||
frappe.get_single_value("Selling Settings", "enable_discount_accounting")
|
||||
)
|
||||
|
||||
for tax in self.get("taxes"):
|
||||
@@ -1518,7 +1518,7 @@ class SalesInvoice(SellingController):
|
||||
def make_item_gl_entries(self, gl_entries):
|
||||
# income account gl entries
|
||||
enable_discount_accounting = cint(
|
||||
frappe.db.get_single_value("Selling Settings", "enable_discount_accounting")
|
||||
frappe.get_single_value("Selling Settings", "enable_discount_accounting")
|
||||
)
|
||||
|
||||
for item in self.get("items"):
|
||||
@@ -1593,7 +1593,7 @@ class SalesInvoice(SellingController):
|
||||
def enable_discount_accounting(self):
|
||||
if not hasattr(self, "_enable_discount_accounting"):
|
||||
self._enable_discount_accounting = cint(
|
||||
frappe.db.get_single_value("Selling Settings", "enable_discount_accounting")
|
||||
frappe.get_single_value("Selling Settings", "enable_discount_accounting")
|
||||
)
|
||||
|
||||
return self._enable_discount_accounting
|
||||
@@ -1635,7 +1635,7 @@ class SalesInvoice(SellingController):
|
||||
def make_pos_gl_entries(self, gl_entries):
|
||||
if cint(self.is_pos):
|
||||
skip_change_gl_entries = not cint(
|
||||
frappe.db.get_single_value("Accounts Settings", "post_change_gl_entries")
|
||||
frappe.get_single_value("Accounts Settings", "post_change_gl_entries")
|
||||
)
|
||||
|
||||
for payment_mode in self.payments:
|
||||
@@ -2920,7 +2920,7 @@ def check_if_return_invoice_linked_with_payment_entry(self):
|
||||
# If a Return invoice is linked with payment entry along with other invoices,
|
||||
# the cancellation of the Return causes allocated amount to be greater than paid
|
||||
|
||||
if not frappe.db.get_single_value("Accounts Settings", "unlink_payment_on_cancellation_of_invoice"):
|
||||
if not frappe.get_single_value("Accounts Settings", "unlink_payment_on_cancellation_of_invoice"):
|
||||
return
|
||||
|
||||
payment_entries = []
|
||||
|
||||
@@ -35,7 +35,7 @@ def make_gl_entries(
|
||||
):
|
||||
if gl_map:
|
||||
if (
|
||||
frappe.db.get_single_value("Accounts Settings", "use_new_budget_controller")
|
||||
frappe.get_single_value("Accounts Settings", "use_new_budget_controller")
|
||||
and gl_map[0].voucher_type != "Period Closing Voucher"
|
||||
):
|
||||
bud_val = BudgetValidation(gl_map=gl_map)
|
||||
@@ -743,9 +743,9 @@ def check_freezing_date(posting_date, adv_adj=False):
|
||||
Hence stop admin to bypass if accounts are freezed
|
||||
"""
|
||||
if not adv_adj:
|
||||
acc_frozen_upto = frappe.db.get_single_value("Accounts Settings", "acc_frozen_upto")
|
||||
acc_frozen_upto = frappe.get_single_value("Accounts Settings", "acc_frozen_upto")
|
||||
if acc_frozen_upto:
|
||||
frozen_accounts_modifier = frappe.db.get_single_value(
|
||||
frozen_accounts_modifier = frappe.get_single_value(
|
||||
"Accounts Settings", "frozen_accounts_modifier"
|
||||
)
|
||||
if getdate(posting_date) <= getdate(acc_frozen_upto) and (
|
||||
@@ -825,4 +825,4 @@ def validate_allowed_dimensions(gl_entry, dimension_filter_map):
|
||||
|
||||
|
||||
def is_immutable_ledger_enabled():
|
||||
return frappe.db.get_single_value("Accounts Settings", "enable_immutable_ledger")
|
||||
return frappe.get_single_value("Accounts Settings", "enable_immutable_ledger")
|
||||
|
||||
@@ -689,7 +689,7 @@ def validate_due_date_with_template(posting_date, due_date, bill_date, template_
|
||||
return
|
||||
|
||||
if default_due_date != posting_date and getdate(due_date) > getdate(default_due_date):
|
||||
if frappe.db.get_single_value("Accounts Settings", "credit_controller") in frappe.get_roles():
|
||||
if frappe.get_single_value("Accounts Settings", "credit_controller") in frappe.get_roles():
|
||||
party_type = "supplier" if doctype == "Purchase Invoice" else "customer"
|
||||
|
||||
msgprint(
|
||||
@@ -703,7 +703,7 @@ def validate_due_date_with_template(posting_date, due_date, bill_date, template_
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_address_tax_category(tax_category=None, billing_address=None, shipping_address=None):
|
||||
addr_tax_category_from = frappe.db.get_single_value(
|
||||
addr_tax_category_from = frappe.get_single_value(
|
||||
"Accounts Settings", "determine_address_tax_category_from"
|
||||
)
|
||||
if addr_tax_category_from == "Shipping Address":
|
||||
@@ -803,7 +803,7 @@ def validate_party_frozen_disabled(party_type, party_name):
|
||||
if party.disabled:
|
||||
frappe.throw(_("{0} {1} is disabled").format(party_type, party_name), PartyDisabled)
|
||||
elif party.get("is_frozen"):
|
||||
frozen_accounts_modifier = frappe.db.get_single_value(
|
||||
frozen_accounts_modifier = frappe.get_single_value(
|
||||
"Accounts Settings", "frozen_accounts_modifier"
|
||||
)
|
||||
if frozen_accounts_modifier not in frappe.get_roles():
|
||||
|
||||
@@ -6,6 +6,7 @@ from collections import OrderedDict
|
||||
|
||||
import frappe
|
||||
from frappe import _, qb, query_builder, scrub
|
||||
from frappe.desk.reportview import build_match_conditions
|
||||
from frappe.query_builder import Criterion
|
||||
from frappe.query_builder.functions import Date, Substring, Sum
|
||||
from frappe.utils import cint, cstr, flt, getdate, nowdate
|
||||
@@ -57,7 +58,7 @@ class ReceivablePayableReport:
|
||||
self.ranges = [num.strip() for num in self.filters.range.split(",") if num.strip().isdigit()]
|
||||
self.range_numbers = [num for num in range(1, len(self.ranges) + 2)]
|
||||
self.ple_fetch_method = (
|
||||
frappe.db.get_single_value("Accounts Settings", "receivable_payable_fetch_method")
|
||||
frappe.get_single_value("Accounts Settings", "receivable_payable_fetch_method")
|
||||
or "Buffered Cursor"
|
||||
) # Fail Safe
|
||||
|
||||
@@ -126,7 +127,7 @@ class ReceivablePayableReport:
|
||||
self.build_data()
|
||||
|
||||
def fetch_ple_in_buffered_cursor(self):
|
||||
query, param = self.ple_query.walk()
|
||||
query, param = self.ple_query
|
||||
self.ple_entries = frappe.db.sql(query, param, as_dict=True)
|
||||
|
||||
for ple in self.ple_entries:
|
||||
@@ -140,7 +141,7 @@ class ReceivablePayableReport:
|
||||
|
||||
def fetch_ple_in_unbuffered_cursor(self):
|
||||
self.ple_entries = []
|
||||
query, param = self.ple_query.walk()
|
||||
query, param = self.ple_query
|
||||
with frappe.db.unbuffered_cursor():
|
||||
for ple in frappe.db.sql(query, param, as_dict=True, as_iterator=True):
|
||||
self.init_voucher_balance(ple) # invoiced, paid, credit_note, outstanding
|
||||
@@ -449,16 +450,14 @@ class ReceivablePayableReport:
|
||||
self.invoice_details = frappe._dict()
|
||||
if self.account_type == "Receivable":
|
||||
# nosemgrep
|
||||
si_list = frappe.db.sql(
|
||||
"""
|
||||
select name, due_date, po_no
|
||||
from `tabSales Invoice`
|
||||
where posting_date <= %s
|
||||
and company = %s
|
||||
and docstatus = 1
|
||||
""",
|
||||
(self.filters.report_date, self.filters.company),
|
||||
as_dict=1,
|
||||
si_list = frappe.get_list(
|
||||
"Sales Invoice",
|
||||
filters={
|
||||
"posting_date": ("<=", self.filters.report_date),
|
||||
"company": self.filters.company,
|
||||
"docstatus": 1,
|
||||
},
|
||||
fields=["name", "due_date", "po_no"],
|
||||
)
|
||||
for d in si_list:
|
||||
self.invoice_details.setdefault(d.name, d)
|
||||
@@ -481,33 +480,29 @@ class ReceivablePayableReport:
|
||||
|
||||
if self.account_type == "Payable":
|
||||
# nosemgrep
|
||||
for pi in frappe.db.sql(
|
||||
"""
|
||||
select name, due_date, bill_no, bill_date
|
||||
from `tabPurchase Invoice`
|
||||
where
|
||||
posting_date <= %s
|
||||
and company = %s
|
||||
and docstatus = 1
|
||||
""",
|
||||
(self.filters.report_date, self.filters.company),
|
||||
as_dict=1,
|
||||
):
|
||||
invoices = frappe.get_list(
|
||||
"Purchase Invoice",
|
||||
filters={
|
||||
"posting_date": ("<=", self.filters.report_date),
|
||||
"company": self.filters.company,
|
||||
"docstatus": 1,
|
||||
},
|
||||
fields=["name", "due_date", "bill_no", "bill_date"],
|
||||
)
|
||||
|
||||
for pi in invoices:
|
||||
self.invoice_details.setdefault(pi.name, pi)
|
||||
|
||||
# Invoices booked via Journal Entries
|
||||
# nosemgrep
|
||||
journal_entries = frappe.db.sql(
|
||||
"""
|
||||
select name, due_date, bill_no, bill_date
|
||||
from `tabJournal Entry`
|
||||
where
|
||||
posting_date <= %s
|
||||
and company = %s
|
||||
and docstatus = 1
|
||||
""",
|
||||
(self.filters.report_date, self.filters.company),
|
||||
as_dict=1,
|
||||
journal_entries = frappe.get_list(
|
||||
"Journal Entry",
|
||||
filters={
|
||||
"posting_date": ("<=", self.filters.report_date),
|
||||
"company": self.filters.company,
|
||||
"docstatus": 1,
|
||||
},
|
||||
fields=["name", "due_date", "bill_no", "bill_date"],
|
||||
)
|
||||
|
||||
for je in journal_entries:
|
||||
@@ -849,19 +844,25 @@ class ReceivablePayableReport:
|
||||
)
|
||||
|
||||
if self.filters.get("show_remarks"):
|
||||
if remarks_length := frappe.db.get_single_value(
|
||||
if remarks_length := frappe.get_single_value(
|
||||
"Accounts Settings", "receivable_payable_remarks_length"
|
||||
):
|
||||
query = query.select(Substring(ple.remarks, 1, remarks_length).as_("remarks"))
|
||||
else:
|
||||
query = query.select(ple.remarks)
|
||||
|
||||
if self.filters.get("group_by_party"):
|
||||
query = query.orderby(self.ple.party, self.ple.posting_date)
|
||||
else:
|
||||
query = query.orderby(self.ple.posting_date, self.ple.party)
|
||||
query, param = query.walk()
|
||||
|
||||
self.ple_query = query
|
||||
match_conditions = build_match_conditions("Payment Ledger Entry")
|
||||
if match_conditions:
|
||||
query += " AND " + match_conditions
|
||||
|
||||
if self.filters.get("group_by_party"):
|
||||
query += f" ORDER BY `{self.ple.party.name}`, `{self.ple.posting_date.name}`"
|
||||
else:
|
||||
query += f" ORDER BY `{self.ple.posting_date.name}`, `{self.ple.party.name}`"
|
||||
|
||||
self.ple_query = (query, param)
|
||||
|
||||
def get_sales_invoices_or_customers_based_on_sales_person(self):
|
||||
if self.filters.get("sales_person"):
|
||||
|
||||
@@ -210,6 +210,7 @@ class PartyLedgerSummaryReport:
|
||||
"fieldtype": "Link",
|
||||
"options": "Currency",
|
||||
"width": 50,
|
||||
"hidden": 1,
|
||||
},
|
||||
]
|
||||
|
||||
@@ -242,6 +243,7 @@ class PartyLedgerSummaryReport:
|
||||
}
|
||||
]
|
||||
|
||||
columns.append({"label": _("Dr/Cr"), "fieldname": "dr_or_cr", "fieldtype": "Data", "width": 100})
|
||||
return columns
|
||||
|
||||
def get_data(self):
|
||||
@@ -300,6 +302,13 @@ class PartyLedgerSummaryReport:
|
||||
for account in self.party_adjustment_accounts:
|
||||
row["adj_" + scrub(account)] = adjustments.get(account, 0)
|
||||
|
||||
if self.filters.party_type == "Customer":
|
||||
balance = row.get("closing_balance", 0)
|
||||
row["dr_or_cr"] = "Dr" if balance > 0 else "Cr" if balance < 0 else ""
|
||||
else:
|
||||
balance = row.get("closing_balance", 0)
|
||||
row["dr_or_cr"] = "Cr" if balance > 0 else "Dr" if balance < 0 else ""
|
||||
|
||||
out.append(row)
|
||||
|
||||
return out
|
||||
|
||||
@@ -435,9 +435,7 @@ def set_gl_entries_by_account(
|
||||
gl_entries = []
|
||||
|
||||
# For balance sheet
|
||||
ignore_closing_balances = frappe.db.get_single_value(
|
||||
"Accounts Settings", "ignore_account_closing_balance"
|
||||
)
|
||||
ignore_closing_balances = frappe.get_single_value("Accounts Settings", "ignore_account_closing_balance")
|
||||
if not from_date and not ignore_closing_balances:
|
||||
last_period_closing_voucher = frappe.db.get_all(
|
||||
"Period Closing Voucher",
|
||||
@@ -519,9 +517,7 @@ def get_accounting_entries(
|
||||
.where(gl_entry.company == filters.company)
|
||||
)
|
||||
|
||||
ignore_is_opening = frappe.db.get_single_value(
|
||||
"Accounts Settings", "ignore_is_opening_check_for_reporting"
|
||||
)
|
||||
ignore_is_opening = frappe.get_single_value("Accounts Settings", "ignore_is_opening_check_for_reporting")
|
||||
|
||||
if doctype == "GL Entry":
|
||||
query = query.select(gl_entry.posting_date, gl_entry.is_opening, gl_entry.fiscal_year)
|
||||
|
||||
@@ -163,7 +163,7 @@ def get_gl_entries(filters, accounting_dimensions):
|
||||
credit_in_account_currency """
|
||||
|
||||
if filters.get("show_remarks"):
|
||||
if remarks_length := frappe.db.get_single_value("Accounts Settings", "general_ledger_remarks_length"):
|
||||
if remarks_length := frappe.get_single_value("Accounts Settings", "general_ledger_remarks_length"):
|
||||
select_fields += f",substr(remarks, 1, {remarks_length}) as 'remarks'"
|
||||
else:
|
||||
select_fields += """,remarks"""
|
||||
@@ -218,9 +218,7 @@ def get_gl_entries(filters, accounting_dimensions):
|
||||
def get_conditions(filters):
|
||||
conditions = []
|
||||
|
||||
ignore_is_opening = frappe.db.get_single_value(
|
||||
"Accounts Settings", "ignore_is_opening_check_for_reporting"
|
||||
)
|
||||
ignore_is_opening = frappe.get_single_value("Accounts Settings", "ignore_is_opening_check_for_reporting")
|
||||
|
||||
if filters.get("account"):
|
||||
filters.account = get_accounts_with_children(filters.account)
|
||||
@@ -480,7 +478,7 @@ def get_accountwise_gle(filters, accounting_dimensions, gl_entries, gle_map):
|
||||
if filters.get("show_net_values_in_party_account"):
|
||||
account_type_map = get_account_type_map(filters.get("company"))
|
||||
|
||||
immutable_ledger = frappe.db.get_single_value("Accounts Settings", "enable_immutable_ledger")
|
||||
immutable_ledger = frappe.get_single_value("Accounts Settings", "enable_immutable_ledger")
|
||||
|
||||
def update_value_in_dict(data, key, gle):
|
||||
data[key].debit += gle.debit
|
||||
|
||||
@@ -6,6 +6,7 @@ import frappe
|
||||
from frappe import _
|
||||
from frappe.model.meta import get_field_precision
|
||||
from frappe.utils import cstr, flt
|
||||
from frappe.utils.nestedset import get_descendants_of
|
||||
from frappe.utils.xlsxutils import handle_html
|
||||
from pypika import Order
|
||||
|
||||
@@ -376,7 +377,12 @@ def apply_conditions(query, si, sii, filters, additional_conditions=None):
|
||||
query = query.where(sii.item_code == filters.get("item_code"))
|
||||
|
||||
if filters.get("item_group"):
|
||||
query = query.where(sii.item_group == filters.get("item_group"))
|
||||
if frappe.db.get_value("Item Group", filters.get("item_group"), "is_group"):
|
||||
item_groups = get_descendants_of("Item Group", filters.get("item_group"))
|
||||
item_groups.append(filters.get("item_group"))
|
||||
query = query.where(sii.item_group.isin(item_groups))
|
||||
else:
|
||||
query = query.where(sii.item_group == filters.get("item_group"))
|
||||
|
||||
if filters.get("income_account"):
|
||||
query = query.where(
|
||||
|
||||
@@ -9,7 +9,7 @@ from frappe.utils import getdate
|
||||
|
||||
def execute(filters=None):
|
||||
if filters.get("party_type") == "Customer":
|
||||
party_naming_by = frappe.db.get_single_value("Selling Settings", "cust_master_name")
|
||||
party_naming_by = frappe.get_single_value("Selling Settings", "cust_master_name")
|
||||
else:
|
||||
party_naming_by = frappe.db.get_single_value("Buying Settings", "supp_master_name")
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ from erpnext.accounts.utils import get_fiscal_year
|
||||
|
||||
def execute(filters=None):
|
||||
if filters.get("party_type") == "Customer":
|
||||
party_naming_by = frappe.db.get_single_value("Selling Settings", "cust_master_name")
|
||||
party_naming_by = frappe.get_single_value("Selling Settings", "cust_master_name")
|
||||
else:
|
||||
party_naming_by = frappe.db.get_single_value("Buying Settings", "supp_master_name")
|
||||
|
||||
|
||||
@@ -89,9 +89,7 @@ def get_data(filters):
|
||||
)
|
||||
company_currency = filters.presentation_currency or erpnext.get_company_currency(filters.company)
|
||||
|
||||
ignore_is_opening = frappe.db.get_single_value(
|
||||
"Accounts Settings", "ignore_is_opening_check_for_reporting"
|
||||
)
|
||||
ignore_is_opening = frappe.get_single_value("Accounts Settings", "ignore_is_opening_check_for_reporting")
|
||||
|
||||
if not accounts:
|
||||
return None
|
||||
@@ -148,9 +146,7 @@ def get_rootwise_opening_balances(filters, report_type, ignore_is_opening):
|
||||
gle = []
|
||||
|
||||
last_period_closing_voucher = ""
|
||||
ignore_closing_balances = frappe.db.get_single_value(
|
||||
"Accounts Settings", "ignore_account_closing_balance"
|
||||
)
|
||||
ignore_closing_balances = frappe.get_single_value("Accounts Settings", "ignore_account_closing_balance")
|
||||
|
||||
if not ignore_closing_balances:
|
||||
last_period_closing_voucher = frappe.db.get_all(
|
||||
|
||||
@@ -256,7 +256,7 @@ def is_party_name_visible(filters):
|
||||
|
||||
if filters.get("party_type") in ["Customer", "Supplier"]:
|
||||
if filters.get("party_type") == "Customer":
|
||||
party_naming_by = frappe.db.get_single_value("Selling Settings", "cust_master_name")
|
||||
party_naming_by = frappe.get_single_value("Selling Settings", "cust_master_name")
|
||||
else:
|
||||
party_naming_by = frappe.db.get_single_value("Buying Settings", "supp_master_name")
|
||||
|
||||
|
||||
@@ -886,7 +886,7 @@ def cancel_common_party_journal(self):
|
||||
if self.doctype not in ["Sales Invoice", "Purchase Invoice"]:
|
||||
return
|
||||
|
||||
if not frappe.db.get_single_value("Accounts Settings", "enable_common_party_accounting"):
|
||||
if not frappe.get_single_value("Accounts Settings", "enable_common_party_accounting"):
|
||||
return
|
||||
|
||||
party_link = self.get_common_party_link()
|
||||
@@ -2312,7 +2312,7 @@ def run_ledger_health_checks():
|
||||
|
||||
|
||||
def sync_auto_reconcile_config(auto_reconciliation_job_trigger: int = 15):
|
||||
auto_reconciliation_job_trigger = auto_reconciliation_job_trigger or frappe.db.get_single_value(
|
||||
auto_reconciliation_job_trigger = auto_reconciliation_job_trigger or frappe.get_single_value(
|
||||
"Accounts Settings", "auto_reconciliation_job_trigger"
|
||||
)
|
||||
method = "erpnext.accounts.doctype.process_payment_reconciliation.process_payment_reconciliation.trigger_reconciliation_for_queued_docs"
|
||||
|
||||
@@ -207,8 +207,8 @@
|
||||
"fieldname": "purchase_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Purchase Date",
|
||||
"mandatory_depends_on": "eval:!doc.is_existing_asset && !doc.is_composite_asset",
|
||||
"read_only_depends_on": "eval:!doc.is_existing_asset && !doc.is_composite_asset"
|
||||
"read_only_depends_on": "eval:!doc.is_existing_asset && !doc.is_composite_asset",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "disposal_date",
|
||||
|
||||
@@ -91,7 +91,7 @@ class Asset(AccountsController):
|
||||
opening_number_of_booked_depreciations: DF.Int
|
||||
policy_number: DF.Data | None
|
||||
purchase_amount: DF.Currency
|
||||
purchase_date: DF.Date | None
|
||||
purchase_date: DF.Date
|
||||
purchase_invoice: DF.Link | None
|
||||
purchase_invoice_item: DF.Data | None
|
||||
purchase_receipt: DF.Link | None
|
||||
|
||||
@@ -35,9 +35,7 @@ from erpnext.assets.doctype.asset_depreciation_schedule.asset_depreciation_sched
|
||||
|
||||
def post_depreciation_entries(date=None):
|
||||
# Return if automatic booking of asset depreciation is disabled
|
||||
if not cint(
|
||||
frappe.db.get_single_value("Accounts Settings", "book_asset_depreciation_entry_automatically")
|
||||
):
|
||||
if not cint(frappe.get_single_value("Accounts Settings", "book_asset_depreciation_entry_automatically")):
|
||||
return
|
||||
|
||||
date = date or today()
|
||||
@@ -114,12 +112,12 @@ def make_depreciation_entry_on_disposal(asset_doc, disposal_date=None):
|
||||
|
||||
|
||||
def get_acc_frozen_upto():
|
||||
acc_frozen_upto = frappe.db.get_single_value("Accounts Settings", "acc_frozen_upto")
|
||||
acc_frozen_upto = frappe.get_single_value("Accounts Settings", "acc_frozen_upto")
|
||||
|
||||
if not acc_frozen_upto:
|
||||
return
|
||||
|
||||
frozen_accounts_modifier = frappe.db.get_single_value("Accounts Settings", "frozen_accounts_modifier")
|
||||
frozen_accounts_modifier = frappe.get_single_value("Accounts Settings", "frozen_accounts_modifier")
|
||||
|
||||
if frozen_accounts_modifier not in frappe.get_roles() or frappe.session.user == "Administrator":
|
||||
return getdate(acc_frozen_upto)
|
||||
|
||||
@@ -251,7 +251,7 @@ class DepreciationScheduleController(StraightLineMethod, WDVMethod):
|
||||
return depr_booked_for_months
|
||||
|
||||
def get_total_pending_days_or_years(self):
|
||||
if cint(frappe.db.get_single_value("Accounts Settings", "calculate_depr_using_total_days")):
|
||||
if cint(frappe.get_single_value("Accounts Settings", "calculate_depr_using_total_days")):
|
||||
last_depr_date = self.get_last_booked_depreciation_date()
|
||||
if last_depr_date:
|
||||
self.total_pending_days = date_diff(self.final_schedule_date, last_depr_date) - 1
|
||||
|
||||
@@ -38,7 +38,7 @@ class StraightLineMethod(Document):
|
||||
return daily_depr_amount * total_depreciable_days
|
||||
|
||||
def get_daily_depr_amount(self):
|
||||
if cint(frappe.db.get_single_value("Accounts Settings", "calculate_depr_using_total_days")):
|
||||
if cint(frappe.get_single_value("Accounts Settings", "calculate_depr_using_total_days")):
|
||||
return self.depreciable_value / self.total_pending_days
|
||||
else:
|
||||
yearly_depr_amount = self.depreciable_value / self.total_pending_years
|
||||
|
||||
@@ -403,7 +403,7 @@ class AccountsController(TransactionBase):
|
||||
self.remove_serial_and_batch_bundle()
|
||||
|
||||
# delete sl and gl entries on deletion of transaction
|
||||
if frappe.db.get_single_value("Accounts Settings", "delete_linked_ledger_entries"):
|
||||
if frappe.get_single_value("Accounts Settings", "delete_linked_ledger_entries"):
|
||||
# delete linked exchange gain/loss journal
|
||||
delete_exchange_gain_loss_journal(self)
|
||||
|
||||
@@ -744,9 +744,7 @@ class AccountsController(TransactionBase):
|
||||
frappe.throw(_(msg), title=_("Internal Transfer Reference Missing"))
|
||||
|
||||
def validate_internal_transaction(self):
|
||||
if not cint(
|
||||
frappe.db.get_single_value("Accounts Settings", "maintain_same_internal_transaction_rate")
|
||||
):
|
||||
if not cint(frappe.get_single_value("Accounts Settings", "maintain_same_internal_transaction_rate")):
|
||||
return
|
||||
|
||||
doctypes_list = ["Sales Order", "Sales Invoice", "Purchase Order", "Purchase Invoice"]
|
||||
@@ -1143,7 +1141,7 @@ class AccountsController(TransactionBase):
|
||||
return True
|
||||
|
||||
def set_taxes_and_charges(self):
|
||||
if frappe.db.get_single_value("Accounts Settings", "add_taxes_from_item_tax_template"):
|
||||
if frappe.get_single_value("Accounts Settings", "add_taxes_from_item_tax_template"):
|
||||
if hasattr(self, "taxes_and_charges") and not self.get("taxes") and not self.get("is_pos"):
|
||||
if tax_master_doctype := self.meta.get_field("taxes_and_charges").options:
|
||||
self.append_taxes_from_master(tax_master_doctype)
|
||||
@@ -1156,7 +1154,7 @@ class AccountsController(TransactionBase):
|
||||
self.extend("taxes", get_taxes_and_charges(tax_master_doctype, self.get("taxes_and_charges")))
|
||||
|
||||
def append_taxes_from_item_tax_template(self):
|
||||
if not frappe.db.get_single_value("Accounts Settings", "add_taxes_from_item_tax_template"):
|
||||
if not frappe.get_single_value("Accounts Settings", "add_taxes_from_item_tax_template"):
|
||||
return
|
||||
|
||||
for row in self.items:
|
||||
@@ -1497,7 +1495,7 @@ class AccountsController(TransactionBase):
|
||||
return res
|
||||
|
||||
def is_inclusive_tax(self):
|
||||
is_inclusive = cint(frappe.db.get_single_value("Accounts Settings", "show_inclusive_tax_in_print"))
|
||||
is_inclusive = cint(frappe.get_single_value("Accounts Settings", "show_inclusive_tax_in_print"))
|
||||
|
||||
if is_inclusive:
|
||||
is_inclusive = 0
|
||||
@@ -1507,7 +1505,7 @@ class AccountsController(TransactionBase):
|
||||
return is_inclusive
|
||||
|
||||
def should_show_taxes_as_table_in_print(self):
|
||||
return cint(frappe.db.get_single_value("Accounts Settings", "show_taxes_as_table_in_print"))
|
||||
return cint(frappe.get_single_value("Accounts Settings", "show_taxes_as_table_in_print"))
|
||||
|
||||
def validate_advance_entries(self):
|
||||
order_field = "sales_order" if self.doctype == "Sales Invoice" else "purchase_order"
|
||||
@@ -1884,13 +1882,11 @@ class AccountsController(TransactionBase):
|
||||
cancel_exchange_gain_loss_journal(self)
|
||||
cancel_common_party_journal(self)
|
||||
|
||||
if frappe.db.get_single_value("Accounts Settings", "unlink_payment_on_cancellation_of_invoice"):
|
||||
if frappe.get_single_value("Accounts Settings", "unlink_payment_on_cancellation_of_invoice"):
|
||||
unlink_ref_doc_from_payment_entries(self)
|
||||
|
||||
elif self.doctype in ["Sales Order", "Purchase Order"]:
|
||||
if frappe.db.get_single_value(
|
||||
"Accounts Settings", "unlink_advance_payment_on_cancelation_of_order"
|
||||
):
|
||||
if frappe.get_single_value("Accounts Settings", "unlink_advance_payment_on_cancelation_of_order"):
|
||||
unlink_ref_doc_from_payment_entries(self)
|
||||
|
||||
if self.doctype == "Sales Order":
|
||||
@@ -1966,7 +1962,7 @@ class AccountsController(TransactionBase):
|
||||
|
||||
def make_discount_gl_entries(self, gl_entries):
|
||||
enable_discount_accounting = cint(
|
||||
frappe.db.get_single_value("Selling Settings", "enable_discount_accounting")
|
||||
frappe.get_single_value("Selling Settings", "enable_discount_accounting")
|
||||
)
|
||||
|
||||
if enable_discount_accounting:
|
||||
@@ -2448,7 +2444,7 @@ class AccountsController(TransactionBase):
|
||||
grand_total = grand_total - flt(self.write_off_amount)
|
||||
po_or_so, doctype, fieldname = self.get_order_details()
|
||||
automatically_fetch_payment_terms = cint(
|
||||
frappe.db.get_single_value("Accounts Settings", "automatically_fetch_payment_terms")
|
||||
frappe.get_single_value("Accounts Settings", "automatically_fetch_payment_terms")
|
||||
)
|
||||
|
||||
if self.get("total_advance"):
|
||||
@@ -2731,7 +2727,7 @@ class AccountsController(TransactionBase):
|
||||
if not is_invoice:
|
||||
return
|
||||
|
||||
if frappe.db.get_single_value("Accounts Settings", "enable_common_party_accounting"):
|
||||
if frappe.get_single_value("Accounts Settings", "enable_common_party_accounting"):
|
||||
party_link = self.get_common_party_link()
|
||||
if party_link and self.outstanding_amount:
|
||||
self.create_advance_and_reconcile(party_link)
|
||||
@@ -3517,7 +3513,7 @@ def set_child_tax_template_and_map(item, child_item, parent_doc):
|
||||
|
||||
|
||||
def add_taxes_from_tax_template(child_item, parent_doc, db_insert=True):
|
||||
add_taxes_from_item_tax_template = frappe.db.get_single_value(
|
||||
add_taxes_from_item_tax_template = frappe.get_single_value(
|
||||
"Accounts Settings", "add_taxes_from_item_tax_template"
|
||||
)
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ class BuyingController(SubcontractingController):
|
||||
if self.docstatus == 1 and self.doctype in ["Purchase Receipt", "Purchase Invoice"]:
|
||||
self.set_onload(
|
||||
"allow_to_make_qc_after_submission",
|
||||
frappe.db.get_single_value(
|
||||
frappe.get_single_value(
|
||||
"Stock Settings", "allow_to_make_quality_inspection_after_purchase_or_delivery"
|
||||
),
|
||||
)
|
||||
@@ -545,7 +545,7 @@ class BuyingController(SubcontractingController):
|
||||
item.bom = None
|
||||
|
||||
def set_qty_as_per_stock_uom(self):
|
||||
allow_to_edit_stock_qty = frappe.db.get_single_value(
|
||||
allow_to_edit_stock_qty = frappe.get_single_value(
|
||||
"Stock Settings", "allow_to_edit_stock_uom_qty_for_purchase"
|
||||
)
|
||||
|
||||
@@ -842,7 +842,7 @@ class BuyingController(SubcontractingController):
|
||||
self.update_fixed_asset(field, delete_asset=True)
|
||||
|
||||
def validate_budget(self):
|
||||
if frappe.db.get_single_value("Accounts Settings", "use_new_budget_controller"):
|
||||
if frappe.get_single_value("Accounts Settings", "use_new_budget_controller"):
|
||||
from erpnext.controllers.budget_controller import BudgetValidation
|
||||
|
||||
val = BudgetValidation(doc=self)
|
||||
|
||||
@@ -948,7 +948,7 @@ def get_filtered_child_rows(doctype, txt, searchfield, start, page_len, filters)
|
||||
@frappe.whitelist()
|
||||
@frappe.validate_and_sanitize_search_inputs
|
||||
def get_item_uom_query(doctype, txt, searchfield, start, page_len, filters):
|
||||
if frappe.db.get_single_value("Stock Settings", "allow_uom_with_conversion_rate_defined_in_item"):
|
||||
if frappe.get_single_value("Stock Settings", "allow_uom_with_conversion_rate_defined_in_item"):
|
||||
query_filters = {"parent": filters.get("item_code")}
|
||||
|
||||
if txt:
|
||||
|
||||
@@ -38,7 +38,7 @@ class SellingController(StockController):
|
||||
if self.docstatus == 1 and self.doctype in ["Delivery Note", "Sales Invoice"]:
|
||||
self.set_onload(
|
||||
"allow_to_make_qc_after_submission",
|
||||
frappe.db.get_single_value(
|
||||
frappe.get_single_value(
|
||||
"Stock Settings", "allow_to_make_quality_inspection_after_purchase_or_delivery"
|
||||
),
|
||||
)
|
||||
@@ -224,7 +224,7 @@ class SellingController(StockController):
|
||||
frappe.throw(_("Maximum discount for Item {0} is {1}%").format(d.item_code, discount))
|
||||
|
||||
def set_qty_as_per_stock_uom(self):
|
||||
allow_to_edit_stock_qty = frappe.db.get_single_value(
|
||||
allow_to_edit_stock_qty = frappe.get_single_value(
|
||||
"Stock Settings", "allow_to_edit_stock_uom_qty_for_sales"
|
||||
)
|
||||
|
||||
@@ -255,9 +255,7 @@ class SellingController(StockController):
|
||||
title=_("Invalid Selling Price"),
|
||||
)
|
||||
|
||||
if self.get("is_return") or not frappe.db.get_single_value(
|
||||
"Selling Settings", "validate_selling_price"
|
||||
):
|
||||
if self.get("is_return") or not frappe.get_single_value("Selling Settings", "validate_selling_price"):
|
||||
return
|
||||
|
||||
is_internal_customer = self.get("is_internal_customer")
|
||||
@@ -717,7 +715,7 @@ class SellingController(StockController):
|
||||
|
||||
def validate_for_duplicate_items(self):
|
||||
check_list, chk_dupl_itm = [], []
|
||||
if cint(frappe.db.get_single_value("Selling Settings", "allow_multiple_items")):
|
||||
if cint(frappe.get_single_value("Selling Settings", "allow_multiple_items")):
|
||||
return
|
||||
if self.doctype == "Sales Invoice" and self.is_consolidated:
|
||||
return
|
||||
@@ -960,7 +958,7 @@ def get_serial_and_batch_bundle(child, parent, delivery_note_child=None):
|
||||
if child.get("use_serial_batch_fields"):
|
||||
return
|
||||
|
||||
if not frappe.db.get_single_value("Stock Settings", "auto_create_serial_and_batch_bundle_for_outward"):
|
||||
if not frappe.get_single_value("Stock Settings", "auto_create_serial_and_batch_bundle_for_outward"):
|
||||
return
|
||||
|
||||
item_details = frappe.db.get_value("Item", child.item_code, ["has_serial_no", "has_batch_no"], as_dict=1)
|
||||
|
||||
@@ -266,7 +266,7 @@ class StatusUpdater(Document):
|
||||
if hasattr(d, "qty") and d.qty > 0 and self.get("is_return"):
|
||||
frappe.throw(_("For an item {0}, quantity must be negative number").format(d.item_code))
|
||||
|
||||
if not frappe.db.get_single_value("Selling Settings", "allow_negative_rates_for_items"):
|
||||
if not frappe.get_single_value("Selling Settings", "allow_negative_rates_for_items"):
|
||||
if hasattr(d, "item_code") and hasattr(d, "rate") and flt(d.rate) < 0:
|
||||
frappe.throw(
|
||||
_(
|
||||
@@ -336,12 +336,10 @@ class StatusUpdater(Document):
|
||||
qty_or_amount,
|
||||
)
|
||||
|
||||
role_allowed_to_over_deliver_receive = frappe.db.get_single_value(
|
||||
role_allowed_to_over_deliver_receive = frappe.get_single_value(
|
||||
"Stock Settings", "role_allowed_to_over_deliver_receive"
|
||||
)
|
||||
role_allowed_to_over_bill = frappe.db.get_single_value(
|
||||
"Accounts Settings", "role_allowed_to_over_bill"
|
||||
)
|
||||
role_allowed_to_over_bill = frappe.get_single_value("Accounts Settings", "role_allowed_to_over_bill")
|
||||
role = role_allowed_to_over_deliver_receive if qty_or_amount == "qty" else role_allowed_to_over_bill
|
||||
|
||||
overflow_percent = (
|
||||
|
||||
@@ -518,7 +518,7 @@ class StockController(AccountsController):
|
||||
)
|
||||
|
||||
def set_use_serial_batch_fields(self):
|
||||
if frappe.db.get_single_value("Stock Settings", "use_serial_batch_fields"):
|
||||
if frappe.get_single_value("Stock Settings", "use_serial_batch_fields"):
|
||||
for row in self.items:
|
||||
row.use_serial_batch_fields = 1
|
||||
|
||||
@@ -1053,7 +1053,7 @@ class StockController(AccountsController):
|
||||
|
||||
for row in self.get("items"):
|
||||
qi_required = False
|
||||
if inspection_required_fieldname and frappe.db.get_value(
|
||||
if inspection_required_fieldname and frappe.get_cached_value(
|
||||
"Item", row.item_code, inspection_required_fieldname
|
||||
):
|
||||
qi_required = True
|
||||
@@ -1076,7 +1076,7 @@ class StockController(AccountsController):
|
||||
"Purchase Invoice",
|
||||
"Sales Invoice",
|
||||
"Delivery Note",
|
||||
] and frappe.db.get_single_value(
|
||||
] and frappe.get_single_value(
|
||||
"Stock Settings", "allow_to_make_quality_inspection_after_purchase_or_delivery"
|
||||
):
|
||||
return
|
||||
@@ -1092,7 +1092,7 @@ class StockController(AccountsController):
|
||||
|
||||
def validate_qi_submission(self, row):
|
||||
"""Check if QI is submitted on row level, during submission"""
|
||||
action = frappe.db.get_single_value("Stock Settings", "action_if_quality_inspection_is_not_submitted")
|
||||
action = frappe.get_single_value("Stock Settings", "action_if_quality_inspection_is_not_submitted")
|
||||
qa_docstatus = frappe.db.get_value("Quality Inspection", row.quality_inspection, "docstatus")
|
||||
|
||||
if qa_docstatus != 1:
|
||||
@@ -1107,7 +1107,7 @@ class StockController(AccountsController):
|
||||
|
||||
def validate_qi_rejection(self, row):
|
||||
"""Check if QI is rejected on row level, during submission"""
|
||||
action = frappe.db.get_single_value("Stock Settings", "action_if_quality_inspection_is_rejected")
|
||||
action = frappe.get_single_value("Stock Settings", "action_if_quality_inspection_is_rejected")
|
||||
qa_status = frappe.db.get_value("Quality Inspection", row.quality_inspection, "status")
|
||||
|
||||
if qa_status == "Rejected":
|
||||
@@ -1206,9 +1206,7 @@ class StockController(AccountsController):
|
||||
item_wise_received_qty = self.get_item_wise_inter_received_qty()
|
||||
precision = frappe.get_precision(self.doctype + " Item", "qty")
|
||||
|
||||
over_receipt_allowance = frappe.db.get_single_value(
|
||||
"Stock Settings", "over_delivery_receipt_allowance"
|
||||
)
|
||||
over_receipt_allowance = frappe.get_single_value("Stock Settings", "over_delivery_receipt_allowance")
|
||||
|
||||
parent_doctype = {
|
||||
"Purchase Receipt": "Delivery Note",
|
||||
@@ -1381,9 +1379,7 @@ class StockController(AccountsController):
|
||||
force = True
|
||||
|
||||
if force or future_sle_exists(args) or repost_required_for_queue(self):
|
||||
item_based_reposting = cint(
|
||||
frappe.db.get_single_value("Stock Reposting Settings", "item_based_reposting")
|
||||
)
|
||||
item_based_reposting = frappe.get_single_value("Stock Reposting Settings", "item_based_reposting")
|
||||
if item_based_reposting:
|
||||
create_item_wise_repost_entries(
|
||||
voucher_type=self.doctype,
|
||||
@@ -1675,7 +1671,7 @@ def is_reposting_pending():
|
||||
def future_sle_exists(args, sl_entries=None, allow_force_reposting=True):
|
||||
from erpnext.stock.utils import get_combine_datetime
|
||||
|
||||
if allow_force_reposting and frappe.db.get_single_value(
|
||||
if allow_force_reposting and frappe.get_single_value(
|
||||
"Stock Reposting Settings", "do_reposting_for_each_stock_transaction"
|
||||
):
|
||||
return True
|
||||
@@ -1769,7 +1765,7 @@ def get_conditions_to_validate_future_sle(sl_entries):
|
||||
for warehouse, items in warehouse_items_map.items():
|
||||
or_conditions.append(
|
||||
f"""warehouse = {frappe.db.escape(warehouse)}
|
||||
and item_code in ({', '.join(frappe.db.escape(item) for item in items)})"""
|
||||
and item_code in ({", ".join(frappe.db.escape(item) for item in items)})"""
|
||||
)
|
||||
|
||||
return or_conditions
|
||||
|
||||
@@ -590,7 +590,7 @@ class SubcontractingController(StockController):
|
||||
|
||||
rm_obj.reference_name = item_row.name
|
||||
|
||||
use_serial_batch_fields = frappe.db.get_single_value("Stock Settings", "use_serial_batch_fields")
|
||||
use_serial_batch_fields = frappe.get_single_value("Stock Settings", "use_serial_batch_fields")
|
||||
|
||||
if self.doctype == self.subcontract_data.order_doctype:
|
||||
rm_obj.required_qty = flt(qty, rm_obj.precision("required_qty"))
|
||||
|
||||
@@ -28,9 +28,7 @@ class calculate_taxes_and_totals:
|
||||
def __init__(self, doc: Document):
|
||||
self.doc = doc
|
||||
frappe.flags.round_off_applicable_accounts = []
|
||||
frappe.flags.round_row_wise_tax = frappe.db.get_single_value(
|
||||
"Accounts Settings", "round_row_wise_tax"
|
||||
)
|
||||
frappe.flags.round_row_wise_tax = frappe.get_single_value("Accounts Settings", "round_row_wise_tax")
|
||||
|
||||
if doc.get("round_off_applicable_accounts_for_tax_withholding"):
|
||||
frappe.flags.round_off_applicable_accounts.append(
|
||||
@@ -1170,7 +1168,7 @@ def get_rounded_tax_amount(itemised_tax, precision):
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_rounding_tax_settings():
|
||||
return frappe.db.get_single_value("Accounts Settings", "round_row_wise_tax")
|
||||
return frappe.get_single_value("Accounts Settings", "round_row_wise_tax")
|
||||
|
||||
|
||||
class init_landed_taxes_and_totals:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@ msgstr ""
|
||||
"Project-Id-Version: frappe\n"
|
||||
"Report-Msgid-Bugs-To: hello@frappe.io\n"
|
||||
"POT-Creation-Date: 2025-06-01 09:36+0000\n"
|
||||
"PO-Revision-Date: 2025-06-01 21:35\n"
|
||||
"PO-Revision-Date: 2025-06-03 22:20\n"
|
||||
"Last-Translator: hello@frappe.io\n"
|
||||
"Language-Team: Serbian (Latin)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@@ -22355,7 +22355,7 @@ msgstr "Prikazivanje otpisanih stavki"
|
||||
#. Option for the 'Coupon Type' (Select) field in DocType 'Coupon Code'
|
||||
#: erpnext/accounts/doctype/coupon_code/coupon_code.json
|
||||
msgid "Gift Card"
|
||||
msgstr "Poklon kartica"
|
||||
msgstr "Poklon-kartica"
|
||||
|
||||
#. Description of the 'Recurse Every (As Per Transaction UOM)' (Float) field in
|
||||
#. DocType 'Pricing Rule'
|
||||
@@ -25949,7 +25949,7 @@ msgstr "Izlazno"
|
||||
#. Label of the is_packed (Check) field in DocType 'Serial and Batch Bundle'
|
||||
#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.json
|
||||
msgid "Is Packed"
|
||||
msgstr ""
|
||||
msgstr "Upakovana stavka"
|
||||
|
||||
#. Label of the is_paid (Check) field in DocType 'Purchase Invoice'
|
||||
#: erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
|
||||
@@ -35260,7 +35260,7 @@ msgstr "Detalji stranke"
|
||||
#. Label of the party_full_name (Data) field in DocType 'Contract'
|
||||
#: erpnext/crm/doctype/contract/contract.json
|
||||
msgid "Party Full Name"
|
||||
msgstr ""
|
||||
msgstr "Pun naziv stranke"
|
||||
|
||||
#. Label of the bank_party_iban (Data) field in DocType 'Bank Transaction'
|
||||
#: erpnext/accounts/doctype/bank_transaction/bank_transaction.json
|
||||
|
||||
@@ -3,7 +3,7 @@ msgstr ""
|
||||
"Project-Id-Version: frappe\n"
|
||||
"Report-Msgid-Bugs-To: hello@frappe.io\n"
|
||||
"POT-Creation-Date: 2025-06-01 09:36+0000\n"
|
||||
"PO-Revision-Date: 2025-06-01 21:35\n"
|
||||
"PO-Revision-Date: 2025-06-05 23:00\n"
|
||||
"Last-Translator: hello@frappe.io\n"
|
||||
"Language-Team: Swedish\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@@ -23504,7 +23504,7 @@ msgstr "Om aktiverad, kommer alla filer som bifogas detta dokument att bifogas t
|
||||
#: erpnext/stock/doctype/stock_settings/stock_settings.json
|
||||
msgid "If enabled, do not update serial / batch values in the stock transactions on creation of auto Serial \n"
|
||||
" / Batch Bundle. "
|
||||
msgstr "Om aktiverad, uppdatera inte serie nummer /parti värde i lager transaktioner vid skapande av automatiskt Serie Nummer \n"
|
||||
msgstr "Om aktiverad, uppdatera inte serie nummer /parti värde i lager transaktioner vid skapande av automatiskt Serie \n"
|
||||
" / Parti Paket. "
|
||||
|
||||
#. Description of the 'Consider Projected Qty in Calculation' (Check) field in
|
||||
@@ -23551,7 +23551,7 @@ msgstr "Om aktiverad kommer system att tillåta val av Enhet i försäljning och
|
||||
#. in DocType 'Buying Settings'
|
||||
#: erpnext/buying/doctype/buying_settings/buying_settings.json
|
||||
msgid "If enabled, the system will generate an accounting entry for materials rejected in the Purchase Receipt."
|
||||
msgstr "Om aktiverat skapar system bokföring post för material som avvisats i Inköp Följesedel."
|
||||
msgstr "Om aktiverad, skapar system bokföring post för material som avvisats i Inköp Följesedel."
|
||||
|
||||
#. Description of the 'Do Not Use Batch-wise Valuation' (Check) field in
|
||||
#. DocType 'Stock Settings'
|
||||
@@ -57553,7 +57553,7 @@ msgstr "Uppdatera ändrad tidsstämpel på ny konversation mottagen i Potentiell
|
||||
#. 'CRM Settings'
|
||||
#: erpnext/crm/doctype/crm_settings/crm_settings.json
|
||||
msgid "Update timestamp on new communication"
|
||||
msgstr "Uppdatera tidsstämpel på ny Konversation"
|
||||
msgstr "Uppdatera tidsstämpel på ny kommunikation"
|
||||
|
||||
#: erpnext/manufacturing/doctype/bom_creator/bom_creator.py:534
|
||||
msgid "Updated successfully"
|
||||
|
||||
@@ -3,7 +3,7 @@ msgstr ""
|
||||
"Project-Id-Version: frappe\n"
|
||||
"Report-Msgid-Bugs-To: hello@frappe.io\n"
|
||||
"POT-Creation-Date: 2025-06-01 09:36+0000\n"
|
||||
"PO-Revision-Date: 2025-06-01 21:35\n"
|
||||
"PO-Revision-Date: 2025-06-04 22:49\n"
|
||||
"Last-Translator: hello@frappe.io\n"
|
||||
"Language-Team: Turkish\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@@ -4393,7 +4393,7 @@ msgstr "Kullanıcının Fiyatı Düzenlemesine İzin Verin"
|
||||
#. Settings'
|
||||
#: erpnext/stock/doctype/item_variant_settings/item_variant_settings.json
|
||||
msgid "Allow Variant UOM to be different from Template UOM"
|
||||
msgstr ""
|
||||
msgstr "Varyant Ölçü Biriminin Şablon Ölçü Biriminden farklı olmasına izin ver"
|
||||
|
||||
#. Label of the allow_zero_rate (Check) field in DocType 'Repost Item
|
||||
#. Valuation'
|
||||
@@ -5003,7 +5003,7 @@ msgstr "Tutar Farkı"
|
||||
#. DocType 'Purchase Receipt Item'
|
||||
#: erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
|
||||
msgid "Amount Difference with Purchase Invoice"
|
||||
msgstr ""
|
||||
msgstr "Satın Alma Faturası ile Fiyat Farkı"
|
||||
|
||||
#. Label of the amount_eligible_for_commission (Currency) field in DocType 'POS
|
||||
#. Invoice'
|
||||
@@ -5035,7 +5035,7 @@ msgstr "Hesap Para Birimindeki Tutar"
|
||||
|
||||
#: erpnext/accounts/print_format/sales_invoice_print/sales_invoice_print.html:119
|
||||
msgid "Amount in Words"
|
||||
msgstr ""
|
||||
msgstr "Yazı ile Tutar"
|
||||
|
||||
#. Description of the 'Outstanding Amount' (Currency) field in DocType 'Payment
|
||||
#. Request'
|
||||
@@ -8958,7 +8958,7 @@ msgstr "Satış Siparişinde Borç Limiti Kontrolünü Atla"
|
||||
|
||||
#: erpnext/accounts/print_format/sales_invoice_print/sales_invoice_print.html:11
|
||||
msgid "CANCELLED"
|
||||
msgstr ""
|
||||
msgstr "İPTAL EDİLDİ"
|
||||
|
||||
#. Label of the cc (Link) field in DocType 'Process Statement Of Accounts CC'
|
||||
#: erpnext/accounts/doctype/process_statement_of_accounts_cc/process_statement_of_accounts_cc.json
|
||||
@@ -9913,30 +9913,30 @@ msgstr ""
|
||||
|
||||
#: erpnext/buying/report/supplier_quotation_comparison/supplier_quotation_comparison.js:84
|
||||
msgid "Categorize by Item"
|
||||
msgstr ""
|
||||
msgstr "Ürüne Göre"
|
||||
|
||||
#: erpnext/accounts/report/general_ledger/general_ledger.js:133
|
||||
msgid "Categorize by Party"
|
||||
msgstr ""
|
||||
msgstr "Cariye Göre"
|
||||
|
||||
#: erpnext/buying/report/supplier_quotation_comparison/supplier_quotation_comparison.js:83
|
||||
#: erpnext/buying/report/supplier_quotation_comparison/supplier_quotation_comparison.js:86
|
||||
msgid "Categorize by Supplier"
|
||||
msgstr ""
|
||||
msgstr "Tedarikçiye Göre"
|
||||
|
||||
#. Option for the 'Categorize By' (Select) field in DocType 'Process Statement
|
||||
#. Of Accounts'
|
||||
#: erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.json
|
||||
#: erpnext/accounts/report/general_ledger/general_ledger.js:121
|
||||
msgid "Categorize by Voucher"
|
||||
msgstr ""
|
||||
msgstr "Faturaya Göre"
|
||||
|
||||
#. Option for the 'Categorize By' (Select) field in DocType 'Process Statement
|
||||
#. Of Accounts'
|
||||
#: erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.json
|
||||
#: erpnext/accounts/report/general_ledger/general_ledger.js:125
|
||||
msgid "Categorize by Voucher (Consolidated)"
|
||||
msgstr ""
|
||||
msgstr "Faturaya Göre (Konsolide)"
|
||||
|
||||
#. Label of the category (Link) field in DocType 'UOM Conversion Factor'
|
||||
#: erpnext/setup/doctype/uom_conversion_factor/uom_conversion_factor.json
|
||||
@@ -10633,7 +10633,7 @@ msgstr "Kapanış Metni"
|
||||
|
||||
#: erpnext/accounts/report/general_ledger/general_ledger.html:135
|
||||
msgid "Closing [Opening + Total] "
|
||||
msgstr ""
|
||||
msgstr "Kapanış [Açılış + Toplam] "
|
||||
|
||||
#. Label of the code (Data) field in DocType 'Incoterm'
|
||||
#: erpnext/edi/doctype/code_list/code_list_import.js:172
|
||||
@@ -14639,17 +14639,17 @@ msgstr "Müşteri Adlandırması"
|
||||
#. Supplier'
|
||||
#: erpnext/buying/doctype/customer_number_at_supplier/customer_number_at_supplier.json
|
||||
msgid "Customer Number"
|
||||
msgstr ""
|
||||
msgstr "Müşteri Numarası"
|
||||
|
||||
#. Name of a DocType
|
||||
#: erpnext/buying/doctype/customer_number_at_supplier/customer_number_at_supplier.json
|
||||
msgid "Customer Number At Supplier"
|
||||
msgstr ""
|
||||
msgstr "Tedarikçideki Müşteri Numarası"
|
||||
|
||||
#. Label of the customer_numbers (Table) field in DocType 'Supplier'
|
||||
#: erpnext/buying/doctype/supplier/supplier.json
|
||||
msgid "Customer Numbers"
|
||||
msgstr ""
|
||||
msgstr "Müşteri Numaraları"
|
||||
|
||||
#: erpnext/stock/report/delayed_item_report/delayed_item_report.py:165
|
||||
#: erpnext/stock/report/delayed_order_report/delayed_order_report.py:80
|
||||
@@ -14936,7 +14936,7 @@ msgstr "Tarihe Göre"
|
||||
#. 'Accounts Settings'
|
||||
#: erpnext/accounts/doctype/accounts_settings/accounts_settings.json
|
||||
msgid "Data Fetch Method"
|
||||
msgstr ""
|
||||
msgstr "Veri Alma Yöntemi"
|
||||
|
||||
#. Label of the data_import_configuration_section (Section Break) field in
|
||||
#. DocType 'Bank'
|
||||
@@ -16987,11 +16987,11 @@ msgstr "Fark Hesabı"
|
||||
|
||||
#: erpnext/stock/doctype/stock_entry/stock_entry.py:545
|
||||
msgid "Difference Account in Items Table"
|
||||
msgstr ""
|
||||
msgstr "Kalemler Tablosundaki Fark Hesabı"
|
||||
|
||||
#: erpnext/stock/doctype/stock_entry/stock_entry.py:534
|
||||
msgid "Difference Account must be a Asset/Liability type account (Temporary Opening), since this Stock Entry is an Opening Entry"
|
||||
msgstr ""
|
||||
msgstr "Bu Stok Mutabakatı bir Hesap Açılış Kaydı olduğundan farklı hesabının aktif ya da pasif bir hesap tipi olması gerekmektedir"
|
||||
|
||||
#: erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py:950
|
||||
msgid "Difference Account must be a Asset/Liability type account, since this Stock Reconciliation is an Opening Entry"
|
||||
@@ -17302,7 +17302,7 @@ msgstr "Dağıtıldı"
|
||||
#. Profile'
|
||||
#: erpnext/accounts/doctype/pos_profile/pos_profile.json
|
||||
msgid "Discard Changes and Load New Invoice"
|
||||
msgstr ""
|
||||
msgstr "Değişiklikleri Sil ve Yeni Fatura Yükle"
|
||||
|
||||
#. Label of the discount (Float) field in DocType 'Payment Schedule'
|
||||
#. Label of the discount (Float) field in DocType 'Payment Term'
|
||||
@@ -17571,7 +17571,7 @@ msgstr "Sevkiyat Adresi"
|
||||
#. 'Purchase Order'
|
||||
#: erpnext/buying/doctype/purchase_order/purchase_order.json
|
||||
msgid "Dispatch Address Details"
|
||||
msgstr ""
|
||||
msgstr "Gönderim Adresi Ayrıntıları"
|
||||
|
||||
#. Label of the dispatch_address_name (Link) field in DocType 'Sales Invoice'
|
||||
#. Label of the dispatch_address_name (Link) field in DocType 'Sales Order'
|
||||
@@ -17585,7 +17585,7 @@ msgstr "Sevk Adresi"
|
||||
#. Label of the dispatch_address (Link) field in DocType 'Purchase Receipt'
|
||||
#: erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
|
||||
msgid "Dispatch Address Template"
|
||||
msgstr ""
|
||||
msgstr "Gönderim Adresi Şablonu"
|
||||
|
||||
#. Label of the section_break_9 (Section Break) field in DocType 'Delivery
|
||||
#. Stop'
|
||||
@@ -17624,7 +17624,7 @@ msgstr "Bertaraf Tarihi"
|
||||
|
||||
#: erpnext/assets/doctype/asset/depreciation.py:824
|
||||
msgid "Disposal date {0} cannot be before {1} date {2} of the asset."
|
||||
msgstr ""
|
||||
msgstr "Elden çıkarma tarihi {0} varlığın {1} tarihinden {2} önce olamaz."
|
||||
|
||||
#. Label of the distance (Float) field in DocType 'Delivery Stop'
|
||||
#: erpnext/stock/doctype/delivery_stop/delivery_stop.json
|
||||
@@ -17799,7 +17799,7 @@ msgstr "Hala negatif envanteri etkinleştirmek istiyor musunuz?"
|
||||
|
||||
#: erpnext/stock/doctype/item/item.js:24
|
||||
msgid "Do you want to change valuation method?"
|
||||
msgstr ""
|
||||
msgstr "Değerleme yöntemini değiştirmek istiyor musunuz?"
|
||||
|
||||
#: erpnext/stock/doctype/delivery_trip/delivery_trip.js:156
|
||||
msgid "Do you want to notify all the customers by email?"
|
||||
@@ -18319,7 +18319,7 @@ msgstr "Projeyi Görevlerle Çoğalt"
|
||||
|
||||
#: erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.py:144
|
||||
msgid "Duplicate Sales Invoices found"
|
||||
msgstr ""
|
||||
msgstr "Yinelenen Satış Faturaları bulundu"
|
||||
|
||||
#: erpnext/stock/doctype/stock_closing_entry/stock_closing_entry.py:78
|
||||
msgid "Duplicate Stock Closing Entry"
|
||||
@@ -19091,7 +19091,7 @@ msgstr ""
|
||||
#. 'Manufacturing Settings'
|
||||
#: erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.json
|
||||
msgid "Enabling this checkbox will force each Job Card Time Log to have From Time and To Time"
|
||||
msgstr ""
|
||||
msgstr "Bu onay kutusunun etkinleştirilmesi, her İş Kartı Zaman Günlüğünün Şu Zamandan ve Şu Zamana sahip olmasını zorunlu kılar"
|
||||
|
||||
#. Description of the 'Check Supplier Invoice Number Uniqueness' (Check) field
|
||||
#. in DocType 'Accounts Settings'
|
||||
@@ -19216,7 +19216,7 @@ msgstr "Enerji"
|
||||
#. Settings'
|
||||
#: erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.json
|
||||
msgid "Enforce Time Logs"
|
||||
msgstr ""
|
||||
msgstr "Zaman Günlüklerini Uygula"
|
||||
|
||||
#: erpnext/setup/setup_wizard/data/designation.txt:15
|
||||
msgid "Engineer"
|
||||
@@ -19946,7 +19946,7 @@ msgstr "Gider hesabı {0} kalemi için zorunludur"
|
||||
|
||||
#: erpnext/assets/doctype/asset_repair/asset_repair.py:108
|
||||
msgid "Expense account {0} not present in Purchase Invoice {1}"
|
||||
msgstr ""
|
||||
msgstr "Satın Alma Faturasında {0} Gider Hesabı Belirtilmemiş"
|
||||
|
||||
#: erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts.py:42
|
||||
#: erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts_with_account_number.py:61
|
||||
@@ -20291,7 +20291,7 @@ msgstr "Ürünleri Depodan Getir"
|
||||
|
||||
#: erpnext/crm/doctype/opportunity/opportunity.js:117
|
||||
msgid "Fetch Latest Exchange Rate"
|
||||
msgstr ""
|
||||
msgstr "Son Döviz Kurunu Getir"
|
||||
|
||||
#: erpnext/accounts/doctype/dunning/dunning.js:61
|
||||
msgid "Fetch Overdue Payments"
|
||||
@@ -20660,7 +20660,7 @@ msgstr "Bitmiş Ürün Miktarı "
|
||||
#. field in DocType 'Work Order'
|
||||
#: erpnext/manufacturing/doctype/work_order/work_order.json
|
||||
msgid "Finished Good Serial / Batch"
|
||||
msgstr ""
|
||||
msgstr "Bitmiş Ürün Seri / Parti"
|
||||
|
||||
#. Label of the finished_good_uom (Link) field in DocType 'Subcontracting BOM'
|
||||
#: erpnext/subcontracting/doctype/subcontracting_bom/subcontracting_bom.json
|
||||
@@ -23117,7 +23117,7 @@ msgstr "Resimleri Gizle"
|
||||
|
||||
#: erpnext/selling/page/point_of_sale/pos_controller.js:282
|
||||
msgid "Hide Recent Orders"
|
||||
msgstr ""
|
||||
msgstr "Son Siparişleri Gizle"
|
||||
|
||||
#. Label of the hide_unavailable_items (Check) field in DocType 'POS Profile'
|
||||
#: erpnext/accounts/doctype/pos_profile/pos_profile.json
|
||||
@@ -25947,7 +25947,7 @@ msgstr "Giden"
|
||||
#. Label of the is_packed (Check) field in DocType 'Serial and Batch Bundle'
|
||||
#: erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.json
|
||||
msgid "Is Packed"
|
||||
msgstr ""
|
||||
msgstr "Paketlendi"
|
||||
|
||||
#. Label of the is_paid (Check) field in DocType 'Purchase Invoice'
|
||||
#: erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
|
||||
@@ -26109,7 +26109,7 @@ msgstr "Abonelik"
|
||||
#. Label of the is_created_using_pos (Check) field in DocType 'Sales Invoice'
|
||||
#: erpnext/accounts/doctype/sales_invoice/sales_invoice.json
|
||||
msgid "Is created using POS"
|
||||
msgstr ""
|
||||
msgstr "POS kullanılarak oluşturuldu"
|
||||
|
||||
#. Label of the included_in_print_rate (Check) field in DocType 'Purchase Taxes
|
||||
#. and Charges'
|
||||
@@ -28510,7 +28510,7 @@ msgstr "Sol Dizin"
|
||||
#. Settings'
|
||||
#: erpnext/accounts/doctype/accounts_settings/accounts_settings.json
|
||||
msgid "Legacy Fields"
|
||||
msgstr ""
|
||||
msgstr "Eski Alanlar"
|
||||
|
||||
#: erpnext/setup/doctype/company/company.py:420
|
||||
#: erpnext/setup/setup_wizard/data/industry_type.txt:30
|
||||
@@ -31676,7 +31676,7 @@ msgstr "Net Kâr/Zarar"
|
||||
#. Label of the gross_purchase_amount (Currency) field in DocType 'Asset'
|
||||
#: erpnext/assets/doctype/asset/asset.json
|
||||
msgid "Net Purchase Amount"
|
||||
msgstr ""
|
||||
msgstr "Net Satın Alma Tutarı"
|
||||
|
||||
#. Label of the net_rate (Currency) field in DocType 'POS Invoice Item'
|
||||
#. Label of the net_rate (Currency) field in DocType 'Purchase Invoice Item'
|
||||
@@ -31917,7 +31917,7 @@ msgstr "Yeni Gelir"
|
||||
|
||||
#: erpnext/selling/page/point_of_sale/pos_controller.js:244
|
||||
msgid "New Invoice"
|
||||
msgstr ""
|
||||
msgstr "Yeni Fatura"
|
||||
|
||||
#: erpnext/assets/doctype/location/location_tree.js:23
|
||||
msgid "New Location"
|
||||
@@ -32181,7 +32181,7 @@ msgstr "Açıklama Yok"
|
||||
|
||||
#: erpnext/public/js/utils/unreconcile.js:147
|
||||
msgid "No Selection"
|
||||
msgstr ""
|
||||
msgstr "Seçim Yok"
|
||||
|
||||
#: erpnext/controllers/sales_and_purchase_return.py:824
|
||||
msgid "No Serial / Batches are available for return"
|
||||
@@ -35921,7 +35921,7 @@ msgstr "Ödeme Planı"
|
||||
|
||||
#: erpnext/accounts/print_format/sales_invoice_print/sales_invoice_print.html:123
|
||||
msgid "Payment Status"
|
||||
msgstr ""
|
||||
msgstr "Ödeme Durumu"
|
||||
|
||||
#. Label of the payment_term (Link) field in DocType 'Overdue Payment'
|
||||
#. Label of the payment_term (Link) field in DocType 'Payment Entry Reference'
|
||||
@@ -42628,7 +42628,7 @@ msgstr "İade Edilebilir Standart Oranlı Giderler, Ters Yükleme Uygulanıyorke
|
||||
#. Valuation'
|
||||
#: erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.json
|
||||
msgid "Recreate Stock Ledgers"
|
||||
msgstr ""
|
||||
msgstr "Stok Defterlerini Yeniden Oluştur"
|
||||
|
||||
#. Label of the recurse_for (Float) field in DocType 'Pricing Rule'
|
||||
#. Label of the recurse_for (Float) field in DocType 'Promotional Scheme
|
||||
@@ -46137,7 +46137,7 @@ msgstr "Satış Faturası Ödemesi"
|
||||
#. Name of a DocType
|
||||
#: erpnext/accounts/doctype/sales_invoice_reference/sales_invoice_reference.json
|
||||
msgid "Sales Invoice Reference"
|
||||
msgstr ""
|
||||
msgstr "Satış Faturası Referansı"
|
||||
|
||||
#. Name of a DocType
|
||||
#: erpnext/accounts/doctype/sales_invoice_timesheet/sales_invoice_timesheet.json
|
||||
@@ -46148,7 +46148,7 @@ msgstr "Satış Faturası Zaman Çizelgesi"
|
||||
#. Closing Entry'
|
||||
#: erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.json
|
||||
msgid "Sales Invoice Transactions"
|
||||
msgstr ""
|
||||
msgstr "Satış Fatura İşlemleri"
|
||||
|
||||
#. Name of a report
|
||||
#. Label of a Link in the Financial Reports Workspace
|
||||
@@ -46161,7 +46161,7 @@ msgstr "Satış Faturası Trendleri"
|
||||
|
||||
#: erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.py:169
|
||||
msgid "Sales Invoice does not have Payments"
|
||||
msgstr ""
|
||||
msgstr "Satış Faturasında Ödemeler Yok"
|
||||
|
||||
#: erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.py:165
|
||||
msgid "Sales Invoice is already consolidated"
|
||||
@@ -46173,11 +46173,11 @@ msgstr ""
|
||||
|
||||
#: erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.py:177
|
||||
msgid "Sales Invoice is not submitted"
|
||||
msgstr ""
|
||||
msgstr "Satış Faturası gönderilmedi"
|
||||
|
||||
#: erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.py:180
|
||||
msgid "Sales Invoice isn't created by user {}"
|
||||
msgstr ""
|
||||
msgstr "Satış Faturası {} kullanıcısı tarafından oluşturulmadı"
|
||||
|
||||
#: erpnext/accounts/doctype/pos_invoice/pos_invoice.py:431
|
||||
msgid "Sales Invoice mode is activated in POS. Please create Sales Invoice instead."
|
||||
|
||||
@@ -189,6 +189,7 @@ class WorkOrder(Document):
|
||||
self.reset_use_multi_level_bom()
|
||||
self.set_reserve_stock()
|
||||
self.validate_fg_warehouse_for_reservation()
|
||||
self.validate_dates()
|
||||
|
||||
if self.source_warehouse:
|
||||
self.set_warehouses()
|
||||
@@ -198,6 +199,11 @@ class WorkOrder(Document):
|
||||
self.set_required_items(reset_only_qty=len(self.get("required_items")))
|
||||
self.enable_auto_reserve_stock()
|
||||
|
||||
def validate_dates(self):
|
||||
if self.actual_start_date and self.actual_end_date:
|
||||
if self.actual_end_date < self.actual_start_date:
|
||||
frappe.throw(_("Actual End Date cannot be before Actual Start Date"))
|
||||
|
||||
def validate_fg_warehouse_for_reservation(self):
|
||||
if self.reserve_stock and self.sales_order:
|
||||
warehouses = frappe.get_all(
|
||||
|
||||
@@ -680,7 +680,7 @@ def send_project_status_email_to_users():
|
||||
|
||||
|
||||
def update_project_sales_billing():
|
||||
sales_update_frequency = frappe.db.get_single_value("Selling Settings", "sales_update_frequency")
|
||||
sales_update_frequency = frappe.get_single_value("Selling Settings", "sales_update_frequency")
|
||||
if sales_update_frequency == "Each Transaction":
|
||||
return
|
||||
elif sales_update_frequency == "Monthly" and frappe.utils.now_datetime().day != 1:
|
||||
|
||||
@@ -554,7 +554,7 @@ def check_credit_limit(customer, company, ignore_outstanding_sales_order=False,
|
||||
message += "<br><br>"
|
||||
|
||||
# If not authorized person raise exception
|
||||
credit_controller_role = frappe.db.get_single_value("Accounts Settings", "credit_controller")
|
||||
credit_controller_role = frappe.get_single_value("Accounts Settings", "credit_controller")
|
||||
if not credit_controller_role or credit_controller_role not in frappe.get_roles():
|
||||
# form a list of emails for the credit controller users
|
||||
credit_controller_users = get_users_with_role(credit_controller_role or "Sales Master Manager")
|
||||
|
||||
@@ -167,7 +167,7 @@ class Quotation(SellingController):
|
||||
"""
|
||||
If permitted in settings and any item has 0 qty, the SO has unit price items.
|
||||
"""
|
||||
if not frappe.db.get_single_value("Selling Settings", "allow_zero_qty_in_quotation"):
|
||||
if not frappe.get_single_value("Selling Settings", "allow_zero_qty_in_quotation"):
|
||||
return
|
||||
|
||||
self.has_unit_price_items = any(
|
||||
|
||||
@@ -195,7 +195,7 @@ class SalesOrder(SellingController):
|
||||
def onload(self) -> None:
|
||||
super().onload()
|
||||
|
||||
if frappe.db.get_single_value("Stock Settings", "enable_stock_reservation"):
|
||||
if frappe.get_single_value("Stock Settings", "enable_stock_reservation"):
|
||||
if self.has_unreserved_stock():
|
||||
self.set_onload("has_unreserved_stock", True)
|
||||
|
||||
@@ -246,14 +246,14 @@ class SalesOrder(SellingController):
|
||||
self.enable_auto_reserve_stock()
|
||||
|
||||
def enable_auto_reserve_stock(self):
|
||||
if self.is_new() and frappe.db.get_single_value("Stock Settings", "auto_reserve_stock"):
|
||||
if self.is_new() and frappe.get_single_value("Stock Settings", "auto_reserve_stock"):
|
||||
self.reserve_stock = 1
|
||||
|
||||
def set_has_unit_price_items(self):
|
||||
"""
|
||||
If permitted in settings and any item has 0 qty, the SO has unit price items.
|
||||
"""
|
||||
if not frappe.db.get_single_value("Selling Settings", "allow_zero_qty_in_sales_order"):
|
||||
if not frappe.get_single_value("Selling Settings", "allow_zero_qty_in_sales_order"):
|
||||
return
|
||||
|
||||
self.has_unit_price_items = any(
|
||||
@@ -280,7 +280,7 @@ class SalesOrder(SellingController):
|
||||
)
|
||||
if so and so[0][0]:
|
||||
if cint(
|
||||
frappe.db.get_single_value("Selling Settings", "allow_against_multiple_purchase_orders")
|
||||
frappe.get_single_value("Selling Settings", "allow_against_multiple_purchase_orders")
|
||||
):
|
||||
frappe.msgprint(
|
||||
_(
|
||||
@@ -405,7 +405,7 @@ class SalesOrder(SellingController):
|
||||
}
|
||||
)
|
||||
|
||||
if cint(frappe.db.get_single_value("Selling Settings", "maintain_same_sales_rate")):
|
||||
if cint(frappe.get_single_value("Selling Settings", "maintain_same_sales_rate")):
|
||||
self.validate_rate_with_reference_doc([["Quotation", "prevdoc_docname", "quotation_item"]])
|
||||
|
||||
def update_enquiry_status(self, prevdoc, flag):
|
||||
@@ -483,7 +483,7 @@ class SalesOrder(SellingController):
|
||||
update_coupon_code_count(self.coupon_code, "cancelled")
|
||||
|
||||
def update_project(self):
|
||||
if frappe.db.get_single_value("Selling Settings", "sales_update_frequency") != "Each Transaction":
|
||||
if frappe.get_single_value("Selling Settings", "sales_update_frequency") != "Each Transaction":
|
||||
return
|
||||
|
||||
if self.project:
|
||||
@@ -633,7 +633,7 @@ class SalesOrder(SellingController):
|
||||
if total_picked_qty and total_qty:
|
||||
per_picked = total_picked_qty / total_qty * 100
|
||||
|
||||
pick_percentage = frappe.db.get_single_value("Stock Settings", "over_picking_allowance")
|
||||
pick_percentage = frappe.get_single_value("Stock Settings", "over_picking_allowance")
|
||||
if pick_percentage:
|
||||
total_qty += flt(total_qty) * (pick_percentage / 100)
|
||||
|
||||
@@ -729,7 +729,7 @@ class SalesOrder(SellingController):
|
||||
def validate_reserved_stock(self):
|
||||
"""Clean reserved stock flag for non-stock Item"""
|
||||
|
||||
enable_stock_reservation = frappe.db.get_single_value("Stock Settings", "enable_stock_reservation")
|
||||
enable_stock_reservation = frappe.get_single_value("Stock Settings", "enable_stock_reservation")
|
||||
|
||||
for item in self.items:
|
||||
if item.reserve_stock and (not enable_stock_reservation or not cint(item.is_stock_item)):
|
||||
@@ -815,7 +815,7 @@ def get_list_context(context=None):
|
||||
|
||||
@frappe.whitelist()
|
||||
def is_enable_cutoff_date_on_bulk_delivery_note_creation():
|
||||
return frappe.db.get_single_value("Selling Settings", "enable_cutoff_date_on_bulk_delivery_note_creation")
|
||||
return frappe.get_single_value("Selling Settings", "enable_cutoff_date_on_bulk_delivery_note_creation")
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
@@ -1220,7 +1220,7 @@ def make_sales_invoice(source_name, target_doc=None, ignore_permissions=False):
|
||||
)
|
||||
|
||||
automatically_fetch_payment_terms = cint(
|
||||
frappe.db.get_single_value("Accounts Settings", "automatically_fetch_payment_terms")
|
||||
frappe.get_single_value("Accounts Settings", "automatically_fetch_payment_terms")
|
||||
)
|
||||
if automatically_fetch_payment_terms:
|
||||
doclist.set_payment_schedule()
|
||||
@@ -1861,4 +1861,4 @@ def get_work_order_items(sales_order, for_raw_material_request=0):
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_stock_reservation_status():
|
||||
return frappe.db.get_single_value("Stock Settings", "enable_stock_reservation")
|
||||
return frappe.get_single_value("Stock Settings", "enable_stock_reservation")
|
||||
|
||||
@@ -13,7 +13,7 @@ def execute(filters=None):
|
||||
if not filters:
|
||||
filters = {}
|
||||
# Check if customer id is according to naming series or customer name
|
||||
customer_naming_type = frappe.db.get_single_value("Selling Settings", "cust_master_name")
|
||||
customer_naming_type = frappe.get_single_value("Selling Settings", "cust_master_name")
|
||||
columns = get_columns(customer_naming_type)
|
||||
|
||||
data = []
|
||||
|
||||
@@ -15,15 +15,13 @@ def boot_session(bootinfo):
|
||||
if frappe.session["user"] != "Guest":
|
||||
update_page_info(bootinfo)
|
||||
|
||||
bootinfo.sysdefaults.territory = frappe.db.get_single_value("Selling Settings", "territory")
|
||||
bootinfo.sysdefaults.customer_group = frappe.db.get_single_value("Selling Settings", "customer_group")
|
||||
bootinfo.sysdefaults.use_server_side_reactivity = frappe.db.get_single_value(
|
||||
bootinfo.sysdefaults.territory = frappe.get_single_value("Selling Settings", "territory")
|
||||
bootinfo.sysdefaults.customer_group = frappe.get_single_value("Selling Settings", "customer_group")
|
||||
bootinfo.sysdefaults.use_server_side_reactivity = frappe.get_single_value(
|
||||
"Selling Settings", "use_server_side_reactivity"
|
||||
)
|
||||
bootinfo.sysdefaults.allow_stale = cint(
|
||||
frappe.db.get_single_value("Accounts Settings", "allow_stale")
|
||||
)
|
||||
bootinfo.sysdefaults.over_billing_allowance = frappe.db.get_single_value(
|
||||
bootinfo.sysdefaults.allow_stale = cint(frappe.get_single_value("Accounts Settings", "allow_stale"))
|
||||
bootinfo.sysdefaults.over_billing_allowance = frappe.get_single_value(
|
||||
"Accounts Settings", "over_billing_allowance"
|
||||
)
|
||||
|
||||
@@ -32,7 +30,7 @@ def boot_session(bootinfo):
|
||||
)
|
||||
|
||||
bootinfo.sysdefaults.allow_sales_order_creation_for_expired_quotation = cint(
|
||||
frappe.db.get_single_value("Selling Settings", "allow_sales_order_creation_for_expired_quotation")
|
||||
frappe.get_single_value("Selling Settings", "allow_sales_order_creation_for_expired_quotation")
|
||||
)
|
||||
|
||||
# if no company, show a dialog box to create a new company
|
||||
|
||||
@@ -37,7 +37,7 @@ def batch_uses_naming_series():
|
||||
Verify if the Batch is to be named using a naming series
|
||||
:return: bool
|
||||
"""
|
||||
use_naming_series = cint(frappe.db.get_single_value("Stock Settings", "use_naming_series"))
|
||||
use_naming_series = cint(frappe.get_single_value("Stock Settings", "use_naming_series"))
|
||||
return bool(use_naming_series)
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ def _get_batch_prefix():
|
||||
is set to use naming series.
|
||||
:return: The naming series.
|
||||
"""
|
||||
naming_series_prefix = frappe.db.get_single_value("Stock Settings", "naming_series_prefix")
|
||||
naming_series_prefix = frappe.get_single_value("Stock Settings", "naming_series_prefix")
|
||||
if not naming_series_prefix:
|
||||
naming_series_prefix = "BATCH-"
|
||||
|
||||
@@ -160,7 +160,7 @@ class Batch(Document):
|
||||
from erpnext.stock.utils import get_valuation_method
|
||||
|
||||
if self.is_new():
|
||||
if get_valuation_method(self.item) == "Moving Average" and frappe.db.get_single_value(
|
||||
if get_valuation_method(self.item) == "Moving Average" and frappe.get_single_value(
|
||||
"Stock Settings", "do_not_use_batchwise_valuation"
|
||||
):
|
||||
self.use_batchwise_valuation = 0
|
||||
|
||||
@@ -247,7 +247,7 @@ class DeliveryNote(SellingController):
|
||||
|
||||
def so_required(self):
|
||||
"""check in manage account if sales order required or not"""
|
||||
if frappe.db.get_single_value("Selling Settings", "so_required") == "Yes":
|
||||
if frappe.get_single_value("Selling Settings", "so_required") == "Yes":
|
||||
for d in self.get("items"):
|
||||
if not d.against_sales_order:
|
||||
frappe.throw(_("Sales Order required for Item {0}").format(d.item_code))
|
||||
@@ -314,7 +314,7 @@ class DeliveryNote(SellingController):
|
||||
)
|
||||
|
||||
if (
|
||||
cint(frappe.db.get_single_value("Selling Settings", "maintain_same_sales_rate"))
|
||||
cint(frappe.get_single_value("Selling Settings", "maintain_same_sales_rate"))
|
||||
and not self.is_return
|
||||
and not self.is_internal_customer
|
||||
):
|
||||
@@ -436,7 +436,7 @@ class DeliveryNote(SellingController):
|
||||
self.update_pick_list_status()
|
||||
|
||||
# Check for Approving Authority
|
||||
frappe.get_doc("Authorization Control").validate_approving_authority(
|
||||
frappe.get_cached_doc("Authorization Control").validate_approving_authority(
|
||||
self.doctype, self.company, self.base_grand_total, self
|
||||
)
|
||||
|
||||
@@ -901,7 +901,7 @@ def make_sales_invoice(source_name, target_doc=None, args=None):
|
||||
)
|
||||
|
||||
automatically_fetch_payment_terms = cint(
|
||||
frappe.db.get_single_value("Accounts Settings", "automatically_fetch_payment_terms")
|
||||
frappe.get_single_value("Accounts Settings", "automatically_fetch_payment_terms")
|
||||
)
|
||||
if automatically_fetch_payment_terms and not doc.is_return:
|
||||
doc.set_payment_schedule()
|
||||
|
||||
@@ -227,7 +227,7 @@ class Item(Document):
|
||||
def validate_description(self):
|
||||
"""Clean HTML description if set"""
|
||||
if (
|
||||
cint(frappe.db.get_single_value("Stock Settings", "clean_description_html"))
|
||||
cint(frappe.get_single_value("Stock Settings", "clean_description_html"))
|
||||
and self.description != self.item_name # perf: Avoid cleaning up a fallback
|
||||
):
|
||||
self.description = clean_html(self.description)
|
||||
@@ -243,7 +243,7 @@ class Item(Document):
|
||||
def add_price(self, price_list=None):
|
||||
"""Add a new price"""
|
||||
if not price_list:
|
||||
price_list = frappe.db.get_single_value(
|
||||
price_list = frappe.get_single_value(
|
||||
"Selling Settings", "selling_price_list"
|
||||
) or frappe.db.get_value("Price List", _("Standard Selling"))
|
||||
if price_list:
|
||||
@@ -274,7 +274,7 @@ class Item(Document):
|
||||
for default in self.item_defaults or [
|
||||
frappe._dict({"company": frappe.defaults.get_defaults().company})
|
||||
]:
|
||||
default_warehouse = default.default_warehouse or frappe.db.get_single_value(
|
||||
default_warehouse = default.default_warehouse or frappe.get_single_value(
|
||||
"Stock Settings", "default_warehouse"
|
||||
)
|
||||
if default_warehouse:
|
||||
@@ -317,9 +317,7 @@ class Item(Document):
|
||||
)
|
||||
|
||||
def validate_retain_sample(self):
|
||||
if self.retain_sample and not frappe.db.get_single_value(
|
||||
"Stock Settings", "sample_retention_warehouse"
|
||||
):
|
||||
if self.retain_sample and not frappe.get_single_value("Stock Settings", "sample_retention_warehouse"):
|
||||
frappe.throw(_("Please select Sample Retention Warehouse in Stock Settings first"))
|
||||
if self.retain_sample and not self.has_batch_no:
|
||||
frappe.throw(
|
||||
@@ -664,7 +662,7 @@ class Item(Document):
|
||||
def recalculate_bin_qty(self, new_name):
|
||||
from erpnext.stock.stock_balance import repost_stock
|
||||
|
||||
existing_allow_negative_stock = frappe.db.get_single_value("Stock Settings", "allow_negative_stock")
|
||||
existing_allow_negative_stock = frappe.get_single_value("Stock Settings", "allow_negative_stock")
|
||||
frappe.db.set_single_value("Stock Settings", "allow_negative_stock", 1)
|
||||
|
||||
repost_stock_for_warehouses = frappe.get_all(
|
||||
@@ -964,7 +962,7 @@ class Item(Document):
|
||||
|
||||
if not values.get("valuation_method") and self.get("valuation_method"):
|
||||
values["valuation_method"] = (
|
||||
frappe.db.get_single_value("Stock Settings", "valuation_method") or "FIFO"
|
||||
frappe.get_single_value("Stock Settings", "valuation_method") or "FIFO"
|
||||
)
|
||||
|
||||
changed_fields = [
|
||||
@@ -1051,7 +1049,7 @@ class Item(Document):
|
||||
|
||||
def validate_auto_reorder_enabled_in_stock_settings(self):
|
||||
if self.reorder_levels:
|
||||
enabled = frappe.db.get_single_value("Stock Settings", "auto_indent")
|
||||
enabled = frappe.get_single_value("Stock Settings", "auto_indent")
|
||||
if not enabled:
|
||||
frappe.msgprint(
|
||||
msg=_("You have to enable auto re-order in Stock Settings to maintain re-order levels."),
|
||||
|
||||
@@ -69,7 +69,7 @@ def make_packing_list(doc):
|
||||
return
|
||||
|
||||
parent_items_price, reset = {}, False
|
||||
set_price_from_children = frappe.db.get_single_value("Selling Settings", "editable_bundle_item_rates")
|
||||
set_price_from_children = frappe.get_single_value("Selling Settings", "editable_bundle_item_rates")
|
||||
|
||||
stale_packed_items_table = get_indexed_packed_items_table(doc)
|
||||
|
||||
@@ -234,7 +234,7 @@ def update_packed_item_stock_data(main_item_row, pi_row, packing_item, item_data
|
||||
bin = get_packed_item_bin_qty(packing_item.item_code, pi_row.warehouse)
|
||||
pi_row.actual_qty = flt(bin.get("actual_qty"))
|
||||
pi_row.projected_qty = flt(bin.get("projected_qty"))
|
||||
pi_row.use_serial_batch_fields = frappe.db.get_single_value("Stock Settings", "use_serial_batch_fields")
|
||||
pi_row.use_serial_batch_fields = frappe.get_single_value("Stock Settings", "use_serial_batch_fields")
|
||||
|
||||
|
||||
def update_packed_item_price_data(pi_row, item_data, doc):
|
||||
|
||||
@@ -440,7 +440,7 @@ class PickList(Document):
|
||||
|
||||
def validate_picked_qty(self, data):
|
||||
over_delivery_receipt_allowance = 100 + flt(
|
||||
frappe.db.get_single_value("Stock Settings", "over_delivery_receipt_allowance")
|
||||
frappe.get_single_value("Stock Settings", "over_delivery_receipt_allowance")
|
||||
)
|
||||
|
||||
for row in data:
|
||||
@@ -1102,7 +1102,7 @@ def get_available_item_locations_for_batched_item(
|
||||
{
|
||||
"item_code": item_code,
|
||||
"warehouse": from_warehouses,
|
||||
"based_on": frappe.db.get_single_value("Stock Settings", "pick_serial_and_batch_based_on"),
|
||||
"based_on": frappe.get_single_value("Stock Settings", "pick_serial_and_batch_based_on"),
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
@@ -39,7 +39,7 @@ class PriceList(Document):
|
||||
|
||||
def set_default_if_missing(self):
|
||||
if cint(self.selling):
|
||||
if not frappe.db.get_single_value("Selling Settings", "selling_price_list"):
|
||||
if not frappe.get_single_value("Selling Settings", "selling_price_list"):
|
||||
frappe.set_value("Selling Settings", "Selling Settings", "selling_price_list", self.name)
|
||||
|
||||
elif cint(self.buying):
|
||||
|
||||
@@ -952,10 +952,8 @@ class PurchaseReceipt(BuyingController):
|
||||
def reserve_stock_for_sales_order(self):
|
||||
if (
|
||||
self.is_return
|
||||
or not frappe.db.get_single_value("Stock Settings", "enable_stock_reservation")
|
||||
or not frappe.db.get_single_value(
|
||||
"Stock Settings", "auto_reserve_stock_for_sales_order_on_purchase"
|
||||
)
|
||||
or not frappe.get_single_value("Stock Settings", "enable_stock_reservation")
|
||||
or not frappe.get_single_value("Stock Settings", "auto_reserve_stock_for_sales_order_on_purchase")
|
||||
):
|
||||
return
|
||||
|
||||
@@ -990,7 +988,7 @@ class PurchaseReceipt(BuyingController):
|
||||
)
|
||||
|
||||
def reserve_stock_for_production_plan(self):
|
||||
if self.is_return or not frappe.db.get_single_value("Stock Settings", "enable_stock_reservation"):
|
||||
if self.is_return or not frappe.get_single_value("Stock Settings", "enable_stock_reservation"):
|
||||
return
|
||||
|
||||
production_plan_references = self.get_production_plan_references()
|
||||
@@ -1201,7 +1199,7 @@ def get_billed_amount_against_po(po_items):
|
||||
def update_billing_percentage(pr_doc, update_modified=True, adjust_incoming_rate=False):
|
||||
# Update Billing % based on pending accepted qty
|
||||
buying_settings = frappe.get_single("Buying Settings")
|
||||
over_billing_allowance = frappe.db.get_single_value("Accounts Settings", "over_billing_allowance")
|
||||
over_billing_allowance = frappe.get_single_value("Accounts Settings", "over_billing_allowance")
|
||||
|
||||
total_amount, total_billed_amount = 0, 0
|
||||
item_wise_returned_qty = get_item_wise_returned_qty(pr_doc)
|
||||
|
||||
@@ -84,7 +84,7 @@ class SerialandBatchBundle(Document):
|
||||
# end: auto-generated types
|
||||
|
||||
def autoname(self):
|
||||
if frappe.db.get_single_value(
|
||||
if frappe.get_single_value(
|
||||
"Stock Settings", "set_serial_and_batch_bundle_naming_based_on_naming_series"
|
||||
):
|
||||
if not self.naming_series:
|
||||
@@ -161,7 +161,7 @@ class SerialandBatchBundle(Document):
|
||||
if self.type_of_transaction == "Outward" or not self.has_serial_no:
|
||||
return
|
||||
|
||||
if frappe.db.get_single_value("Stock Settings", "allow_existing_serial_no"):
|
||||
if frappe.get_single_value("Stock Settings", "allow_existing_serial_no"):
|
||||
return
|
||||
|
||||
if self.voucher_type not in ["Purchase Receipt", "Purchase Invoice", "Stock Entry"]:
|
||||
|
||||
@@ -2457,7 +2457,7 @@ class StockEntry(StockController):
|
||||
if not qty:
|
||||
return
|
||||
|
||||
use_serial_batch_fields = frappe.db.get_single_value("Stock Settings", "use_serial_batch_fields")
|
||||
use_serial_batch_fields = frappe.get_single_value("Stock Settings", "use_serial_batch_fields")
|
||||
|
||||
ste_item_details = {
|
||||
"from_warehouse": item.warehouse,
|
||||
@@ -2935,7 +2935,7 @@ def move_sample_to_retention_warehouse(company, items):
|
||||
|
||||
if isinstance(items, str):
|
||||
items = json.loads(items)
|
||||
retention_warehouse = frappe.db.get_single_value("Stock Settings", "sample_retention_warehouse")
|
||||
retention_warehouse = frappe.get_single_value("Stock Settings", "sample_retention_warehouse")
|
||||
stock_entry = frappe.new_doc("Stock Entry")
|
||||
stock_entry.company = company
|
||||
stock_entry.purpose = "Material Transfer"
|
||||
@@ -2986,7 +2986,7 @@ def make_stock_in_entry(source_name, target_doc=None):
|
||||
target.stock_entry_type = "Material Transfer"
|
||||
target.set_missing_values()
|
||||
|
||||
if not frappe.db.get_single_value("Stock Settings", "use_serial_batch_fields"):
|
||||
if not frappe.get_single_value("Stock Settings", "use_serial_batch_fields"):
|
||||
target.make_serial_and_batch_bundle_for_transfer()
|
||||
|
||||
def update_item(source_doc, target_doc, source_parent):
|
||||
@@ -3215,7 +3215,7 @@ def validate_sample_quantity(item_code, sample_quantity, qty, batch_no=None):
|
||||
frappe.throw(
|
||||
_("Sample quantity {0} cannot be more than received quantity {1}").format(sample_quantity, qty)
|
||||
)
|
||||
retention_warehouse = frappe.db.get_single_value("Stock Settings", "sample_retention_warehouse")
|
||||
retention_warehouse = frappe.get_single_value("Stock Settings", "sample_retention_warehouse")
|
||||
retainted_qty = 0
|
||||
if batch_no:
|
||||
retainted_qty = get_batch_qty(batch_no, retention_warehouse, item_code)
|
||||
|
||||
@@ -299,7 +299,7 @@ class StockLedgerEntry(Document):
|
||||
is_group_warehouse(self.warehouse)
|
||||
|
||||
def validate_with_last_transaction_posting_time(self):
|
||||
authorized_role = frappe.db.get_single_value(
|
||||
authorized_role = frappe.get_single_value(
|
||||
"Stock Settings", "role_allowed_to_create_edit_back_dated_transactions"
|
||||
)
|
||||
if authorized_role:
|
||||
|
||||
@@ -45,6 +45,7 @@ class TestStockReconciliation(IntegrationTestCase, StockTestMixin):
|
||||
def test_reco_for_moving_average(self):
|
||||
self._test_reco_sle_gle("Moving Average")
|
||||
|
||||
@IntegrationTestCase.change_settings("Stock Settings", {"allow_negative_stock": 1})
|
||||
def _test_reco_sle_gle(self, valuation_method):
|
||||
item_code = self.make_item(properties={"valuation_method": valuation_method}).name
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ class StockReservationEntry(Document):
|
||||
not self.from_voucher_type
|
||||
and (self.get("_action") == "submit")
|
||||
and (self.has_serial_no or self.has_batch_no)
|
||||
and cint(frappe.db.get_single_value("Stock Settings", "auto_reserve_serial_and_batch"))
|
||||
and cint(frappe.get_single_value("Stock Settings", "auto_reserve_serial_and_batch"))
|
||||
):
|
||||
from erpnext.stock.doctype.batch.batch import get_available_batches
|
||||
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos_for_outward
|
||||
@@ -176,7 +176,7 @@ class StockReservationEntry(Document):
|
||||
"warehouse": self.warehouse,
|
||||
"qty": abs(self.reserved_qty) or 0,
|
||||
"based_on": based_on
|
||||
or frappe.db.get_single_value("Stock Settings", "pick_serial_and_batch_based_on"),
|
||||
or frappe.get_single_value("Stock Settings", "pick_serial_and_batch_based_on"),
|
||||
}
|
||||
)
|
||||
|
||||
@@ -219,9 +219,7 @@ class StockReservationEntry(Document):
|
||||
return
|
||||
|
||||
if self.reservation_based_on == "Serial and Batch":
|
||||
allow_partial_reservation = frappe.db.get_single_value(
|
||||
"Stock Settings", "allow_partial_reservation"
|
||||
)
|
||||
allow_partial_reservation = frappe.get_single_value("Stock Settings", "allow_partial_reservation")
|
||||
|
||||
available_serial_nos = []
|
||||
if self.has_serial_no:
|
||||
@@ -570,7 +568,7 @@ class StockReservationEntry(Document):
|
||||
def validate_stock_reservation_settings(voucher: object) -> None:
|
||||
"""Raises an exception if `Stock Reservation` is not enabled or `Voucher Type` is not allowed."""
|
||||
|
||||
if not frappe.db.get_single_value("Stock Settings", "enable_stock_reservation"):
|
||||
if not frappe.get_single_value("Stock Settings", "enable_stock_reservation"):
|
||||
msg = _("Please enable {0} in the {1}.").format(
|
||||
frappe.bold(_("Stock Reservation")),
|
||||
frappe.bold(_("Stock Settings")),
|
||||
@@ -1347,7 +1345,7 @@ def create_stock_reservation_entries_for_so_items(
|
||||
|
||||
validate_stock_reservation_settings(sales_order)
|
||||
|
||||
allow_partial_reservation = frappe.db.get_single_value("Stock Settings", "allow_partial_reservation")
|
||||
allow_partial_reservation = frappe.get_single_value("Stock Settings", "allow_partial_reservation")
|
||||
|
||||
items = []
|
||||
if items_details:
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
|
||||
import json
|
||||
import typing
|
||||
from functools import WRAPPER_ASSIGNMENTS, wraps
|
||||
|
||||
import frappe
|
||||
@@ -135,7 +136,7 @@ def get_item_details(
|
||||
out.update(data)
|
||||
|
||||
if (
|
||||
frappe.db.get_single_value("Stock Settings", "auto_create_serial_and_batch_bundle_for_outward")
|
||||
frappe.get_single_value("Stock Settings", "auto_create_serial_and_batch_bundle_for_outward")
|
||||
and not ctx.get("serial_and_batch_bundle")
|
||||
and (ctx.get("use_serial_batch_fields") or ctx.get("doctype") == "POS Invoice")
|
||||
):
|
||||
@@ -200,7 +201,7 @@ def update_stock(ctx, out, doc=None):
|
||||
{
|
||||
"item_code": ctx.item_code,
|
||||
"warehouse": ctx.warehouse,
|
||||
"based_on": frappe.db.get_single_value("Stock Settings", "pick_serial_and_batch_based_on"),
|
||||
"based_on": frappe.get_single_value("Stock Settings", "pick_serial_and_batch_based_on"),
|
||||
}
|
||||
)
|
||||
|
||||
@@ -366,7 +367,7 @@ def get_basic_details(ctx: ItemDetailsCtx, item, overwrite_warehouse=True) -> It
|
||||
"""
|
||||
|
||||
if not item:
|
||||
item = frappe.get_doc("Item", ctx.item_code)
|
||||
item = frappe.get_cached_doc("Item", ctx.item_code)
|
||||
|
||||
if item.variant_of and not item.taxes and frappe.db.exists("Item Tax", {"parent": item.variant_of}):
|
||||
item.update_template_tables()
|
||||
@@ -532,8 +533,8 @@ def get_basic_details(ctx: ItemDetailsCtx, item, overwrite_warehouse=True) -> It
|
||||
out.manufacturer_part_no = None
|
||||
out.manufacturer = None
|
||||
else:
|
||||
data = frappe.get_value(
|
||||
"Item", item.name, ["default_item_manufacturer", "default_manufacturer_part_no"], as_dict=1
|
||||
data = frappe.get_cached_value(
|
||||
"Item", item.name, ["default_item_manufacturer", "default_manufacturer_part_no"], as_dict=True
|
||||
)
|
||||
|
||||
if data:
|
||||
@@ -590,7 +591,7 @@ def get_item_warehouse_(ctx: ItemDetailsCtx, item, overwrite_warehouse, defaults
|
||||
warehouse = ctx.warehouse
|
||||
|
||||
if not warehouse:
|
||||
default_warehouse = frappe.db.get_single_value("Stock Settings", "default_warehouse")
|
||||
default_warehouse = frappe.get_single_value("Stock Settings", "default_warehouse")
|
||||
if frappe.db.get_value("Warehouse", default_warehouse, "company") == ctx.company:
|
||||
return default_warehouse
|
||||
|
||||
@@ -1178,9 +1179,8 @@ def check_packing_list(price_list_rate_name, desired_qty, item_code):
|
||||
"""
|
||||
|
||||
flag = True
|
||||
item_price = frappe.get_doc("Item Price", price_list_rate_name)
|
||||
if item_price.packing_unit:
|
||||
packing_increment = desired_qty % item_price.packing_unit
|
||||
if packing_unit := frappe.db.get_value("Item Price", price_list_rate_name, "packing_unit", cache=True):
|
||||
packing_increment = desired_qty % packing_unit
|
||||
|
||||
if packing_increment != 0:
|
||||
flag = False
|
||||
@@ -1317,15 +1317,20 @@ def get_pos_profile(company, pos_profile=None, user=None):
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_conversion_factor(item_code, uom):
|
||||
variant_of = frappe.db.get_value("Item", item_code, "variant_of", cache=True)
|
||||
item = frappe.get_cached_value("Item", item_code, ["variant_of", "stock_uom"], as_dict=True)
|
||||
if not item_code or not item:
|
||||
return {"conversion_factor": 1.0}
|
||||
|
||||
if uom == item.stock_uom:
|
||||
return {"conversion_factor": 1.0}
|
||||
|
||||
filters = {"parent": item_code, "uom": uom}
|
||||
|
||||
if variant_of:
|
||||
filters["parent"] = ("in", (item_code, variant_of))
|
||||
if item.variant_of:
|
||||
filters["parent"] = ("in", (item_code, item.variant_of))
|
||||
conversion_factor = frappe.db.get_value("UOM Conversion Detail", filters, "conversion_factor")
|
||||
if not conversion_factor:
|
||||
stock_uom = frappe.db.get_value("Item", item_code, "stock_uom")
|
||||
conversion_factor = get_uom_conv_factor(uom, stock_uom)
|
||||
conversion_factor = get_uom_conv_factor(uom, item.stock_uom)
|
||||
|
||||
return {"conversion_factor": conversion_factor or 1.0}
|
||||
|
||||
@@ -1447,7 +1452,7 @@ def apply_price_list(ctx: ItemDetailsCtx, as_doc=False, doc=None):
|
||||
|
||||
|
||||
def apply_price_list_on_item(ctx, doc=None):
|
||||
item_doc = frappe.db.get_value("Item", ctx.item_code, ["name", "variant_of"], as_dict=1)
|
||||
item_doc = frappe.get_cached_doc("Item", ctx.item_code)
|
||||
item_details = get_price_list_rate(ctx, item_doc)
|
||||
item_details.update(get_pricing_rule_for_item(ctx, doc=doc))
|
||||
|
||||
@@ -1515,7 +1520,6 @@ def get_valuation_rate(item_code, company, warehouse=None):
|
||||
item = get_item_defaults(item_code, company)
|
||||
item_group = get_item_group_defaults(item_code, company)
|
||||
brand = get_brand_defaults(item_code, company)
|
||||
# item = frappe.get_doc("Item", item_code)
|
||||
if item.get("is_stock_item"):
|
||||
if not warehouse:
|
||||
warehouse = (
|
||||
|
||||
@@ -151,12 +151,12 @@ class SerialBatchBundle:
|
||||
if (
|
||||
self.item_details.has_batch_no
|
||||
and not self.item_details.batch_number_series
|
||||
and not frappe.db.get_single_value("Stock Settings", "naming_series_prefix")
|
||||
and not frappe.get_single_value("Stock Settings", "naming_series_prefix")
|
||||
):
|
||||
msg += f". If you want auto pick batch bundle, then kindly set Batch Number Series in Item {self.item_code}"
|
||||
|
||||
elif self.sle.actual_qty < 0:
|
||||
if not frappe.db.get_single_value(
|
||||
if not frappe.get_single_value(
|
||||
"Stock Settings", "auto_create_serial_and_batch_bundle_for_outward"
|
||||
):
|
||||
msg += ". If you want auto pick serial/batch bundle, then kindly enable 'Auto Create Serial and Batch Bundle' in Stock Settings."
|
||||
@@ -187,7 +187,7 @@ class SerialBatchBundle:
|
||||
if self.sle.actual_qty < 0 and self.is_material_transfer():
|
||||
values_to_update["valuation_rate"] = flt(sn_doc.avg_rate)
|
||||
|
||||
if not frappe.db.get_single_value(
|
||||
if not frappe.get_single_value(
|
||||
"Stock Settings", "do_not_update_serial_batch_on_creation_of_auto_bundle"
|
||||
):
|
||||
if sn_doc.has_serial_no:
|
||||
@@ -253,7 +253,7 @@ class SerialBatchBundle:
|
||||
and (
|
||||
self.item_details.create_new_batch
|
||||
or (
|
||||
frappe.db.get_single_value(
|
||||
frappe.get_single_value(
|
||||
"Stock Settings", "auto_create_serial_and_batch_bundle_for_outward"
|
||||
)
|
||||
and self.sle.actual_qty < 0
|
||||
@@ -724,7 +724,7 @@ class BatchNoValuation(DeprecatedBatchNoValuation):
|
||||
self.batchwise_valuation_batches = []
|
||||
self.non_batchwise_valuation_batches = []
|
||||
|
||||
if get_valuation_method(self.sle.item_code) == "Moving Average" and frappe.db.get_single_value(
|
||||
if get_valuation_method(self.sle.item_code) == "Moving Average" and frappe.get_single_value(
|
||||
"Stock Settings", "do_not_use_batchwise_valuation"
|
||||
):
|
||||
self.non_batchwise_valuation_batches = self.batches
|
||||
@@ -1029,7 +1029,7 @@ class SerialBatchCreation:
|
||||
"item_code": self.item_code,
|
||||
"warehouse": self.warehouse,
|
||||
"qty": abs(self.actual_qty) if self.actual_qty else 0,
|
||||
"based_on": frappe.db.get_single_value("Stock Settings", "pick_serial_and_batch_based_on"),
|
||||
"based_on": frappe.get_single_value("Stock Settings", "pick_serial_and_batch_based_on"),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ def repost(only_actual=False, allow_negative_stock=False, allow_zero_rate=False,
|
||||
frappe.db.auto_commit_on_many_writes = 1
|
||||
|
||||
if allow_negative_stock:
|
||||
existing_allow_negative_stock = frappe.db.get_single_value("Stock Settings", "allow_negative_stock")
|
||||
existing_allow_negative_stock = frappe.get_single_value("Stock Settings", "allow_negative_stock")
|
||||
frappe.db.set_single_value("Stock Settings", "allow_negative_stock", 1)
|
||||
|
||||
item_warehouses = frappe.db.sql(
|
||||
|
||||
@@ -2189,9 +2189,9 @@ def validate_reserved_batch_nos(item_code, warehouse, batch_nos):
|
||||
|
||||
|
||||
def is_negative_stock_allowed(*, item_code: str | None = None) -> bool:
|
||||
if cint(frappe.db.get_single_value("Stock Settings", "allow_negative_stock", cache=True)):
|
||||
if frappe.get_cached_doc("Stock Settings").allow_negative_stock:
|
||||
return True
|
||||
if item_code and cint(frappe.db.get_value("Item", item_code, "allow_negative_stock", cache=True)):
|
||||
if item_code and cint(frappe.get_cached_value("Item", item_code, "allow_negative_stock")):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
@@ -252,7 +252,7 @@ def get_incoming_rate(args, raise_error_if_no_rate=True):
|
||||
"Item", args.get("item_code"), ["has_serial_no", "has_batch_no"], as_dict=1
|
||||
)
|
||||
|
||||
use_moving_avg_for_batch = frappe.db.get_single_value("Stock Settings", "do_not_use_batchwise_valuation")
|
||||
use_moving_avg_for_batch = frappe.get_single_value("Stock Settings", "do_not_use_batchwise_valuation")
|
||||
|
||||
if isinstance(args, dict):
|
||||
args = frappe._dict(args)
|
||||
@@ -374,9 +374,9 @@ def get_avg_purchase_rate(serial_nos):
|
||||
|
||||
def get_valuation_method(item_code):
|
||||
"""get valuation method from item or default"""
|
||||
val_method = frappe.db.get_value("Item", item_code, "valuation_method", cache=True)
|
||||
val_method = frappe.get_cached_value("Item", item_code, "valuation_method")
|
||||
if not val_method:
|
||||
val_method = frappe.db.get_single_value("Stock Settings", "valuation_method", cache=True) or "FIFO"
|
||||
val_method = frappe.get_cached_doc("Stock Settings").valuation_method or "FIFO"
|
||||
return val_method
|
||||
|
||||
|
||||
|
||||
@@ -354,7 +354,7 @@ class TransactionBase(StatusUpdater):
|
||||
self.set_rate_based_on_price_list(item_obj, item_details)
|
||||
|
||||
def add_taxes_from_item_template(self, item_obj: object, item_details: dict) -> None:
|
||||
if item_details.item_tax_rate and frappe.db.get_single_value(
|
||||
if item_details.item_tax_rate and frappe.get_single_value(
|
||||
"Accounts Settings", "add_taxes_from_item_tax_template"
|
||||
):
|
||||
item_tax_template = frappe.json.loads(item_details.item_tax_rate)
|
||||
|
||||
Reference in New Issue
Block a user