(cherry picked from commit 329d14957b)
# Conflicts:
# .editorconfig
# .git-blame-ignore-revs
# .github/helper/documentation.py
# .github/helper/install.sh
# .github/stale.yml
# .github/workflows/linters.yml
# .github/workflows/patch.yml
# .github/workflows/release.yml
# .github/workflows/release_notes.yml
# .github/workflows/server-tests-mariadb.yml
# .github/workflows/server-tests-postgres.yml
# .gitignore
# .mergify.yml
# .releaserc
# CODEOWNERS
# README.md
# erpnext/__init__.py
# erpnext/accounts/deferred_revenue.py
# erpnext/accounts/doctype/account/account.json
# erpnext/accounts/doctype/account/account.py
# erpnext/accounts/doctype/account/account_tree.js
# erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py
# erpnext/accounts/doctype/account/chart_of_accounts/verified/de_kontenplan_SKR04.json
# erpnext/accounts/doctype/account/chart_of_accounts/verified/hu_chart_of_accounts_for_microenterprises_with_account_number.json
# erpnext/accounts/doctype/account/chart_of_accounts/verified/in_standard_chart_of_accounts.json
# erpnext/accounts/doctype/account/chart_of_accounts/verified/ni_catalogo_de_cuentas.json
# erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts.py
# erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts_with_account_number.py
# erpnext/accounts/doctype/account/test_account.py
# erpnext/accounts/doctype/account_closing_balance/account_closing_balance.json
# erpnext/accounts/doctype/account_closing_balance/test_account_closing_balance.py
# erpnext/accounts/doctype/accounting_dimension/accounting_dimension.json
# erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py
# erpnext/accounts/doctype/accounting_dimension_detail/accounting_dimension_detail.json
# erpnext/accounts/doctype/accounting_dimension_filter/accounting_dimension_filter.json
# erpnext/accounts/doctype/accounting_dimension_filter/accounting_dimension_filter.py
# erpnext/accounts/doctype/accounting_dimension_filter/test_accounting_dimension_filter.py
# erpnext/accounts/doctype/accounting_period/accounting_period.json
# erpnext/accounts/doctype/accounting_period/test_accounting_period.py
# erpnext/accounts/doctype/accounts_settings/accounts_settings.json
# erpnext/accounts/doctype/accounts_settings/test_accounts_settings.py
# erpnext/accounts/doctype/advance_payment_ledger_entry/test_advance_payment_ledger_entry.py
# erpnext/accounts/doctype/advance_tax/advance_tax.json
# erpnext/accounts/doctype/advance_taxes_and_charges/advance_taxes_and_charges.json
# erpnext/accounts/doctype/advance_taxes_and_charges/advance_taxes_and_charges.py
# erpnext/accounts/doctype/allowed_dimension/allowed_dimension.json
# erpnext/accounts/doctype/allowed_to_transact_with/allowed_to_transact_with.json
# erpnext/accounts/doctype/applicable_on_account/applicable_on_account.json
# erpnext/accounts/doctype/bank/bank.json
# erpnext/accounts/doctype/bank/test_bank.py
# erpnext/accounts/doctype/bank_account/bank_account.json
# erpnext/accounts/doctype/bank_account/bank_account.py
# erpnext/accounts/doctype/bank_account/test_bank_account.py
# erpnext/accounts/doctype/bank_account_subtype/bank_account_subtype.json
# erpnext/accounts/doctype/bank_account_subtype/test_bank_account_subtype.py
# erpnext/accounts/doctype/bank_account_type/bank_account_type.json
# erpnext/accounts/doctype/bank_account_type/test_bank_account_type.py
# erpnext/accounts/doctype/bank_clearance/bank_clearance.json
# erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py
# erpnext/accounts/doctype/bank_clearance_detail/bank_clearance_detail.json
# erpnext/accounts/doctype/bank_guarantee/bank_guarantee.json
# erpnext/accounts/doctype/bank_guarantee/bank_guarantee.py
# erpnext/accounts/doctype/bank_guarantee/test_bank_guarantee.py
# erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.json
# erpnext/accounts/doctype/bank_reconciliation_tool/test_bank_reconciliation_tool.py
# erpnext/accounts/doctype/bank_statement_import/bank_statement_import.js
# erpnext/accounts/doctype/bank_statement_import/bank_statement_import.json
# erpnext/accounts/doctype/bank_statement_import/bank_statement_import.py
# erpnext/accounts/doctype/bank_statement_import/test_bank_statement_import.py
# erpnext/accounts/doctype/bank_transaction/auto_match_party.py
# erpnext/accounts/doctype/bank_transaction/bank_transaction.py
# erpnext/accounts/doctype/bank_transaction/test_auto_match_party.py
# erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py
# erpnext/accounts/doctype/bank_transaction_mapping/bank_transaction_mapping.json
# erpnext/accounts/doctype/bank_transaction_payments/bank_transaction_payments.json
# erpnext/accounts/doctype/bisect_accounting_statements/bisect_accounting_statements.json
# erpnext/accounts/doctype/bisect_accounting_statements/bisect_accounting_statements.py
# erpnext/accounts/doctype/bisect_accounting_statements/test_bisect_accounting_statements.py
# erpnext/accounts/doctype/bisect_nodes/bisect_nodes.json
# erpnext/accounts/doctype/bisect_nodes/test_bisect_nodes.py
# erpnext/accounts/doctype/budget/budget.json
# erpnext/accounts/doctype/budget/test_budget.py
# erpnext/accounts/doctype/budget_account/budget_account.json
# erpnext/accounts/doctype/campaign_item/campaign_item.json
# erpnext/accounts/doctype/cashier_closing/cashier_closing.json
# erpnext/accounts/doctype/cashier_closing/test_cashier_closing.py
# erpnext/accounts/doctype/cashier_closing_payments/cashier_closing_payments.json
# erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.json
# erpnext/accounts/doctype/chart_of_accounts_importer/test_chart_of_accounts_importer.py
# erpnext/accounts/doctype/cheque_print_template/cheque_print_template.json
# erpnext/accounts/doctype/cheque_print_template/test_cheque_print_template.py
# erpnext/accounts/doctype/closed_document/closed_document.json
# erpnext/accounts/doctype/cost_center/cost_center.json
# erpnext/accounts/doctype/cost_center/test_cost_center.py
# erpnext/accounts/doctype/cost_center_allocation/cost_center_allocation.json
# erpnext/accounts/doctype/cost_center_allocation/test_cost_center_allocation.py
# erpnext/accounts/doctype/cost_center_allocation_percentage/cost_center_allocation_percentage.json
# erpnext/accounts/doctype/coupon_code/coupon_code.json
# erpnext/accounts/doctype/coupon_code/coupon_code.py
# erpnext/accounts/doctype/coupon_code/test_coupon_code.py
# erpnext/accounts/doctype/currency_exchange_settings/currency_exchange_settings.json
# erpnext/accounts/doctype/currency_exchange_settings/test_currency_exchange_settings.py
# erpnext/accounts/doctype/currency_exchange_settings_details/currency_exchange_settings_details.json
# erpnext/accounts/doctype/currency_exchange_settings_result/currency_exchange_settings_result.json
# erpnext/accounts/doctype/customer_group_item/customer_group_item.json
# erpnext/accounts/doctype/customer_item/customer_item.json
# erpnext/accounts/doctype/discounted_invoice/discounted_invoice.json
# erpnext/accounts/doctype/dunning/dunning.json
# erpnext/accounts/doctype/dunning/dunning.py
# erpnext/accounts/doctype/dunning/test_dunning.py
# erpnext/accounts/doctype/dunning_letter_text/dunning_letter_text.json
# erpnext/accounts/doctype/dunning_type/dunning_type.json
# erpnext/accounts/doctype/dunning_type/test_dunning_type.py
# erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.js
# erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.json
# erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py
# erpnext/accounts/doctype/exchange_rate_revaluation/test_exchange_rate_revaluation.py
# erpnext/accounts/doctype/exchange_rate_revaluation_account/exchange_rate_revaluation_account.json
# erpnext/accounts/doctype/finance_book/finance_book.json
# erpnext/accounts/doctype/finance_book/test_finance_book.py
# erpnext/accounts/doctype/fiscal_year/fiscal_year.json
# erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py
# erpnext/accounts/doctype/fiscal_year_company/fiscal_year_company.json
# erpnext/accounts/doctype/gl_entry/test_gl_entry.py
# erpnext/accounts/doctype/invoice_discounting/invoice_discounting.js
# erpnext/accounts/doctype/invoice_discounting/invoice_discounting.json
# erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py
# erpnext/accounts/doctype/item_tax_template/item_tax_template.json
# erpnext/accounts/doctype/item_tax_template/test_item_tax_template.py
# erpnext/accounts/doctype/item_tax_template_detail/item_tax_template_detail.json
# erpnext/accounts/doctype/journal_entry/journal_entry.js
# erpnext/accounts/doctype/journal_entry/journal_entry.json
# erpnext/accounts/doctype/journal_entry/journal_entry.py
# erpnext/accounts/doctype/journal_entry/journal_entry_list.js
# erpnext/accounts/doctype/journal_entry/test_journal_entry.py
# erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json
# erpnext/accounts/doctype/journal_entry_template/journal_entry_template.json
# erpnext/accounts/doctype/journal_entry_template/test_journal_entry_template.py
# erpnext/accounts/doctype/journal_entry_template_account/journal_entry_template_account.json
# erpnext/accounts/doctype/ledger_health/test_ledger_health.py
# erpnext/accounts/doctype/ledger_health_monitor/test_ledger_health_monitor.py
# erpnext/accounts/doctype/ledger_merge/ledger_merge.json
# erpnext/accounts/doctype/ledger_merge/test_ledger_merge.py
# erpnext/accounts/doctype/ledger_merge_accounts/ledger_merge_accounts.json
# erpnext/accounts/doctype/loyalty_point_entry/loyalty_point_entry.json
# erpnext/accounts/doctype/loyalty_point_entry/loyalty_point_entry.py
# erpnext/accounts/doctype/loyalty_point_entry/test_loyalty_point_entry.py
# erpnext/accounts/doctype/loyalty_point_entry_redemption/loyalty_point_entry_redemption.json
# erpnext/accounts/doctype/loyalty_program/loyalty_program.json
# erpnext/accounts/doctype/loyalty_program/loyalty_program.py
# erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py
# erpnext/accounts/doctype/loyalty_program_collection/loyalty_program_collection.json
# erpnext/accounts/doctype/mode_of_payment/mode_of_payment.json
# erpnext/accounts/doctype/mode_of_payment/test_mode_of_payment.py
# erpnext/accounts/doctype/mode_of_payment_account/mode_of_payment_account.json
# erpnext/accounts/doctype/monthly_distribution/monthly_distribution.json
# erpnext/accounts/doctype/monthly_distribution/test_monthly_distribution.py
# erpnext/accounts/doctype/monthly_distribution_percentage/monthly_distribution_percentage.json
# erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.json
# erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py
# erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py
# erpnext/accounts/doctype/opening_invoice_creation_tool_item/opening_invoice_creation_tool_item.json
# erpnext/accounts/doctype/overdue_payment/overdue_payment.json
# erpnext/accounts/doctype/party_account/party_account.json
# erpnext/accounts/doctype/party_link/party_link.json
# erpnext/accounts/doctype/party_link/test_party_link.py
# erpnext/accounts/doctype/payment_entry/payment_entry.js
# erpnext/accounts/doctype/payment_entry/payment_entry.json
# erpnext/accounts/doctype/payment_entry/payment_entry.py
# erpnext/accounts/doctype/payment_entry/test_payment_entry.py
# erpnext/accounts/doctype/payment_entry_deduction/payment_entry_deduction.json
# erpnext/accounts/doctype/payment_entry_reference/payment_entry_reference.json
# erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account.json
# erpnext/accounts/doctype/payment_gateway_account/test_payment_gateway_account.py
# erpnext/accounts/doctype/payment_ledger_entry/payment_ledger_entry.json
# erpnext/accounts/doctype/payment_ledger_entry/test_payment_ledger_entry.py
# erpnext/accounts/doctype/payment_order/payment_order.json
# erpnext/accounts/doctype/payment_order/test_payment_order.py
# erpnext/accounts/doctype/payment_order_reference/payment_order_reference.json
# erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.json
# erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py
# erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py
# erpnext/accounts/doctype/payment_reconciliation_allocation/payment_reconciliation_allocation.json
# erpnext/accounts/doctype/payment_reconciliation_invoice/payment_reconciliation_invoice.json
# erpnext/accounts/doctype/payment_reconciliation_payment/payment_reconciliation_payment.json
# erpnext/accounts/doctype/payment_request/payment_request.js
# erpnext/accounts/doctype/payment_request/payment_request.json
# erpnext/accounts/doctype/payment_request/payment_request.py
# erpnext/accounts/doctype/payment_request/payment_request_list.js
# erpnext/accounts/doctype/payment_request/test_payment_request.py
# erpnext/accounts/doctype/payment_schedule/payment_schedule.json
# erpnext/accounts/doctype/payment_term/payment_term.json
# erpnext/accounts/doctype/payment_term/test_payment_term.py
# erpnext/accounts/doctype/payment_terms_template/payment_terms_template.json
# erpnext/accounts/doctype/payment_terms_template/test_payment_terms_template.py
# erpnext/accounts/doctype/payment_terms_template_detail/payment_terms_template_detail.json
# erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.json
# erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py
# erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.json
# erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py
# erpnext/accounts/doctype/pos_closing_entry_detail/pos_closing_entry_detail.json
# erpnext/accounts/doctype/pos_closing_entry_taxes/pos_closing_entry_taxes.json
# erpnext/accounts/doctype/pos_customer_group/pos_customer_group.json
# erpnext/accounts/doctype/pos_field/pos_field.json
# erpnext/accounts/doctype/pos_invoice/pos_invoice.js
# erpnext/accounts/doctype/pos_invoice/pos_invoice.json
# erpnext/accounts/doctype/pos_invoice/pos_invoice.py
# erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py
# erpnext/accounts/doctype/pos_invoice_item/pos_invoice_item.json
# erpnext/accounts/doctype/pos_invoice_item/pos_invoice_item.py
# erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.json
# erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py
# erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py
# erpnext/accounts/doctype/pos_invoice_reference/pos_invoice_reference.json
# erpnext/accounts/doctype/pos_item_group/pos_item_group.json
# erpnext/accounts/doctype/pos_opening_entry/pos_opening_entry.json
# erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py
# erpnext/accounts/doctype/pos_opening_entry_detail/pos_opening_entry_detail.json
# erpnext/accounts/doctype/pos_payment_method/pos_payment_method.json
# erpnext/accounts/doctype/pos_profile/pos_profile.json
# erpnext/accounts/doctype/pos_profile/pos_profile.py
# erpnext/accounts/doctype/pos_profile/test_pos_profile.py
# erpnext/accounts/doctype/pos_profile_user/pos_profile_user.json
# erpnext/accounts/doctype/pos_profile_user/test_pos_profile_user.py
# erpnext/accounts/doctype/pos_search_fields/pos_search_fields.json
# erpnext/accounts/doctype/pos_settings/pos_settings.json
# erpnext/accounts/doctype/pos_settings/test_pos_settings.py
# erpnext/accounts/doctype/pricing_rule/pricing_rule.json
# erpnext/accounts/doctype/pricing_rule/pricing_rule.py
# erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py
# erpnext/accounts/doctype/pricing_rule/utils.py
# erpnext/accounts/doctype/pricing_rule_brand/pricing_rule_brand.json
# erpnext/accounts/doctype/pricing_rule_detail/pricing_rule_detail.json
# erpnext/accounts/doctype/pricing_rule_item_code/pricing_rule_item_code.json
# erpnext/accounts/doctype/pricing_rule_item_group/pricing_rule_item_group.json
# erpnext/accounts/doctype/process_deferred_accounting/process_deferred_accounting.json
# erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py
# erpnext/accounts/doctype/process_payment_reconciliation/process_payment_reconciliation.json
# erpnext/accounts/doctype/process_payment_reconciliation/process_payment_reconciliation.py
# erpnext/accounts/doctype/process_payment_reconciliation/test_process_payment_reconciliation.py
# erpnext/accounts/doctype/process_payment_reconciliation_log/process_payment_reconciliation_log.json
# erpnext/accounts/doctype/process_payment_reconciliation_log/test_process_payment_reconciliation_log.py
# erpnext/accounts/doctype/process_payment_reconciliation_log_allocations/process_payment_reconciliation_log_allocations.json
# erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.html
# erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.json
# erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts_accounts_receivable.html
# erpnext/accounts/doctype/process_statement_of_accounts/test_process_statement_of_accounts.py
# erpnext/accounts/doctype/process_statement_of_accounts_customer/process_statement_of_accounts_customer.json
# erpnext/accounts/doctype/process_subscription/process_subscription.json
# erpnext/accounts/doctype/process_subscription/test_process_subscription.py
# erpnext/accounts/doctype/promotional_scheme/promotional_scheme.json
# erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py
# erpnext/accounts/doctype/promotional_scheme_price_discount/promotional_scheme_price_discount.json
# erpnext/accounts/doctype/promotional_scheme_product_discount/promotional_scheme_product_discount.json
# erpnext/accounts/doctype/psoa_cost_center/psoa_cost_center.json
# erpnext/accounts/doctype/psoa_project/psoa_project.json
# erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
# erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
# erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
# erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
# erpnext/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.json
# erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
# erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.py
# erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.json
# erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.py
# erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template.json
# erpnext/accounts/doctype/purchase_taxes_and_charges_template/test_purchase_taxes_and_charges_template.py
# erpnext/accounts/doctype/repost_accounting_ledger/repost_accounting_ledger.json
# erpnext/accounts/doctype/repost_accounting_ledger/test_repost_accounting_ledger.py
# erpnext/accounts/doctype/repost_accounting_ledger_items/repost_accounting_ledger_items.json
# erpnext/accounts/doctype/repost_accounting_ledger_settings/repost_accounting_ledger_settings.json
# erpnext/accounts/doctype/repost_accounting_ledger_settings/test_repost_accounting_ledger_settings.py
# erpnext/accounts/doctype/repost_allowed_types/repost_allowed_types.json
# erpnext/accounts/doctype/repost_payment_ledger/repost_payment_ledger.json
# erpnext/accounts/doctype/repost_payment_ledger/test_repost_payment_ledger.py
# erpnext/accounts/doctype/repost_payment_ledger_items/repost_payment_ledger_items.json
# erpnext/accounts/doctype/sales_invoice/sales_invoice.js
# erpnext/accounts/doctype/sales_invoice/sales_invoice.json
# erpnext/accounts/doctype/sales_invoice/sales_invoice.py
# erpnext/accounts/doctype/sales_invoice/sales_invoice_list.js
# erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
# erpnext/accounts/doctype/sales_invoice_advance/sales_invoice_advance.json
# erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
# erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.py
# erpnext/accounts/doctype/sales_invoice_payment/sales_invoice_payment.json
# erpnext/accounts/doctype/sales_invoice_timesheet/sales_invoice_timesheet.json
# erpnext/accounts/doctype/sales_partner_item/sales_partner_item.json
# erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.json
# erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.py
# erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.json
# erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py
# erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.py
# erpnext/accounts/doctype/share_balance/share_balance.json
# erpnext/accounts/doctype/share_transfer/share_transfer.json
# erpnext/accounts/doctype/share_transfer/test_share_transfer.py
# erpnext/accounts/doctype/share_type/share_type.json
# erpnext/accounts/doctype/share_type/test_share_type.py
# erpnext/accounts/doctype/shareholder/shareholder.json
# erpnext/accounts/doctype/shareholder/test_shareholder.py
# erpnext/accounts/doctype/shipping_rule/shipping_rule.json
# erpnext/accounts/doctype/shipping_rule/shipping_rule.py
# erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py
# erpnext/accounts/doctype/shipping_rule_condition/shipping_rule_condition.json
# erpnext/accounts/doctype/shipping_rule_country/shipping_rule_country.json
# erpnext/accounts/doctype/south_africa_vat_account/south_africa_vat_account.json
# erpnext/accounts/doctype/subscription/subscription.json
# erpnext/accounts/doctype/subscription/subscription.py
# erpnext/accounts/doctype/subscription/subscription_list.js
# erpnext/accounts/doctype/subscription/test_subscription.py
# erpnext/accounts/doctype/subscription_invoice/subscription_invoice.json
# erpnext/accounts/doctype/subscription_invoice/test_subscription_invoice.py
# erpnext/accounts/doctype/subscription_plan/subscription_plan.json
# erpnext/accounts/doctype/subscription_plan/test_subscription_plan.py
# erpnext/accounts/doctype/subscription_plan_detail/subscription_plan_detail.json
# erpnext/accounts/doctype/subscription_settings/subscription_settings.json
# erpnext/accounts/doctype/subscription_settings/test_subscription_settings.py
# erpnext/accounts/doctype/supplier_group_item/supplier_group_item.json
# erpnext/accounts/doctype/supplier_item/supplier_item.json
# erpnext/accounts/doctype/tax_category/tax_category.json
# erpnext/accounts/doctype/tax_category/test_tax_category.py
# erpnext/accounts/doctype/tax_rule/tax_rule.json
# erpnext/accounts/doctype/tax_rule/tax_rule.py
# erpnext/accounts/doctype/tax_rule/test_tax_rule.py
# erpnext/accounts/doctype/tax_withheld_vouchers/tax_withheld_vouchers.json
# erpnext/accounts/doctype/tax_withholding_account/tax_withholding_account.json
# erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.json
# erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py
# erpnext/accounts/doctype/tax_withholding_rate/tax_withholding_rate.json
# erpnext/accounts/doctype/territory_item/territory_item.json
# erpnext/accounts/doctype/transaction_deletion_record_details/transaction_deletion_record_details.json
# erpnext/accounts/doctype/unreconcile_payment/test_unreconcile_payment.py
# erpnext/accounts/doctype/unreconcile_payment/unreconcile_payment.json
# erpnext/accounts/doctype/unreconcile_payment/unreconcile_payment.py
# erpnext/accounts/doctype/unreconcile_payment_entries/unreconcile_payment_entries.json
# erpnext/accounts/general_ledger.py
# erpnext/accounts/notification/notification_for_new_fiscal_year/notification_for_new_fiscal_year.json
# erpnext/accounts/party.py
# erpnext/accounts/print_format/dunning_letter/dunning_letter.json
# erpnext/accounts/print_format/sales_invoice_return/sales_invoice_return.html
# erpnext/accounts/report/account_balance/account_balance.js
# erpnext/accounts/report/account_balance/account_balance.py
# erpnext/accounts/report/account_balance/test_account_balance.py
# erpnext/accounts/report/accounts_payable/accounts_payable.js
# erpnext/accounts/report/accounts_payable/test_accounts_payable.py
# erpnext/accounts/report/accounts_receivable/accounts_receivable.js
# erpnext/accounts/report/accounts_receivable/accounts_receivable.py
# erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py
# erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py
# erpnext/accounts/report/accounts_receivable_summary/test_accounts_receivable_summary.py
# erpnext/accounts/report/balance_sheet/test_balance_sheet.py
# erpnext/accounts/report/bank_reconciliation_statement/test_bank_reconciliation_statement.py
# erpnext/accounts/report/cash_flow/cash_flow.py
# erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.py
# erpnext/accounts/report/customer_ledger_summary/customer_ledger_summary.py
# erpnext/accounts/report/deferred_revenue_and_expense/deferred_revenue_and_expense.py
# erpnext/accounts/report/deferred_revenue_and_expense/test_deferred_revenue_and_expense.py
# erpnext/accounts/report/general_and_payment_ledger_comparison/test_general_and_payment_ledger_comparison.py
# erpnext/accounts/report/general_ledger/general_ledger.html
# erpnext/accounts/report/general_ledger/general_ledger.py
# erpnext/accounts/report/general_ledger/test_general_ledger.py
# erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py
# erpnext/accounts/report/gross_profit/test_gross_profit.py
# erpnext/accounts/report/item_wise_purchase_register/test_item_wise_purchase_register.py
# erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.js
# erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
# erpnext/accounts/report/item_wise_sales_register/test_item_wise_sales_register.py
# erpnext/accounts/report/payment_ledger/test_payment_ledger.py
# erpnext/accounts/report/profit_and_loss_statement/test_profit_and_loss_statement.py
# erpnext/accounts/report/purchase_register/test_purchase_register.py
# erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py
# erpnext/accounts/report/sales_register/test_sales_register.py
# erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py
# erpnext/accounts/report/tax_withholding_details/test_tax_withholding_details.py
# erpnext/accounts/report/trial_balance/test_trial_balance.py
# erpnext/accounts/test/accounts_mixin.py
# erpnext/accounts/test/test_reports.py
# erpnext/accounts/test/test_utils.py
# erpnext/accounts/test_party.py
# erpnext/accounts/utils.py
# erpnext/assets/doctype/asset/asset.js
# erpnext/assets/doctype/asset/asset.json
# erpnext/assets/doctype/asset/asset.py
# erpnext/assets/doctype/asset/depreciation.py
# erpnext/assets/doctype/asset/test_asset.py
# erpnext/assets/doctype/asset_activity/asset_activity.json
# erpnext/assets/doctype/asset_activity/test_asset_activity.py
# erpnext/assets/doctype/asset_capitalization/asset_capitalization.js
# erpnext/assets/doctype/asset_capitalization/asset_capitalization.json
# erpnext/assets/doctype/asset_capitalization/asset_capitalization.py
# erpnext/assets/doctype/asset_capitalization/test_asset_capitalization.py
# erpnext/assets/doctype/asset_capitalization_asset_item/asset_capitalization_asset_item.json
# erpnext/assets/doctype/asset_capitalization_service_item/asset_capitalization_service_item.json
# erpnext/assets/doctype/asset_capitalization_stock_item/asset_capitalization_stock_item.json
# erpnext/assets/doctype/asset_category/asset_category.json
# erpnext/assets/doctype/asset_category/test_asset_category.py
# erpnext/assets/doctype/asset_category_account/asset_category_account.json
# erpnext/assets/doctype/asset_depreciation_schedule/asset_depreciation_schedule.json
# erpnext/assets/doctype/asset_depreciation_schedule/test_asset_depreciation_schedule.py
# erpnext/assets/doctype/asset_finance_book/asset_finance_book.json
# erpnext/assets/doctype/asset_maintenance/asset_maintenance.json
# erpnext/assets/doctype/asset_maintenance/asset_maintenance.py
# erpnext/assets/doctype/asset_maintenance/test_asset_maintenance.py
# erpnext/assets/doctype/asset_maintenance_log/asset_maintenance_log.json
# erpnext/assets/doctype/asset_maintenance_log/test_asset_maintenance_log.py
# erpnext/assets/doctype/asset_maintenance_task/asset_maintenance_task.json
# erpnext/assets/doctype/asset_maintenance_team/asset_maintenance_team.json
# erpnext/assets/doctype/asset_maintenance_team/test_asset_maintenance_team.py
# erpnext/assets/doctype/asset_movement/asset_movement.json
# erpnext/assets/doctype/asset_movement/asset_movement.py
# erpnext/assets/doctype/asset_movement/test_asset_movement.py
# erpnext/assets/doctype/asset_movement_item/asset_movement_item.json
# erpnext/assets/doctype/asset_repair/asset_repair.js
# erpnext/assets/doctype/asset_repair/asset_repair.json
# erpnext/assets/doctype/asset_repair/asset_repair.py
# erpnext/assets/doctype/asset_repair/test_asset_repair.py
# erpnext/assets/doctype/asset_repair_consumed_item/asset_repair_consumed_item.json
# erpnext/assets/doctype/asset_shift_allocation/asset_shift_allocation.json
# erpnext/assets/doctype/asset_shift_allocation/test_asset_shift_allocation.py
# erpnext/assets/doctype/asset_shift_factor/asset_shift_factor.json
# erpnext/assets/doctype/asset_shift_factor/test_asset_shift_factor.py
# erpnext/assets/doctype/asset_value_adjustment/asset_value_adjustment.js
# erpnext/assets/doctype/asset_value_adjustment/asset_value_adjustment.json
# erpnext/assets/doctype/asset_value_adjustment/asset_value_adjustment.py
# erpnext/assets/doctype/asset_value_adjustment/test_asset_value_adjustment.py
# erpnext/assets/doctype/depreciation_schedule/depreciation_schedule.json
# erpnext/assets/doctype/linked_location/linked_location.json
# erpnext/assets/doctype/location/location.json
# erpnext/assets/doctype/location/test_location.py
# erpnext/assets/doctype/maintenance_team_member/maintenance_team_member.json
# erpnext/assets/doctype/maintenance_team_member/test_maintenance_team_member.py
# erpnext/assets/report/fixed_asset_register/fixed_asset_register.py
# erpnext/bulk_transaction/doctype/bulk_transaction_log/bulk_transaction_log.json
# erpnext/bulk_transaction/doctype/bulk_transaction_log/test_bulk_transaction_log.py
# erpnext/bulk_transaction/doctype/bulk_transaction_log_detail/bulk_transaction_log_detail.json
# erpnext/bulk_transaction/doctype/bulk_transaction_log_detail/test_bulk_transaction_log_detail.py
# erpnext/buying/doctype/buying_settings/buying_settings.json
# erpnext/buying/doctype/buying_settings/test_buying_settings.py
# erpnext/buying/doctype/purchase_order/purchase_order.js
# erpnext/buying/doctype/purchase_order/purchase_order.json
# erpnext/buying/doctype/purchase_order/purchase_order.py
# erpnext/buying/doctype/purchase_order/purchase_order_list.js
# erpnext/buying/doctype/purchase_order/test_purchase_order.py
# erpnext/buying/doctype/purchase_order_item/purchase_order_item.json
# erpnext/buying/doctype/purchase_order_item/purchase_order_item.py
# erpnext/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.json
# erpnext/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.json
# erpnext/buying/doctype/request_for_quotation/request_for_quotation.js
# erpnext/buying/doctype/request_for_quotation/request_for_quotation.json
# erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
# erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.py
# erpnext/buying/doctype/request_for_quotation_item/request_for_quotation_item.json
# erpnext/buying/doctype/request_for_quotation_supplier/request_for_quotation_supplier.json
# erpnext/buying/doctype/supplier/supplier.json
# erpnext/buying/doctype/supplier/supplier_dashboard.py
# erpnext/buying/doctype/supplier/test_supplier.py
# erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
# erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
# erpnext/buying/doctype/supplier_quotation/supplier_quotation.py
# erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py
# erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json
# erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.py
# erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.json
# erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.py
# erpnext/buying/doctype/supplier_scorecard/test_supplier_scorecard.py
# erpnext/buying/doctype/supplier_scorecard_criteria/supplier_scorecard_criteria.json
# erpnext/buying/doctype/supplier_scorecard_criteria/test_supplier_scorecard_criteria.py
# erpnext/buying/doctype/supplier_scorecard_period/supplier_scorecard_period.json
# erpnext/buying/doctype/supplier_scorecard_period/test_supplier_scorecard_period.py
# erpnext/buying/doctype/supplier_scorecard_scoring_criteria/supplier_scorecard_scoring_criteria.json
# erpnext/buying/doctype/supplier_scorecard_scoring_standing/supplier_scorecard_scoring_standing.json
# erpnext/buying/doctype/supplier_scorecard_scoring_variable/supplier_scorecard_scoring_variable.json
# erpnext/buying/doctype/supplier_scorecard_standing/supplier_scorecard_standing.json
# erpnext/buying/doctype/supplier_scorecard_standing/test_supplier_scorecard_standing.py
# erpnext/buying/doctype/supplier_scorecard_variable/supplier_scorecard_variable.json
# erpnext/buying/doctype/supplier_scorecard_variable/supplier_scorecard_variable.py
# erpnext/buying/doctype/supplier_scorecard_variable/test_supplier_scorecard_variable.py
# erpnext/buying/report/procurement_tracker/test_procurement_tracker.py
# erpnext/buying/report/purchase_order_analysis/purchase_order_analysis.js
# erpnext/buying/report/purchase_order_analysis/purchase_order_analysis.py
# erpnext/buying/report/requested_items_to_order_and_receive/test_requested_items_to_order_and_receive.py
# erpnext/buying/report/subcontracted_item_to_be_received/test_subcontracted_item_to_be_received.py
# erpnext/buying/report/subcontracted_raw_materials_to_be_transferred/test_subcontracted_raw_materials_to_be_transferred.py
# erpnext/buying/utils.py
# erpnext/communication/doctype/communication_medium/communication_medium.json
# erpnext/communication/doctype/communication_medium_timeslot/communication_medium_timeslot.json
# erpnext/controllers/accounts_controller.py
# erpnext/controllers/buying_controller.py
# erpnext/controllers/queries.py
# erpnext/controllers/sales_and_purchase_return.py
# erpnext/controllers/selling_controller.py
# erpnext/controllers/status_updater.py
# erpnext/controllers/stock_controller.py
# erpnext/controllers/subcontracting_controller.py
# erpnext/controllers/taxes_and_totals.py
# erpnext/controllers/tests/test_accounts_controller.py
# erpnext/controllers/tests/test_item_variant.py
# erpnext/controllers/tests/test_mapper.py
# erpnext/controllers/tests/test_qty_based_taxes.py
# erpnext/controllers/tests/test_queries.py
# erpnext/controllers/tests/test_subcontracting_controller.py
# erpnext/controllers/tests/test_transaction_base.py
# erpnext/controllers/website_list_for_contact.py
# erpnext/crm/dashboard_chart/lead_source/lead_source.json
# erpnext/crm/dashboard_chart/opportunities_via_campaigns/opportunities_via_campaigns.json
# erpnext/crm/doctype/appointment/appointment.json
# erpnext/crm/doctype/appointment/appointment.py
# erpnext/crm/doctype/appointment/test_appointment.py
# erpnext/crm/doctype/appointment_booking_settings/appointment_booking_settings.json
# erpnext/crm/doctype/appointment_booking_settings/test_appointment_booking_settings.py
# erpnext/crm/doctype/appointment_booking_slots/appointment_booking_slots.json
# erpnext/crm/doctype/availability_of_slots/availability_of_slots.json
# erpnext/crm/doctype/campaign/campaign.js
# erpnext/crm/doctype/campaign/campaign.json
# erpnext/crm/doctype/campaign/campaign.py
# erpnext/crm/doctype/campaign/test_campaign.py
# erpnext/crm/doctype/campaign_email_schedule/campaign_email_schedule.json
# erpnext/crm/doctype/competitor/competitor.json
# erpnext/crm/doctype/competitor/test_competitor.py
# erpnext/crm/doctype/competitor_detail/competitor_detail.json
# erpnext/crm/doctype/contract/contract.json
# erpnext/crm/doctype/contract/test_contract.py
# erpnext/crm/doctype/contract_fulfilment_checklist/contract_fulfilment_checklist.json
# erpnext/crm/doctype/contract_fulfilment_checklist/test_contract_fulfilment_checklist.py
# erpnext/crm/doctype/contract_template/contract_template.json
# erpnext/crm/doctype/contract_template/test_contract_template.py
# erpnext/crm/doctype/contract_template_fulfilment_terms/contract_template_fulfilment_terms.json
# erpnext/crm/doctype/crm_note/crm_note.json
# erpnext/crm/doctype/crm_settings/crm_settings.json
# erpnext/crm/doctype/crm_settings/test_crm_settings.py
# erpnext/crm/doctype/email_campaign/email_campaign.json
# erpnext/crm/doctype/email_campaign/email_campaign.py
# erpnext/crm/doctype/email_campaign/test_email_campaign.py
# erpnext/crm/doctype/lead/lead.json
# erpnext/crm/doctype/lead/lead.py
# erpnext/crm/doctype/lead/test_lead.py
# erpnext/crm/doctype/lost_reason_detail/lost_reason_detail.json
# erpnext/crm/doctype/market_segment/market_segment.json
# erpnext/crm/doctype/market_segment/test_market_segment.py
# erpnext/crm/doctype/opportunity/opportunity.js
# erpnext/crm/doctype/opportunity/opportunity.json
# erpnext/crm/doctype/opportunity/opportunity.py
# erpnext/crm/doctype/opportunity/test_opportunity.py
# erpnext/crm/doctype/opportunity_item/opportunity_item.json
# erpnext/crm/doctype/opportunity_lost_reason/opportunity_lost_reason.json
# erpnext/crm/doctype/opportunity_lost_reason_detail/opportunity_lost_reason_detail.json
# erpnext/crm/doctype/opportunity_type/opportunity_type.json
# erpnext/crm/doctype/opportunity_type/test_opportunity_type.py
# erpnext/crm/doctype/prospect/prospect.json
# erpnext/crm/doctype/prospect/test_prospect.py
# erpnext/crm/doctype/prospect_lead/prospect_lead.json
# erpnext/crm/doctype/prospect_opportunity/prospect_opportunity.json
# erpnext/crm/doctype/sales_stage/sales_stage.json
# erpnext/crm/doctype/sales_stage/test_sales_stage.py
# erpnext/crm/doctype/utils.py
# erpnext/crm/report/campaign_efficiency/campaign_efficiency.py
# erpnext/crm/report/opportunity_summary_by_sales_stage/opportunity_summary_by_sales_stage.js
# erpnext/crm/report/opportunity_summary_by_sales_stage/opportunity_summary_by_sales_stage.py
# erpnext/crm/report/opportunity_summary_by_sales_stage/test_opportunity_summary_by_sales_stage.py
# erpnext/crm/report/sales_pipeline_analytics/sales_pipeline_analytics.js
# erpnext/crm/report/sales_pipeline_analytics/sales_pipeline_analytics.py
# erpnext/crm/report/sales_pipeline_analytics/test_sales_pipeline_analytics.py
# erpnext/crm/workspace/crm/crm.json
# erpnext/edi/doctype/code_list/code_list_import.py
# erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.json
# erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py
# erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.json
# erpnext/erpnext_integrations/doctype/quickbooks_migrator/test_quickbooks_migrator.py
# erpnext/erpnext_integrations/doctype/tally_migration/tally_migration.json
# erpnext/erpnext_integrations/doctype/tally_migration/tally_migration.py
# erpnext/erpnext_integrations/doctype/tally_migration/test_tally_migration.py
# erpnext/erpnext_integrations/utils.py
# erpnext/hooks.py
# erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.json
# erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py
# erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py
# erpnext/maintenance/doctype/maintenance_schedule_detail/maintenance_schedule_detail.json
# erpnext/maintenance/doctype/maintenance_schedule_item/maintenance_schedule_item.json
# erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.json
# erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.py
# erpnext/maintenance/doctype/maintenance_visit/test_maintenance_visit.py
# erpnext/maintenance/doctype/maintenance_visit_purpose/maintenance_visit_purpose.json
# erpnext/manufacturing/doctype/blanket_order/blanket_order.json
# erpnext/manufacturing/doctype/blanket_order/blanket_order.py
# erpnext/manufacturing/doctype/blanket_order/test_blanket_order.py
# erpnext/manufacturing/doctype/blanket_order_item/blanket_order_item.json
# erpnext/manufacturing/doctype/bom/bom.js
# erpnext/manufacturing/doctype/bom/bom.json
# erpnext/manufacturing/doctype/bom/bom.py
# erpnext/manufacturing/doctype/bom/test_bom.py
# erpnext/manufacturing/doctype/bom_creator/bom_creator.js
# erpnext/manufacturing/doctype/bom_creator/bom_creator.json
# erpnext/manufacturing/doctype/bom_creator/bom_creator.py
# erpnext/manufacturing/doctype/bom_creator/test_bom_creator.py
# erpnext/manufacturing/doctype/bom_creator_item/bom_creator_item.json
# erpnext/manufacturing/doctype/bom_creator_item/bom_creator_item.py
# erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.json
# erpnext/manufacturing/doctype/bom_item/bom_item.json
# erpnext/manufacturing/doctype/bom_item/bom_item.py
# erpnext/manufacturing/doctype/bom_operation/bom_operation.json
# erpnext/manufacturing/doctype/bom_operation/bom_operation.py
# erpnext/manufacturing/doctype/bom_scrap_item/bom_scrap_item.json
# erpnext/manufacturing/doctype/bom_update_batch/bom_update_batch.json
# erpnext/manufacturing/doctype/bom_update_log/bom_update_log.json
# erpnext/manufacturing/doctype/bom_update_log/bom_update_log.py
# erpnext/manufacturing/doctype/bom_update_log/test_bom_update_log.py
# erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.json
# erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py
# erpnext/manufacturing/doctype/bom_website_item/bom_website_item.json
# erpnext/manufacturing/doctype/bom_website_operation/bom_website_operation.json
# erpnext/manufacturing/doctype/downtime_entry/downtime_entry.json
# erpnext/manufacturing/doctype/downtime_entry/test_downtime_entry.py
# erpnext/manufacturing/doctype/job_card/job_card.js
# erpnext/manufacturing/doctype/job_card/job_card.json
# erpnext/manufacturing/doctype/job_card/job_card.py
# erpnext/manufacturing/doctype/job_card/job_card_dashboard.py
# erpnext/manufacturing/doctype/job_card/test_job_card.py
# erpnext/manufacturing/doctype/job_card_item/job_card_item.json
# erpnext/manufacturing/doctype/job_card_operation/job_card_operation.json
# erpnext/manufacturing/doctype/job_card_scheduled_time/job_card_scheduled_time.json
# erpnext/manufacturing/doctype/job_card_scrap_item/job_card_scrap_item.json
# erpnext/manufacturing/doctype/job_card_time_log/job_card_time_log.json
# erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.json
# erpnext/manufacturing/doctype/manufacturing_settings/test_manufacturing_settings.py
# erpnext/manufacturing/doctype/material_request_plan_item/material_request_plan_item.json
# erpnext/manufacturing/doctype/material_request_plan_item/test_material_request_plan_item.py
# erpnext/manufacturing/doctype/operation/operation.json
# erpnext/manufacturing/doctype/operation/test_operation.py
# erpnext/manufacturing/doctype/plant_floor/plant_floor.js
# erpnext/manufacturing/doctype/plant_floor/plant_floor.json
# erpnext/manufacturing/doctype/plant_floor/test_plant_floor.py
# erpnext/manufacturing/doctype/production_plan/production_plan.json
# erpnext/manufacturing/doctype/production_plan/production_plan.py
# erpnext/manufacturing/doctype/production_plan/test_production_plan.py
# erpnext/manufacturing/doctype/production_plan_item/production_plan_item.json
# erpnext/manufacturing/doctype/production_plan_item_reference/production_plan_item_reference.json
# erpnext/manufacturing/doctype/production_plan_material_request/production_plan_material_request.json
# erpnext/manufacturing/doctype/production_plan_material_request_warehouse/production_plan_material_request_warehouse.json
# erpnext/manufacturing/doctype/production_plan_material_request_warehouse/test_production_plan_material_request_warehouse.py
# erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.json
# erpnext/manufacturing/doctype/production_plan_sub_assembly_item/production_plan_sub_assembly_item.json
# erpnext/manufacturing/doctype/routing/routing.json
# erpnext/manufacturing/doctype/routing/routing.py
# erpnext/manufacturing/doctype/routing/test_routing.py
# erpnext/manufacturing/doctype/sub_operation/sub_operation.json
# erpnext/manufacturing/doctype/sub_operation/test_sub_operation.py
# erpnext/manufacturing/doctype/work_order/test_work_order.py
# erpnext/manufacturing/doctype/work_order/work_order.js
# erpnext/manufacturing/doctype/work_order/work_order.json
# erpnext/manufacturing/doctype/work_order/work_order.py
# erpnext/manufacturing/doctype/work_order_item/work_order_item.json
# erpnext/manufacturing/doctype/work_order_operation/work_order_operation.json
# erpnext/manufacturing/doctype/work_order_operation/work_order_operation.py
# erpnext/manufacturing/doctype/workstation/test_workstation.py
# erpnext/manufacturing/doctype/workstation/workstation.js
# erpnext/manufacturing/doctype/workstation/workstation.json
# erpnext/manufacturing/doctype/workstation/workstation.py
# erpnext/manufacturing/doctype/workstation/workstation_job_card.html
# erpnext/manufacturing/doctype/workstation_type/test_workstation_type.py
# erpnext/manufacturing/doctype/workstation_type/workstation_type.json
# erpnext/manufacturing/doctype/workstation_working_hour/workstation_working_hour.json
# erpnext/manufacturing/notification/material_request_receipt_notification/material_request_receipt_notification.json
# erpnext/manufacturing/report/bom_stock_calculated/test_bom_stock_calculated.py
# erpnext/manufacturing/report/bom_stock_report/test_bom_stock_report.py
# erpnext/manufacturing/report/production_analytics/production_analytics.py
# erpnext/manufacturing/report/quality_inspection_summary/quality_inspection_summary.py
# erpnext/manufacturing/report/test_reports.py
# erpnext/patches.txt
# erpnext/patches/v11_0/create_department_records_for_each_company.py
# erpnext/patches/v11_0/make_location_from_warehouse.py
# erpnext/patches/v11_0/rebuild_tree_for_company.py
# erpnext/patches/v11_0/rename_supplier_type_to_supplier_group.py
# erpnext/patches/v11_0/update_department_lft_rgt.py
# erpnext/patches/v13_0/modify_invalid_gain_loss_gl_entries.py
# erpnext/patches/v14_0/migrate_crm_settings.py
# erpnext/patches/v14_0/migrate_gl_to_payment_ledger.py
# erpnext/patches/v15_0/create_advance_payment_ledger_records.py
# erpnext/patches/v15_0/create_asset_depreciation_schedules_from_assets.py
# erpnext/patches/v15_0/update_gpa_and_ndb_for_assdeprsch.py
# erpnext/portal/doctype/website_attribute/website_attribute.json
# erpnext/portal/doctype/website_filter_field/website_filter_field.json
# erpnext/portal/utils.py
# erpnext/projects/doctype/activity_cost/activity_cost.json
# erpnext/projects/doctype/activity_cost/test_activity_cost.py
# erpnext/projects/doctype/activity_type/activity_type.json
# erpnext/projects/doctype/activity_type/test_activity_type.py
# erpnext/projects/doctype/dependent_task/dependent_task.json
# erpnext/projects/doctype/project/project.json
# erpnext/projects/doctype/project/project.py
# erpnext/projects/doctype/project/test_project.py
# erpnext/projects/doctype/project_template/project_template.json
# erpnext/projects/doctype/project_template/test_project_template.py
# erpnext/projects/doctype/project_template_task/project_template_task.json
# erpnext/projects/doctype/project_type/project_type.json
# erpnext/projects/doctype/project_type/test_project_type.py
# erpnext/projects/doctype/project_update/project_update.json
# erpnext/projects/doctype/project_update/test_project_update.py
# erpnext/projects/doctype/project_user/project_user.json
# erpnext/projects/doctype/projects_settings/projects_settings.json
# erpnext/projects/doctype/projects_settings/test_projects_settings.py
# erpnext/projects/doctype/task/task.js
# erpnext/projects/doctype/task/task.json
# erpnext/projects/doctype/task/task.py
# erpnext/projects/doctype/task/test_task.py
# erpnext/projects/doctype/task_depends_on/task_depends_on.json
# erpnext/projects/doctype/task_type/task_type.json
# erpnext/projects/doctype/task_type/test_task_type.py
# erpnext/projects/doctype/timesheet/test_timesheet.py
# erpnext/projects/doctype/timesheet/timesheet.js
# erpnext/projects/doctype/timesheet/timesheet.json
# erpnext/projects/doctype/timesheet/timesheet.py
# erpnext/projects/doctype/timesheet_detail/timesheet_detail.json
# erpnext/projects/doctype/timesheet_detail/timesheet_detail.py
# erpnext/projects/report/delayed_tasks_summary/delayed_tasks_summary.py
# erpnext/projects/report/delayed_tasks_summary/test_delayed_tasks_summary.py
# erpnext/projects/workspace/projects/projects.json
# erpnext/public/images/erpnext-logo.svg
# erpnext/public/js/bom_configurator/bom_configurator.bundle.js
# erpnext/public/js/bulk_transaction_processing.js
# erpnext/public/js/controllers/accounts.js
# erpnext/public/js/controllers/taxes_and_totals.js
# erpnext/public/js/controllers/transaction.js
# erpnext/public/js/financial_statements.js
# erpnext/public/js/plant_floor_visual/visual_plant.js
# erpnext/public/js/projects/timer.js
# erpnext/public/js/setup_wizard.js
# erpnext/public/js/templates/visual_plant_floor_template.html
# erpnext/public/js/utils.js
# erpnext/public/js/utils/dimension_tree_filter.js
# erpnext/public/scss/erpnext.scss
# erpnext/quality_management/doctype/non_conformance/non_conformance.json
# erpnext/quality_management/doctype/non_conformance/test_non_conformance.py
# erpnext/quality_management/doctype/quality_action/quality_action.json
# erpnext/quality_management/doctype/quality_action/test_quality_action.py
# erpnext/quality_management/doctype/quality_action_resolution/quality_action_resolution.json
# erpnext/quality_management/doctype/quality_feedback/quality_feedback.json
# erpnext/quality_management/doctype/quality_feedback/test_quality_feedback.py
# erpnext/quality_management/doctype/quality_feedback_parameter/quality_feedback_parameter.json
# erpnext/quality_management/doctype/quality_feedback_template/quality_feedback_template.json
# erpnext/quality_management/doctype/quality_feedback_template/test_quality_feedback_template.py
# erpnext/quality_management/doctype/quality_feedback_template_parameter/quality_feedback_template_parameter.json
# erpnext/quality_management/doctype/quality_goal/quality_goal.json
# erpnext/quality_management/doctype/quality_goal/test_quality_goal.py
# erpnext/quality_management/doctype/quality_goal_objective/quality_goal_objective.json
# erpnext/quality_management/doctype/quality_meeting/quality_meeting.json
# erpnext/quality_management/doctype/quality_meeting/test_quality_meeting.py
# erpnext/quality_management/doctype/quality_meeting_agenda/quality_meeting_agenda.json
# erpnext/quality_management/doctype/quality_meeting_agenda/test_quality_meeting_agenda.py
# erpnext/quality_management/doctype/quality_meeting_minutes/quality_meeting_minutes.json
# erpnext/quality_management/doctype/quality_procedure/quality_procedure.json
# erpnext/quality_management/doctype/quality_procedure/test_quality_procedure.py
# erpnext/quality_management/doctype/quality_procedure_process/quality_procedure_process.json
# erpnext/quality_management/doctype/quality_review/quality_review.json
# erpnext/quality_management/doctype/quality_review/test_quality_review.py
# erpnext/quality_management/doctype/quality_review_objective/quality_review_objective.json
# erpnext/regional/doctype/import_supplier_invoice/import_supplier_invoice.json
# erpnext/regional/doctype/import_supplier_invoice/import_supplier_invoice.py
# erpnext/regional/doctype/import_supplier_invoice/test_import_supplier_invoice.py
# erpnext/regional/doctype/lower_deduction_certificate/lower_deduction_certificate.json
# erpnext/regional/doctype/lower_deduction_certificate/lower_deduction_certificate.py
# erpnext/regional/doctype/lower_deduction_certificate/test_lower_deduction_certificate.py
# erpnext/regional/doctype/south_africa_vat_settings/south_africa_vat_settings.json
# erpnext/regional/doctype/south_africa_vat_settings/test_south_africa_vat_settings.py
# erpnext/regional/doctype/uae_vat_account/uae_vat_account.json
# erpnext/regional/doctype/uae_vat_settings/test_uae_vat_settings.py
# erpnext/regional/doctype/uae_vat_settings/uae_vat_settings.json
# erpnext/regional/italy/utils.py
# erpnext/regional/print_format/detailed_tax_invoice/detailed_tax_invoice.json
# erpnext/regional/print_format/tax_invoice/tax_invoice.json
# erpnext/regional/report/uae_vat_201/test_uae_vat_201.py
# erpnext/regional/report/vat_audit_report/vat_audit_report.py
# erpnext/regional/united_states/test_united_states.py
# erpnext/selling/doctype/customer/customer.js
# erpnext/selling/doctype/customer/customer.json
# erpnext/selling/doctype/customer/customer.py
# erpnext/selling/doctype/customer/customer_dashboard.py
# erpnext/selling/doctype/customer/test_customer.py
# erpnext/selling/doctype/customer_credit_limit/customer_credit_limit.json
# erpnext/selling/doctype/industry_type/industry_type.json
# erpnext/selling/doctype/industry_type/test_industry_type.py
# erpnext/selling/doctype/installation_note/installation_note.json
# erpnext/selling/doctype/installation_note/installation_note.py
# erpnext/selling/doctype/installation_note/test_installation_note.py
# erpnext/selling/doctype/installation_note_item/installation_note_item.json
# erpnext/selling/doctype/party_specific_item/party_specific_item.json
# erpnext/selling/doctype/party_specific_item/test_party_specific_item.py
# erpnext/selling/doctype/product_bundle/product_bundle.js
# erpnext/selling/doctype/product_bundle/product_bundle.json
# erpnext/selling/doctype/product_bundle/test_product_bundle.py
# erpnext/selling/doctype/product_bundle_item/product_bundle_item.json
# erpnext/selling/doctype/quotation/quotation.json
# erpnext/selling/doctype/quotation/quotation.py
# erpnext/selling/doctype/quotation/test_quotation.py
# erpnext/selling/doctype/quotation_item/quotation_item.json
# erpnext/selling/doctype/quotation_item/quotation_item.py
# erpnext/selling/doctype/sales_order/sales_order.js
# erpnext/selling/doctype/sales_order/sales_order.json
# erpnext/selling/doctype/sales_order/sales_order.py
# erpnext/selling/doctype/sales_order/sales_order_list.js
# erpnext/selling/doctype/sales_order/test_sales_order.py
# erpnext/selling/doctype/sales_order_item/sales_order_item.json
# erpnext/selling/doctype/sales_order_item/sales_order_item.py
# erpnext/selling/doctype/sales_partner_type/sales_partner_type.json
# erpnext/selling/doctype/sales_partner_type/test_sales_partner_type.py
# erpnext/selling/doctype/sales_team/sales_team.json
# erpnext/selling/doctype/selling_settings/selling_settings.json
# erpnext/selling/doctype/selling_settings/selling_settings.py
# erpnext/selling/doctype/selling_settings/test_selling_settings.py
# erpnext/selling/doctype/sms_center/sms_center.json
# erpnext/selling/page/point_of_sale/pos_controller.js
# erpnext/selling/page/point_of_sale/pos_item_cart.js
# erpnext/selling/page/point_of_sale/pos_past_order_summary.js
# erpnext/selling/page/point_of_sale/pos_payment.js
# erpnext/selling/page/sales_funnel/sales_funnel.js
# erpnext/selling/page/sales_funnel/sales_funnel.py
# erpnext/selling/report/address_and_contacts/address_and_contacts.py
# erpnext/selling/report/customer_credit_balance/customer_credit_balance.py
# erpnext/selling/report/payment_terms_status_for_sales_order/payment_terms_status_for_sales_order.py
# erpnext/selling/report/payment_terms_status_for_sales_order/test_payment_terms_status_for_sales_order.py
# erpnext/selling/report/pending_so_items_for_purchase_request/test_pending_so_items_for_purchase_request.py
# erpnext/selling/report/sales_analytics/sales_analytics.js
# erpnext/selling/report/sales_analytics/sales_analytics.py
# erpnext/selling/report/sales_analytics/test_analytics.py
# erpnext/selling/report/sales_order_analysis/sales_order_analysis.js
# erpnext/selling/report/sales_order_analysis/sales_order_analysis.py
# erpnext/selling/report/sales_order_analysis/test_sales_order_analysis.py
# erpnext/selling/report/sales_partner_target_variance_based_on_item_group/test_sales_partner_target_variance_based_on_item_group.py
# erpnext/selling/report/sales_person_target_variance_based_on_item_group/test_sales_person_target_variance_based_on_item_group.py
# erpnext/selling/workspace/selling/selling.json
# erpnext/setup/doctype/authorization_control/authorization_control.json
# erpnext/setup/doctype/authorization_control/authorization_control.py
# erpnext/setup/doctype/authorization_rule/authorization_rule.json
# erpnext/setup/doctype/authorization_rule/test_authorization_rule.py
# erpnext/setup/doctype/branch/branch.json
# erpnext/setup/doctype/branch/test_branch.py
# erpnext/setup/doctype/brand/brand.json
# erpnext/setup/doctype/brand/test_brand.py
# erpnext/setup/doctype/company/company.js
# erpnext/setup/doctype/company/company.json
# erpnext/setup/doctype/company/company.py
# erpnext/setup/doctype/company/test_company.py
# erpnext/setup/doctype/currency_exchange/test_currency_exchange.py
# erpnext/setup/doctype/customer_group/customer_group.json
# erpnext/setup/doctype/customer_group/customer_group.py
# erpnext/setup/doctype/customer_group/test_customer_group.py
# erpnext/setup/doctype/department/department.json
# erpnext/setup/doctype/department/department.py
# erpnext/setup/doctype/department/test_department.py
# erpnext/setup/doctype/designation/designation.json
# erpnext/setup/doctype/designation/test_designation.py
# erpnext/setup/doctype/driver/driver.json
# erpnext/setup/doctype/driver/driver.py
# erpnext/setup/doctype/driver/test_driver.py
# erpnext/setup/doctype/driving_license_category/driving_license_category.json
# erpnext/setup/doctype/email_digest/email_digest.json
# erpnext/setup/doctype/email_digest/email_digest.py
# erpnext/setup/doctype/email_digest/test_email_digest.py
# erpnext/setup/doctype/email_digest_recipient/email_digest_recipient.json
# erpnext/setup/doctype/employee/employee.json
# erpnext/setup/doctype/employee/employee.py
# erpnext/setup/doctype/employee/test_employee.py
# erpnext/setup/doctype/employee_education/employee_education.json
# erpnext/setup/doctype/employee_external_work_history/employee_external_work_history.json
# erpnext/setup/doctype/employee_group/employee_group.json
# erpnext/setup/doctype/employee_group/test_employee_group.py
# erpnext/setup/doctype/employee_group_table/employee_group_table.json
# erpnext/setup/doctype/employee_internal_work_history/employee_internal_work_history.json
# erpnext/setup/doctype/global_defaults/global_defaults.json
# erpnext/setup/doctype/global_defaults/test_global_defaults.py
# erpnext/setup/doctype/holiday/holiday.json
# erpnext/setup/doctype/holiday_list/holiday_list.json
# erpnext/setup/doctype/holiday_list/test_holiday_list.py
# erpnext/setup/doctype/incoterm/test_incoterm.py
# erpnext/setup/doctype/item_group/item_group.json
# erpnext/setup/doctype/item_group/test_item_group.py
# erpnext/setup/doctype/party_type/party_type.json
# erpnext/setup/doctype/party_type/test_party_type.py
# erpnext/setup/doctype/print_heading/print_heading.json
# erpnext/setup/doctype/print_heading/test_print_heading.py
# erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.json
# erpnext/setup/doctype/quotation_lost_reason/test_quotation_lost_reason.py
# erpnext/setup/doctype/quotation_lost_reason_detail/quotation_lost_reason_detail.json
# erpnext/setup/doctype/sales_partner/sales_partner.json
# erpnext/setup/doctype/sales_partner/sales_partner.py
# erpnext/setup/doctype/sales_partner/test_sales_partner.py
# erpnext/setup/doctype/sales_person/sales_person.json
# erpnext/setup/doctype/sales_person/test_sales_person.py
# erpnext/setup/doctype/supplier_group/supplier_group.js
# erpnext/setup/doctype/supplier_group/supplier_group.json
# erpnext/setup/doctype/supplier_group/test_supplier_group.py
# erpnext/setup/doctype/target_detail/target_detail.json
# erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.json
# erpnext/setup/doctype/terms_and_conditions/test_terms_and_conditions.py
# erpnext/setup/doctype/territory/territory.json
# erpnext/setup/doctype/territory/test_territory.py
# erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py
# erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record.json
# erpnext/setup/doctype/transaction_deletion_record_item/transaction_deletion_record_item.json
# erpnext/setup/doctype/uom/test_uom.py
# erpnext/setup/doctype/uom/uom.json
# erpnext/setup/doctype/uom/uom.py
# erpnext/setup/doctype/uom_conversion_factor/test_uom_conversion_factor.py
# erpnext/setup/doctype/uom_conversion_factor/uom_conversion_factor.json
# erpnext/setup/doctype/vehicle/test_vehicle.py
# erpnext/setup/doctype/vehicle/vehicle.json
# erpnext/setup/doctype/website_item_group/website_item_group.json
# erpnext/setup/install.py
# erpnext/setup/setup_wizard/data/country_wise_tax.json
# erpnext/setup/setup_wizard/data/uom_data.json
# erpnext/setup/setup_wizard/operations/defaults_setup.py
# erpnext/setup/setup_wizard/operations/install_fixtures.py
# erpnext/setup/utils.py
# erpnext/startup/boot.py
# erpnext/startup/leaderboard.py
# erpnext/stock/__init__.py
# erpnext/stock/deprecated_serial_batch.py
# erpnext/stock/doctype/batch/batch.json
# erpnext/stock/doctype/batch/test_batch.py
# erpnext/stock/doctype/bin/bin.json
# erpnext/stock/doctype/bin/test_bin.py
# erpnext/stock/doctype/closing_stock_balance/closing_stock_balance.json
# erpnext/stock/doctype/closing_stock_balance/test_closing_stock_balance.py
# erpnext/stock/doctype/customs_tariff_number/customs_tariff_number.json
# erpnext/stock/doctype/customs_tariff_number/test_customs_tariff_number.py
# erpnext/stock/doctype/delivery_note/delivery_note.json
# erpnext/stock/doctype/delivery_note/delivery_note.py
# erpnext/stock/doctype/delivery_note/delivery_note_list.js
# erpnext/stock/doctype/delivery_note/test_delivery_note.py
# erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
# erpnext/stock/doctype/delivery_note_item/delivery_note_item.py
# erpnext/stock/doctype/delivery_settings/delivery_settings.json
# erpnext/stock/doctype/delivery_settings/test_delivery_settings.py
# erpnext/stock/doctype/delivery_stop/delivery_stop.json
# erpnext/stock/doctype/delivery_trip/delivery_trip.js
# erpnext/stock/doctype/delivery_trip/delivery_trip.json
# erpnext/stock/doctype/delivery_trip/delivery_trip.py
# erpnext/stock/doctype/delivery_trip/test_delivery_trip.py
# erpnext/stock/doctype/inventory_dimension/inventory_dimension.json
# erpnext/stock/doctype/inventory_dimension/inventory_dimension.py
# erpnext/stock/doctype/inventory_dimension/test_inventory_dimension.py
# erpnext/stock/doctype/item/item.js
# erpnext/stock/doctype/item/item.json
# erpnext/stock/doctype/item/item.py
# erpnext/stock/doctype/item/item_list.js
# erpnext/stock/doctype/item/test_item.py
# erpnext/stock/doctype/item_alternative/item_alternative.json
# erpnext/stock/doctype/item_alternative/test_item_alternative.py
# erpnext/stock/doctype/item_attribute/item_attribute.json
# erpnext/stock/doctype/item_attribute/item_attribute.py
# erpnext/stock/doctype/item_attribute/test_item_attribute.py
# erpnext/stock/doctype/item_attribute_value/item_attribute_value.json
# erpnext/stock/doctype/item_barcode/item_barcode.json
# erpnext/stock/doctype/item_customer_detail/item_customer_detail.json
# erpnext/stock/doctype/item_default/item_default.json
# erpnext/stock/doctype/item_manufacturer/item_manufacturer.json
# erpnext/stock/doctype/item_manufacturer/test_item_manufacturer.py
# erpnext/stock/doctype/item_price/item_price.json
# erpnext/stock/doctype/item_price/item_price.py
# erpnext/stock/doctype/item_price/test_item_price.py
# erpnext/stock/doctype/item_quality_inspection_parameter/item_quality_inspection_parameter.json
# erpnext/stock/doctype/item_reorder/item_reorder.json
# erpnext/stock/doctype/item_supplier/item_supplier.json
# erpnext/stock/doctype/item_tax/item_tax.json
# erpnext/stock/doctype/item_variant/item_variant.json
# erpnext/stock/doctype/item_variant_attribute/item_variant_attribute.json
# erpnext/stock/doctype/item_variant_settings/item_variant_settings.js
# erpnext/stock/doctype/item_variant_settings/item_variant_settings.json
# erpnext/stock/doctype/item_variant_settings/test_item_variant_settings.py
# erpnext/stock/doctype/item_website_specification/item_website_specification.json
# erpnext/stock/doctype/landed_cost_item/landed_cost_item.json
# erpnext/stock/doctype/landed_cost_purchase_receipt/landed_cost_purchase_receipt.json
# erpnext/stock/doctype/landed_cost_taxes_and_charges/landed_cost_taxes_and_charges.json
# erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.json
# erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py
# erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py
# erpnext/stock/doctype/manufacturer/manufacturer.json
# erpnext/stock/doctype/manufacturer/test_manufacturer.py
# erpnext/stock/doctype/material_request/material_request.js
# erpnext/stock/doctype/material_request/material_request.json
# erpnext/stock/doctype/material_request/material_request.py
# erpnext/stock/doctype/material_request/material_request_list.js
# erpnext/stock/doctype/material_request/test_material_request.py
# erpnext/stock/doctype/material_request_item/material_request_item.json
# erpnext/stock/doctype/packed_item/packed_item.json
# erpnext/stock/doctype/packed_item/packed_item.py
# erpnext/stock/doctype/packed_item/test_packed_item.py
# erpnext/stock/doctype/packing_slip/packing_slip.json
# erpnext/stock/doctype/packing_slip/test_packing_slip.py
# erpnext/stock/doctype/packing_slip_item/packing_slip_item.json
# erpnext/stock/doctype/pick_list/pick_list.json
# erpnext/stock/doctype/pick_list/pick_list_list.js
# erpnext/stock/doctype/pick_list/test_pick_list.py
# erpnext/stock/doctype/pick_list_item/pick_list_item.json
# erpnext/stock/doctype/price_list/price_list.json
# erpnext/stock/doctype/price_list/price_list.py
# erpnext/stock/doctype/price_list/test_price_list.py
# erpnext/stock/doctype/price_list_country/price_list_country.json
# erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
# erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
# erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
# erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
# erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.py
# erpnext/stock/doctype/putaway_rule/putaway_rule.json
# erpnext/stock/doctype/putaway_rule/putaway_rule.py
# erpnext/stock/doctype/putaway_rule/test_putaway_rule.py
# erpnext/stock/doctype/quality_inspection/quality_inspection.json
# erpnext/stock/doctype/quality_inspection/test_quality_inspection.py
# erpnext/stock/doctype/quality_inspection_parameter/quality_inspection_parameter.json
# erpnext/stock/doctype/quality_inspection_parameter/test_quality_inspection_parameter.py
# erpnext/stock/doctype/quality_inspection_parameter_group/quality_inspection_parameter_group.json
# erpnext/stock/doctype/quality_inspection_parameter_group/test_quality_inspection_parameter_group.py
# erpnext/stock/doctype/quality_inspection_reading/quality_inspection_reading.json
# erpnext/stock/doctype/quality_inspection_template/quality_inspection_template.json
# erpnext/stock/doctype/quality_inspection_template/test_quality_inspection_template.py
# erpnext/stock/doctype/quick_stock_balance/quick_stock_balance.json
# erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.json
# erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py
# erpnext/stock/doctype/repost_item_valuation/test_repost_item_valuation.py
# erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.json
# erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py
# erpnext/stock/doctype/serial_and_batch_bundle/test_serial_and_batch_bundle.py
# erpnext/stock/doctype/serial_and_batch_entry/serial_and_batch_entry.json
# erpnext/stock/doctype/serial_no/serial_no.json
# erpnext/stock/doctype/serial_no/test_serial_no.py
# erpnext/stock/doctype/shipment/shipment.json
# erpnext/stock/doctype/shipment/test_shipment.py
# erpnext/stock/doctype/shipment_delivery_note/shipment_delivery_note.json
# erpnext/stock/doctype/shipment_parcel/shipment_parcel.json
# erpnext/stock/doctype/shipment_parcel_template/shipment_parcel_template.json
# erpnext/stock/doctype/shipment_parcel_template/test_shipment_parcel_template.py
# erpnext/stock/doctype/stock_entry/stock_entry.json
# erpnext/stock/doctype/stock_entry/stock_entry.py
# erpnext/stock/doctype/stock_entry/test_stock_entry.py
# erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json
# erpnext/stock/doctype/stock_entry_type/stock_entry_type.json
# erpnext/stock/doctype/stock_entry_type/stock_entry_type.py
# erpnext/stock/doctype/stock_entry_type/test_stock_entry_type.py
# erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.json
# erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py
# erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py
# erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.json
# erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
# erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py
# erpnext/stock/doctype/stock_reconciliation_item/stock_reconciliation_item.json
# erpnext/stock/doctype/stock_reposting_settings/stock_reposting_settings.json
# erpnext/stock/doctype/stock_reposting_settings/test_stock_reposting_settings.py
# erpnext/stock/doctype/stock_reservation_entry/stock_reservation_entry.json
# erpnext/stock/doctype/stock_reservation_entry/stock_reservation_entry.py
# erpnext/stock/doctype/stock_reservation_entry/test_stock_reservation_entry.py
# erpnext/stock/doctype/stock_settings/stock_settings.json
# erpnext/stock/doctype/stock_settings/stock_settings.py
# erpnext/stock/doctype/stock_settings/test_stock_settings.py
# erpnext/stock/doctype/uom_category/test_uom_category.py
# erpnext/stock/doctype/uom_category/uom_category.json
# erpnext/stock/doctype/uom_conversion_detail/uom_conversion_detail.json
# erpnext/stock/doctype/variant_field/test_variant_field.py
# erpnext/stock/doctype/variant_field/variant_field.json
# erpnext/stock/doctype/warehouse/test_warehouse.py
# erpnext/stock/doctype/warehouse/warehouse.json
# erpnext/stock/doctype/warehouse/warehouse.py
# erpnext/stock/doctype/warehouse_type/test_warehouse_type.py
# erpnext/stock/doctype/warehouse_type/warehouse_type.json
# erpnext/stock/get_item_details.py
# erpnext/stock/page/warehouse_capacity_summary/warehouse_capacity_summary.js
# erpnext/stock/page/warehouse_capacity_summary/warehouse_capacity_summary_header.html
# erpnext/stock/print_format/purchase_receipt_serial_and_batch_bundle_print/purchase_receipt_serial_and_batch_bundle_print.json
# erpnext/stock/reorder_item.py
# erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py
# erpnext/stock/report/item_shortage_report/test_item_shortage_report.py
# erpnext/stock/report/reserved_stock/test_reserved_stock.py
# erpnext/stock/report/stock_ageing/test_stock_ageing.py
# erpnext/stock/report/stock_analytics/test_stock_analytics.py
# erpnext/stock/report/stock_balance/test_stock_balance.py
# erpnext/stock/report/stock_ledger/test_stock_ledger_report.py
# erpnext/stock/report/test_reports.py
# erpnext/stock/serial_batch_bundle.py
# erpnext/stock/stock_balance.py
# erpnext/stock/stock_ledger.py
# erpnext/stock/tests/test_get_item_details.py
# erpnext/stock/tests/test_utils.py
# erpnext/stock/tests/test_valuation.py
# erpnext/stock/utils.py
# erpnext/subcontracting/doctype/subcontracting_bom/subcontracting_bom.json
# erpnext/subcontracting/doctype/subcontracting_bom/subcontracting_bom.py
# erpnext/subcontracting/doctype/subcontracting_bom/test_subcontracting_bom.py
# erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.json
# erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.py
# erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order_list.js
# erpnext/subcontracting/doctype/subcontracting_order/test_subcontracting_order.py
# erpnext/subcontracting/doctype/subcontracting_order_item/subcontracting_order_item.json
# erpnext/subcontracting/doctype/subcontracting_order_item/subcontracting_order_item.py
# erpnext/subcontracting/doctype/subcontracting_order_service_item/subcontracting_order_service_item.json
# erpnext/subcontracting/doctype/subcontracting_order_supplied_item/subcontracting_order_supplied_item.json
# erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.json
# erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py
# erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt_list.js
# erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py
# erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.json
# erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.py
# erpnext/subcontracting/doctype/subcontracting_receipt_supplied_item/subcontracting_receipt_supplied_item.json
# erpnext/support/doctype/issue/issue.json
# erpnext/support/doctype/issue/issue.py
# erpnext/support/doctype/issue/test_issue.py
# erpnext/support/doctype/issue_priority/issue_priority.json
# erpnext/support/doctype/issue_priority/test_issue_priority.py
# erpnext/support/doctype/issue_type/issue_type.json
# erpnext/support/doctype/issue_type/test_issue_type.py
# erpnext/support/doctype/pause_sla_on_status/pause_sla_on_status.json
# erpnext/support/doctype/service_day/service_day.json
# erpnext/support/doctype/service_level_agreement/service_level_agreement.json
# erpnext/support/doctype/service_level_agreement/service_level_agreement.py
# erpnext/support/doctype/service_level_agreement/test_service_level_agreement.py
# erpnext/support/doctype/service_level_priority/service_level_priority.json
# erpnext/support/doctype/sla_fulfilled_on_status/sla_fulfilled_on_status.json
# erpnext/support/doctype/support_search_source/support_search_source.json
# erpnext/support/doctype/support_settings/support_settings.json
# erpnext/support/doctype/support_settings/test_support_settings.py
# erpnext/support/doctype/warranty_claim/test_warranty_claim.py
# erpnext/support/doctype/warranty_claim/warranty_claim.json
# erpnext/support/doctype/warranty_claim/warranty_claim.py
# erpnext/support/report/issue_analytics/test_issue_analytics.py
# erpnext/telephony/doctype/call_log/test_call_log.py
# erpnext/telephony/doctype/incoming_call_handling_schedule/incoming_call_handling_schedule.json
# erpnext/telephony/doctype/incoming_call_settings/incoming_call_settings.json
# erpnext/telephony/doctype/incoming_call_settings/test_incoming_call_settings.py
# erpnext/telephony/doctype/telephony_call_type/telephony_call_type.json
# erpnext/telephony/doctype/telephony_call_type/test_telephony_call_type.py
# erpnext/telephony/doctype/voice_call_settings/test_voice_call_settings.py
# erpnext/telephony/doctype/voice_call_settings/voice_call_settings.json
# erpnext/templates/form_grid/includes/visible_cols.html
# erpnext/templates/generators/sales_partner.html
# erpnext/templates/includes/issue_row.html
# erpnext/templates/includes/macros.html
# erpnext/templates/includes/projects/project_row.html
# erpnext/templates/includes/transaction_row.html
# erpnext/templates/pages/order.html
# erpnext/templates/pages/order.py
# erpnext/templates/pages/timelog_info.html
# erpnext/templates/print_formats/includes/total.html
# erpnext/tests/test_activation.py
# erpnext/tests/test_init.py
# erpnext/tests/test_notifications.py
# erpnext/tests/test_perf.py
# erpnext/tests/test_point_of_sale.py
# erpnext/tests/test_regional.py
# erpnext/tests/test_webform.py
# erpnext/tests/test_zform_loads.py
# erpnext/utilities/activation.py
# erpnext/utilities/bulk_transaction.py
# erpnext/utilities/doctype/portal_user/portal_user.json
# erpnext/utilities/doctype/rename_tool/rename_tool.json
# erpnext/utilities/doctype/video/test_video.py
# erpnext/utilities/doctype/video/video.json
# erpnext/utilities/doctype/video/video.py
# erpnext/utilities/doctype/video_settings/test_video_settings.py
# erpnext/utilities/doctype/video_settings/video_settings.json
# erpnext/www/support/index.py
# pyproject.toml
1782 lines
54 KiB
Python
1782 lines
54 KiB
Python
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
|
# License: GNU General Public License v3. See license.txt
|
|
|
|
import json
|
|
from collections import defaultdict
|
|
|
|
import frappe
|
|
from frappe import _, bold
|
|
from frappe.utils import cint, cstr, flt, get_link_to_form, getdate
|
|
|
|
import erpnext
|
|
from erpnext.accounts.general_ledger import (
|
|
make_gl_entries,
|
|
make_reverse_gl_entries,
|
|
process_gl_map,
|
|
)
|
|
from erpnext.accounts.utils import cancel_exchange_gain_loss_journal, get_fiscal_year
|
|
from erpnext.controllers.accounts_controller import AccountsController
|
|
from erpnext.controllers.sales_and_purchase_return import (
|
|
available_serial_batch_for_return,
|
|
filter_serial_batches,
|
|
make_serial_batch_bundle_for_return,
|
|
)
|
|
from erpnext.stock import get_warehouse_account_map
|
|
from erpnext.stock.doctype.inventory_dimension.inventory_dimension import (
|
|
get_evaluated_inventory_dimension,
|
|
)
|
|
from erpnext.stock.doctype.serial_and_batch_bundle.serial_and_batch_bundle import (
|
|
get_type_of_transaction,
|
|
)
|
|
from erpnext.stock.stock_ledger import get_items_to_be_repost
|
|
|
|
|
|
class QualityInspectionRequiredError(frappe.ValidationError):
|
|
pass
|
|
|
|
|
|
class QualityInspectionRejectedError(frappe.ValidationError):
|
|
pass
|
|
|
|
|
|
class QualityInspectionNotSubmittedError(frappe.ValidationError):
|
|
pass
|
|
|
|
|
|
class BatchExpiredError(frappe.ValidationError):
|
|
pass
|
|
|
|
|
|
class StockController(AccountsController):
|
|
def validate(self):
|
|
super().validate()
|
|
|
|
if self.docstatus == 0:
|
|
for table_name in ["items", "packed_items", "supplied_items"]:
|
|
self.validate_duplicate_serial_and_batch_bundle(table_name)
|
|
|
|
if not self.get("is_return"):
|
|
self.validate_inspection()
|
|
self.validate_serialized_batch()
|
|
self.clean_serial_nos()
|
|
self.validate_customer_provided_item()
|
|
self.set_rate_of_stock_uom()
|
|
self.validate_internal_transfer()
|
|
self.validate_putaway_capacity()
|
|
self.reset_conversion_factor()
|
|
|
|
def reset_conversion_factor(self):
|
|
for row in self.get("items"):
|
|
if row.uom != row.stock_uom:
|
|
continue
|
|
|
|
if row.conversion_factor != 1.0:
|
|
row.conversion_factor = 1.0
|
|
frappe.msgprint(
|
|
_(
|
|
"Conversion factor for item {0} has been reset to 1.0 as the uom {1} is same as stock uom {2}."
|
|
).format(bold(row.item_code), bold(row.uom), bold(row.stock_uom)),
|
|
alert=True,
|
|
)
|
|
|
|
def validate_items_exist(self):
|
|
if not self.get("items"):
|
|
return
|
|
|
|
items = [d.item_code for d in self.get("items")]
|
|
|
|
exists_items = frappe.get_all("Item", filters={"name": ("in", items)}, pluck="name")
|
|
non_exists_items = set(items) - set(exists_items)
|
|
|
|
if non_exists_items:
|
|
frappe.throw(_("Items {0} do not exist in the Item master.").format(", ".join(non_exists_items)))
|
|
|
|
def validate_duplicate_serial_and_batch_bundle(self, table_name):
|
|
if not self.get(table_name):
|
|
return
|
|
|
|
sbb_list = []
|
|
for item in self.get(table_name):
|
|
if item.get("serial_and_batch_bundle"):
|
|
sbb_list.append(item.get("serial_and_batch_bundle"))
|
|
|
|
if item.get("rejected_serial_and_batch_bundle"):
|
|
sbb_list.append(item.get("rejected_serial_and_batch_bundle"))
|
|
|
|
if sbb_list:
|
|
SLE = frappe.qb.DocType("Stock Ledger Entry")
|
|
data = (
|
|
frappe.qb.from_(SLE)
|
|
.select(SLE.voucher_type, SLE.voucher_no, SLE.serial_and_batch_bundle)
|
|
.where(
|
|
(SLE.docstatus == 1)
|
|
& (SLE.serial_and_batch_bundle.notnull())
|
|
& (SLE.serial_and_batch_bundle.isin(sbb_list))
|
|
)
|
|
.limit(1)
|
|
).run(as_dict=True)
|
|
|
|
if data:
|
|
data = data[0]
|
|
frappe.throw(
|
|
_("Serial and Batch Bundle {0} is already used in {1} {2}.").format(
|
|
frappe.bold(data.serial_and_batch_bundle), data.voucher_type, data.voucher_no
|
|
)
|
|
)
|
|
|
|
def make_gl_entries(self, gl_entries=None, from_repost=False, via_landed_cost_voucher=False):
|
|
if self.docstatus == 2:
|
|
make_reverse_gl_entries(voucher_type=self.doctype, voucher_no=self.name)
|
|
|
|
provisional_accounting_for_non_stock_items = cint(
|
|
frappe.get_cached_value(
|
|
"Company", self.company, "enable_provisional_accounting_for_non_stock_items"
|
|
)
|
|
)
|
|
|
|
is_asset_pr = any(d.get("is_fixed_asset") for d in self.get("items"))
|
|
|
|
if (
|
|
cint(erpnext.is_perpetual_inventory_enabled(self.company))
|
|
or provisional_accounting_for_non_stock_items
|
|
or is_asset_pr
|
|
):
|
|
warehouse_account = get_warehouse_account_map(self.company)
|
|
|
|
if self.docstatus == 1:
|
|
if not gl_entries:
|
|
gl_entries = (
|
|
self.get_gl_entries(warehouse_account, via_landed_cost_voucher)
|
|
if self.doctype == "Purchase Receipt"
|
|
else self.get_gl_entries(warehouse_account)
|
|
)
|
|
make_gl_entries(gl_entries, from_repost=from_repost)
|
|
|
|
def validate_serialized_batch(self):
|
|
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
|
|
|
|
is_material_issue = False
|
|
if self.doctype == "Stock Entry" and self.purpose == "Material Issue":
|
|
is_material_issue = True
|
|
|
|
for d in self.get("items"):
|
|
if hasattr(d, "serial_no") and hasattr(d, "batch_no") and d.serial_no and d.batch_no:
|
|
serial_nos = frappe.get_all(
|
|
"Serial No",
|
|
fields=["batch_no", "name", "warehouse"],
|
|
filters={"name": ("in", get_serial_nos(d.serial_no))},
|
|
)
|
|
|
|
for row in serial_nos:
|
|
if row.warehouse and row.batch_no != d.batch_no:
|
|
frappe.throw(
|
|
_("Row #{0}: Serial No {1} does not belong to Batch {2}").format(
|
|
d.idx, row.name, d.batch_no
|
|
)
|
|
)
|
|
|
|
if is_material_issue:
|
|
continue
|
|
|
|
if flt(d.qty) > 0.0 and d.get("batch_no") and self.get("posting_date") and self.docstatus < 2:
|
|
expiry_date = frappe.get_cached_value("Batch", d.get("batch_no"), "expiry_date")
|
|
|
|
if expiry_date and getdate(expiry_date) < getdate(self.posting_date):
|
|
frappe.throw(
|
|
_("Row #{0}: The batch {1} has already expired.").format(
|
|
d.idx, get_link_to_form("Batch", d.get("batch_no"))
|
|
),
|
|
BatchExpiredError,
|
|
)
|
|
|
|
def clean_serial_nos(self):
|
|
from erpnext.stock.doctype.serial_no.serial_no import clean_serial_no_string
|
|
|
|
for row in self.get("items"):
|
|
if hasattr(row, "serial_no") and row.serial_no:
|
|
# remove extra whitespace and store one serial no on each line
|
|
row.serial_no = clean_serial_no_string(row.serial_no)
|
|
|
|
for row in self.get("packed_items") or []:
|
|
if hasattr(row, "serial_no") and row.serial_no:
|
|
# remove extra whitespace and store one serial no on each line
|
|
row.serial_no = clean_serial_no_string(row.serial_no)
|
|
|
|
def make_bundle_using_old_serial_batch_fields(self, table_name=None, via_landed_cost_voucher=False):
|
|
if self.get("_action") == "update_after_submit":
|
|
return
|
|
|
|
# To handle test cases
|
|
if frappe.flags.in_test and frappe.flags.use_serial_and_batch_fields:
|
|
return
|
|
|
|
if not table_name:
|
|
table_name = "items"
|
|
|
|
if self.doctype == "Asset Capitalization":
|
|
table_name = "stock_items"
|
|
|
|
for row in self.get(table_name):
|
|
if row.serial_and_batch_bundle and (row.serial_no or row.batch_no):
|
|
self.validate_serial_nos_and_batches_with_bundle(row)
|
|
|
|
if not row.serial_no and not row.batch_no and not row.get("rejected_serial_no"):
|
|
continue
|
|
|
|
if not row.use_serial_batch_fields and (
|
|
row.serial_no or row.batch_no or row.get("rejected_serial_no")
|
|
):
|
|
row.use_serial_batch_fields = 1
|
|
|
|
if row.use_serial_batch_fields and (
|
|
not row.serial_and_batch_bundle and not row.get("rejected_serial_and_batch_bundle")
|
|
):
|
|
bundle_details = {
|
|
"item_code": row.get("rm_item_code") or row.item_code,
|
|
"posting_date": self.posting_date,
|
|
"posting_time": self.posting_time,
|
|
"voucher_type": self.doctype,
|
|
"voucher_no": self.name,
|
|
"voucher_detail_no": row.name,
|
|
"company": self.company,
|
|
"is_rejected": 1 if row.get("rejected_warehouse") else 0,
|
|
"use_serial_batch_fields": row.use_serial_batch_fields,
|
|
"via_landed_cost_voucher": via_landed_cost_voucher,
|
|
"do_not_submit": True if not via_landed_cost_voucher else False,
|
|
}
|
|
|
|
if row.get("qty") or row.get("consumed_qty") or row.get("stock_qty"):
|
|
self.update_bundle_details(bundle_details, table_name, row)
|
|
self.create_serial_batch_bundle(bundle_details, row)
|
|
|
|
if row.get("rejected_qty"):
|
|
self.update_bundle_details(bundle_details, table_name, row, is_rejected=True)
|
|
self.create_serial_batch_bundle(bundle_details, row)
|
|
|
|
def make_bundle_for_sales_purchase_return(self, table_name=None):
|
|
if not self.get("is_return"):
|
|
return
|
|
|
|
if not table_name:
|
|
table_name = "items"
|
|
|
|
self.make_bundle_for_non_rejected_qty(table_name)
|
|
|
|
if self.doctype in ["Purchase Invoice", "Purchase Receipt"]:
|
|
self.make_bundle_for_rejected_qty(table_name)
|
|
|
|
def make_bundle_for_rejected_qty(self, table_name=None):
|
|
field, reference_ids = self.get_reference_ids(
|
|
table_name, "rejected_qty", "rejected_serial_and_batch_bundle"
|
|
)
|
|
|
|
if not reference_ids:
|
|
return
|
|
|
|
child_doctype = self.doctype + " Item"
|
|
available_dict = available_serial_batch_for_return(
|
|
field, child_doctype, reference_ids, is_rejected=True
|
|
)
|
|
|
|
for row in self.get(table_name):
|
|
if data := available_dict.get(row.get(field)):
|
|
qty_field = "rejected_qty"
|
|
warehouse_field = "rejected_warehouse"
|
|
if row.get("return_qty_from_rejected_warehouse"):
|
|
qty_field = "qty"
|
|
warehouse_field = "warehouse"
|
|
|
|
if not data.get("qty"):
|
|
frappe.throw(
|
|
_("For the {0}, no stock is available for the return in the warehouse {1}.").format(
|
|
frappe.bold(row.item_code), row.get(warehouse_field)
|
|
)
|
|
)
|
|
|
|
data = filter_serial_batches(
|
|
self, data, row, warehouse_field=warehouse_field, qty_field=qty_field
|
|
)
|
|
bundle = make_serial_batch_bundle_for_return(data, row, self, warehouse_field, qty_field)
|
|
if row.get("return_qty_from_rejected_warehouse"):
|
|
row.db_set(
|
|
{
|
|
"serial_and_batch_bundle": bundle,
|
|
"batch_no": "",
|
|
"serial_no": "",
|
|
}
|
|
)
|
|
else:
|
|
row.db_set(
|
|
{
|
|
"rejected_serial_and_batch_bundle": bundle,
|
|
"batch_no": "",
|
|
"rejected_serial_no": "",
|
|
}
|
|
)
|
|
|
|
def make_bundle_for_non_rejected_qty(self, table_name):
|
|
field, reference_ids = self.get_reference_ids(table_name)
|
|
if not reference_ids:
|
|
return
|
|
|
|
child_doctype = self.doctype + " Item"
|
|
available_dict = available_serial_batch_for_return(field, child_doctype, reference_ids)
|
|
|
|
for row in self.get(table_name):
|
|
if data := available_dict.get(row.get(field)):
|
|
data = filter_serial_batches(self, data, row)
|
|
bundle = make_serial_batch_bundle_for_return(data, row, self)
|
|
row.db_set(
|
|
{
|
|
"serial_and_batch_bundle": bundle,
|
|
"batch_no": "",
|
|
"serial_no": "",
|
|
}
|
|
)
|
|
|
|
if self.doctype in ["Sales Invoice", "Delivery Note"]:
|
|
row.db_set(
|
|
"incoming_rate", frappe.db.get_value("Serial and Batch Bundle", bundle, "avg_rate")
|
|
)
|
|
|
|
def get_reference_ids(self, table_name, qty_field=None, bundle_field=None) -> tuple[str, list[str]]:
|
|
field = {
|
|
"Sales Invoice": "sales_invoice_item",
|
|
"Delivery Note": "dn_detail",
|
|
"Purchase Receipt": "purchase_receipt_item",
|
|
"Purchase Invoice": "purchase_invoice_item",
|
|
"POS Invoice": "pos_invoice_item",
|
|
}.get(self.doctype)
|
|
|
|
if not bundle_field:
|
|
bundle_field = "serial_and_batch_bundle"
|
|
|
|
if not qty_field:
|
|
qty_field = "qty"
|
|
|
|
reference_ids = []
|
|
|
|
for row in self.get(table_name):
|
|
if not self.is_serial_batch_item(row.item_code):
|
|
continue
|
|
|
|
if (
|
|
row.get(field)
|
|
and (
|
|
qty_field == "qty"
|
|
and not row.get("return_qty_from_rejected_warehouse")
|
|
or qty_field == "rejected_qty"
|
|
and (row.get("return_qty_from_rejected_warehouse") or row.get("rejected_warehouse"))
|
|
)
|
|
and not row.get("use_serial_batch_fields")
|
|
and not row.get(bundle_field)
|
|
):
|
|
reference_ids.append(row.get(field))
|
|
|
|
return field, reference_ids
|
|
|
|
@frappe.request_cache
|
|
def is_serial_batch_item(self, item_code) -> bool:
|
|
if not frappe.db.exists("Item", item_code):
|
|
frappe.throw(_("Item {0} does not exist.").format(bold(item_code)))
|
|
|
|
item_details = frappe.db.get_value("Item", item_code, ["has_serial_no", "has_batch_no"], as_dict=1)
|
|
|
|
if item_details.has_serial_no or item_details.has_batch_no:
|
|
return True
|
|
|
|
return False
|
|
|
|
def update_bundle_details(self, bundle_details, table_name, row, is_rejected=False):
|
|
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
|
|
|
|
# Since qty field is different for different doctypes
|
|
qty = row.get("qty")
|
|
warehouse = row.get("warehouse")
|
|
|
|
if table_name == "packed_items":
|
|
type_of_transaction = "Inward"
|
|
if not self.is_return:
|
|
type_of_transaction = "Outward"
|
|
elif table_name == "supplied_items":
|
|
qty = row.consumed_qty
|
|
warehouse = self.supplier_warehouse
|
|
type_of_transaction = "Outward"
|
|
if self.is_return:
|
|
type_of_transaction = "Inward"
|
|
else:
|
|
type_of_transaction = get_type_of_transaction(self, row)
|
|
|
|
if hasattr(row, "stock_qty"):
|
|
qty = row.stock_qty
|
|
|
|
if self.doctype == "Stock Entry":
|
|
qty = row.transfer_qty
|
|
warehouse = row.s_warehouse or row.t_warehouse
|
|
|
|
serial_nos = row.serial_no
|
|
if is_rejected:
|
|
serial_nos = row.get("rejected_serial_no")
|
|
type_of_transaction = "Inward" if not self.is_return else "Outward"
|
|
qty = row.get("rejected_qty")
|
|
warehouse = row.get("rejected_warehouse")
|
|
|
|
if (
|
|
self.is_internal_transfer()
|
|
and self.doctype in ["Sales Invoice", "Delivery Note"]
|
|
and self.is_return
|
|
):
|
|
warehouse = row.get("target_warehouse") or row.get("warehouse")
|
|
type_of_transaction = "Outward"
|
|
|
|
bundle_details.update(
|
|
{
|
|
"qty": qty,
|
|
"is_rejected": is_rejected,
|
|
"type_of_transaction": type_of_transaction,
|
|
"warehouse": warehouse,
|
|
"batches": frappe._dict({row.batch_no: qty}) if row.batch_no else None,
|
|
"serial_nos": get_serial_nos(serial_nos) if serial_nos else None,
|
|
"batch_no": row.batch_no,
|
|
}
|
|
)
|
|
|
|
def create_serial_batch_bundle(self, bundle_details, row):
|
|
from erpnext.stock.serial_batch_bundle import SerialBatchCreation
|
|
|
|
sn_doc = SerialBatchCreation(bundle_details).make_serial_and_batch_bundle()
|
|
|
|
field = "serial_and_batch_bundle"
|
|
if bundle_details.get("is_rejected"):
|
|
field = "rejected_serial_and_batch_bundle"
|
|
|
|
row.set(field, sn_doc.name)
|
|
row.db_set({field: sn_doc.name})
|
|
|
|
def validate_serial_nos_and_batches_with_bundle(self, row):
|
|
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
|
|
|
|
throw_error = False
|
|
if row.serial_no:
|
|
serial_nos = frappe.get_all(
|
|
"Serial and Batch Entry",
|
|
fields=["serial_no"],
|
|
filters={"parent": row.serial_and_batch_bundle},
|
|
)
|
|
serial_nos = sorted([cstr(d.serial_no) for d in serial_nos])
|
|
parsed_serial_nos = get_serial_nos(row.serial_no)
|
|
|
|
if len(serial_nos) != len(parsed_serial_nos):
|
|
throw_error = True
|
|
elif serial_nos != parsed_serial_nos:
|
|
for serial_no in serial_nos:
|
|
if serial_no not in parsed_serial_nos:
|
|
throw_error = True
|
|
break
|
|
|
|
elif row.batch_no:
|
|
batches = frappe.get_all(
|
|
"Serial and Batch Entry", fields=["batch_no"], filters={"parent": row.serial_and_batch_bundle}
|
|
)
|
|
batches = sorted([d.batch_no for d in batches])
|
|
|
|
if batches != [row.batch_no]:
|
|
throw_error = True
|
|
|
|
if throw_error:
|
|
frappe.throw(
|
|
_(
|
|
"At row {0}: Serial and Batch Bundle {1} has already created. Please remove the values from the serial no or batch no fields."
|
|
).format(row.idx, row.serial_and_batch_bundle)
|
|
)
|
|
|
|
def set_use_serial_batch_fields(self):
|
|
if frappe.db.get_single_value("Stock Settings", "use_serial_batch_fields"):
|
|
for row in self.items:
|
|
row.use_serial_batch_fields = 1
|
|
|
|
def get_gl_entries(self, warehouse_account=None, default_expense_account=None, default_cost_center=None):
|
|
if not warehouse_account:
|
|
warehouse_account = get_warehouse_account_map(self.company)
|
|
|
|
sle_map = self.get_stock_ledger_details()
|
|
voucher_details = self.get_voucher_details(default_expense_account, default_cost_center, sle_map)
|
|
|
|
gl_list = []
|
|
warehouse_with_no_account = []
|
|
precision = self.get_debit_field_precision()
|
|
for item_row in voucher_details:
|
|
sle_list = sle_map.get(item_row.name)
|
|
sle_rounding_diff = 0.0
|
|
if sle_list:
|
|
for sle in sle_list:
|
|
if warehouse_account.get(sle.warehouse):
|
|
# from warehouse account
|
|
|
|
sle_rounding_diff += flt(sle.stock_value_difference)
|
|
|
|
self.check_expense_account(item_row)
|
|
|
|
# expense account/ target_warehouse / source_warehouse
|
|
if item_row.get("target_warehouse"):
|
|
warehouse = item_row.get("target_warehouse")
|
|
expense_account = warehouse_account[warehouse]["account"]
|
|
else:
|
|
expense_account = item_row.expense_account
|
|
|
|
gl_list.append(
|
|
self.get_gl_dict(
|
|
{
|
|
"account": warehouse_account[sle.warehouse]["account"],
|
|
"against": expense_account,
|
|
"cost_center": item_row.cost_center,
|
|
"project": item_row.project or self.get("project"),
|
|
"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
|
|
"debit": flt(sle.stock_value_difference, precision),
|
|
"is_opening": item_row.get("is_opening")
|
|
or self.get("is_opening")
|
|
or "No",
|
|
},
|
|
warehouse_account[sle.warehouse]["account_currency"],
|
|
item=item_row,
|
|
)
|
|
)
|
|
|
|
gl_list.append(
|
|
self.get_gl_dict(
|
|
{
|
|
"account": expense_account,
|
|
"against": warehouse_account[sle.warehouse]["account"],
|
|
"cost_center": item_row.cost_center,
|
|
"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
|
|
"debit": -1 * flt(sle.stock_value_difference, precision),
|
|
"project": item_row.get("project") or self.get("project"),
|
|
"is_opening": item_row.get("is_opening")
|
|
or self.get("is_opening")
|
|
or "No",
|
|
},
|
|
item=item_row,
|
|
)
|
|
)
|
|
elif sle.warehouse not in warehouse_with_no_account:
|
|
warehouse_with_no_account.append(sle.warehouse)
|
|
|
|
if abs(sle_rounding_diff) > (1.0 / (10**precision)) and self.is_internal_transfer():
|
|
warehouse_asset_account = ""
|
|
if self.get("is_internal_customer"):
|
|
warehouse_asset_account = warehouse_account[item_row.get("target_warehouse")]["account"]
|
|
elif self.get("is_internal_supplier"):
|
|
warehouse_asset_account = warehouse_account[item_row.get("warehouse")]["account"]
|
|
|
|
expense_account = frappe.get_cached_value("Company", self.company, "default_expense_account")
|
|
if not expense_account:
|
|
frappe.throw(
|
|
_(
|
|
"Please set default cost of goods sold account in company {0} for booking rounding gain and loss during stock transfer"
|
|
).format(frappe.bold(self.company))
|
|
)
|
|
|
|
gl_list.append(
|
|
self.get_gl_dict(
|
|
{
|
|
"account": expense_account,
|
|
"against": warehouse_asset_account,
|
|
"cost_center": item_row.cost_center,
|
|
"project": item_row.project or self.get("project"),
|
|
"remarks": _("Rounding gain/loss Entry for Stock Transfer"),
|
|
"debit": sle_rounding_diff,
|
|
"is_opening": item_row.get("is_opening") or self.get("is_opening") or "No",
|
|
},
|
|
warehouse_account[sle.warehouse]["account_currency"],
|
|
item=item_row,
|
|
)
|
|
)
|
|
|
|
gl_list.append(
|
|
self.get_gl_dict(
|
|
{
|
|
"account": warehouse_asset_account,
|
|
"against": expense_account,
|
|
"cost_center": item_row.cost_center,
|
|
"remarks": _("Rounding gain/loss Entry for Stock Transfer"),
|
|
"credit": sle_rounding_diff,
|
|
"project": item_row.get("project") or self.get("project"),
|
|
"is_opening": item_row.get("is_opening") or self.get("is_opening") or "No",
|
|
},
|
|
item=item_row,
|
|
)
|
|
)
|
|
|
|
if warehouse_with_no_account:
|
|
for wh in warehouse_with_no_account:
|
|
if frappe.get_cached_value("Warehouse", wh, "company"):
|
|
frappe.throw(
|
|
_(
|
|
"Warehouse {0} is not linked to any account, please mention the account in the warehouse record or set default inventory account in company {1}."
|
|
).format(wh, self.company)
|
|
)
|
|
|
|
return process_gl_map(gl_list, precision=precision)
|
|
|
|
def get_debit_field_precision(self):
|
|
if not frappe.flags.debit_field_precision:
|
|
frappe.flags.debit_field_precision = frappe.get_precision("GL Entry", "debit_in_account_currency")
|
|
|
|
return frappe.flags.debit_field_precision
|
|
|
|
def get_voucher_details(self, default_expense_account, default_cost_center, sle_map):
|
|
if self.doctype == "Stock Reconciliation":
|
|
reconciliation_purpose = frappe.db.get_value(self.doctype, self.name, "purpose")
|
|
is_opening = "Yes" if reconciliation_purpose == "Opening Stock" else "No"
|
|
details = []
|
|
for voucher_detail_no in sle_map:
|
|
details.append(
|
|
frappe._dict(
|
|
{
|
|
"name": voucher_detail_no,
|
|
"expense_account": default_expense_account,
|
|
"cost_center": default_cost_center,
|
|
"is_opening": is_opening,
|
|
}
|
|
)
|
|
)
|
|
return details
|
|
else:
|
|
details = self.get("items")
|
|
|
|
if default_expense_account or default_cost_center:
|
|
for d in details:
|
|
if default_expense_account and not d.get("expense_account"):
|
|
d.expense_account = default_expense_account
|
|
if default_cost_center and not d.get("cost_center"):
|
|
d.cost_center = default_cost_center
|
|
|
|
return details
|
|
|
|
def get_items_and_warehouses(self) -> tuple[list[str], list[str]]:
|
|
"""Get list of items and warehouses affected by a transaction"""
|
|
|
|
if not (hasattr(self, "items") or hasattr(self, "packed_items")):
|
|
return [], []
|
|
|
|
item_rows = (self.get("items") or []) + (self.get("packed_items") or [])
|
|
|
|
items = {d.item_code for d in item_rows if d.item_code}
|
|
|
|
warehouses = set()
|
|
for d in item_rows:
|
|
if d.get("warehouse"):
|
|
warehouses.add(d.warehouse)
|
|
|
|
if self.doctype == "Stock Entry":
|
|
if d.get("s_warehouse"):
|
|
warehouses.add(d.s_warehouse)
|
|
if d.get("t_warehouse"):
|
|
warehouses.add(d.t_warehouse)
|
|
|
|
return list(items), list(warehouses)
|
|
|
|
def get_stock_ledger_details(self):
|
|
stock_ledger = {}
|
|
stock_ledger_entries = frappe.db.sql(
|
|
"""
|
|
select
|
|
name, warehouse, stock_value_difference, valuation_rate,
|
|
voucher_detail_no, item_code, posting_date, posting_time,
|
|
actual_qty, qty_after_transaction
|
|
from
|
|
`tabStock Ledger Entry`
|
|
where
|
|
voucher_type=%s and voucher_no=%s and is_cancelled = 0
|
|
""",
|
|
(self.doctype, self.name),
|
|
as_dict=True,
|
|
)
|
|
|
|
for sle in stock_ledger_entries:
|
|
stock_ledger.setdefault(sle.voucher_detail_no, []).append(sle)
|
|
return stock_ledger
|
|
|
|
def check_expense_account(self, item):
|
|
if not item.get("expense_account"):
|
|
msg = _("Please set an Expense Account in the Items table")
|
|
frappe.throw(
|
|
_("Row #{0}: Expense Account not set for the Item {1}. {2}").format(
|
|
item.idx, frappe.bold(item.item_code), msg
|
|
),
|
|
title=_("Expense Account Missing"),
|
|
)
|
|
|
|
else:
|
|
is_expense_account = (
|
|
frappe.get_cached_value("Account", item.get("expense_account"), "report_type")
|
|
== "Profit and Loss"
|
|
)
|
|
if (
|
|
self.doctype
|
|
not in (
|
|
"Purchase Receipt",
|
|
"Purchase Invoice",
|
|
"Stock Reconciliation",
|
|
"Stock Entry",
|
|
"Subcontracting Receipt",
|
|
)
|
|
and not is_expense_account
|
|
):
|
|
frappe.throw(
|
|
_("Expense / Difference account ({0}) must be a 'Profit or Loss' account").format(
|
|
item.get("expense_account")
|
|
)
|
|
)
|
|
if is_expense_account and not item.get("cost_center"):
|
|
frappe.throw(
|
|
_("{0} {1}: Cost Center is mandatory for Item {2}").format(
|
|
_(self.doctype), self.name, item.get("item_code")
|
|
)
|
|
)
|
|
|
|
def delete_auto_created_batches(self):
|
|
for table_name in ["items", "packed_items", "supplied_items"]:
|
|
if not self.get(table_name):
|
|
continue
|
|
|
|
for row in self.get(table_name):
|
|
update_values = {}
|
|
if row.get("batch_no"):
|
|
update_values["batch_no"] = None
|
|
|
|
if row.serial_and_batch_bundle:
|
|
update_values["serial_and_batch_bundle"] = None
|
|
frappe.db.set_value(
|
|
"Serial and Batch Bundle", row.serial_and_batch_bundle, {"is_cancelled": 1}
|
|
)
|
|
|
|
if update_values:
|
|
row.db_set(update_values)
|
|
|
|
if table_name == "items" and row.get("rejected_serial_and_batch_bundle"):
|
|
frappe.db.set_value(
|
|
"Serial and Batch Bundle", row.rejected_serial_and_batch_bundle, {"is_cancelled": 1}
|
|
)
|
|
|
|
row.db_set("rejected_serial_and_batch_bundle", None)
|
|
|
|
if row.get("current_serial_and_batch_bundle"):
|
|
row.db_set("current_serial_and_batch_bundle", None)
|
|
|
|
def set_serial_and_batch_bundle(self, table_name=None, ignore_validate=False):
|
|
if not table_name:
|
|
table_name = "items"
|
|
|
|
QTY_FIELD = {
|
|
"serial_and_batch_bundle": "qty",
|
|
"current_serial_and_batch_bundle": "current_qty",
|
|
"rejected_serial_and_batch_bundle": "rejected_qty",
|
|
}
|
|
|
|
for row in self.get(table_name):
|
|
for field in QTY_FIELD.keys():
|
|
if row.get(field):
|
|
frappe.get_doc("Serial and Batch Bundle", row.get(field)).set_serial_and_batch_values(
|
|
self, row, qty_field=QTY_FIELD[field]
|
|
)
|
|
|
|
def make_package_for_transfer(
|
|
self, serial_and_batch_bundle, warehouse, type_of_transaction=None, do_not_submit=None
|
|
):
|
|
return make_bundle_for_material_transfer(
|
|
is_new=self.is_new(),
|
|
docstatus=self.docstatus,
|
|
voucher_type=self.doctype,
|
|
voucher_no=self.name,
|
|
serial_and_batch_bundle=serial_and_batch_bundle,
|
|
warehouse=warehouse,
|
|
type_of_transaction=type_of_transaction,
|
|
do_not_submit=do_not_submit,
|
|
)
|
|
|
|
def get_sl_entries(self, d, args):
|
|
sl_dict = frappe._dict(
|
|
{
|
|
"item_code": d.get("item_code", None),
|
|
"warehouse": d.get("warehouse", None),
|
|
"serial_and_batch_bundle": d.get("serial_and_batch_bundle"),
|
|
"posting_date": self.posting_date,
|
|
"posting_time": self.posting_time,
|
|
"fiscal_year": get_fiscal_year(self.posting_date, company=self.company)[0],
|
|
"voucher_type": self.doctype,
|
|
"voucher_no": self.name,
|
|
"voucher_detail_no": d.name,
|
|
"actual_qty": (self.docstatus == 1 and 1 or -1) * flt(d.get("stock_qty")),
|
|
"stock_uom": frappe.get_cached_value(
|
|
"Item", args.get("item_code") or d.get("item_code"), "stock_uom"
|
|
),
|
|
"incoming_rate": 0,
|
|
"company": self.company,
|
|
"project": d.get("project") or self.get("project"),
|
|
"is_cancelled": 1 if self.docstatus == 2 else 0,
|
|
}
|
|
)
|
|
|
|
sl_dict.update(args)
|
|
self.update_inventory_dimensions(d, sl_dict)
|
|
|
|
if self.docstatus == 2:
|
|
<<<<<<< HEAD
|
|
=======
|
|
from erpnext.deprecation_dumpster import deprecation_warning
|
|
|
|
deprecation_warning("unknown", "v16", "No instructions.")
|
|
>>>>>>> 329d14957b (fix: validate negative qty)
|
|
# To handle denormalized serial no records, will br deprecated in v16
|
|
for field in ["serial_no", "batch_no"]:
|
|
if d.get(field):
|
|
sl_dict[field] = d.get(field)
|
|
|
|
return sl_dict
|
|
|
|
def update_inventory_dimensions(self, row, sl_dict) -> None:
|
|
# To handle delivery note and sales invoice
|
|
if row.get("item_row"):
|
|
row = row.get("item_row")
|
|
|
|
dimensions = get_evaluated_inventory_dimension(row, sl_dict, parent_doc=self)
|
|
for dimension in dimensions:
|
|
if not dimension:
|
|
continue
|
|
|
|
if (
|
|
self.doctype in ["Purchase Invoice", "Purchase Receipt"]
|
|
and row.get("rejected_warehouse")
|
|
and sl_dict.get("warehouse") == row.get("rejected_warehouse")
|
|
):
|
|
fieldname = f"rejected_{dimension.source_fieldname}"
|
|
sl_dict[dimension.target_fieldname] = row.get(fieldname)
|
|
continue
|
|
|
|
if self.doctype in [
|
|
"Purchase Invoice",
|
|
"Purchase Receipt",
|
|
"Sales Invoice",
|
|
"Delivery Note",
|
|
"Stock Entry",
|
|
]:
|
|
if (
|
|
(
|
|
sl_dict.actual_qty > 0
|
|
and not self.get("is_return")
|
|
or sl_dict.actual_qty < 0
|
|
and self.get("is_return")
|
|
)
|
|
and self.doctype in ["Purchase Invoice", "Purchase Receipt"]
|
|
) or (
|
|
(
|
|
sl_dict.actual_qty < 0
|
|
and not self.get("is_return")
|
|
or sl_dict.actual_qty > 0
|
|
and self.get("is_return")
|
|
)
|
|
and self.doctype in ["Sales Invoice", "Delivery Note", "Stock Entry"]
|
|
):
|
|
sl_dict[dimension.target_fieldname] = row.get(dimension.source_fieldname)
|
|
else:
|
|
fieldname_start_with = "to"
|
|
if self.doctype in ["Purchase Invoice", "Purchase Receipt"]:
|
|
fieldname_start_with = "from"
|
|
|
|
fieldname = f"{fieldname_start_with}_{dimension.source_fieldname}"
|
|
sl_dict[dimension.target_fieldname] = row.get(fieldname)
|
|
|
|
if not sl_dict.get(dimension.target_fieldname):
|
|
sl_dict[dimension.target_fieldname] = row.get(dimension.source_fieldname)
|
|
|
|
elif row.get(dimension.source_fieldname):
|
|
sl_dict[dimension.target_fieldname] = row.get(dimension.source_fieldname)
|
|
|
|
if not sl_dict.get(dimension.target_fieldname) and dimension.fetch_from_parent:
|
|
sl_dict[dimension.target_fieldname] = self.get(dimension.fetch_from_parent)
|
|
|
|
# Get value based on doctype name
|
|
if not sl_dict.get(dimension.target_fieldname):
|
|
fieldname = next(
|
|
(
|
|
field.fieldname
|
|
for field in frappe.get_meta(self.doctype).fields
|
|
if field.options == dimension.fetch_from_parent
|
|
),
|
|
None,
|
|
)
|
|
|
|
if fieldname and self.get(fieldname):
|
|
sl_dict[dimension.target_fieldname] = self.get(fieldname)
|
|
|
|
if sl_dict[dimension.target_fieldname] and self.docstatus == 1:
|
|
row.db_set(dimension.source_fieldname, sl_dict[dimension.target_fieldname])
|
|
|
|
def make_sl_entries(self, sl_entries, allow_negative_stock=False, via_landed_cost_voucher=False):
|
|
from erpnext.stock.stock_ledger import make_sl_entries
|
|
|
|
make_sl_entries(sl_entries, allow_negative_stock, via_landed_cost_voucher)
|
|
|
|
def make_gl_entries_on_cancel(self):
|
|
cancel_exchange_gain_loss_journal(frappe._dict(doctype=self.doctype, name=self.name))
|
|
if frappe.db.sql(
|
|
"""select name from `tabGL Entry` where voucher_type=%s
|
|
and voucher_no=%s""",
|
|
(self.doctype, self.name),
|
|
):
|
|
self.make_gl_entries()
|
|
|
|
def get_serialized_items(self):
|
|
serialized_items = []
|
|
item_codes = list(set(d.item_code for d in self.get("items")))
|
|
if item_codes:
|
|
serialized_items = frappe.db.sql_list(
|
|
"""select name from `tabItem`
|
|
where has_serial_no=1 and name in ({})""".format(", ".join(["%s"] * len(item_codes))),
|
|
tuple(item_codes),
|
|
)
|
|
|
|
return serialized_items
|
|
|
|
def validate_warehouse(self):
|
|
from erpnext.stock.utils import validate_disabled_warehouse, validate_warehouse_company
|
|
|
|
warehouses = list(set(d.warehouse for d in self.get("items") if getattr(d, "warehouse", None)))
|
|
|
|
target_warehouses = list(
|
|
set([d.target_warehouse for d in self.get("items") if getattr(d, "target_warehouse", None)])
|
|
)
|
|
|
|
warehouses.extend(target_warehouses)
|
|
|
|
from_warehouse = list(
|
|
set([d.from_warehouse for d in self.get("items") if getattr(d, "from_warehouse", None)])
|
|
)
|
|
|
|
warehouses.extend(from_warehouse)
|
|
|
|
for w in warehouses:
|
|
validate_disabled_warehouse(w)
|
|
validate_warehouse_company(w, self.company)
|
|
|
|
def update_billing_percentage(self, update_modified=True):
|
|
target_ref_field = "amount"
|
|
if self.doctype == "Delivery Note":
|
|
target_ref_field = "amount - (returned_qty * rate)"
|
|
|
|
self._update_percent_field(
|
|
{
|
|
"target_dt": self.doctype + " Item",
|
|
"target_parent_dt": self.doctype,
|
|
"target_parent_field": "per_billed",
|
|
"target_ref_field": target_ref_field,
|
|
"target_field": "billed_amt",
|
|
"name": self.name,
|
|
},
|
|
update_modified,
|
|
)
|
|
|
|
def validate_inspection(self):
|
|
"""Checks if quality inspection is set/ is valid for Items that require inspection."""
|
|
inspection_fieldname_map = {
|
|
"Purchase Receipt": "inspection_required_before_purchase",
|
|
"Purchase Invoice": "inspection_required_before_purchase",
|
|
"Subcontracting Receipt": "inspection_required_before_purchase",
|
|
"Sales Invoice": "inspection_required_before_delivery",
|
|
"Delivery Note": "inspection_required_before_delivery",
|
|
}
|
|
inspection_required_fieldname = inspection_fieldname_map.get(self.doctype)
|
|
|
|
# return if inspection is not required on document level
|
|
if (
|
|
(not inspection_required_fieldname and self.doctype != "Stock Entry")
|
|
or (self.doctype == "Stock Entry" and not self.inspection_required)
|
|
or (self.doctype in ["Sales Invoice", "Purchase Invoice"] and not self.update_stock)
|
|
):
|
|
return
|
|
|
|
for row in self.get("items"):
|
|
qi_required = False
|
|
if inspection_required_fieldname and frappe.db.get_value(
|
|
"Item", row.item_code, inspection_required_fieldname
|
|
):
|
|
qi_required = True
|
|
elif self.doctype == "Stock Entry" and row.t_warehouse:
|
|
qi_required = True # inward stock needs inspection
|
|
|
|
if qi_required: # validate row only if inspection is required on item level
|
|
self.validate_qi_presence(row)
|
|
if self.docstatus == 1:
|
|
self.validate_qi_submission(row)
|
|
self.validate_qi_rejection(row)
|
|
|
|
def validate_qi_presence(self, row):
|
|
"""Check if QI is present on row level. Warn on save and stop on submit if missing."""
|
|
if not row.quality_inspection:
|
|
msg = _("Row #{0}: Quality Inspection is required for Item {1}").format(
|
|
row.idx, frappe.bold(row.item_code)
|
|
)
|
|
if self.docstatus == 1:
|
|
frappe.throw(msg, title=_("Inspection Required"), exc=QualityInspectionRequiredError)
|
|
else:
|
|
frappe.msgprint(msg, title=_("Inspection Required"), indicator="blue")
|
|
|
|
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")
|
|
qa_docstatus = frappe.db.get_value("Quality Inspection", row.quality_inspection, "docstatus")
|
|
|
|
<<<<<<< HEAD
|
|
if not qa_docstatus == 1:
|
|
=======
|
|
if qa_docstatus != 1:
|
|
>>>>>>> 329d14957b (fix: validate negative qty)
|
|
link = frappe.utils.get_link_to_form("Quality Inspection", row.quality_inspection)
|
|
msg = _("Row #{0}: Quality Inspection {1} is not submitted for the item: {2}").format(
|
|
row.idx, link, row.item_code
|
|
)
|
|
if action == "Stop":
|
|
frappe.throw(msg, title=_("Inspection Submission"), exc=QualityInspectionNotSubmittedError)
|
|
else:
|
|
frappe.msgprint(msg, alert=True, indicator="orange")
|
|
|
|
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")
|
|
qa_status = frappe.db.get_value("Quality Inspection", row.quality_inspection, "status")
|
|
|
|
if qa_status == "Rejected":
|
|
link = frappe.utils.get_link_to_form("Quality Inspection", row.quality_inspection)
|
|
msg = _("Row #{0}: Quality Inspection {1} was rejected for item {2}").format(
|
|
row.idx, link, row.item_code
|
|
)
|
|
if action == "Stop":
|
|
frappe.throw(msg, title=_("Inspection Rejected"), exc=QualityInspectionRejectedError)
|
|
else:
|
|
frappe.msgprint(msg, alert=True, indicator="orange")
|
|
|
|
def update_blanket_order(self):
|
|
blanket_orders = list(set([d.blanket_order for d in self.items if d.blanket_order]))
|
|
for blanket_order in blanket_orders:
|
|
frappe.get_doc("Blanket Order", blanket_order).update_ordered_qty()
|
|
|
|
def validate_customer_provided_item(self):
|
|
for d in self.get("items"):
|
|
# Customer Provided parts will have zero valuation rate
|
|
if frappe.get_cached_value("Item", d.item_code, "is_customer_provided_item"):
|
|
d.allow_zero_valuation_rate = 1
|
|
|
|
def set_rate_of_stock_uom(self):
|
|
if self.doctype in [
|
|
"Purchase Receipt",
|
|
"Purchase Invoice",
|
|
"Purchase Order",
|
|
"Sales Invoice",
|
|
"Sales Order",
|
|
"Delivery Note",
|
|
"Quotation",
|
|
]:
|
|
for d in self.get("items"):
|
|
d.stock_uom_rate = d.rate / (d.conversion_factor or 1)
|
|
|
|
def validate_internal_transfer(self):
|
|
if self.doctype in ("Sales Invoice", "Delivery Note", "Purchase Invoice", "Purchase Receipt"):
|
|
if self.is_internal_transfer():
|
|
self.validate_in_transit_warehouses()
|
|
self.validate_multi_currency()
|
|
self.validate_packed_items()
|
|
|
|
if self.get("is_internal_supplier") and self.docstatus == 1:
|
|
self.validate_internal_transfer_qty()
|
|
else:
|
|
self.validate_internal_transfer_warehouse()
|
|
|
|
def validate_internal_transfer_warehouse(self):
|
|
for row in self.items:
|
|
if row.get("target_warehouse"):
|
|
row.target_warehouse = None
|
|
|
|
if row.get("from_warehouse"):
|
|
row.from_warehouse = None
|
|
|
|
def validate_in_transit_warehouses(self):
|
|
if (self.doctype == "Sales Invoice" and self.get("update_stock")) or self.doctype == "Delivery Note":
|
|
for item in self.get("items"):
|
|
if not item.target_warehouse:
|
|
frappe.throw(
|
|
_("Row {0}: Target Warehouse is mandatory for internal transfers").format(item.idx)
|
|
)
|
|
|
|
if (
|
|
self.doctype == "Purchase Invoice" and self.get("update_stock")
|
|
) or self.doctype == "Purchase Receipt":
|
|
for item in self.get("items"):
|
|
if not item.from_warehouse:
|
|
frappe.throw(
|
|
_("Row {0}: From Warehouse is mandatory for internal transfers").format(item.idx)
|
|
)
|
|
|
|
def validate_multi_currency(self):
|
|
if self.currency != self.company_currency:
|
|
frappe.throw(_("Internal transfers can only be done in company's default currency"))
|
|
|
|
def validate_packed_items(self):
|
|
if self.doctype in ("Sales Invoice", "Delivery Note Item") and self.get("packed_items"):
|
|
frappe.throw(_("Packed Items cannot be transferred internally"))
|
|
|
|
def validate_internal_transfer_qty(self):
|
|
if self.doctype not in ["Purchase Invoice", "Purchase Receipt"]:
|
|
return
|
|
|
|
item_wise_transfer_qty = self.get_item_wise_inter_transfer_qty()
|
|
if not item_wise_transfer_qty:
|
|
return
|
|
|
|
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"
|
|
)
|
|
|
|
parent_doctype = {
|
|
"Purchase Receipt": "Delivery Note",
|
|
"Purchase Invoice": "Sales Invoice",
|
|
}.get(self.doctype)
|
|
|
|
for key, transferred_qty in item_wise_transfer_qty.items():
|
|
recevied_qty = flt(item_wise_received_qty.get(key), precision)
|
|
if over_receipt_allowance:
|
|
transferred_qty = transferred_qty + flt(
|
|
transferred_qty * over_receipt_allowance / 100, precision
|
|
)
|
|
|
|
if recevied_qty > flt(transferred_qty, precision):
|
|
frappe.throw(
|
|
_("For Item {0} cannot be received more than {1} qty against the {2} {3}").format(
|
|
bold(key[1]),
|
|
bold(flt(transferred_qty, precision)),
|
|
bold(parent_doctype),
|
|
get_link_to_form(parent_doctype, self.get("inter_company_reference")),
|
|
)
|
|
)
|
|
|
|
def get_item_wise_inter_transfer_qty(self):
|
|
reference_field = "inter_company_reference"
|
|
if self.doctype == "Purchase Invoice":
|
|
reference_field = "inter_company_invoice_reference"
|
|
|
|
parent_doctype = {
|
|
"Purchase Receipt": "Delivery Note",
|
|
"Purchase Invoice": "Sales Invoice",
|
|
}.get(self.doctype)
|
|
|
|
child_doctype = parent_doctype + " Item"
|
|
|
|
parent_tab = frappe.qb.DocType(parent_doctype)
|
|
child_tab = frappe.qb.DocType(child_doctype)
|
|
|
|
query = (
|
|
frappe.qb.from_(parent_doctype)
|
|
.inner_join(child_tab)
|
|
.on(child_tab.parent == parent_tab.name)
|
|
.select(
|
|
child_tab.name,
|
|
child_tab.item_code,
|
|
child_tab.qty,
|
|
)
|
|
.where((parent_tab.name == self.get(reference_field)) & (parent_tab.docstatus == 1))
|
|
)
|
|
|
|
data = query.run(as_dict=True)
|
|
item_wise_transfer_qty = defaultdict(float)
|
|
for row in data:
|
|
item_wise_transfer_qty[(row.name, row.item_code)] += flt(row.qty)
|
|
|
|
return item_wise_transfer_qty
|
|
|
|
def get_item_wise_inter_received_qty(self):
|
|
child_doctype = self.doctype + " Item"
|
|
|
|
parent_tab = frappe.qb.DocType(self.doctype)
|
|
child_tab = frappe.qb.DocType(child_doctype)
|
|
|
|
query = (
|
|
frappe.qb.from_(self.doctype)
|
|
.inner_join(child_tab)
|
|
.on(child_tab.parent == parent_tab.name)
|
|
.select(
|
|
child_tab.item_code,
|
|
child_tab.qty,
|
|
)
|
|
.where(parent_tab.docstatus < 2)
|
|
)
|
|
|
|
if self.doctype == "Purchase Invoice":
|
|
query = query.select(
|
|
child_tab.sales_invoice_item.as_("name"),
|
|
)
|
|
|
|
query = query.where(
|
|
parent_tab.inter_company_invoice_reference == self.inter_company_invoice_reference
|
|
)
|
|
else:
|
|
query = query.select(
|
|
child_tab.delivery_note_item.as_("name"),
|
|
)
|
|
|
|
query = query.where(parent_tab.inter_company_reference == self.inter_company_reference)
|
|
|
|
data = query.run(as_dict=True)
|
|
item_wise_transfer_qty = defaultdict(float)
|
|
for row in data:
|
|
item_wise_transfer_qty[(row.name, row.item_code)] += flt(row.qty)
|
|
|
|
return item_wise_transfer_qty
|
|
|
|
def validate_putaway_capacity(self):
|
|
# if over receipt is attempted while 'apply putaway rule' is disabled
|
|
# and if rule was applied on the transaction, validate it.
|
|
from erpnext.stock.doctype.putaway_rule.putaway_rule import get_available_putaway_capacity
|
|
|
|
valid_doctype = self.doctype in (
|
|
"Purchase Receipt",
|
|
"Stock Entry",
|
|
"Purchase Invoice",
|
|
"Stock Reconciliation",
|
|
)
|
|
|
|
if not frappe.get_all("Putaway Rule", limit=1):
|
|
return
|
|
|
|
if self.doctype == "Purchase Invoice" and self.get("update_stock") == 0:
|
|
valid_doctype = False
|
|
|
|
if valid_doctype:
|
|
rule_map = defaultdict(dict)
|
|
for item in self.get("items"):
|
|
warehouse_field = "t_warehouse" if self.doctype == "Stock Entry" else "warehouse"
|
|
rule = frappe.db.get_value(
|
|
"Putaway Rule",
|
|
{"item_code": item.get("item_code"), "warehouse": item.get(warehouse_field)},
|
|
["name", "disable"],
|
|
as_dict=True,
|
|
)
|
|
if rule:
|
|
if rule.get("disabled"):
|
|
continue # dont validate for disabled rule
|
|
|
|
if self.doctype == "Stock Reconciliation":
|
|
stock_qty = flt(item.qty)
|
|
else:
|
|
stock_qty = (
|
|
flt(item.transfer_qty) if self.doctype == "Stock Entry" else flt(item.stock_qty)
|
|
)
|
|
|
|
rule_name = rule.get("name")
|
|
if not rule_map[rule_name]:
|
|
rule_map[rule_name]["warehouse"] = item.get(warehouse_field)
|
|
rule_map[rule_name]["item"] = item.get("item_code")
|
|
rule_map[rule_name]["qty_put"] = 0
|
|
rule_map[rule_name]["capacity"] = get_available_putaway_capacity(rule_name)
|
|
rule_map[rule_name]["qty_put"] += flt(stock_qty)
|
|
|
|
for rule, values in rule_map.items():
|
|
if flt(values["qty_put"]) > flt(values["capacity"]):
|
|
message = self.prepare_over_receipt_message(rule, values)
|
|
frappe.throw(msg=message, title=_("Over Receipt"))
|
|
|
|
def prepare_over_receipt_message(self, rule, values):
|
|
message = _("{0} qty of Item {1} is being received into Warehouse {2} with capacity {3}.").format(
|
|
frappe.bold(values["qty_put"]),
|
|
frappe.bold(values["item"]),
|
|
frappe.bold(values["warehouse"]),
|
|
frappe.bold(values["capacity"]),
|
|
)
|
|
message += "<br><br>"
|
|
rule_link = frappe.utils.get_link_to_form("Putaway Rule", rule)
|
|
message += _("Please adjust the qty or edit {0} to proceed.").format(rule_link)
|
|
return message
|
|
|
|
def repost_future_sle_and_gle(self, force=False, via_landed_cost_voucher=False):
|
|
args = frappe._dict(
|
|
{
|
|
"posting_date": self.posting_date,
|
|
"posting_time": self.posting_time,
|
|
"voucher_type": self.doctype,
|
|
"voucher_no": self.name,
|
|
"company": self.company,
|
|
"via_landed_cost_voucher": via_landed_cost_voucher,
|
|
}
|
|
)
|
|
|
|
if self.docstatus == 2:
|
|
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")
|
|
)
|
|
if item_based_reposting:
|
|
create_item_wise_repost_entries(
|
|
voucher_type=self.doctype,
|
|
voucher_no=self.name,
|
|
via_landed_cost_voucher=via_landed_cost_voucher,
|
|
)
|
|
else:
|
|
create_repost_item_valuation_entry(args)
|
|
|
|
def add_gl_entry(
|
|
self,
|
|
gl_entries,
|
|
account,
|
|
cost_center,
|
|
debit,
|
|
credit,
|
|
remarks,
|
|
against_account,
|
|
debit_in_account_currency=None,
|
|
credit_in_account_currency=None,
|
|
account_currency=None,
|
|
project=None,
|
|
voucher_detail_no=None,
|
|
item=None,
|
|
posting_date=None,
|
|
):
|
|
gl_entry = {
|
|
"account": account,
|
|
"cost_center": cost_center,
|
|
"debit": debit,
|
|
"credit": credit,
|
|
"against": against_account,
|
|
"remarks": remarks,
|
|
}
|
|
|
|
if voucher_detail_no:
|
|
gl_entry.update({"voucher_detail_no": voucher_detail_no})
|
|
|
|
if debit_in_account_currency:
|
|
gl_entry.update({"debit_in_account_currency": debit_in_account_currency})
|
|
|
|
if credit_in_account_currency:
|
|
gl_entry.update({"credit_in_account_currency": credit_in_account_currency})
|
|
|
|
if posting_date:
|
|
gl_entry.update({"posting_date": posting_date})
|
|
|
|
gl_entries.append(self.get_gl_dict(gl_entry, item=item))
|
|
|
|
|
|
@frappe.whitelist()
|
|
def show_accounting_ledger_preview(company, doctype, docname):
|
|
filters = frappe._dict(company=company, include_dimensions=1)
|
|
doc = frappe.get_doc(doctype, docname)
|
|
doc.run_method("before_gl_preview")
|
|
|
|
gl_columns, gl_data = get_accounting_ledger_preview(doc, filters)
|
|
|
|
frappe.db.rollback()
|
|
|
|
return {"gl_columns": gl_columns, "gl_data": gl_data}
|
|
|
|
|
|
@frappe.whitelist()
|
|
def show_stock_ledger_preview(company, doctype, docname):
|
|
filters = frappe._dict(company=company)
|
|
doc = frappe.get_doc(doctype, docname)
|
|
doc.run_method("before_sl_preview")
|
|
|
|
sl_columns, sl_data = get_stock_ledger_preview(doc, filters)
|
|
|
|
frappe.db.rollback()
|
|
|
|
return {
|
|
"sl_columns": sl_columns,
|
|
"sl_data": sl_data,
|
|
}
|
|
|
|
|
|
def get_accounting_ledger_preview(doc, filters):
|
|
from erpnext.accounts.report.general_ledger.general_ledger import get_columns as get_gl_columns
|
|
|
|
gl_columns, gl_data = [], []
|
|
fields = [
|
|
"posting_date",
|
|
"account",
|
|
"debit",
|
|
"credit",
|
|
"against",
|
|
"party_type",
|
|
"party",
|
|
"cost_center",
|
|
"against_voucher_type",
|
|
"against_voucher",
|
|
]
|
|
|
|
doc.docstatus = 1
|
|
|
|
if doc.get("update_stock") or doc.doctype in ("Purchase Receipt", "Delivery Note"):
|
|
doc.update_stock_ledger()
|
|
|
|
doc.make_gl_entries()
|
|
columns = get_gl_columns(filters)
|
|
gl_entries = get_gl_entries_for_preview(doc.doctype, doc.name, fields)
|
|
|
|
gl_columns = get_columns(columns, fields)
|
|
gl_data = get_data(fields, gl_entries)
|
|
|
|
return gl_columns, gl_data
|
|
|
|
|
|
def get_stock_ledger_preview(doc, filters):
|
|
from erpnext.stock.report.stock_ledger.stock_ledger import get_columns as get_sl_columns
|
|
|
|
sl_columns, sl_data = [], []
|
|
fields = [
|
|
"item_code",
|
|
"stock_uom",
|
|
"actual_qty",
|
|
"qty_after_transaction",
|
|
"warehouse",
|
|
"incoming_rate",
|
|
"valuation_rate",
|
|
"stock_value",
|
|
"stock_value_difference",
|
|
]
|
|
columns_fields = [
|
|
"item_code",
|
|
"stock_uom",
|
|
"in_qty",
|
|
"out_qty",
|
|
"qty_after_transaction",
|
|
"warehouse",
|
|
"incoming_rate",
|
|
"in_out_rate",
|
|
"stock_value",
|
|
"stock_value_difference",
|
|
]
|
|
|
|
if doc.get("update_stock") or doc.doctype in ("Purchase Receipt", "Delivery Note"):
|
|
doc.docstatus = 1
|
|
doc.update_stock_ledger()
|
|
columns = get_sl_columns(filters)
|
|
sl_entries = get_sl_entries_for_preview(doc.doctype, doc.name, fields)
|
|
|
|
sl_columns = get_columns(columns, columns_fields)
|
|
sl_data = get_data(columns_fields, sl_entries)
|
|
|
|
return sl_columns, sl_data
|
|
|
|
|
|
def get_sl_entries_for_preview(doctype, docname, fields):
|
|
sl_entries = frappe.get_all(
|
|
"Stock Ledger Entry", filters={"voucher_type": doctype, "voucher_no": docname}, fields=fields
|
|
)
|
|
|
|
for entry in sl_entries:
|
|
if entry.actual_qty > 0:
|
|
entry["in_qty"] = entry.actual_qty
|
|
entry["out_qty"] = 0
|
|
else:
|
|
entry["out_qty"] = abs(entry.actual_qty)
|
|
entry["in_qty"] = 0
|
|
|
|
entry["in_out_rate"] = entry["valuation_rate"]
|
|
|
|
return sl_entries
|
|
|
|
|
|
def get_gl_entries_for_preview(doctype, docname, fields):
|
|
return frappe.get_all("GL Entry", filters={"voucher_type": doctype, "voucher_no": docname}, fields=fields)
|
|
|
|
|
|
def get_columns(raw_columns, fields):
|
|
return [
|
|
{"name": d.get("label"), "editable": False, "width": 110}
|
|
for d in raw_columns
|
|
if not d.get("hidden") and d.get("fieldname") in fields
|
|
]
|
|
|
|
|
|
def get_data(raw_columns, raw_data):
|
|
datatable_data = []
|
|
for row in raw_data:
|
|
data_row = []
|
|
for column in raw_columns:
|
|
data_row.append(row.get(column) or "")
|
|
|
|
datatable_data.append(data_row)
|
|
|
|
return datatable_data
|
|
|
|
|
|
def repost_required_for_queue(doc: StockController) -> bool:
|
|
"""check if stock document contains repeated item-warehouse with queue based valuation.
|
|
|
|
if queue exists for repeated items then SLEs need to reprocessed in background again.
|
|
"""
|
|
|
|
consuming_sles = frappe.db.get_all(
|
|
"Stock Ledger Entry",
|
|
filters={
|
|
"voucher_type": doc.doctype,
|
|
"voucher_no": doc.name,
|
|
"actual_qty": ("<", 0),
|
|
"is_cancelled": 0,
|
|
},
|
|
fields=["item_code", "warehouse", "stock_queue"],
|
|
)
|
|
item_warehouses = [(sle.item_code, sle.warehouse) for sle in consuming_sles]
|
|
|
|
unique_item_warehouses = set(item_warehouses)
|
|
|
|
if len(unique_item_warehouses) == len(item_warehouses):
|
|
return False
|
|
|
|
for sle in consuming_sles:
|
|
if sle.stock_queue != "[]": # using FIFO/LIFO valuation
|
|
return True
|
|
return False
|
|
|
|
|
|
@frappe.whitelist()
|
|
<<<<<<< HEAD
|
|
def make_quality_inspections(doctype, docname, items):
|
|
=======
|
|
def make_quality_inspections(doctype, docname, items, inspection_type):
|
|
>>>>>>> 329d14957b (fix: validate negative qty)
|
|
if isinstance(items, str):
|
|
items = json.loads(items)
|
|
|
|
inspections = []
|
|
for item in items:
|
|
if flt(item.get("sample_size")) > flt(item.get("qty")):
|
|
frappe.throw(
|
|
_(
|
|
"{item_name}'s Sample Size ({sample_size}) cannot be greater than the Accepted Quantity ({accepted_quantity})"
|
|
).format(
|
|
item_name=item.get("item_name"),
|
|
sample_size=item.get("sample_size"),
|
|
accepted_quantity=item.get("qty"),
|
|
)
|
|
)
|
|
|
|
quality_inspection = frappe.get_doc(
|
|
{
|
|
"doctype": "Quality Inspection",
|
|
<<<<<<< HEAD
|
|
"inspection_type": "Incoming",
|
|
=======
|
|
"inspection_type": inspection_type,
|
|
>>>>>>> 329d14957b (fix: validate negative qty)
|
|
"inspected_by": frappe.session.user,
|
|
"reference_type": doctype,
|
|
"reference_name": docname,
|
|
"item_code": item.get("item_code"),
|
|
"description": item.get("description"),
|
|
"sample_size": flt(item.get("sample_size")),
|
|
"item_serial_no": item.get("serial_no").split("\n")[0] if item.get("serial_no") else None,
|
|
"batch_no": item.get("batch_no"),
|
|
}
|
|
).insert()
|
|
quality_inspection.save()
|
|
inspections.append(quality_inspection.name)
|
|
|
|
return inspections
|
|
|
|
|
|
def is_reposting_pending():
|
|
return frappe.db.exists(
|
|
"Repost Item Valuation", {"docstatus": 1, "status": ["in", ["Queued", "In Progress"]]}
|
|
)
|
|
|
|
|
|
def future_sle_exists(args, sl_entries=None, allow_force_reposting=True):
|
|
if allow_force_reposting and frappe.db.get_single_value(
|
|
"Stock Reposting Settings", "do_reposting_for_each_stock_transaction"
|
|
):
|
|
return True
|
|
|
|
key = (args.voucher_type, args.voucher_no)
|
|
if not hasattr(frappe.local, "future_sle"):
|
|
frappe.local.future_sle = {}
|
|
|
|
if validate_future_sle_not_exists(args, key, sl_entries):
|
|
return False
|
|
elif get_cached_data(args, key):
|
|
return True
|
|
|
|
if not sl_entries:
|
|
sl_entries = get_sle_entries_against_voucher(args)
|
|
if not sl_entries:
|
|
return
|
|
|
|
or_conditions = get_conditions_to_validate_future_sle(sl_entries)
|
|
|
|
data = frappe.db.sql(
|
|
"""
|
|
select item_code, warehouse, count(name) as total_row
|
|
from `tabStock Ledger Entry` force index (item_warehouse)
|
|
where
|
|
({})
|
|
and timestamp(posting_date, posting_time)
|
|
>= timestamp(%(posting_date)s, %(posting_time)s)
|
|
and voucher_no != %(voucher_no)s
|
|
and is_cancelled = 0
|
|
GROUP BY
|
|
item_code, warehouse
|
|
""".format(" or ".join(or_conditions)),
|
|
args,
|
|
as_dict=1,
|
|
)
|
|
|
|
for d in data:
|
|
frappe.local.future_sle[key][(d.item_code, d.warehouse)] = d.total_row
|
|
|
|
return len(data)
|
|
|
|
|
|
def validate_future_sle_not_exists(args, key, sl_entries=None):
|
|
item_key = ""
|
|
if args.get("item_code"):
|
|
item_key = (args.get("item_code"), args.get("warehouse"))
|
|
|
|
if not sl_entries and hasattr(frappe.local, "future_sle"):
|
|
if key not in frappe.local.future_sle:
|
|
return False
|
|
|
|
if not frappe.local.future_sle.get(key) or (
|
|
item_key and item_key not in frappe.local.future_sle.get(key)
|
|
):
|
|
return True
|
|
|
|
|
|
def get_cached_data(args, key):
|
|
if key not in frappe.local.future_sle:
|
|
frappe.local.future_sle[key] = frappe._dict({})
|
|
|
|
if args.get("item_code"):
|
|
item_key = (args.get("item_code"), args.get("warehouse"))
|
|
count = frappe.local.future_sle[key].get(item_key)
|
|
|
|
return True if (count or count == 0) else False
|
|
else:
|
|
return frappe.local.future_sle[key]
|
|
|
|
|
|
def get_sle_entries_against_voucher(args):
|
|
return frappe.get_all(
|
|
"Stock Ledger Entry",
|
|
filters={"voucher_type": args.voucher_type, "voucher_no": args.voucher_no},
|
|
fields=["item_code", "warehouse"],
|
|
order_by="creation asc",
|
|
)
|
|
|
|
|
|
def get_conditions_to_validate_future_sle(sl_entries):
|
|
warehouse_items_map = {}
|
|
for entry in sl_entries:
|
|
if entry.warehouse not in warehouse_items_map:
|
|
warehouse_items_map[entry.warehouse] = set()
|
|
|
|
warehouse_items_map[entry.warehouse].add(entry.item_code)
|
|
|
|
or_conditions = []
|
|
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)})"""
|
|
)
|
|
|
|
return or_conditions
|
|
|
|
|
|
def create_repost_item_valuation_entry(args):
|
|
args = frappe._dict(args)
|
|
repost_entry = frappe.new_doc("Repost Item Valuation")
|
|
repost_entry.based_on = args.based_on
|
|
if not args.based_on:
|
|
repost_entry.based_on = "Transaction" if args.voucher_no else "Item and Warehouse"
|
|
repost_entry.voucher_type = args.voucher_type
|
|
repost_entry.voucher_no = args.voucher_no
|
|
repost_entry.item_code = args.item_code
|
|
repost_entry.warehouse = args.warehouse
|
|
repost_entry.posting_date = args.posting_date
|
|
repost_entry.posting_time = args.posting_time
|
|
repost_entry.company = args.company
|
|
repost_entry.allow_zero_rate = args.allow_zero_rate
|
|
repost_entry.flags.ignore_links = True
|
|
repost_entry.flags.ignore_permissions = True
|
|
repost_entry.via_landed_cost_voucher = args.via_landed_cost_voucher
|
|
repost_entry.save()
|
|
repost_entry.submit()
|
|
|
|
|
|
def create_item_wise_repost_entries(
|
|
voucher_type, voucher_no, allow_zero_rate=False, via_landed_cost_voucher=False
|
|
):
|
|
"""Using a voucher create repost item valuation records for all item-warehouse pairs."""
|
|
|
|
stock_ledger_entries = get_items_to_be_repost(voucher_type, voucher_no)
|
|
|
|
distinct_item_warehouses = set()
|
|
repost_entries = []
|
|
|
|
for sle in stock_ledger_entries:
|
|
item_wh = (sle.item_code, sle.warehouse)
|
|
if item_wh in distinct_item_warehouses:
|
|
continue
|
|
distinct_item_warehouses.add(item_wh)
|
|
|
|
repost_entry = frappe.new_doc("Repost Item Valuation")
|
|
repost_entry.based_on = "Item and Warehouse"
|
|
|
|
repost_entry.item_code = sle.item_code
|
|
repost_entry.warehouse = sle.warehouse
|
|
repost_entry.posting_date = sle.posting_date
|
|
repost_entry.posting_time = sle.posting_time
|
|
repost_entry.allow_zero_rate = allow_zero_rate
|
|
repost_entry.flags.ignore_links = True
|
|
repost_entry.flags.ignore_permissions = True
|
|
repost_entry.via_landed_cost_voucher = via_landed_cost_voucher
|
|
repost_entry.submit()
|
|
repost_entries.append(repost_entry)
|
|
|
|
return repost_entries
|
|
|
|
|
|
def make_bundle_for_material_transfer(**kwargs):
|
|
if isinstance(kwargs, dict):
|
|
kwargs = frappe._dict(kwargs)
|
|
|
|
bundle_doc = frappe.get_doc("Serial and Batch Bundle", kwargs.serial_and_batch_bundle)
|
|
|
|
if not kwargs.type_of_transaction:
|
|
kwargs.type_of_transaction = "Inward"
|
|
|
|
bundle_doc = frappe.copy_doc(bundle_doc)
|
|
bundle_doc.warehouse = kwargs.warehouse
|
|
bundle_doc.type_of_transaction = kwargs.type_of_transaction
|
|
bundle_doc.voucher_type = kwargs.voucher_type
|
|
bundle_doc.voucher_no = "" if kwargs.is_new or kwargs.docstatus == 2 else kwargs.voucher_no
|
|
bundle_doc.is_cancelled = 0
|
|
|
|
for row in bundle_doc.entries:
|
|
row.is_outward = 0
|
|
row.qty = abs(row.qty)
|
|
row.stock_value_difference = abs(row.stock_value_difference)
|
|
if kwargs.type_of_transaction == "Outward":
|
|
row.qty *= -1
|
|
row.stock_value_difference *= row.stock_value_difference
|
|
row.is_outward = 1
|
|
|
|
row.warehouse = kwargs.warehouse
|
|
|
|
bundle_doc.calculate_qty_and_amount()
|
|
bundle_doc.flags.ignore_permissions = True
|
|
bundle_doc.flags.ignore_validate = True
|
|
bundle_doc.save(ignore_permissions=True)
|
|
|
|
return bundle_doc.name
|